Lines Matching +full:1 +full:d
36 static int anysee_ctrl_msg(struct dvb_usb_device *d, in anysee_ctrl_msg() argument
39 struct anysee_state *state = d_to_priv(d); in anysee_ctrl_msg()
42 mutex_lock(&d->usb_mutex); in anysee_ctrl_msg()
47 dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, slen, state->buf); in anysee_ctrl_msg()
51 * due to weird transaction flow, which is 1 x send + 2 x receive. in anysee_ctrl_msg()
53 ret = dvb_usbv2_generic_rw_locked(d, state->buf, sizeof(state->buf), in anysee_ctrl_msg()
61 ret = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, in anysee_ctrl_msg()
62 d->props->generic_bulk_ctrl_endpoint), in anysee_ctrl_msg()
65 dev_dbg(&d->udev->dev, in anysee_ctrl_msg()
66 "%s: recv bulk message failed=%d\n", in anysee_ctrl_msg()
69 dev_dbg(&d->udev->dev, "%s: <<< %*ph\n", __func__, in anysee_ctrl_msg()
73 dev_dbg(&d->udev->dev, in anysee_ctrl_msg()
81 dev_err(&d->udev->dev, "%s: recv bulk message failed=%d\n", in anysee_ctrl_msg()
91 mutex_unlock(&d->usb_mutex); in anysee_ctrl_msg()
95 static int anysee_read_reg(struct dvb_usb_device *d, u16 reg, u8 *val) in anysee_read_reg() argument
99 ret = anysee_ctrl_msg(d, buf, sizeof(buf), val, 1); in anysee_read_reg()
100 dev_dbg(&d->udev->dev, "%s: reg=%04x val=%02x\n", __func__, reg, *val); in anysee_read_reg()
104 static int anysee_write_reg(struct dvb_usb_device *d, u16 reg, u8 val) in anysee_write_reg() argument
107 dev_dbg(&d->udev->dev, "%s: reg=%04x val=%02x\n", __func__, reg, val); in anysee_write_reg()
108 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); in anysee_write_reg()
112 static int anysee_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val, in anysee_wr_reg_mask() argument
120 ret = anysee_read_reg(d, reg, &tmp); in anysee_wr_reg_mask()
129 return anysee_write_reg(d, reg, val); in anysee_wr_reg_mask()
133 static int anysee_rd_reg_mask(struct dvb_usb_device *d, u16 reg, u8 *val, in anysee_rd_reg_mask() argument
139 ret = anysee_read_reg(d, reg, &tmp); in anysee_rd_reg_mask()
155 static int anysee_get_hw_info(struct dvb_usb_device *d, u8 *id) in anysee_get_hw_info() argument
158 return anysee_ctrl_msg(d, buf, sizeof(buf), id, 3); in anysee_get_hw_info()
164 dev_dbg(&fe_to_d(fe)->udev->dev, "%s: onoff=%d\n", __func__, onoff); in anysee_streaming_ctrl()
168 static int anysee_led_ctrl(struct dvb_usb_device *d, u8 mode, u8 interval) in anysee_led_ctrl() argument
171 dev_dbg(&d->udev->dev, "%s: state=%d interval=%d\n", __func__, in anysee_led_ctrl()
173 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); in anysee_led_ctrl()
176 static int anysee_ir_ctrl(struct dvb_usb_device *d, u8 onoff) in anysee_ir_ctrl() argument
179 dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff); in anysee_ir_ctrl()
180 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); in anysee_ir_ctrl()
187 struct dvb_usb_device *d = i2c_get_adapdata(adap); in anysee_master_xfer() local
191 if (mutex_lock_interruptible(&d->i2c_mutex) < 0) in anysee_master_xfer()
195 if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) { in anysee_master_xfer()
196 if (msg[i].len < 1 || msg[i].len > 2 || msg[i + 1].len > 60) { in anysee_master_xfer()
201 buf[1] = (msg[i].addr << 1) | 0x01; in anysee_master_xfer()
203 buf[3] = (msg[i].len < 2) ? 0 : msg[i].buf[1]; in anysee_master_xfer()
204 buf[4] = msg[i].len-1; in anysee_master_xfer()
205 buf[5] = msg[i+1].len; in anysee_master_xfer()
206 ret = anysee_ctrl_msg(d, buf, 6, msg[i+1].buf, in anysee_master_xfer()
207 msg[i+1].len); in anysee_master_xfer()
215 buf[1] = (msg[i].addr << 1); in anysee_master_xfer()
219 ret = anysee_ctrl_msg(d, buf, 4 + msg[i].len, NULL, 0); in anysee_master_xfer()
220 inc = 1; in anysee_master_xfer()
228 mutex_unlock(&d->i2c_mutex); in anysee_master_xfer()
266 .demod_address = (0x1a >> 1),
271 .pll_n = 1,
277 .demod_address = (0x1e >> 1),
282 .demod_address = (0x1e >> 1),
283 .parallel_ts = 1,
287 .demod_address = (0x1e >> 1),
288 .parallel_ts = 1,
289 .disable_i2c_gate_ctrl = 1,
290 .no_tuner = 1,
295 .demod_address = (0x18 >> 1),
296 .parallel_ts = 1,
297 .disable_i2c_gate_ctrl = 1,
298 .no_tuner = 1,
303 .demod_address = (0x1a >> 1),
307 .pll_n = 1,
330 .demod_address = (0xaa >> 1),
336 .demod_address = (0xd0 >> 1),
342 .tun1_adc = 1, /* 1 Vpp */
347 .i2c_address = (0xc0 >> 1),
349 .clk_div = 1,
355 .mod_extern = 1,
356 .addr = (0x10 >> 1),
360 .i2c_address = 0x6d, /* (0xda >> 1) */
365 * New USB device strings: Mfr=1, Product=2, SerialNumber=0
379 * PCB: 507CD (rev1.1)
383 * IOD[0] ZL10353 1=enabled
392 * IOD[0] TDA10023 1=enabled
395 * PCB: 507SI (rev2.1)
398 * IOA=4d IOB=ff IOC=00 IOD=26 IOE=01
399 * IOD[0] CX24116 1=enabled
401 * E30 C Plus VID=1c73 PID=861f HW=15 FW=1.2 "anysee-FA(LP)"
405 * IOA=4d IOB=ff IOC=00 IOD=00 IOE=c0
406 * IOD[5] TDA10023 1=enabled
407 * IOE[0] tuner 1=enabled
409 * E30 Combo Plus VID=1c73 PID=861f HW=15 FW=1.2 "anysee-FA(LP)"
410 * PCB: 507FA (rev1.1)
413 * IOA=4d IOB=ff IOC=00 IOD=00 IOE=c0
415 * IOD[5] TDA10023 1=enabled
416 * IOE[0] tuner 1=enabled
418 * IOD[0] ZL10353 1=enabled
423 * E7 TC VID=1c73 PID=861f HW=18 FW=0.7 AMTCI=0.5 "anysee-E7TC(LP)"
427 * IOA=4d IOB=00 IOC=cc IOD=48 IOE=e4
428 * IOA[7] TS 1=enabled
429 * IOE[4] TDA18212 1=enabled
432 * IOD[5] TDA10023 1=enabled
433 * IOE[0] IF 1=enabled
436 * IOD[6] ZL10353 1=enabled
439 * E7 S2 VID=1c73 PID=861f HW=19 FW=0.4 AMTCI=0.5 "anysee-E7S2(LP)"
443 * IOA=4d IOB=00 IOC=c4 IOD=08 IOE=e4
444 * IOA[7] TS 1=enabled
445 * IOE[5] STV0903 1=enabled
447 * E7 T2C VID=1c73 PID=861f HW=20 FW=0.1 AMTCI=0.5 "anysee-E7T2C(LP)"
451 * IOA=4d IOB=00 IOC=cc IOD=48 IOE=e4
452 * IOA[7] TS 1=enabled
453 * IOE[5] CXD2820R 1=enabled
455 * E7 PTC VID=1c73 PID=861f HW=21 FW=0.1 AMTCI=?? "anysee-E7PTC(LP)"
459 * IOA=4d IOB=00 IOC=cc IOD=48 IOE=e4
460 * IOA[7] TS 1=enabled
461 * IOE[4] TDA18212 1=enabled
464 * IOD[5] TDA10023 1=enabled
465 * IOE[0] IF 1=enabled
468 * IOD[6] ZL10353 1=enabled
471 * E7 PS2 VID=1c73 PID=861f HW=22 FW=0.1 AMTCI=?? "anysee-E7PS2(LP)"
475 * IOA=4d IOB=00 IOC=c4 IOD=08 IOE=e4
476 * IOA[7] TS 1=enabled
477 * IOE[5] STV0903 1=enabled
480 static int anysee_read_config(struct dvb_usb_device *d) in anysee_read_config() argument
482 struct anysee_state *state = d_to_priv(d); in anysee_read_config()
490 ret = anysee_get_hw_info(d, hw_info); in anysee_read_config()
494 ret = anysee_get_hw_info(d, hw_info); in anysee_read_config()
501 dev_info(&d->udev->dev, "%s: firmware version %d.%d hardware id %d\n", in anysee_read_config()
502 KBUILD_MODNAME, hw_info[1], hw_info[2], hw_info[0]); in anysee_read_config()
519 struct dvb_usb_device *d = fe_to_d(fe); in anysee_frontend_ctrl() local
521 dev_dbg(&d->udev->dev, "%s: fe=%d onoff=%d\n", __func__, fe->id, onoff); in anysee_frontend_ctrl()
534 ret = anysee_wr_reg_mask(d, REG_IOD, (0 << 0), 0x01); in anysee_frontend_ctrl()
539 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 5), 0x20); in anysee_frontend_ctrl()
544 ret = anysee_wr_reg_mask(d, REG_IOE, (1 << 0), 0x01); in anysee_frontend_ctrl()
549 ret = anysee_wr_reg_mask(d, REG_IOD, (0 << 5), 0x20); in anysee_frontend_ctrl()
554 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 0), 0x01); in anysee_frontend_ctrl()
559 ret = anysee_wr_reg_mask(d, REG_IOE, (0 << 0), 0x01); in anysee_frontend_ctrl()
572 ret = anysee_wr_reg_mask(d, REG_IOD, (0 << 6), 0x40); in anysee_frontend_ctrl()
577 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 5), 0x20); in anysee_frontend_ctrl()
582 ret = anysee_wr_reg_mask(d, REG_IOE, (1 << 0), 0x01); in anysee_frontend_ctrl()
587 ret = anysee_wr_reg_mask(d, REG_IOD, (0 << 5), 0x20); in anysee_frontend_ctrl()
592 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 6), 0x40); in anysee_frontend_ctrl()
597 ret = anysee_wr_reg_mask(d, REG_IOE, (0 << 0), 0x01); in anysee_frontend_ctrl()
611 static int anysee_add_i2c_dev(struct dvb_usb_device *d, const char *type, in anysee_add_i2c_dev() argument
615 struct anysee_state *state = d_to_priv(d); in anysee_add_i2c_dev()
617 struct i2c_adapter *adapter = &d->i2c_adap; in anysee_add_i2c_dev()
631 dev_dbg(&d->udev->dev, "%s: num=%d\n", __func__, num); in anysee_add_i2c_dev()
634 dev_err(&d->udev->dev, "%s: I2C client out of index\n", in anysee_add_i2c_dev()
659 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret); in anysee_add_i2c_dev()
663 static void anysee_del_i2c_dev(struct dvb_usb_device *d) in anysee_del_i2c_dev() argument
666 struct anysee_state *state = d_to_priv(d); in anysee_del_i2c_dev()
676 dev_dbg(&d->udev->dev, "%s: num=%d\n", __func__, num); in anysee_del_i2c_dev()
678 if (num == -1) { in anysee_del_i2c_dev()
679 dev_err(&d->udev->dev, "%s: I2C client out of index\n", in anysee_del_i2c_dev()
694 dev_dbg(&d->udev->dev, "%s: failed\n", __func__); in anysee_del_i2c_dev()
700 struct dvb_usb_device *d = adap_to_d(adap); in anysee_frontend_attach() local
707 .len = 1, in anysee_frontend_attach()
712 .len = 1, in anysee_frontend_attach()
723 &d->i2c_adap); in anysee_frontend_attach()
729 &d->i2c_adap); in anysee_frontend_attach()
736 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 0), 0x01); in anysee_frontend_attach()
741 ret = anysee_wr_reg_mask(d, REG_IOA, (0 << 7), 0x80); in anysee_frontend_attach()
747 &d->i2c_adap); in anysee_frontend_attach()
754 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 0), 0x01); in anysee_frontend_attach()
760 &anysee_tda10023_config, &d->i2c_adap, 0x48); in anysee_frontend_attach()
767 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 0), 0x01); in anysee_frontend_attach()
773 &d->i2c_adap); in anysee_frontend_attach()
781 ret = anysee_wr_reg_mask(d, REG_IOE, (1 << 4), 0x10); in anysee_frontend_attach()
787 ret = i2c_transfer(&d->i2c_adap, msg, 2); in anysee_frontend_attach()
789 dev_dbg(&d->udev->dev, "%s: TDA18212 found\n", in anysee_frontend_attach()
797 ret = anysee_wr_reg_mask(d, REG_IOE, (0 << 4), 0x10); in anysee_frontend_attach()
802 ret = anysee_wr_reg_mask(d, REG_IOD, (0 << 0), 0x01); in anysee_frontend_attach()
807 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 5), 0x20); in anysee_frontend_attach()
816 &d->i2c_adap, 0x48); in anysee_frontend_attach()
826 &d->i2c_adap, 0x48); in anysee_frontend_attach()
834 ret = anysee_wr_reg_mask(d, REG_IOD, (0 << 5), 0x20); in anysee_frontend_attach()
839 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 0), 0x01); in anysee_frontend_attach()
846 adap->fe[1] = dvb_attach(zl10353_attach, in anysee_frontend_attach()
848 &d->i2c_adap); in anysee_frontend_attach()
851 if (adap->fe[1]) in anysee_frontend_attach()
852 adap->fe[1]->ops.i2c_gate_ctrl = in anysee_frontend_attach()
856 adap->fe[1] = dvb_attach(zl10353_attach, in anysee_frontend_attach()
858 &d->i2c_adap); in anysee_frontend_attach()
868 ret = anysee_wr_reg_mask(d, REG_IOD, (0 << 6), 0x40); in anysee_frontend_attach()
873 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 5), 0x20); in anysee_frontend_attach()
880 &d->i2c_adap, 0x48); in anysee_frontend_attach()
891 ret = anysee_wr_reg_mask(d, REG_IOD, (0 << 5), 0x20); in anysee_frontend_attach()
896 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 6), 0x40); in anysee_frontend_attach()
901 adap->fe[1] = dvb_attach(zl10353_attach, in anysee_frontend_attach()
903 &d->i2c_adap); in anysee_frontend_attach()
906 if (adap->fe[1]) in anysee_frontend_attach()
907 adap->fe[1]->ops.i2c_gate_ctrl = anysee_i2c_gate_ctrl; in anysee_frontend_attach()
918 ret = anysee_wr_reg_mask(d, REG_IOE, (1 << 5), 0x20); in anysee_frontend_attach()
924 &anysee_stv0900_config, &d->i2c_adap, 0); in anysee_frontend_attach()
933 ret = anysee_wr_reg_mask(d, REG_IOE, (1 << 5), 0x20); in anysee_frontend_attach()
939 &anysee_cxd2820r_config, &d->i2c_adap, NULL); in anysee_frontend_attach()
949 dev_err(&d->udev->dev, in anysee_frontend_attach()
960 struct dvb_usb_device *d = adap_to_d(adap); in anysee_tuner_attach() local
963 dev_dbg(&d->udev->dev, "%s:\n", __func__); in anysee_tuner_attach()
970 fe = dvb_attach(dvb_pll_attach, adap->fe[0], (0xc2 >> 1), NULL, in anysee_tuner_attach()
978 fe = dvb_attach(dvb_pll_attach, adap->fe[0], (0xc2 >> 1), in anysee_tuner_attach()
979 &d->i2c_adap, DVB_PLL_THOMSON_DTT7579); in anysee_tuner_attach()
986 fe = dvb_attach(dvb_pll_attach, adap->fe[0], (0xc0 >> 1), in anysee_tuner_attach()
987 &d->i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A); in anysee_tuner_attach()
994 fe = dvb_attach(isl6423_attach, adap->fe[0], &d->i2c_adap, in anysee_tuner_attach()
1011 ret = anysee_add_i2c_dev(d, "tda18212", 0x60, in anysee_tuner_attach()
1017 if (adap->fe[1]) { in anysee_tuner_attach()
1018 adap->fe[1]->tuner_priv = in anysee_tuner_attach()
1020 memcpy(&adap->fe[1]->ops.tuner_ops, in anysee_tuner_attach()
1029 (0xc0 >> 1), &d->i2c_adap, in anysee_tuner_attach()
1032 if (fe && adap->fe[1]) { in anysee_tuner_attach()
1034 fe = dvb_attach(dvb_pll_attach, adap->fe[1], in anysee_tuner_attach()
1035 (0xc0 >> 1), &d->i2c_adap, in anysee_tuner_attach()
1049 ret = anysee_add_i2c_dev(d, "tda18212", 0x60, &tda18212_config); in anysee_tuner_attach()
1054 if (adap->fe[1]) { in anysee_tuner_attach()
1055 adap->fe[1]->tuner_priv = adap->fe[0]->tuner_priv; in anysee_tuner_attach()
1056 memcpy(&adap->fe[1]->ops.tuner_ops, in anysee_tuner_attach()
1070 &anysee_stv6110_config, &d->i2c_adap); in anysee_tuner_attach()
1075 &d->i2c_adap, &anysee_isl6423_config); in anysee_tuner_attach()
1087 ret = anysee_add_i2c_dev(d, "tda18212", 0x60, &tda18212_config); in anysee_tuner_attach()
1106 static int anysee_rc_query(struct dvb_usb_device *d) in anysee_rc_query() argument
1120 ret = anysee_ctrl_msg(d, buf, sizeof(buf), ircode, sizeof(ircode)); in anysee_rc_query()
1125 dev_dbg(&d->udev->dev, "%s: key pressed %02x\n", __func__, in anysee_rc_query()
1126 ircode[1]); in anysee_rc_query()
1127 rc_keydown(d->rc_dev, RC_PROTO_NEC, in anysee_rc_query()
1128 RC_SCANCODE_NEC(0x08, ircode[1]), 0); in anysee_rc_query()
1134 static int anysee_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) in anysee_get_rc_config() argument
1149 struct dvb_usb_device *d = ci->data; in anysee_ci_read_attribute_mem() local
1151 u8 buf[] = {CMD_CI, 0x02, 0x40 | addr >> 8, addr & 0xff, 0x00, 1}; in anysee_ci_read_attribute_mem()
1154 ret = anysee_ctrl_msg(d, buf, sizeof(buf), &val, 1); in anysee_ci_read_attribute_mem()
1164 struct dvb_usb_device *d = ci->data; in anysee_ci_write_attribute_mem() local
1165 u8 buf[] = {CMD_CI, 0x03, 0x40 | addr >> 8, addr & 0xff, 0x00, 1, val}; in anysee_ci_write_attribute_mem()
1167 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); in anysee_ci_write_attribute_mem()
1173 struct dvb_usb_device *d = ci->data; in anysee_ci_read_cam_control() local
1175 u8 buf[] = {CMD_CI, 0x04, 0x40, addr, 0x00, 1}; in anysee_ci_read_cam_control()
1178 ret = anysee_ctrl_msg(d, buf, sizeof(buf), &val, 1); in anysee_ci_read_cam_control()
1188 struct dvb_usb_device *d = ci->data; in anysee_ci_write_cam_control() local
1189 u8 buf[] = {CMD_CI, 0x05, 0x40, addr, 0x00, 1, val}; in anysee_ci_write_cam_control()
1191 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); in anysee_ci_write_cam_control()
1196 struct dvb_usb_device *d = ci->data; in anysee_ci_slot_reset() local
1198 struct anysee_state *state = d_to_priv(d); in anysee_ci_slot_reset()
1202 ret = anysee_wr_reg_mask(d, REG_IOA, (0 << 7), 0x80); in anysee_ci_slot_reset()
1208 ret = anysee_wr_reg_mask(d, REG_IOA, (1 << 7), 0x80); in anysee_ci_slot_reset()
1217 struct dvb_usb_device *d = ci->data; in anysee_ci_slot_shutdown() local
1220 ret = anysee_wr_reg_mask(d, REG_IOA, (0 << 7), 0x80); in anysee_ci_slot_shutdown()
1226 ret = anysee_wr_reg_mask(d, REG_IOA, (1 << 7), 0x80); in anysee_ci_slot_shutdown()
1235 struct dvb_usb_device *d = ci->data; in anysee_ci_slot_ts_enable() local
1237 return anysee_wr_reg_mask(d, REG_IOD, (0 << 1), 0x02); in anysee_ci_slot_ts_enable()
1243 struct dvb_usb_device *d = ci->data; in anysee_ci_poll_slot_status() local
1244 struct anysee_state *state = d_to_priv(d); in anysee_ci_poll_slot_status()
1248 ret = anysee_rd_reg_mask(d, REG_IOC, &tmp, 0x40); in anysee_ci_poll_slot_status()
1261 static int anysee_ci_init(struct dvb_usb_device *d) in anysee_ci_init() argument
1263 struct anysee_state *state = d_to_priv(d); in anysee_ci_init()
1275 state->ci.data = d; in anysee_ci_init()
1277 ret = anysee_wr_reg_mask(d, REG_IOA, (1 << 7), 0x80); in anysee_ci_init()
1281 ret = anysee_wr_reg_mask(d, REG_IOD, (0 << 2)|(0 << 1)|(0 << 0), 0x07); in anysee_ci_init()
1285 ret = anysee_wr_reg_mask(d, REG_IOD, (1 << 2)|(1 << 1)|(1 << 0), 0x07); in anysee_ci_init()
1289 ret = dvb_ca_en50221_init(&d->adapter[0].dvb_adap, &state->ci, 0, 1); in anysee_ci_init()
1298 static void anysee_ci_release(struct dvb_usb_device *d) in anysee_ci_release() argument
1300 struct anysee_state *state = d_to_priv(d); in anysee_ci_release()
1309 static int anysee_init(struct dvb_usb_device *d) in anysee_init() argument
1311 struct anysee_state *state = d_to_priv(d); in anysee_init()
1316 Alternate setting 1 is for isochronous transfer. in anysee_init()
1318 ret = usb_set_interface(d->udev, 0, 0); in anysee_init()
1323 ret = anysee_led_ctrl(d, 0x01, 0x03); in anysee_init()
1328 ret = anysee_ir_ctrl(d, 1); in anysee_init()
1334 ret = anysee_ci_init(d); in anysee_init()
1342 static void anysee_exit(struct dvb_usb_device *d) in anysee_exit() argument
1344 struct anysee_state *state = d_to_priv(d); in anysee_exit()
1347 anysee_del_i2c_dev(d); in anysee_exit()
1349 return anysee_ci_release(d); in anysee_exit()
1372 .num_adapters = 1,
1397 .no_dynamic_id = 1,
1398 .soft_unbind = 1,