Lines Matching +full:manufacturer +full:- +full:id
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * DVB USB Linux driver for Afatech AF9015 DVB-T USB2.0 receiver
22 struct usb_interface *intf = d->intf; in af9015_ctrl_msg()
26 mutex_lock(&d->usb_mutex); in af9015_ctrl_msg()
28 state->buf[0] = req->cmd; in af9015_ctrl_msg()
29 state->buf[1] = state->seq++; in af9015_ctrl_msg()
30 state->buf[2] = req->i2c_addr << 1; in af9015_ctrl_msg()
31 state->buf[3] = req->addr >> 8; in af9015_ctrl_msg()
32 state->buf[4] = req->addr & 0xff; in af9015_ctrl_msg()
33 state->buf[5] = req->mbox; in af9015_ctrl_msg()
34 state->buf[6] = req->addr_len; in af9015_ctrl_msg()
35 state->buf[7] = req->data_len; in af9015_ctrl_msg()
37 switch (req->cmd) { in af9015_ctrl_msg()
45 state->buf[2] |= 0x01; /* set I2C direction */ in af9015_ctrl_msg()
48 state->buf[0] = READ_WRITE_I2C; in af9015_ctrl_msg()
51 if (((req->addr & 0xff00) == 0xff00) || in af9015_ctrl_msg()
52 ((req->addr & 0xff00) == 0xae00)) in af9015_ctrl_msg()
53 state->buf[0] = WRITE_VIRTUAL_MEMORY; in af9015_ctrl_msg()
61 dev_err(&intf->dev, "unknown cmd %d\n", req->cmd); in af9015_ctrl_msg()
62 ret = -EIO; in af9015_ctrl_msg()
67 if ((write && (req->data_len > BUF_LEN - REQ_HDR_LEN)) || in af9015_ctrl_msg()
68 (!write && (req->data_len > BUF_LEN - ACK_HDR_LEN))) { in af9015_ctrl_msg()
69 dev_err(&intf->dev, "too much data, cmd %u, len %u\n", in af9015_ctrl_msg()
70 req->cmd, req->data_len); in af9015_ctrl_msg()
71 ret = -EINVAL; in af9015_ctrl_msg()
82 wlen += req->data_len; in af9015_ctrl_msg()
83 memcpy(&state->buf[REQ_HDR_LEN], req->data, req->data_len); in af9015_ctrl_msg()
85 rlen += req->data_len; in af9015_ctrl_msg()
89 if (req->cmd == DOWNLOAD_FIRMWARE || req->cmd == RECONNECT_USB) in af9015_ctrl_msg()
92 ret = dvb_usbv2_generic_rw_locked(d, state->buf, wlen, in af9015_ctrl_msg()
93 state->buf, rlen); in af9015_ctrl_msg()
98 if (rlen && state->buf[1]) { in af9015_ctrl_msg()
99 dev_err(&intf->dev, "cmd failed %u\n", state->buf[1]); in af9015_ctrl_msg()
100 ret = -EIO; in af9015_ctrl_msg()
106 memcpy(req->data, &state->buf[ACK_HDR_LEN], req->data_len); in af9015_ctrl_msg()
108 mutex_unlock(&d->usb_mutex); in af9015_ctrl_msg()
119 if (addr == state->af9013_i2c_addr[0] || in af9015_write_reg_i2c()
120 addr == state->af9013_i2c_addr[1]) in af9015_write_reg_i2c()
132 if (addr == state->af9013_i2c_addr[0] || in af9015_read_reg_i2c()
133 addr == state->af9013_i2c_addr[1]) in af9015_read_reg_i2c()
144 struct usb_interface *intf = d->intf; in af9015_i2c_xfer()
153 * I2C-gate is only possibility to select correct tuner. in af9015_i2c_xfer()
159 * .|------------| |------------|. |------------| in af9015_i2c_xfer()
161 * .| |--+--I2C-----|-----/ -----|.----I2C-----| | in af9015_i2c_xfer()
167 * | |------------| |------------| in af9015_i2c_xfer()
169 * +--I2C-----|-----/ -----|-----I2C-----| | in af9015_i2c_xfer()
195 ret = -EOPNOTSUPP; in af9015_i2c_xfer()
198 if (msg[0].addr == state->af9013_i2c_addr[0]) in af9015_i2c_xfer()
206 req.data_len = msg[0].len - addr_len; in af9015_i2c_xfer()
213 ret = -EOPNOTSUPP; in af9015_i2c_xfer()
216 if (msg[0].addr == state->af9013_i2c_addr[0]) in af9015_i2c_xfer()
230 ret = -EOPNOTSUPP; in af9015_i2c_xfer()
233 if (msg[0].addr == state->af9013_i2c_addr[0]) { in af9015_i2c_xfer()
234 ret = -EINVAL; in af9015_i2c_xfer()
246 ret = -EOPNOTSUPP; in af9015_i2c_xfer()
247 dev_dbg(&intf->dev, "unknown msg, num %u\n", num); in af9015_i2c_xfer()
254 dev_dbg(&intf->dev, "failed %d\n", ret); in af9015_i2c_xfer()
270 struct usb_interface *intf = d->intf; in af9015_identify_state()
279 dev_dbg(&intf->dev, "reply %02x\n", reply); in af9015_identify_state()
293 struct usb_interface *intf = d->intf; in af9015_download_firmware()
298 dev_dbg(&intf->dev, "\n"); in af9015_download_firmware()
301 for (i = 0, checksum = 0; i < firmware->size; i++) in af9015_download_firmware()
302 checksum += firmware->data[i]; in af9015_download_firmware()
304 state->firmware_size = firmware->size; in af9015_download_firmware()
305 state->firmware_checksum = checksum; in af9015_download_firmware()
307 #define LEN_MAX (BUF_LEN - REQ_HDR_LEN) /* Max payload size */ in af9015_download_firmware()
308 for (rem = firmware->size; rem > 0; rem -= LEN_MAX) { in af9015_download_firmware()
310 req.data = (u8 *)&firmware->data[firmware->size - rem]; in af9015_download_firmware()
311 req.addr = 0x5100 + firmware->size - rem; in af9015_download_firmware()
314 dev_err(&intf->dev, "firmware download failed %d\n", in af9015_download_firmware()
324 dev_err(&intf->dev, "firmware boot failed %d\n", ret); in af9015_download_firmware()
330 dev_dbg(&intf->dev, "failed %d\n", ret); in af9015_download_firmware()
335 /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */
342 struct usb_interface *intf = d->intf; in af9015_eeprom_hash()
358 state->eeprom_sum *= GOLDEN_RATIO_PRIME_32; in af9015_eeprom_hash()
359 state->eeprom_sum += le32_to_cpu(((__le32 *)buf)[i]); in af9015_eeprom_hash()
363 dev_dbg(&intf->dev, "%*ph\n", 16, buf + i); in af9015_eeprom_hash()
365 dev_dbg(&intf->dev, "eeprom sum %.8x\n", state->eeprom_sum); in af9015_eeprom_hash()
368 dev_dbg(&intf->dev, "failed %d\n", ret); in af9015_eeprom_hash()
375 struct usb_interface *intf = d->intf; in af9015_read_config()
380 dev_dbg(&intf->dev, "\n"); in af9015_read_config()
397 state->ir_mode = val; in af9015_read_config()
398 dev_dbg(&intf->dev, "ir mode %02x\n", val); in af9015_read_config()
400 /* TS mode - one or two receivers */ in af9015_read_config()
406 state->dual_mode = val; in af9015_read_config()
407 dev_dbg(&intf->dev, "ts mode %02x\n", state->dual_mode); in af9015_read_config()
409 state->af9013_i2c_addr[0] = AF9015_I2C_DEMOD; in af9015_read_config()
411 if (state->dual_mode) { in af9015_read_config()
418 state->af9013_i2c_addr[1] = val >> 1; in af9015_read_config()
421 for (i = 0; i < state->dual_mode + 1; i++) { in af9015_read_config()
431 state->af9013_pdata[i].clk = 28800000; in af9015_read_config()
434 state->af9013_pdata[i].clk = 20480000; in af9015_read_config()
437 state->af9013_pdata[i].clk = 28000000; in af9015_read_config()
440 state->af9013_pdata[i].clk = 25000000; in af9015_read_config()
443 dev_dbg(&intf->dev, "[%d] xtal %02x, clk %u\n", in af9015_read_config()
444 i, val, state->af9013_pdata[i].clk); in af9015_read_config()
452 state->af9013_pdata[i].if_frequency = val << 8; in af9015_read_config()
459 state->af9013_pdata[i].if_frequency += val; in af9015_read_config()
460 state->af9013_pdata[i].if_frequency *= 1000; in af9015_read_config()
461 dev_dbg(&intf->dev, "[%d] if frequency %u\n", in af9015_read_config()
462 i, state->af9013_pdata[i].if_frequency); in af9015_read_config()
469 state->mt2060_if1[i] = val << 8; in af9015_read_config()
474 state->mt2060_if1[i] += val; in af9015_read_config()
475 dev_dbg(&intf->dev, "[%d] MT2060 IF1 %u\n", in af9015_read_config()
476 i, state->mt2060_if1[i]); in af9015_read_config()
492 state->af9013_pdata[i].spec_inv = 1; in af9015_read_config()
498 state->af9013_pdata[i].spec_inv = 0; in af9015_read_config()
501 state->af9013_pdata[i].gpio[1] = AF9013_GPIO_LO; in af9015_read_config()
502 state->af9013_pdata[i].spec_inv = 1; in af9015_read_config()
505 dev_err(&intf->dev, in af9015_read_config()
506 "tuner id %02x not supported, please report!\n", in af9015_read_config()
508 return -ENODEV; in af9015_read_config()
511 state->af9013_pdata[i].tuner = val; in af9015_read_config()
512 dev_dbg(&intf->dev, "[%d] tuner id %02x\n", i, val); in af9015_read_config()
517 dev_err(&intf->dev, "eeprom read failed %d\n", ret); in af9015_read_config()
521 * content :-( Override some wrong values here. Ditto for the in af9015_read_config()
524 if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA && in af9015_read_config()
525 ((le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_A850) || in af9015_read_config()
526 (le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_A850T))) { in af9015_read_config()
527 dev_dbg(&intf->dev, "AverMedia A850: overriding config\n"); in af9015_read_config()
529 state->dual_mode = 0; in af9015_read_config()
532 state->af9013_pdata[0].if_frequency = 4570000; in af9015_read_config()
542 struct usb_interface *intf = d->intf; in af9015_get_stream_config()
544 dev_dbg(&intf->dev, "adap %u\n", fe_to_adap(fe)->id); in af9015_get_stream_config()
546 if (d->udev->speed == USB_SPEED_FULL) in af9015_get_stream_config()
547 stream->u.bulk.buffersize = 5 * 188; in af9015_get_stream_config()
556 struct usb_interface *intf = d->intf; in af9015_streaming_ctrl()
560 const unsigned int adap_id = fe_to_adap(fe)->id; in af9015_streaming_ctrl()
562 dev_dbg(&intf->dev, "adap id %d, onoff %d\n", adap_id, onoff); in af9015_streaming_ctrl()
564 if (!state->usb_ts_if_configured[adap_id]) { in af9015_streaming_ctrl()
565 dev_dbg(&intf->dev, "set usb and ts interface\n"); in af9015_streaming_ctrl()
568 utmp1 = (d->udev->speed == USB_SPEED_FULL ? 5 : 87) * 188 / 4; in af9015_streaming_ctrl()
569 utmp2 = (d->udev->speed == USB_SPEED_FULL ? 64 : 512) / 4; in af9015_streaming_ctrl()
582 ret = regmap_bulk_write(state->regmap, reg1, buf, 2); in af9015_streaming_ctrl()
585 ret = regmap_write(state->regmap, reg2, utmp2); in af9015_streaming_ctrl()
590 if (state->dual_mode) { in af9015_streaming_ctrl()
597 ret = regmap_update_bits(state->regmap, 0xd50b, 0x01, utmp1); in af9015_streaming_ctrl()
600 ret = regmap_update_bits(state->regmap, 0xd520, 0x10, utmp2); in af9015_streaming_ctrl()
604 state->usb_ts_if_configured[adap_id] = true; in af9015_streaming_ctrl()
609 ret = regmap_update_bits(state->regmap, 0xdd13, 0x20, 0x00); in af9015_streaming_ctrl()
612 ret = regmap_update_bits(state->regmap, 0xdd11, 0x20, 0x20); in af9015_streaming_ctrl()
615 ret = regmap_update_bits(state->regmap, 0xd507, 0x04, 0x00); in af9015_streaming_ctrl()
620 ret = regmap_update_bits(state->regmap, 0xdd13, 0x40, 0x00); in af9015_streaming_ctrl()
623 ret = regmap_update_bits(state->regmap, 0xdd11, 0x40, 0x40); in af9015_streaming_ctrl()
626 ret = regmap_update_bits(state->regmap, 0xd50b, 0x02, 0x00); in af9015_streaming_ctrl()
631 ret = regmap_update_bits(state->regmap, 0xd507, 0x04, 0x04); in af9015_streaming_ctrl()
634 ret = regmap_update_bits(state->regmap, 0xdd11, 0x20, 0x00); in af9015_streaming_ctrl()
637 ret = regmap_update_bits(state->regmap, 0xdd13, 0x20, 0x20); in af9015_streaming_ctrl()
642 ret = regmap_update_bits(state->regmap, 0xd50b, 0x02, 0x02); in af9015_streaming_ctrl()
645 ret = regmap_update_bits(state->regmap, 0xdd11, 0x40, 0x00); in af9015_streaming_ctrl()
648 ret = regmap_update_bits(state->regmap, 0xdd13, 0x40, 0x40); in af9015_streaming_ctrl()
655 dev_dbg(&intf->dev, "failed %d\n", ret); in af9015_streaming_ctrl()
663 return state->dual_mode + 1; in af9015_get_adapter_count()
672 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_af9013_set_frontend()
673 return -EAGAIN; in af9015_af9013_set_frontend()
675 ret = state->set_frontend[fe_to_adap(fe)->id](fe); in af9015_af9013_set_frontend()
677 mutex_unlock(&state->fe_mutex); in af9015_af9013_set_frontend()
689 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_af9013_read_status()
690 return -EAGAIN; in af9015_af9013_read_status()
692 ret = state->read_status[fe_to_adap(fe)->id](fe, status); in af9015_af9013_read_status()
694 mutex_unlock(&state->fe_mutex); in af9015_af9013_read_status()
705 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_af9013_init()
706 return -EAGAIN; in af9015_af9013_init()
708 ret = state->init[fe_to_adap(fe)->id](fe); in af9015_af9013_init()
710 mutex_unlock(&state->fe_mutex); in af9015_af9013_init()
721 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_af9013_sleep()
722 return -EAGAIN; in af9015_af9013_sleep()
724 ret = state->sleep[fe_to_adap(fe)->id](fe); in af9015_af9013_sleep()
726 mutex_unlock(&state->fe_mutex); in af9015_af9013_sleep()
737 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_tuner_init()
738 return -EAGAIN; in af9015_tuner_init()
740 ret = state->tuner_init[fe_to_adap(fe)->id](fe); in af9015_tuner_init()
742 mutex_unlock(&state->fe_mutex); in af9015_tuner_init()
753 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_tuner_sleep()
754 return -EAGAIN; in af9015_tuner_sleep()
756 ret = state->tuner_sleep[fe_to_adap(fe)->id](fe); in af9015_tuner_sleep()
758 mutex_unlock(&state->fe_mutex); in af9015_tuner_sleep()
766 struct usb_interface *intf = d->intf; in af9015_copy_firmware()
772 dev_dbg(&intf->dev, "\n"); in af9015_copy_firmware()
774 firmware_info[0] = (state->firmware_size >> 8) & 0xff; in af9015_copy_firmware()
775 firmware_info[1] = (state->firmware_size >> 0) & 0xff; in af9015_copy_firmware()
776 firmware_info[2] = (state->firmware_checksum >> 8) & 0xff; in af9015_copy_firmware()
777 firmware_info[3] = (state->firmware_checksum >> 0) & 0xff; in af9015_copy_firmware()
780 ret = af9015_read_reg_i2c(d, state->af9013_i2c_addr[1], 0x98be, &val); in af9015_copy_firmware()
784 dev_dbg(&intf->dev, "firmware status %02x\n", val); in af9015_copy_firmware()
790 ret = regmap_write(state->regmap, 0xd416, 0x04); in af9015_copy_firmware()
797 dev_err(&intf->dev, "firmware copy cmd failed %d\n", ret); in af9015_copy_firmware()
802 ret = regmap_write(state->regmap, 0xd416, 0x14); in af9015_copy_firmware()
807 ret = af9015_write_reg_i2c(d, state->af9013_i2c_addr[1], 0xe205, 0x01); in af9015_copy_firmware()
817 ret = af9015_read_reg_i2c(d, state->af9013_i2c_addr[1], in af9015_copy_firmware()
822 dev_dbg(&intf->dev, "firmware status %02x\n", val); in af9015_copy_firmware()
825 dev_dbg(&intf->dev, "firmware boot took %u ms\n", in af9015_copy_firmware()
826 jiffies_to_msecs(jiffies) - (jiffies_to_msecs(timeout) - 1000)); in af9015_copy_firmware()
829 ret = -ENODEV; in af9015_copy_firmware()
830 dev_err(&intf->dev, "firmware did not run\n"); in af9015_copy_firmware()
833 ret = -ETIMEDOUT; in af9015_copy_firmware()
834 dev_err(&intf->dev, "firmware boot timeout\n"); in af9015_copy_firmware()
840 dev_dbg(&intf->dev, "failed %d\n", ret); in af9015_copy_firmware()
848 struct usb_interface *intf = d->intf; in af9015_af9013_frontend_attach()
852 dev_dbg(&intf->dev, "adap id %u\n", adap->id); in af9015_af9013_frontend_attach()
854 if (adap->id == 0) { in af9015_af9013_frontend_attach()
855 state->af9013_pdata[0].ts_mode = AF9013_TS_MODE_USB; in af9015_af9013_frontend_attach()
856 memcpy(state->af9013_pdata[0].api_version, "\x0\x1\x9\x0", 4); in af9015_af9013_frontend_attach()
857 state->af9013_pdata[0].gpio[0] = AF9013_GPIO_HI; in af9015_af9013_frontend_attach()
858 state->af9013_pdata[0].gpio[3] = AF9013_GPIO_TUNER_ON; in af9015_af9013_frontend_attach()
859 } else if (adap->id == 1) { in af9015_af9013_frontend_attach()
860 state->af9013_pdata[1].ts_mode = AF9013_TS_MODE_SERIAL; in af9015_af9013_frontend_attach()
861 state->af9013_pdata[1].ts_output_pin = 7; in af9015_af9013_frontend_attach()
862 memcpy(state->af9013_pdata[1].api_version, "\x0\x1\x9\x0", 4); in af9015_af9013_frontend_attach()
863 state->af9013_pdata[1].gpio[0] = AF9013_GPIO_TUNER_ON; in af9015_af9013_frontend_attach()
864 state->af9013_pdata[1].gpio[1] = AF9013_GPIO_LO; in af9015_af9013_frontend_attach()
867 if (state->dual_mode) { in af9015_af9013_frontend_attach()
873 dev_err(&intf->dev, in af9015_af9013_frontend_attach()
875 state->dual_mode = 0; in af9015_af9013_frontend_attach()
879 ret = -ENODEV; in af9015_af9013_frontend_attach()
885 client = dvb_module_probe("af9013", NULL, &d->i2c_adap, in af9015_af9013_frontend_attach()
886 state->af9013_i2c_addr[adap->id], in af9015_af9013_frontend_attach()
887 &state->af9013_pdata[adap->id]); in af9015_af9013_frontend_attach()
889 ret = -ENODEV; in af9015_af9013_frontend_attach()
892 adap->fe[0] = state->af9013_pdata[adap->id].get_dvb_frontend(client); in af9015_af9013_frontend_attach()
893 state->demod_i2c_client[adap->id] = client; in af9015_af9013_frontend_attach()
902 if (adap->fe[0]) { in af9015_af9013_frontend_attach()
903 state->set_frontend[adap->id] = adap->fe[0]->ops.set_frontend; in af9015_af9013_frontend_attach()
904 adap->fe[0]->ops.set_frontend = af9015_af9013_set_frontend; in af9015_af9013_frontend_attach()
905 state->read_status[adap->id] = adap->fe[0]->ops.read_status; in af9015_af9013_frontend_attach()
906 adap->fe[0]->ops.read_status = af9015_af9013_read_status; in af9015_af9013_frontend_attach()
907 state->init[adap->id] = adap->fe[0]->ops.init; in af9015_af9013_frontend_attach()
908 adap->fe[0]->ops.init = af9015_af9013_init; in af9015_af9013_frontend_attach()
909 state->sleep[adap->id] = adap->fe[0]->ops.sleep; in af9015_af9013_frontend_attach()
910 adap->fe[0]->ops.sleep = af9015_af9013_sleep; in af9015_af9013_frontend_attach()
915 dev_dbg(&intf->dev, "failed %d\n", ret); in af9015_af9013_frontend_attach()
923 struct usb_interface *intf = d->intf; in af9015_frontend_detach()
926 dev_dbg(&intf->dev, "adap id %u\n", adap->id); in af9015_frontend_detach()
929 client = state->demod_i2c_client[adap->id]; in af9015_frontend_detach()
1002 struct usb_interface *intf = d->intf; in af9015_tuner_attach()
1007 dev_dbg(&intf->dev, "adap id %u\n", adap->id); in af9015_tuner_attach()
1009 client = state->demod_i2c_client[adap->id]; in af9015_tuner_attach()
1010 adapter = state->af9013_pdata[adap->id].get_i2c_adapter(client); in af9015_tuner_attach()
1012 switch (state->af9013_pdata[adap->id].tuner) { in af9015_tuner_attach()
1015 ret = dvb_attach(mt2060_attach, adap->fe[0], adapter, in af9015_tuner_attach()
1017 state->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0; in af9015_tuner_attach()
1021 ret = dvb_attach(qt1010_attach, adap->fe[0], adapter, in af9015_tuner_attach()
1022 &af9015_qt1010_config) == NULL ? -ENODEV : 0; in af9015_tuner_attach()
1025 ret = dvb_attach(tda18271_attach, adap->fe[0], 0x60, adapter, in af9015_tuner_attach()
1026 &af9015_tda18271_config) == NULL ? -ENODEV : 0; in af9015_tuner_attach()
1029 ret = dvb_attach(tda18218_attach, adap->fe[0], adapter, in af9015_tuner_attach()
1030 &af9015_tda18218_config) == NULL ? -ENODEV : 0; in af9015_tuner_attach()
1033 ret = dvb_attach(mxl5005s_attach, adap->fe[0], adapter, in af9015_tuner_attach()
1034 &af9015_mxl5003_config) == NULL ? -ENODEV : 0; in af9015_tuner_attach()
1038 ret = dvb_attach(mxl5005s_attach, adap->fe[0], adapter, in af9015_tuner_attach()
1039 &af9015_mxl5005_config) == NULL ? -ENODEV : 0; in af9015_tuner_attach()
1042 ret = dvb_attach(dvb_pll_attach, adap->fe[0], 0x60, adapter, in af9015_tuner_attach()
1043 DVB_PLL_TDA665X) == NULL ? -ENODEV : 0; in af9015_tuner_attach()
1046 ret = dvb_attach(mc44s803_attach, adap->fe[0], adapter, in af9015_tuner_attach()
1047 &af9015_mc44s803_config) == NULL ? -ENODEV : 0; in af9015_tuner_attach()
1050 ret = dvb_attach(mxl5007t_attach, adap->fe[0], adapter, in af9015_tuner_attach()
1051 0x60, &af9015_mxl5007t_config) == NULL ? -ENODEV : 0; in af9015_tuner_attach()
1055 dev_err(&intf->dev, "unknown tuner, tuner id %02x\n", in af9015_tuner_attach()
1056 state->af9013_pdata[adap->id].tuner); in af9015_tuner_attach()
1057 ret = -ENODEV; in af9015_tuner_attach()
1060 if (adap->fe[0]->ops.tuner_ops.init) { in af9015_tuner_attach()
1061 state->tuner_init[adap->id] = in af9015_tuner_attach()
1062 adap->fe[0]->ops.tuner_ops.init; in af9015_tuner_attach()
1063 adap->fe[0]->ops.tuner_ops.init = af9015_tuner_init; in af9015_tuner_attach()
1066 if (adap->fe[0]->ops.tuner_ops.sleep) { in af9015_tuner_attach()
1067 state->tuner_sleep[adap->id] = in af9015_tuner_attach()
1068 adap->fe[0]->ops.tuner_ops.sleep; in af9015_tuner_attach()
1069 adap->fe[0]->ops.tuner_ops.sleep = af9015_tuner_sleep; in af9015_tuner_attach()
1078 struct af9013_platform_data *pdata = &state->af9013_pdata[adap->id]; in af9015_pid_filter_ctrl()
1081 mutex_lock(&state->fe_mutex); in af9015_pid_filter_ctrl()
1082 ret = pdata->pid_filter_ctrl(adap->fe[0], onoff); in af9015_pid_filter_ctrl()
1083 mutex_unlock(&state->fe_mutex); in af9015_pid_filter_ctrl()
1092 struct af9013_platform_data *pdata = &state->af9013_pdata[adap->id]; in af9015_pid_filter()
1095 mutex_lock(&state->fe_mutex); in af9015_pid_filter()
1096 ret = pdata->pid_filter(adap->fe[0], index, pid, onoff); in af9015_pid_filter()
1097 mutex_unlock(&state->fe_mutex); in af9015_pid_filter()
1105 struct usb_interface *intf = d->intf; in af9015_init()
1108 dev_dbg(&intf->dev, "\n"); in af9015_init()
1110 mutex_init(&state->fe_mutex); in af9015_init()
1113 ret = regmap_write(state->regmap, 0x98e9, 0xff); in af9015_init()
1123 unsigned int id; member
1127 static char *af9015_rc_setup_match(unsigned int id, in af9015_rc_setup_match() argument
1130 for (; table->rc_codes; table++) in af9015_rc_setup_match()
1131 if (table->id == id) in af9015_rc_setup_match()
1132 return table->rc_codes; in af9015_rc_setup_match()
1149 { 0x5d49e3db, RC_MAP_DIGITTRADE }, /* LC-Power LC-USB-DVBT */
1156 struct usb_interface *intf = d->intf; in af9015_rc_query()
1161 ret = regmap_bulk_read(state->regmap, 0x98d9, buf, sizeof(buf)); in af9015_rc_query()
1165 /* If any of these are non-zero, assume invalid data */ in af9015_rc_query()
1167 dev_dbg(&intf->dev, "invalid data\n"); in af9015_rc_query()
1172 if ((state->rc_repeat != buf[6] || buf[0]) && in af9015_rc_query()
1173 !memcmp(&buf[12], state->rc_last, 4)) { in af9015_rc_query()
1174 dev_dbg(&intf->dev, "key repeated\n"); in af9015_rc_query()
1175 rc_repeat(d->rc_dev); in af9015_rc_query()
1176 state->rc_repeat = buf[6]; in af9015_rc_query()
1184 dev_dbg(&intf->dev, "key pressed %*ph\n", 4, buf + 12); in af9015_rc_query()
1187 ret = regmap_write(state->regmap, 0x98e9, 0xff); in af9015_rc_query()
1192 memcpy(state->rc_last, &buf[12], 4); in af9015_rc_query()
1196 state->rc_keycode = RC_SCANCODE_NEC(buf[12], in af9015_rc_query()
1201 state->rc_keycode = RC_SCANCODE_NECX(buf[12] << 8 | in af9015_rc_query()
1208 state->rc_keycode = RC_SCANCODE_NEC32(buf[12] << 24 | in af9015_rc_query()
1214 rc_keydown(d->rc_dev, proto, state->rc_keycode, 0); in af9015_rc_query()
1216 dev_dbg(&intf->dev, "no key press\n"); in af9015_rc_query()
1219 state->rc_last[2] = state->rc_last[3]; in af9015_rc_query()
1222 state->rc_repeat = buf[6]; in af9015_rc_query()
1223 state->rc_failed = false; in af9015_rc_query()
1227 dev_warn(&intf->dev, "rc query failed %d\n", ret); in af9015_rc_query()
1229 /* allow random errors as dvb-usb will stop polling on error */ in af9015_rc_query()
1230 if (!state->rc_failed) in af9015_rc_query()
1233 state->rc_failed = true; in af9015_rc_query()
1242 u16 vid = le16_to_cpu(d->udev->descriptor.idVendor); in af9015_get_rc_config()
1244 if (state->ir_mode == AF9015_IR_MODE_DISABLED) in af9015_get_rc_config()
1248 if (!rc->map_name) in af9015_get_rc_config()
1249 rc->map_name = af9015_rc_setup_match(dvb_usb_af9015_remote, in af9015_get_rc_config()
1253 if (!rc->map_name) in af9015_get_rc_config()
1254 rc->map_name = af9015_rc_setup_match(state->eeprom_sum, in af9015_get_rc_config()
1258 if (!rc->map_name && vid == USB_VID_AFATECH) { in af9015_get_rc_config()
1260 * Check USB manufacturer and product strings and try in af9015_get_rc_config()
1265 char manufacturer[10]; in af9015_get_rc_config() local
1267 memset(manufacturer, 0, sizeof(manufacturer)); in af9015_get_rc_config()
1268 usb_string(d->udev, d->udev->descriptor.iManufacturer, in af9015_get_rc_config()
1269 manufacturer, sizeof(manufacturer)); in af9015_get_rc_config()
1270 if (!strcmp("MSI", manufacturer)) { in af9015_get_rc_config()
1273 * iProduct 2 MSI K-VOX in af9015_get_rc_config()
1275 rc->map_name = af9015_rc_setup_match(AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3, in af9015_get_rc_config()
1281 if (!rc->map_name) in af9015_get_rc_config()
1282 rc->map_name = RC_MAP_EMPTY; in af9015_get_rc_config()
1284 rc->allowed_protos = RC_PROTO_BIT_NEC | RC_PROTO_BIT_NECX | in af9015_get_rc_config()
1286 rc->query = af9015_rc_query; in af9015_get_rc_config()
1287 rc->interval = 500; in af9015_get_rc_config()
1298 struct usb_interface *intf = d->intf; in af9015_regmap_write()
1302 const unsigned int len = count - 2; in af9015_regmap_write()
1311 dev_dbg(&intf->dev, "failed %d\n", ret); in af9015_regmap_write()
1319 struct usb_interface *intf = d->intf; in af9015_regmap_read()
1332 dev_dbg(&intf->dev, "failed %d\n", ret); in af9015_regmap_read()
1339 struct usb_interface *intf = d->intf; in af9015_probe()
1342 char manufacturer[sizeof("ITE Technologies, Inc.")]; in af9015_probe() local
1352 dev_dbg(&intf->dev, "\n"); in af9015_probe()
1354 memset(manufacturer, 0, sizeof(manufacturer)); in af9015_probe()
1355 usb_string(udev, udev->descriptor.iManufacturer, in af9015_probe()
1356 manufacturer, sizeof(manufacturer)); in af9015_probe()
1358 * There is two devices having same ID but different chipset. One uses in af9015_probe()
1366 * iProduct 2 DVB-T 2 in af9015_probe()
1372 * iProduct 2 DVB-T TV Stick in af9015_probe()
1374 if ((le16_to_cpu(udev->descriptor.idVendor) == USB_VID_TERRATEC) && in af9015_probe()
1375 (le16_to_cpu(udev->descriptor.idProduct) == 0x0099)) { in af9015_probe()
1376 if (!strcmp("ITE Technologies, Inc.", manufacturer)) { in af9015_probe()
1377 ret = -ENODEV; in af9015_probe()
1378 dev_dbg(&intf->dev, "rejecting device\n"); in af9015_probe()
1383 state->regmap = regmap_init(&intf->dev, ®map_bus, d, ®map_config); in af9015_probe()
1384 if (IS_ERR(state->regmap)) { in af9015_probe()
1385 ret = PTR_ERR(state->regmap); in af9015_probe()
1391 dev_dbg(&intf->dev, "failed %d\n", ret); in af9015_probe()
1398 struct usb_interface *intf = d->intf; in af9015_disconnect()
1400 dev_dbg(&intf->dev, "\n"); in af9015_disconnect()
1402 regmap_exit(state->regmap); in af9015_disconnect()
1406 * Interface 0 is used by DVB-T receiver and
1466 &af9015_props, "KWorld PlusTV Dual DVB-T Stick (DVB-T 399U)", NULL) },
1470 &af9015_props, "TwinHan AzureWave AD-TU700(704J)", RC_MAP_AZUREWAVE_AD_TU700) },
1474 &af9015_props, "KWorld PlusTV Dual DVB-T PCI (DVB-T PC160-2T)", NULL) },
1476 &af9015_props, "AVerMedia AVerTV DVB-T Volar X", RC_MAP_AVERMEDIA_M135A) },
1478 &af9015_props, "Xtensions XD-380", NULL) },
1482 &af9015_props, "Fujitsu-Siemens Slim Mobile USB DVB-T", NULL) },
1490 &af9015_props, "KWorld USB DVB-T TV Stick II (VS-DVB-T 395U)", NULL) },
1492 &af9015_props, "KWorld USB DVB-T TV Stick II (VS-DVB-T 395U)", NULL) },
1494 &af9015_props, "KWorld USB DVB-T TV Stick II (VS-DVB-T 395U)", NULL) },
1496 &af9015_props, "TrekStor DVB-T USB Stick", RC_MAP_TREKSTOR) },
1502 &af9015_props, "Conceptronic USB2.0 DVB-T CTVDIGRCU V3.0", NULL) },
1504 &af9015_props, "KWorld Digital MC-810", NULL) },
1506 &af9015_props, "Genius TVGo DVB-T03", NULL) },
1508 &af9015_props, "KWorld PlusTV Dual DVB-T Stick (DVB-T 399U)", NULL) },
1510 &af9015_props, "KWorld PlusTV DVB-T PCI Pro Card (DVB-T PC160-T)", NULL) },
1512 &af9015_props, "Sveon STV20 Tuner USB DVB-T HDTV", NULL) },
1518 &af9015_props, "KWorld USB DVB-T Stick Mobile (UB383-T)", NULL) },
1520 &af9015_props, "KWorld USB DVB-T TV Stick II (VS-DVB-T 395U)", NULL) },
1525 /* XXX: that same ID [0ccd:0099] is used by af9035 driver too */
1533 &af9015_props, "Sveon STV22 Dual USB DVB-T Tuner HDTV", RC_MAP_MSI_DIGIVOX_III) },