Lines Matching +full:memcpy +full:- +full:burst +full:- +full:size

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 Conexant cx24117/cx24132 - Dual DVBS/S2 Satellite demod/tuner driver
10 TBS6980 - Dual DVBS/S2 PCIe card
11 TBS6981 - Dual DVBS/S2 PCIe card
22 #include "tuner-i2c.h"
27 #define CX24117_DEFAULT_FIRMWARE "dvb-fe-cx24117.fw"
40 #define CX24117_REG_FREQ5_0 (0x3c) /* +-freq */
42 #define CX24117_REG_SRATE2_0 (0x3e) /* +- 1000 * srate */
66 #define CX24117_REG_FREQ5_1 (0x5d) /* +- freq */
85 /* arg buffer size */
116 /* DiSEqC burst */
230 /* NBC-QPSK */
260 struct i2c_msg msg = { .addr = state->priv->demod_address, in cx24117_writereg()
264 dev_dbg(&state->priv->i2c->dev, in cx24117_writereg()
266 __func__, state->demod, reg, data); in cx24117_writereg()
268 ret = i2c_transfer(state->priv->i2c, &msg, 1); in cx24117_writereg()
270 dev_warn(&state->priv->i2c->dev, in cx24117_writereg()
272 KBUILD_MODNAME, state->demod, ret, reg, data); in cx24117_writereg()
285 dev_dbg(&state->priv->i2c->dev, in cx24117_writecmd()
287 __func__, state->demod, cmd->len); in cx24117_writecmd()
290 memcpy(&buf[1], cmd->args, cmd->len); in cx24117_writecmd()
292 msg.addr = state->priv->demod_address; in cx24117_writecmd()
294 msg.len = cmd->len+1; in cx24117_writecmd()
296 ret = i2c_transfer(state->priv->i2c, &msg, 1); in cx24117_writecmd()
298 dev_warn(&state->priv->i2c->dev, in cx24117_writecmd()
300 KBUILD_MODNAME, state->demod, ret, cmd->len); in cx24117_writecmd()
311 { .addr = state->priv->demod_address, .flags = 0, in cx24117_readreg()
313 { .addr = state->priv->demod_address, .flags = I2C_M_RD, in cx24117_readreg()
317 ret = i2c_transfer(state->priv->i2c, msg, 2); in cx24117_readreg()
319 dev_warn(&state->priv->i2c->dev, in cx24117_readreg()
321 KBUILD_MODNAME, state->demod, ret, reg); in cx24117_readreg()
325 dev_dbg(&state->priv->i2c->dev, "%s() demod%d i2c rd @0x%02x=0x%02x\n", in cx24117_readreg()
326 __func__, state->demod, reg, recv); in cx24117_readreg()
336 { .addr = state->priv->demod_address, .flags = 0, in cx24117_readregN()
338 { .addr = state->priv->demod_address, .flags = I2C_M_RD, in cx24117_readregN()
342 ret = i2c_transfer(state->priv->i2c, msg, 2); in cx24117_readregN()
344 dev_warn(&state->priv->i2c->dev, in cx24117_readregN()
346 KBUILD_MODNAME, state->demod, ret, reg); in cx24117_readregN()
355 dev_dbg(&state->priv->i2c->dev, "%s(%d) demod%d\n", in cx24117_set_inversion()
356 __func__, inversion, state->demod); in cx24117_set_inversion()
360 state->dnxt.inversion_val = 0x00; in cx24117_set_inversion()
363 state->dnxt.inversion_val = 0x04; in cx24117_set_inversion()
366 state->dnxt.inversion_val = 0x0C; in cx24117_set_inversion()
369 return -EINVAL; in cx24117_set_inversion()
372 state->dnxt.inversion = inversion; in cx24117_set_inversion()
380 int i, ret = -EINVAL; in cx24117_lookup_fecmod()
382 dev_dbg(&state->priv->i2c->dev, in cx24117_lookup_fecmod()
384 __func__, m, f, state->demod); in cx24117_lookup_fecmod()
405 dev_dbg(&state->priv->i2c->dev, in cx24117_set_fec()
407 __func__, mod, fec, state->demod); in cx24117_set_fec()
413 state->dnxt.fec = fec; in cx24117_set_fec()
414 state->dnxt.fec_val = cx24117_modfec_modes[ret].val; in cx24117_set_fec()
415 state->dnxt.fec_mask = cx24117_modfec_modes[ret].mask; in cx24117_set_fec()
416 dev_dbg(&state->priv->i2c->dev, in cx24117_set_fec()
418 state->demod, state->dnxt.fec_mask, state->dnxt.fec_val); in cx24117_set_fec()
425 dev_dbg(&state->priv->i2c->dev, "%s(%d) demod%d\n", in cx24117_set_symbolrate()
426 __func__, rate, state->demod); in cx24117_set_symbolrate()
428 state->dnxt.symbol_rate = rate; in cx24117_set_symbolrate()
430 dev_dbg(&state->priv->i2c->dev, in cx24117_set_symbolrate()
432 __func__, state->demod, rate); in cx24117_set_symbolrate()
442 struct cx24117_state *state = fe->demodulator_priv; in cx24117_firmware_ondemand()
446 dev_dbg(&state->priv->i2c->dev, "%s() demod%d skip_fw_load=%d\n", in cx24117_firmware_ondemand()
447 __func__, state->demod, state->priv->skip_fw_load); in cx24117_firmware_ondemand()
449 if (state->priv->skip_fw_load) in cx24117_firmware_ondemand()
456 dev_dbg(&state->priv->i2c->dev, in cx24117_firmware_ondemand()
460 state->priv->i2c->dev.parent); in cx24117_firmware_ondemand()
461 dev_dbg(&state->priv->i2c->dev, in cx24117_firmware_ondemand()
464 dev_err(&state->priv->i2c->dev, in cx24117_firmware_ondemand()
472 state->priv->skip_fw_load = 1; in cx24117_firmware_ondemand()
476 dev_err(&state->priv->i2c->dev, in cx24117_firmware_ondemand()
480 dev_info(&state->priv->i2c->dev, in cx24117_firmware_ondemand()
485 state->priv->skip_fw_load = 0; in cx24117_firmware_ondemand()
497 struct cx24117_state *state = fe->demodulator_priv; in cx24117_cmd_execute_nolock()
500 dev_dbg(&state->priv->i2c->dev, "%s() demod%d\n", in cx24117_cmd_execute_nolock()
501 __func__, state->demod); in cx24117_cmd_execute_nolock()
519 dev_warn(&state->priv->i2c->dev, in cx24117_cmd_execute_nolock()
521 return -EIO; in cx24117_cmd_execute_nolock()
529 struct cx24117_state *state = fe->demodulator_priv; in cx24117_cmd_execute()
532 mutex_lock(&state->priv->fe_lock); in cx24117_cmd_execute()
534 mutex_unlock(&state->priv->fe_lock); in cx24117_cmd_execute()
542 struct cx24117_state *state = fe->demodulator_priv; in cx24117_load_firmware()
550 dev_dbg(&state->priv->i2c->dev, in cx24117_load_firmware()
552 __func__, state->demod, fw->size, fw->data[0], fw->data[1], in cx24117_load_firmware()
553 fw->data[fw->size - 2], fw->data[fw->size - 1]); in cx24117_load_firmware()
604 buf = kmalloc(fw->size + 1, GFP_KERNEL); in cx24117_load_firmware()
606 state->priv->skip_fw_load = 0; in cx24117_load_firmware()
607 return -ENOMEM; in cx24117_load_firmware()
612 memcpy(&buf[1], fw->data, fw->size); in cx24117_load_firmware()
615 msg.addr = state->priv->demod_address; in cx24117_load_firmware()
617 msg.len = fw->size + 1; in cx24117_load_firmware()
621 ret = i2c_transfer(state->priv->i2c, &msg, 1); in cx24117_load_firmware()
722 dev_info(&state->priv->i2c->dev, in cx24117_load_firmware()
727 state->priv->skip_fw_load = 0; in cx24117_load_firmware()
728 dev_err(&state->priv->i2c->dev, "%s() Error running FW.\n", __func__); in cx24117_load_firmware()
734 struct cx24117_state *state = fe->demodulator_priv; in cx24117_read_status()
738 (state->demod == 0) ? CX24117_REG_SSTATUS0 : in cx24117_read_status()
742 dev_dbg(&state->priv->i2c->dev, "%s() demod%d status = 0x%02x\n", in cx24117_read_status()
743 __func__, state->demod, lock); in cx24117_read_status()
761 struct cx24117_state *state = fe->demodulator_priv; in cx24117_read_ber()
764 u8 base_reg = (state->demod == 0) ? in cx24117_read_ber()
775 dev_dbg(&state->priv->i2c->dev, "%s() demod%d ber=0x%04x\n", in cx24117_read_ber()
776 __func__, state->demod, *ber); in cx24117_read_ber()
784 struct cx24117_state *state = fe->demodulator_priv; in cx24117_read_signal_strength()
789 u8 reg = (state->demod == 0) ? in cx24117_read_signal_strength()
794 cmd.args[1] = (u8) state->demod; in cx24117_read_signal_strength()
805 *signal_strength = -100 * sig_reading + 94324; in cx24117_read_signal_strength()
807 dev_dbg(&state->priv->i2c->dev, in cx24117_read_signal_strength()
809 __func__, state->demod, sig_reading, *signal_strength); in cx24117_read_signal_strength()
816 struct cx24117_state *state = fe->demodulator_priv; in cx24117_read_snr()
819 u8 reg = (state->demod == 0) ? in cx24117_read_snr()
828 dev_dbg(&state->priv->i2c->dev, in cx24117_read_snr()
830 __func__, state->demod, *snr); in cx24117_read_snr()
837 struct cx24117_state *state = fe->demodulator_priv; in cx24117_read_ucblocks()
838 enum fe_delivery_system delsys = fe->dtv_property_cache.delivery_system; in cx24117_read_ucblocks()
841 u8 reg = (state->demod == 0) ? in cx24117_read_ucblocks()
849 reg += (CX24117_REG_DVBS2_UCB2_0 - CX24117_REG_DVBS_UCB2_0); in cx24117_read_ucblocks()
852 return -EINVAL; in cx24117_read_ucblocks()
860 dev_dbg(&state->priv->i2c->dev, "%s() demod%d ucb=0x%04x\n", in cx24117_read_ucblocks()
861 __func__, state->demod, *ucblocks); in cx24117_read_ucblocks()
869 struct cx24117_state *state = fe->demodulator_priv; in cx24117_clone_params()
870 state->dcur = state->dnxt; in cx24117_clone_params()
876 struct cx24117_state *state = fe->demodulator_priv; in cx24117_wait_for_lnb()
878 u8 val, reg = (state->demod == 0) ? CX24117_REG_QSTATUS0 : in cx24117_wait_for_lnb()
881 dev_dbg(&state->priv->i2c->dev, "%s() demod%d qstatus = 0x%02x\n", in cx24117_wait_for_lnb()
882 __func__, state->demod, cx24117_readreg(state, reg)); in cx24117_wait_for_lnb()
892 dev_warn(&state->priv->i2c->dev, "%s: demod%d LNB not ready\n", in cx24117_wait_for_lnb()
893 KBUILD_MODNAME, state->demod); in cx24117_wait_for_lnb()
895 return -ETIMEDOUT; /* -EBUSY ? */ in cx24117_wait_for_lnb()
901 struct cx24117_state *state = fe->demodulator_priv; in cx24117_set_voltage()
904 u8 reg = (state->demod == 0) ? 0x10 : 0x20; in cx24117_set_voltage()
906 dev_dbg(&state->priv->i2c->dev, "%s() demod%d %s\n", in cx24117_set_voltage()
907 __func__, state->demod, in cx24117_set_voltage()
934 cmd.args[1] = state->demod ? 0 : 1; in cx24117_set_voltage()
953 struct cx24117_state *state = fe->demodulator_priv; in cx24117_set_tone()
957 dev_dbg(&state->priv->i2c->dev, "%s(%d) demod%d\n", in cx24117_set_tone()
958 __func__, state->demod, tone); in cx24117_set_tone()
960 dev_warn(&state->priv->i2c->dev, "%s: demod%d invalid tone=%d\n", in cx24117_set_tone()
961 KBUILD_MODNAME, state->demod, tone); in cx24117_set_tone()
962 return -EINVAL; in cx24117_set_tone()
975 cmd.args[1] = (state->demod ? 0 : 1); in cx24117_set_tone()
996 struct cx24117_state *state = fe->demodulator_priv; in cx24117_diseqc_init()
999 state->dsec_cmd.args[0] = CMD_LNBSEND; in cx24117_diseqc_init()
1002 state->dsec_cmd.args[CX24117_DISEQC_DEMOD] = state->demod ? 0 : 1; in cx24117_diseqc_init()
1004 /* DiSEqC burst */ in cx24117_diseqc_init()
1005 state->dsec_cmd.args[CX24117_DISEQC_BURST] = CX24117_DISEQC_MINI_A; in cx24117_diseqc_init()
1008 state->dsec_cmd.args[CX24117_DISEQC_ARG3_2] = 0x02; in cx24117_diseqc_init()
1009 state->dsec_cmd.args[CX24117_DISEQC_ARG4_0] = 0x00; in cx24117_diseqc_init()
1012 state->dsec_cmd.args[CX24117_DISEQC_ARG5_0] = 0x00; in cx24117_diseqc_init()
1015 state->dsec_cmd.args[CX24117_DISEQC_MSGLEN] = 0x00; in cx24117_diseqc_init()
1018 state->dsec_cmd.len = 7; in cx24117_diseqc_init()
1027 struct cx24117_state *state = fe->demodulator_priv; in cx24117_send_diseqc_msg()
1031 dev_dbg(&state->priv->i2c->dev, "%s: demod %d (", in cx24117_send_diseqc_msg()
1032 __func__, state->demod); in cx24117_send_diseqc_msg()
1033 for (i = 0; i < d->msg_len; i++) in cx24117_send_diseqc_msg()
1034 dev_dbg(&state->priv->i2c->dev, "0x%02x ", d->msg[i]); in cx24117_send_diseqc_msg()
1035 dev_dbg(&state->priv->i2c->dev, ")\n"); in cx24117_send_diseqc_msg()
1038 if (d->msg_len > sizeof(d->msg)) in cx24117_send_diseqc_msg()
1039 return -EINVAL; in cx24117_send_diseqc_msg()
1042 for (i = 0; i < d->msg_len; i++) in cx24117_send_diseqc_msg()
1043 state->dsec_cmd.args[CX24117_DISEQC_MSGOFS + i] = d->msg[i]; in cx24117_send_diseqc_msg()
1046 state->dsec_cmd.args[CX24117_DISEQC_MSGLEN] = d->msg_len; in cx24117_send_diseqc_msg()
1049 state->dsec_cmd.len = CX24117_DISEQC_MSGOFS + in cx24117_send_diseqc_msg()
1050 state->dsec_cmd.args[CX24117_DISEQC_MSGLEN]; in cx24117_send_diseqc_msg()
1053 * Message is sent with derived else cached burst in cx24117_send_diseqc_msg()
1070 if (d->msg_len >= 4 && d->msg[2] == 0x38) in cx24117_send_diseqc_msg()
1071 state->dsec_cmd.args[CX24117_DISEQC_BURST] = in cx24117_send_diseqc_msg()
1072 ((d->msg[3] & 4) >> 2); in cx24117_send_diseqc_msg()
1074 dev_dbg(&state->priv->i2c->dev, "%s() demod%d burst=%d\n", in cx24117_send_diseqc_msg()
1075 __func__, state->demod, in cx24117_send_diseqc_msg()
1076 state->dsec_cmd.args[CX24117_DISEQC_BURST]); in cx24117_send_diseqc_msg()
1087 ret = cx24117_cmd_execute(fe, &state->dsec_cmd); in cx24117_send_diseqc_msg()
1097 * 12.5ms burst + in cx24117_send_diseqc_msg()
1100 msleep((state->dsec_cmd.args[CX24117_DISEQC_MSGLEN] << 4) + 60); in cx24117_send_diseqc_msg()
1105 /* Send DiSEqC burst */
1107 enum fe_sec_mini_cmd burst) in cx24117_diseqc_send_burst() argument
1109 struct cx24117_state *state = fe->demodulator_priv; in cx24117_diseqc_send_burst()
1111 dev_dbg(&state->priv->i2c->dev, "%s(%d) demod=%d\n", in cx24117_diseqc_send_burst()
1112 __func__, burst, state->demod); in cx24117_diseqc_send_burst()
1114 /* DiSEqC burst */ in cx24117_diseqc_send_burst()
1115 if (burst == SEC_MINI_A) in cx24117_diseqc_send_burst()
1116 state->dsec_cmd.args[CX24117_DISEQC_BURST] = in cx24117_diseqc_send_burst()
1118 else if (burst == SEC_MINI_B) in cx24117_diseqc_send_burst()
1119 state->dsec_cmd.args[CX24117_DISEQC_BURST] = in cx24117_diseqc_send_burst()
1122 return -EINVAL; in cx24117_diseqc_send_burst()
1150 struct cx24117_state *state = fe->demodulator_priv; in cx24117_release()
1151 dev_dbg(&state->priv->i2c->dev, "%s demod%d\n", in cx24117_release()
1152 __func__, state->demod); in cx24117_release()
1153 cx24117_release_priv(state->priv); in cx24117_release()
1167 demod = cx24117_get_priv(&priv, i2c, config->demod_address); in cx24117_attach()
1171 dev_err(&i2c->dev, in cx24117_attach()
1177 priv->i2c = i2c; in cx24117_attach()
1178 priv->demod_address = config->demod_address; in cx24117_attach()
1179 mutex_init(&priv->fe_lock); in cx24117_attach()
1191 state->demod = demod - 1; in cx24117_attach()
1192 state->priv = priv; in cx24117_attach()
1194 dev_info(&state->priv->i2c->dev, in cx24117_attach()
1196 KBUILD_MODNAME, state->demod); in cx24117_attach()
1199 memcpy(&state->frontend.ops, &cx24117_ops, in cx24117_attach()
1201 state->frontend.demodulator_priv = state; in cx24117_attach()
1202 return &state->frontend; in cx24117_attach()
1218 struct cx24117_state *state = fe->demodulator_priv; in cx24117_initfe()
1222 dev_dbg(&state->priv->i2c->dev, "%s() demod%d\n", in cx24117_initfe()
1223 __func__, state->demod); in cx24117_initfe()
1225 mutex_lock(&state->priv->fe_lock); in cx24117_initfe()
1229 cmd.args[1] = (state->demod ? 1 : 0); in cx24117_initfe()
1242 cmd.args[1] = (state->demod ? 1 : 0); in cx24117_initfe()
1252 cmd.args[1] = (state->demod ? 1 : 0); in cx24117_initfe()
1260 /* Set as output - controls LNB power on/off */ in cx24117_initfe()
1268 mutex_unlock(&state->priv->fe_lock); in cx24117_initfe()
1278 struct cx24117_state *state = fe->demodulator_priv; in cx24117_sleep()
1281 dev_dbg(&state->priv->i2c->dev, "%s() demod%d\n", in cx24117_sleep()
1282 __func__, state->demod); in cx24117_sleep()
1286 cmd.args[1] = (state->demod ? 1 : 0); in cx24117_sleep()
1292 /* dvb-core told us to tune, the tv property cache will be complete,
1297 struct cx24117_state *state = fe->demodulator_priv; in cx24117_set_frontend()
1298 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in cx24117_set_frontend()
1304 dev_dbg(&state->priv->i2c->dev, "%s() demod%d\n", in cx24117_set_frontend()
1305 __func__, state->demod); in cx24117_set_frontend()
1307 switch (c->delivery_system) { in cx24117_set_frontend()
1309 dev_dbg(&state->priv->i2c->dev, "%s() demod%d DVB-S\n", in cx24117_set_frontend()
1310 __func__, state->demod); in cx24117_set_frontend()
1312 /* Only QPSK is supported for DVB-S */ in cx24117_set_frontend()
1313 if (c->modulation != QPSK) { in cx24117_set_frontend()
1314 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1316 __func__, state->demod, c->modulation); in cx24117_set_frontend()
1317 return -EINVAL; in cx24117_set_frontend()
1320 /* Pilot doesn't exist in DVB-S, turn bit off */ in cx24117_set_frontend()
1321 state->dnxt.pilot_val = CX24117_PILOT_OFF; in cx24117_set_frontend()
1323 /* DVB-S only supports 0.35 */ in cx24117_set_frontend()
1324 state->dnxt.rolloff_val = CX24117_ROLLOFF_035; in cx24117_set_frontend()
1328 dev_dbg(&state->priv->i2c->dev, "%s() demod%d DVB-S2\n", in cx24117_set_frontend()
1329 __func__, state->demod); in cx24117_set_frontend()
1332 * NBC 8PSK/QPSK with DVB-S is supported for DVB-S2, in cx24117_set_frontend()
1335 if (c->modulation != PSK_8 && c->modulation != QPSK) { in cx24117_set_frontend()
1336 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1338 __func__, state->demod, c->modulation); in cx24117_set_frontend()
1339 return -EOPNOTSUPP; in cx24117_set_frontend()
1342 switch (c->pilot) { in cx24117_set_frontend()
1344 state->dnxt.pilot_val = CX24117_PILOT_AUTO; in cx24117_set_frontend()
1347 state->dnxt.pilot_val = CX24117_PILOT_OFF; in cx24117_set_frontend()
1350 state->dnxt.pilot_val = CX24117_PILOT_ON; in cx24117_set_frontend()
1353 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1355 __func__, state->demod, c->pilot); in cx24117_set_frontend()
1356 return -EOPNOTSUPP; in cx24117_set_frontend()
1359 switch (c->rolloff) { in cx24117_set_frontend()
1361 state->dnxt.rolloff_val = CX24117_ROLLOFF_020; in cx24117_set_frontend()
1364 state->dnxt.rolloff_val = CX24117_ROLLOFF_025; in cx24117_set_frontend()
1367 state->dnxt.rolloff_val = CX24117_ROLLOFF_035; in cx24117_set_frontend()
1370 state->dnxt.rolloff_val = CX24117_ROLLOFF_035; in cx24117_set_frontend()
1371 /* soft-auto rolloff */ in cx24117_set_frontend()
1375 dev_warn(&state->priv->i2c->dev, in cx24117_set_frontend()
1377 KBUILD_MODNAME, state->demod, c->rolloff); in cx24117_set_frontend()
1378 return -EOPNOTSUPP; in cx24117_set_frontend()
1383 dev_warn(&state->priv->i2c->dev, in cx24117_set_frontend()
1385 KBUILD_MODNAME, state->demod, c->delivery_system); in cx24117_set_frontend()
1386 return -EINVAL; in cx24117_set_frontend()
1389 state->dnxt.delsys = c->delivery_system; in cx24117_set_frontend()
1390 state->dnxt.modulation = c->modulation; in cx24117_set_frontend()
1391 state->dnxt.frequency = c->frequency; in cx24117_set_frontend()
1392 state->dnxt.pilot = c->pilot; in cx24117_set_frontend()
1393 state->dnxt.rolloff = c->rolloff; in cx24117_set_frontend()
1395 ret = cx24117_set_inversion(state, c->inversion); in cx24117_set_frontend()
1400 c->delivery_system, c->modulation, c->fec_inner); in cx24117_set_frontend()
1404 ret = cx24117_set_symbolrate(state, c->symbol_rate); in cx24117_set_frontend()
1411 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1412 "%s: delsys = %d\n", __func__, state->dcur.delsys); in cx24117_set_frontend()
1413 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1414 "%s: modulation = %d\n", __func__, state->dcur.modulation); in cx24117_set_frontend()
1415 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1416 "%s: frequency = %d\n", __func__, state->dcur.frequency); in cx24117_set_frontend()
1417 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1419 state->dcur.pilot, state->dcur.pilot_val); in cx24117_set_frontend()
1420 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1422 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1424 state->dcur.rolloff, state->dcur.rolloff_val); in cx24117_set_frontend()
1425 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1426 "%s: symbol_rate = %d\n", __func__, state->dcur.symbol_rate); in cx24117_set_frontend()
1427 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1429 state->dcur.fec, state->dcur.fec_mask, state->dcur.fec_val); in cx24117_set_frontend()
1430 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1432 state->dcur.inversion, state->dcur.inversion_val); in cx24117_set_frontend()
1438 cmd.args[1] = state->demod; in cx24117_set_frontend()
1441 cmd.args[2] = (state->dcur.frequency & 0xff0000) >> 16; in cx24117_set_frontend()
1442 cmd.args[3] = (state->dcur.frequency & 0x00ff00) >> 8; in cx24117_set_frontend()
1443 cmd.args[4] = (state->dcur.frequency & 0x0000ff); in cx24117_set_frontend()
1446 cmd.args[5] = ((state->dcur.symbol_rate / 1000) & 0xff00) >> 8; in cx24117_set_frontend()
1447 cmd.args[6] = ((state->dcur.symbol_rate / 1000) & 0x00ff); in cx24117_set_frontend()
1450 cmd.args[7] = state->dcur.inversion_val; in cx24117_set_frontend()
1453 cmd.args[8] = state->dcur.fec_val | state->dcur.pilot_val; in cx24117_set_frontend()
1458 cmd.args[11] = state->dcur.rolloff_val; in cx24117_set_frontend()
1459 cmd.args[12] = state->dcur.fec_mask; in cx24117_set_frontend()
1461 if (state->dcur.symbol_rate > 30000000) { in cx24117_set_frontend()
1464 } else if (state->dcur.symbol_rate > 10000000) { in cx24117_set_frontend()
1475 cx24117_writereg(state, (state->demod == 0) ? in cx24117_set_frontend()
1477 cx24117_writereg(state, (state->demod == 0) ? in cx24117_set_frontend()
1485 status = cx24117_readreg(state, (state->demod == 0) ? in cx24117_set_frontend()
1489 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1491 __func__, state->demod, status); in cx24117_set_frontend()
1493 cx24117_writereg(state, (state->demod == 0) ? in cx24117_set_frontend()
1511 dev_dbg(&state->priv->i2c->dev, in cx24117_set_frontend()
1513 __func__, state->demod); in cx24117_set_frontend()
1519 dev_dbg(&state->priv->i2c->dev, "%s() demod%d not tuned\n", in cx24117_set_frontend()
1520 __func__, state->demod); in cx24117_set_frontend()
1523 if (state->dcur.rolloff == 3) in cx24117_set_frontend()
1524 cmd.args[11]--; in cx24117_set_frontend()
1526 } while (--retune); in cx24117_set_frontend()
1527 return -EINVAL; in cx24117_set_frontend()
1533 struct cx24117_state *state = fe->demodulator_priv; in cx24117_tune()
1535 dev_dbg(&state->priv->i2c->dev, "%s() demod%d\n", in cx24117_tune()
1536 __func__, state->demod); in cx24117_tune()
1555 struct cx24117_state *state = fe->demodulator_priv; in cx24117_get_frontend()
1562 u8 buf[0x1f-4]; in cx24117_get_frontend()
1566 cmd.args[1] = (u8) state->demod; in cx24117_get_frontend()
1573 reg = (state->demod == 0) ? CX24117_REG_FREQ3_0 : CX24117_REG_FREQ3_1; in cx24117_get_frontend()
1574 ret = cx24117_readregN(state, reg, buf, 0x1f-4); in cx24117_get_frontend()
1581 inv = (((state->demod == 0) ? ~st : st) >> 6) & 1; in cx24117_get_frontend()
1583 c->inversion = INVERSION_OFF; in cx24117_get_frontend()
1585 c->inversion = INVERSION_ON; in cx24117_get_frontend()
1589 if (c->delivery_system == SYS_DVBS2) { in cx24117_get_frontend()
1596 c->modulation = cx24117_modfec_modes[idx].modulation; in cx24117_get_frontend()
1597 c->fec_inner = cx24117_modfec_modes[idx].fec; in cx24117_get_frontend()
1602 c->frequency = freq + freq_os; in cx24117_get_frontend()
1606 c->symbol_rate = -1000 * srate_os + state->dcur.symbol_rate; in cx24117_get_frontend()