Lines Matching +full:1 +full:- +full:d
1 // SPDX-License-Identifier: GPL-2.0-or-later
21 for (i = 1; i < len; i++) { in af9035_checksum()
32 static int af9035_ctrl_msg(struct dvb_usb_device *d, struct usb_req *req) in af9035_ctrl_msg() argument
38 struct state *state = d_to_priv(d); in af9035_ctrl_msg()
39 struct usb_interface *intf = d->intf; in af9035_ctrl_msg()
43 mutex_lock(&d->usb_mutex); in af9035_ctrl_msg()
46 if (req->wlen > (BUF_LEN - REQ_HDR_LEN - CHECKSUM_LEN) || in af9035_ctrl_msg()
47 req->rlen > (BUF_LEN - ACK_HDR_LEN - CHECKSUM_LEN)) { in af9035_ctrl_msg()
48 dev_err(&intf->dev, "too much data wlen=%d rlen=%d\n", in af9035_ctrl_msg()
49 req->wlen, req->rlen); in af9035_ctrl_msg()
50 ret = -EINVAL; in af9035_ctrl_msg()
54 state->buf[0] = REQ_HDR_LEN + req->wlen + CHECKSUM_LEN - 1; in af9035_ctrl_msg()
55 state->buf[1] = req->mbox; in af9035_ctrl_msg()
56 state->buf[2] = req->cmd; in af9035_ctrl_msg()
57 state->buf[3] = state->seq++; in af9035_ctrl_msg()
58 memcpy(&state->buf[REQ_HDR_LEN], req->wbuf, req->wlen); in af9035_ctrl_msg()
60 wlen = REQ_HDR_LEN + req->wlen + CHECKSUM_LEN; in af9035_ctrl_msg()
61 rlen = ACK_HDR_LEN + req->rlen + CHECKSUM_LEN; in af9035_ctrl_msg()
64 checksum = af9035_checksum(state->buf, state->buf[0] - 1); in af9035_ctrl_msg()
65 state->buf[state->buf[0] - 1] = (checksum >> 8); in af9035_ctrl_msg()
66 state->buf[state->buf[0] - 0] = (checksum & 0xff); in af9035_ctrl_msg()
69 if (req->cmd == CMD_FW_DL) in af9035_ctrl_msg()
72 ret = dvb_usbv2_generic_rw_locked(d, in af9035_ctrl_msg()
73 state->buf, wlen, state->buf, rlen); in af9035_ctrl_msg()
78 if (req->cmd == CMD_FW_DL) in af9035_ctrl_msg()
82 checksum = af9035_checksum(state->buf, rlen - 2); in af9035_ctrl_msg()
83 tmp_checksum = (state->buf[rlen - 2] << 8) | state->buf[rlen - 1]; in af9035_ctrl_msg()
85 dev_err(&intf->dev, "command=%02x checksum mismatch (%04x != %04x)\n", in af9035_ctrl_msg()
86 req->cmd, tmp_checksum, checksum); in af9035_ctrl_msg()
87 ret = -EIO; in af9035_ctrl_msg()
92 if (state->buf[2]) { in af9035_ctrl_msg()
93 /* fw returns status 1 when IR code was not received */ in af9035_ctrl_msg()
94 if (req->cmd == CMD_IR_GET || state->buf[2] == 1) { in af9035_ctrl_msg()
95 ret = 1; in af9035_ctrl_msg()
99 dev_dbg(&intf->dev, "command=%02x failed fw error=%d\n", in af9035_ctrl_msg()
100 req->cmd, state->buf[2]); in af9035_ctrl_msg()
101 ret = -EIO; in af9035_ctrl_msg()
106 if (req->rlen) in af9035_ctrl_msg()
107 memcpy(req->rbuf, &state->buf[ACK_HDR_LEN], req->rlen); in af9035_ctrl_msg()
109 mutex_unlock(&d->usb_mutex); in af9035_ctrl_msg()
114 static int af9035_wr_regs(struct dvb_usb_device *d, u32 reg, u8 *val, int len) in af9035_wr_regs() argument
116 struct usb_interface *intf = d->intf; in af9035_wr_regs()
122 dev_warn(&intf->dev, "i2c wr: len=%d is too big!\n", len); in af9035_wr_regs()
123 return -EOPNOTSUPP; in af9035_wr_regs()
127 wbuf[1] = 2; in af9035_wr_regs()
134 return af9035_ctrl_msg(d, &req); in af9035_wr_regs()
138 static int af9035_rd_regs(struct dvb_usb_device *d, u32 reg, u8 *val, int len) in af9035_rd_regs() argument
144 return af9035_ctrl_msg(d, &req); in af9035_rd_regs()
148 static int af9035_wr_reg(struct dvb_usb_device *d, u32 reg, u8 val) in af9035_wr_reg() argument
150 return af9035_wr_regs(d, reg, &val, 1); in af9035_wr_reg()
154 static int af9035_rd_reg(struct dvb_usb_device *d, u32 reg, u8 *val) in af9035_rd_reg() argument
156 return af9035_rd_regs(d, reg, val, 1); in af9035_rd_reg()
160 static int af9035_wr_reg_mask(struct dvb_usb_device *d, u32 reg, u8 val, in af9035_wr_reg_mask() argument
168 ret = af9035_rd_regs(d, reg, &tmp, 1); in af9035_wr_reg_mask()
177 return af9035_wr_regs(d, reg, &val, 1); in af9035_wr_reg_mask()
180 static int af9035_add_i2c_dev(struct dvb_usb_device *d, const char *type, in af9035_add_i2c_dev() argument
184 struct state *state = d_to_priv(d); in af9035_add_i2c_dev()
185 struct usb_interface *intf = d->intf; in af9035_add_i2c_dev()
196 if (state->i2c_client[num] == NULL) in af9035_add_i2c_dev()
200 dev_dbg(&intf->dev, "num=%d\n", num); in af9035_add_i2c_dev()
203 dev_err(&intf->dev, "I2C client out of index\n"); in af9035_add_i2c_dev()
204 ret = -ENODEV; in af9035_add_i2c_dev()
213 dev_err(&intf->dev, "failed to bind i2c device to %s driver\n", type); in af9035_add_i2c_dev()
214 ret = -ENODEV; in af9035_add_i2c_dev()
219 if (!try_module_get(client->dev.driver->owner)) { in af9035_add_i2c_dev()
221 ret = -ENODEV; in af9035_add_i2c_dev()
225 state->i2c_client[num] = client; in af9035_add_i2c_dev()
228 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_add_i2c_dev()
232 static void af9035_del_i2c_dev(struct dvb_usb_device *d) in af9035_del_i2c_dev() argument
235 struct state *state = d_to_priv(d); in af9035_del_i2c_dev()
236 struct usb_interface *intf = d->intf; in af9035_del_i2c_dev()
241 while (num--) { in af9035_del_i2c_dev()
242 if (state->i2c_client[num] != NULL) in af9035_del_i2c_dev()
246 dev_dbg(&intf->dev, "num=%d\n", num); in af9035_del_i2c_dev()
248 if (num == -1) { in af9035_del_i2c_dev()
249 dev_err(&intf->dev, "I2C client out of index\n"); in af9035_del_i2c_dev()
253 client = state->i2c_client[num]; in af9035_del_i2c_dev()
256 module_put(client->dev.driver->owner); in af9035_del_i2c_dev()
261 state->i2c_client[num] = NULL; in af9035_del_i2c_dev()
264 dev_dbg(&intf->dev, "failed\n"); in af9035_del_i2c_dev()
270 struct dvb_usb_device *d = i2c_get_adapdata(adap); in af9035_i2c_master_xfer() local
271 struct state *state = d_to_priv(d); in af9035_i2c_master_xfer()
274 if (mutex_lock_interruptible(&d->i2c_mutex) < 0) in af9035_i2c_master_xfer()
275 return -EAGAIN; in af9035_i2c_master_xfer()
280 * 1: I2C addr << 1 in af9035_i2c_master_xfer()
286 * used when reg addr len is set to 1 or 2 in af9035_i2c_master_xfer()
297 * dual tuner configuration, is covered by firmware - actual USB IO in af9035_i2c_master_xfer()
309 * 1: I2C bus (0x03 seems to be only value used) in af9035_i2c_master_xfer()
310 * 2: I2C addr << 1 in af9035_i2c_master_xfer()
313 (_num == 2 && !(_msg[0].flags & I2C_M_RD) && (_msg[1].flags & I2C_M_RD)) in af9035_i2c_master_xfer()
315 (_num == 1 && !(_msg[0].flags & I2C_M_RD)) in af9035_i2c_master_xfer()
317 (_num == 1 && (_msg[0].flags & I2C_M_RD)) in af9035_i2c_master_xfer()
320 if (msg[0].len > 40 || msg[1].len > 40) { in af9035_i2c_master_xfer()
322 ret = -EOPNOTSUPP; in af9035_i2c_master_xfer()
323 } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || in af9035_i2c_master_xfer()
324 (msg[0].addr == state->af9033_i2c_addr[1])) { in af9035_i2c_master_xfer()
325 if (msg[0].len < 3 || msg[1].len < 1) { in af9035_i2c_master_xfer()
326 ret = -EOPNOTSUPP; in af9035_i2c_master_xfer()
330 u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | in af9035_i2c_master_xfer()
333 if (msg[0].addr == state->af9033_i2c_addr[1]) in af9035_i2c_master_xfer()
336 ret = af9035_rd_regs(d, reg, &msg[1].buf[0], in af9035_i2c_master_xfer()
337 msg[1].len); in af9035_i2c_master_xfer()
338 } else if (state->no_read) { in af9035_i2c_master_xfer()
339 memset(msg[1].buf, 0, msg[1].len); in af9035_i2c_master_xfer()
345 buf, msg[1].len, msg[1].buf }; in af9035_i2c_master_xfer()
347 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
353 buf[0] = msg[1].len; in af9035_i2c_master_xfer()
354 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
355 buf[1] = 0x03; /* I2C bus */ in af9035_i2c_master_xfer()
356 buf[2] = msg[0].addr << 1; in af9035_i2c_master_xfer()
359 buf[1] = msg[0].addr << 1; in af9035_i2c_master_xfer()
374 buf[4] = msg[0].buf[1]; in af9035_i2c_master_xfer()
375 } else if (msg[0].len == 1) { in af9035_i2c_master_xfer()
380 ret = af9035_ctrl_msg(d, &req); in af9035_i2c_master_xfer()
385 ret = -EOPNOTSUPP; in af9035_i2c_master_xfer()
386 } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || in af9035_i2c_master_xfer()
387 (msg[0].addr == state->af9033_i2c_addr[1])) { in af9035_i2c_master_xfer()
389 ret = -EOPNOTSUPP; in af9035_i2c_master_xfer()
393 u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | in af9035_i2c_master_xfer()
396 if (msg[0].addr == state->af9033_i2c_addr[1]) in af9035_i2c_master_xfer()
399 ret = af9035_wr_regs(d, reg, &msg[0].buf[3], msg[0].len - 3); in af9035_i2c_master_xfer()
406 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
413 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
414 buf[1] = 0x03; /* I2C bus */ in af9035_i2c_master_xfer()
415 buf[2] = msg[0].addr << 1; in af9035_i2c_master_xfer()
418 buf[1] = msg[0].addr << 1; in af9035_i2c_master_xfer()
424 ret = af9035_ctrl_msg(d, &req); in af9035_i2c_master_xfer()
429 ret = -EOPNOTSUPP; in af9035_i2c_master_xfer()
430 } else if (state->no_read) { in af9035_i2c_master_xfer()
439 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
445 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
446 buf[1] = 0x03; /* I2C bus */ in af9035_i2c_master_xfer()
447 buf[2] = msg[0].addr << 1; in af9035_i2c_master_xfer()
449 buf[1] = msg[0].addr << 1; in af9035_i2c_master_xfer()
454 ret = af9035_ctrl_msg(d, &req); in af9035_i2c_master_xfer()
459 * 1) 1 x write + 1 x read (repeated start) in af9035_i2c_master_xfer()
460 * 2) 1 x write in af9035_i2c_master_xfer()
461 * 3) 1 x read in af9035_i2c_master_xfer()
463 ret = -EOPNOTSUPP; in af9035_i2c_master_xfer()
467 mutex_unlock(&d->i2c_mutex); in af9035_i2c_master_xfer()
485 static int af9035_identify_state(struct dvb_usb_device *d, const char **name) in af9035_identify_state() argument
487 struct state *state = d_to_priv(d); in af9035_identify_state()
488 struct usb_interface *intf = d->intf; in af9035_identify_state()
492 u8 wbuf[1] = { 1 }; in af9035_identify_state()
497 ret = af9035_rd_regs(d, 0x1222, rbuf, 3); in af9035_identify_state()
501 state->chip_version = rbuf[0]; in af9035_identify_state()
502 state->chip_type = rbuf[2] << 8 | rbuf[1] << 0; in af9035_identify_state()
504 ret = af9035_rd_reg(d, 0x384f, &state->prechip_version); in af9035_identify_state()
508 dev_info(&intf->dev, "prechip_version=%02x chip_version=%02x chip_type=%04x\n", in af9035_identify_state()
509 state->prechip_version, state->chip_version, state->chip_type); in af9035_identify_state()
511 if (state->chip_type == 0x9135) { in af9035_identify_state()
512 if (state->chip_version == 0x02) { in af9035_identify_state()
521 ret = af9035_rd_reg(d, utmp, &tmp); in af9035_identify_state()
526 dev_dbg(&intf->dev, "no eeprom\n"); in af9035_identify_state()
527 state->no_eeprom = true; in af9035_identify_state()
532 } else if (state->chip_type == 0x9306) { in af9035_identify_state()
534 state->no_eeprom = true; in af9035_identify_state()
543 ret = af9035_rd_regs(d, eeprom_addr + i, &state->eeprom[i], 32); in af9035_identify_state()
548 dev_dbg(&intf->dev, "eeprom dump:\n"); in af9035_identify_state()
550 dev_dbg(&intf->dev, "%*ph\n", 16, &state->eeprom[i]); in af9035_identify_state()
553 tmp = state->eeprom[EEPROM_TS_MODE]; in af9035_identify_state()
558 case 1: in af9035_identify_state()
560 state->dual_mode = true; in af9035_identify_state()
563 if (state->chip_type != 0x9135 && state->chip_type != 0x9306) in af9035_identify_state()
564 state->dual_mode = true; /* AF9035 */ in af9035_identify_state()
566 ts_mode_invalid = 1; in af9035_identify_state()
569 ts_mode_invalid = 1; in af9035_identify_state()
572 dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, state->dual_mode); in af9035_identify_state()
575 dev_info(&intf->dev, "ts mode=%d not supported, defaulting to single tuner mode!", tmp); in af9035_identify_state()
578 ret = af9035_ctrl_msg(d, &req); in af9035_identify_state()
582 dev_dbg(&intf->dev, "reply=%*ph\n", 4, rbuf); in af9035_identify_state()
583 if (rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3]) in af9035_identify_state()
591 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_identify_state()
596 static int af9035_download_firmware_old(struct dvb_usb_device *d, in af9035_download_firmware_old() argument
599 struct usb_interface *intf = d->intf; in af9035_download_firmware_old()
601 u8 wbuf[1]; in af9035_download_firmware_old()
610 * Thanks to Daniel Glöckner <daniel-gl@gmx.net> about that info! in af9035_download_firmware_old()
613 * There are two inside the AF9035 (1=Link and 2=OFDM) with separate in af9035_download_firmware_old()
615 * byte 1-2: Big endian destination address in af9035_download_firmware_old()
616 * byte 3-4: Big endian number of data bytes following the header in af9035_download_firmware_old()
617 * byte 5-6: Big endian header checksum, apparently ignored by the chip in af9035_download_firmware_old()
618 * Calculated as ~(h[0]*256+h[1]+h[2]*256+h[3]+h[4]*256) in af9035_download_firmware_old()
621 for (i = fw->size; i > HDR_SIZE;) { in af9035_download_firmware_old()
622 hdr_core = fw->data[fw->size - i + 0]; in af9035_download_firmware_old()
623 hdr_addr = fw->data[fw->size - i + 1] << 8; in af9035_download_firmware_old()
624 hdr_addr |= fw->data[fw->size - i + 2] << 0; in af9035_download_firmware_old()
625 hdr_data_len = fw->data[fw->size - i + 3] << 8; in af9035_download_firmware_old()
626 hdr_data_len |= fw->data[fw->size - i + 4] << 0; in af9035_download_firmware_old()
627 hdr_checksum = fw->data[fw->size - i + 5] << 8; in af9035_download_firmware_old()
628 hdr_checksum |= fw->data[fw->size - i + 6] << 0; in af9035_download_firmware_old()
630 dev_dbg(&intf->dev, "core=%d addr=%04x data_len=%d checksum=%04x\n", in af9035_download_firmware_old()
633 if (((hdr_core != 1) && (hdr_core != 2)) || in af9035_download_firmware_old()
635 dev_dbg(&intf->dev, "bad firmware\n"); in af9035_download_firmware_old()
641 ret = af9035_ctrl_msg(d, &req); in af9035_download_firmware_old()
646 for (j = HDR_SIZE + hdr_data_len; j > 0; j -= MAX_DATA) { in af9035_download_firmware_old()
651 req_fw_dl.wbuf = (u8 *) &fw->data[fw->size - i + in af9035_download_firmware_old()
652 HDR_SIZE + hdr_data_len - j]; in af9035_download_firmware_old()
653 ret = af9035_ctrl_msg(d, &req_fw_dl); in af9035_download_firmware_old()
660 ret = af9035_ctrl_msg(d, &req); in af9035_download_firmware_old()
664 i -= hdr_data_len + HDR_SIZE; in af9035_download_firmware_old()
666 dev_dbg(&intf->dev, "data uploaded=%zu\n", fw->size - i); in af9035_download_firmware_old()
671 dev_warn(&intf->dev, "bad firmware\n"); in af9035_download_firmware_old()
676 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_download_firmware_old()
681 static int af9035_download_firmware_new(struct dvb_usb_device *d, in af9035_download_firmware_new() argument
684 struct usb_interface *intf = d->intf; in af9035_download_firmware_new()
690 * There seems to be following firmware header. Meaning of bytes 0-3 in af9035_download_firmware_new()
694 * 1: 0, 1 in af9035_download_firmware_new()
696 * 3: 1, 2, 3 in af9035_download_firmware_new()
701 for (i = HDR_SIZE, i_prev = 0; i <= fw->size; i++) { in af9035_download_firmware_new()
702 if (i == fw->size || in af9035_download_firmware_new()
703 (fw->data[i + 0] == 0x03 && in af9035_download_firmware_new()
704 (fw->data[i + 1] == 0x00 || in af9035_download_firmware_new()
705 fw->data[i + 1] == 0x01) && in af9035_download_firmware_new()
706 fw->data[i + 2] == 0x00)) { in af9035_download_firmware_new()
707 req_fw_dl.wlen = i - i_prev; in af9035_download_firmware_new()
708 req_fw_dl.wbuf = (u8 *) &fw->data[i_prev]; in af9035_download_firmware_new()
710 ret = af9035_ctrl_msg(d, &req_fw_dl); in af9035_download_firmware_new()
714 dev_dbg(&intf->dev, "data uploaded=%d\n", i); in af9035_download_firmware_new()
721 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_download_firmware_new()
726 static int af9035_download_firmware(struct dvb_usb_device *d, in af9035_download_firmware() argument
729 struct usb_interface *intf = d->intf; in af9035_download_firmware()
730 struct state *state = d_to_priv(d); in af9035_download_firmware()
732 u8 wbuf[1]; in af9035_download_firmware()
736 struct usb_req req_fw_ver = { CMD_FW_QUERYINFO, 0, 1, wbuf, 4, rbuf }; in af9035_download_firmware()
738 dev_dbg(&intf->dev, "\n"); in af9035_download_firmware()
746 if (state->dual_mode) { in af9035_download_firmware()
748 ret = af9035_wr_reg_mask(d, 0x00d8b0, 0x01, 0x01); in af9035_download_firmware()
752 ret = af9035_wr_reg_mask(d, 0x00d8b1, 0x01, 0x01); in af9035_download_firmware()
756 ret = af9035_wr_reg_mask(d, 0x00d8af, 0x00, 0x01); in af9035_download_firmware()
762 ret = af9035_wr_reg_mask(d, 0x00d8af, 0x01, 0x01); in af9035_download_firmware()
767 tmp = state->eeprom[EEPROM_2ND_DEMOD_ADDR]; in af9035_download_firmware()
771 tmp = 0x1d << 1; /* 8-bit format used by chip */ in af9035_download_firmware()
773 if ((state->chip_type == 0x9135) || in af9035_download_firmware()
774 (state->chip_type == 0x9306)) { in af9035_download_firmware()
775 ret = af9035_wr_reg(d, 0x004bfb, tmp); in af9035_download_firmware()
779 ret = af9035_wr_reg(d, 0x00417f, tmp); in af9035_download_firmware()
784 ret = af9035_wr_reg_mask(d, 0x00d81a, 0x01, 0x01); in af9035_download_firmware()
790 if (fw->data[0] == 0x01) in af9035_download_firmware()
791 ret = af9035_download_firmware_old(d, fw); in af9035_download_firmware()
793 ret = af9035_download_firmware_new(d, fw); in af9035_download_firmware()
799 ret = af9035_ctrl_msg(d, &req); in af9035_download_firmware()
804 wbuf[0] = 1; in af9035_download_firmware()
805 ret = af9035_ctrl_msg(d, &req_fw_ver); in af9035_download_firmware()
809 if (!(rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3])) { in af9035_download_firmware()
810 dev_err(&intf->dev, "firmware did not run\n"); in af9035_download_firmware()
811 ret = -ENODEV; in af9035_download_firmware()
815 dev_info(&intf->dev, "firmware version=%d.%d.%d.%d", in af9035_download_firmware()
816 rbuf[0], rbuf[1], rbuf[2], rbuf[3]); in af9035_download_firmware()
821 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_download_firmware()
826 static int af9035_read_config(struct dvb_usb_device *d) in af9035_read_config() argument
828 struct usb_interface *intf = d->intf; in af9035_read_config()
829 struct state *state = d_to_priv(d); in af9035_read_config()
835 state->af9033_i2c_addr[0] = 0x1c; in af9035_read_config()
836 state->af9033_i2c_addr[1] = 0x1d; in af9035_read_config()
837 state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; in af9035_read_config()
838 state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; in af9035_read_config()
839 state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB; in af9035_read_config()
840 state->af9033_config[1].ts_mode = AF9033_TS_MODE_SERIAL; in af9035_read_config()
841 state->it930x_addresses = 0; in af9035_read_config()
843 if (state->chip_type == 0x9135) { in af9035_read_config()
845 state->af9033_config[0].dyn0_clk = true; in af9035_read_config()
846 state->af9033_config[1].dyn0_clk = true; in af9035_read_config()
848 if (state->chip_version == 0x02) { in af9035_read_config()
849 state->af9033_config[0].tuner = AF9033_TUNER_IT9135_60; in af9035_read_config()
850 state->af9033_config[1].tuner = AF9033_TUNER_IT9135_60; in af9035_read_config()
852 state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38; in af9035_read_config()
853 state->af9033_config[1].tuner = AF9033_TUNER_IT9135_38; in af9035_read_config()
856 if (state->no_eeprom) { in af9035_read_config()
858 state->ir_mode = 0x05; in af9035_read_config()
859 state->ir_type = 0x00; in af9035_read_config()
863 } else if (state->chip_type == 0x9306) { in af9035_read_config()
865 * IT930x is an USB bridge, only single demod-single tuner in af9035_read_config()
868 if ((le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA) && in af9035_read_config()
869 (le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_TD310)) { in af9035_read_config()
870 state->it930x_addresses = 1; in af9035_read_config()
872 state->ir_mode = 0x05; in af9035_read_config()
873 state->ir_type = 0x00; in af9035_read_config()
879 state->ir_mode = state->eeprom[EEPROM_IR_MODE]; in af9035_read_config()
880 state->ir_type = state->eeprom[EEPROM_IR_TYPE]; in af9035_read_config()
882 if (state->dual_mode) { in af9035_read_config()
883 /* Read 2nd demodulator I2C address. 8-bit format on eeprom */ in af9035_read_config()
884 tmp = state->eeprom[EEPROM_2ND_DEMOD_ADDR]; in af9035_read_config()
886 state->af9033_i2c_addr[1] = tmp >> 1; in af9035_read_config()
888 dev_dbg(&intf->dev, "2nd demod I2C addr=%02x\n", in af9035_read_config()
889 state->af9033_i2c_addr[1]); in af9035_read_config()
892 for (i = 0; i < state->dual_mode + 1; i++) { in af9035_read_config()
896 tmp = state->eeprom[EEPROM_1_TUNER_ID + eeprom_offset]; in af9035_read_config()
897 dev_dbg(&intf->dev, "[%d]tuner=%02x\n", i, tmp); in af9035_read_config()
900 if (state->chip_type == 0x9135) { in af9035_read_config()
901 if (state->chip_version == 0x02) { in af9035_read_config()
907 state->af9033_config[i].tuner = tmp; in af9035_read_config()
916 state->af9033_config[i].tuner = tmp; in af9035_read_config()
922 state->af9033_config[i].tuner = tmp; in af9035_read_config()
925 if (state->af9033_config[i].tuner != tmp) { in af9035_read_config()
926 dev_info(&intf->dev, "[%d] overriding tuner from %02x to %02x\n", in af9035_read_config()
927 i, tmp, state->af9033_config[i].tuner); in af9035_read_config()
930 switch (state->af9033_config[i].tuner) { in af9035_read_config()
937 state->af9033_config[i].spec_inv = 1; in af9035_read_config()
947 dev_warn(&intf->dev, "tuner id=%02x not supported, please report!", in af9035_read_config()
952 if (i == 1) in af9035_read_config()
953 switch (state->af9033_config[i].tuner) { in af9035_read_config()
964 state->dual_mode = false; in af9035_read_config()
965 dev_info(&intf->dev, "driver does not support 2nd tuner and will disable it"); in af9035_read_config()
969 tmp = state->eeprom[EEPROM_1_IF_L + eeprom_offset]; in af9035_read_config()
971 tmp = state->eeprom[EEPROM_1_IF_H + eeprom_offset]; in af9035_read_config()
973 dev_dbg(&intf->dev, "[%d]IF=%d\n", i, tmp16); in af9035_read_config()
980 ret = af9035_rd_reg(d, 0x00d800, &tmp); in af9035_read_config()
986 for (i = 0; i < ARRAY_SIZE(state->af9033_config); i++) { in af9035_read_config()
987 if (state->chip_type == 0x9135) in af9035_read_config()
988 state->af9033_config[i].clock = clock_lut_it9135[tmp]; in af9035_read_config()
990 state->af9033_config[i].clock = clock_lut_af9035[tmp]; in af9035_read_config()
993 state->no_read = false; in af9035_read_config()
995 if (state->af9033_config[0].tuner == AF9033_TUNER_MXL5007T && in af9035_read_config()
996 le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA) in af9035_read_config()
998 switch (le16_to_cpu(d->udev->descriptor.idProduct)) { in af9035_read_config()
1001 dev_info(&intf->dev, in af9035_read_config()
1003 state->no_read = true; in af9035_read_config()
1010 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_read_config()
1015 static int af9035_tua9001_tuner_callback(struct dvb_usb_device *d, in af9035_tua9001_tuner_callback() argument
1018 struct usb_interface *intf = d->intf; in af9035_tua9001_tuner_callback()
1022 dev_dbg(&intf->dev, "cmd=%d arg=%d\n", cmd, arg); in af9035_tua9001_tuner_callback()
1037 ret = af9035_wr_reg_mask(d, 0x00d8e7, val, 0x01); in af9035_tua9001_tuner_callback()
1047 ret = af9035_wr_reg_mask(d, 0x00d8eb, val, 0x01); in af9035_tua9001_tuner_callback()
1056 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_tua9001_tuner_callback()
1062 static int af9035_fc0011_tuner_callback(struct dvb_usb_device *d, in af9035_fc0011_tuner_callback() argument
1065 struct usb_interface *intf = d->intf; in af9035_fc0011_tuner_callback()
1071 ret = af9035_wr_reg_mask(d, 0xd8eb, 1, 1); in af9035_fc0011_tuner_callback()
1075 ret = af9035_wr_reg_mask(d, 0xd8ec, 1, 1); in af9035_fc0011_tuner_callback()
1079 ret = af9035_wr_reg_mask(d, 0xd8ed, 1, 1); in af9035_fc0011_tuner_callback()
1084 ret = af9035_wr_reg_mask(d, 0xd8d0, 1, 1); in af9035_fc0011_tuner_callback()
1088 ret = af9035_wr_reg_mask(d, 0xd8d1, 1, 1); in af9035_fc0011_tuner_callback()
1095 ret = af9035_wr_reg(d, 0xd8e9, 1); in af9035_fc0011_tuner_callback()
1099 ret = af9035_wr_reg(d, 0xd8e8, 1); in af9035_fc0011_tuner_callback()
1103 ret = af9035_wr_reg(d, 0xd8e7, 1); in af9035_fc0011_tuner_callback()
1109 ret = af9035_wr_reg(d, 0xd8e7, 0); in af9035_fc0011_tuner_callback()
1116 ret = -EINVAL; in af9035_fc0011_tuner_callback()
1123 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_fc0011_tuner_callback()
1128 static int af9035_tuner_callback(struct dvb_usb_device *d, int cmd, int arg) in af9035_tuner_callback() argument
1130 struct state *state = d_to_priv(d); in af9035_tuner_callback()
1132 switch (state->af9033_config[0].tuner) { in af9035_tuner_callback()
1134 return af9035_fc0011_tuner_callback(d, cmd, arg); in af9035_tuner_callback()
1136 return af9035_tua9001_tuner_callback(d, cmd, arg); in af9035_tuner_callback()
1148 struct dvb_usb_device *d = i2c_get_adapdata(adap); in af9035_frontend_callback() local
1149 struct usb_interface *intf = d->intf; in af9035_frontend_callback()
1151 dev_dbg(&intf->dev, "component=%d cmd=%d arg=%d\n", in af9035_frontend_callback()
1156 return af9035_tuner_callback(d, cmd, arg); in af9035_frontend_callback()
1164 static int af9035_get_adapter_count(struct dvb_usb_device *d) in af9035_get_adapter_count() argument
1166 struct state *state = d_to_priv(d); in af9035_get_adapter_count()
1168 return state->dual_mode + 1; in af9035_get_adapter_count()
1174 struct dvb_usb_device *d = adap_to_d(adap); in af9035_frontend_attach() local
1175 struct usb_interface *intf = d->intf; in af9035_frontend_attach()
1178 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in af9035_frontend_attach()
1180 if (!state->af9033_config[adap->id].tuner) { in af9035_frontend_attach()
1182 ret = -ENODEV; in af9035_frontend_attach()
1186 state->af9033_config[adap->id].fe = &adap->fe[0]; in af9035_frontend_attach()
1187 state->af9033_config[adap->id].ops = &state->ops; in af9035_frontend_attach()
1188 ret = af9035_add_i2c_dev(d, "af9033", state->af9033_i2c_addr[adap->id], in af9035_frontend_attach()
1189 &state->af9033_config[adap->id], &d->i2c_adap); in af9035_frontend_attach()
1193 if (adap->fe[0] == NULL) { in af9035_frontend_attach()
1194 ret = -ENODEV; in af9035_frontend_attach()
1198 /* disable I2C-gate */ in af9035_frontend_attach()
1199 adap->fe[0]->ops.i2c_gate_ctrl = NULL; in af9035_frontend_attach()
1200 adap->fe[0]->callback = af9035_frontend_callback; in af9035_frontend_attach()
1205 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_frontend_attach()
1222 struct dvb_usb_device *d = adap_to_d(adap); in it930x_frontend_attach() local
1223 struct usb_interface *intf = d->intf; in it930x_frontend_attach()
1228 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in it930x_frontend_attach()
1231 ret = af9035_wr_reg(d, 0x00f6a7, I2C_SPEED_366K); in it930x_frontend_attach()
1235 /* I2C master bus 1,3 clock speed 366k */ in it930x_frontend_attach()
1236 ret = af9035_wr_reg(d, 0x00f103, I2C_SPEED_366K); in it930x_frontend_attach()
1241 ret = af9035_wr_reg_mask(d, 0xd8d4, 0x01, 0x01); in it930x_frontend_attach()
1245 ret = af9035_wr_reg_mask(d, 0xd8d5, 0x01, 0x01); in it930x_frontend_attach()
1249 ret = af9035_wr_reg_mask(d, 0xd8d3, 0x01, 0x01); in it930x_frontend_attach()
1254 ret = af9035_wr_reg_mask(d, 0xd8b8, 0x01, 0x01); in it930x_frontend_attach()
1258 ret = af9035_wr_reg_mask(d, 0xd8b9, 0x01, 0x01); in it930x_frontend_attach()
1262 ret = af9035_wr_reg_mask(d, 0xd8b7, 0x00, 0x01); in it930x_frontend_attach()
1268 ret = af9035_wr_reg_mask(d, 0xd8b7, 0x01, 0x01); in it930x_frontend_attach()
1274 si2168_config.fe = &adap->fe[0]; in it930x_frontend_attach()
1277 state->af9033_config[adap->id].fe = &adap->fe[0]; in it930x_frontend_attach()
1278 state->af9033_config[adap->id].ops = &state->ops; in it930x_frontend_attach()
1279 ret = af9035_add_i2c_dev(d, "si2168", in it930x_frontend_attach()
1280 it930x_addresses_table[state->it930x_addresses].frontend_i2c_addr, in it930x_frontend_attach()
1281 &si2168_config, &d->i2c_adap); in it930x_frontend_attach()
1285 if (adap->fe[0] == NULL) { in it930x_frontend_attach()
1286 ret = -ENODEV; in it930x_frontend_attach()
1289 state->i2c_adapter_demod = adapter; in it930x_frontend_attach()
1294 dev_dbg(&intf->dev, "failed=%d\n", ret); in it930x_frontend_attach()
1302 struct dvb_usb_device *d = adap_to_d(adap); in af9035_frontend_detach() local
1303 struct usb_interface *intf = d->intf; in af9035_frontend_detach()
1305 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in af9035_frontend_detach()
1307 if (adap->id == 1) { in af9035_frontend_detach()
1308 if (state->i2c_client[1]) in af9035_frontend_detach()
1309 af9035_del_i2c_dev(d); in af9035_frontend_detach()
1310 } else if (adap->id == 0) { in af9035_frontend_detach()
1311 if (state->i2c_client[0]) in af9035_frontend_detach()
1312 af9035_del_i2c_dev(d); in af9035_frontend_detach()
1334 .loop_thru_enable = 1,
1335 .clk_out_enable = 1,
1362 struct dvb_usb_device *d = adap_to_d(adap); in af9035_tuner_attach() local
1363 struct usb_interface *intf = d->intf; in af9035_tuner_attach()
1366 struct i2c_msg msg[1]; in af9035_tuner_attach()
1369 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in af9035_tuner_attach()
1376 switch (state->af9033_config[adap->id].tuner) { in af9035_tuner_attach()
1379 .dvb_frontend = adap->fe[0], in af9035_tuner_attach()
1388 ret = af9035_wr_reg_mask(d, 0x00d8ec, 0x01, 0x01); in af9035_tuner_attach()
1392 ret = af9035_wr_reg_mask(d, 0x00d8ed, 0x01, 0x01); in af9035_tuner_attach()
1396 ret = af9035_wr_reg_mask(d, 0x00d8e8, 0x01, 0x01); in af9035_tuner_attach()
1400 ret = af9035_wr_reg_mask(d, 0x00d8e9, 0x01, 0x01); in af9035_tuner_attach()
1405 ret = af9035_add_i2c_dev(d, "tua9001", 0x60, &tua9001_pdata, in af9035_tuner_attach()
1406 &d->i2c_adap); in af9035_tuner_attach()
1410 fe = adap->fe[0]; in af9035_tuner_attach()
1414 fe = dvb_attach(fc0011_attach, adap->fe[0], in af9035_tuner_attach()
1415 &d->i2c_adap, &af9035_fc0011_config); in af9035_tuner_attach()
1418 if (adap->id == 0) { in af9035_tuner_attach()
1419 ret = af9035_wr_reg(d, 0x00d8e0, 1); in af9035_tuner_attach()
1423 ret = af9035_wr_reg(d, 0x00d8e1, 1); in af9035_tuner_attach()
1427 ret = af9035_wr_reg(d, 0x00d8df, 0); in af9035_tuner_attach()
1433 ret = af9035_wr_reg(d, 0x00d8df, 1); in af9035_tuner_attach()
1439 ret = af9035_wr_reg(d, 0x00d8c0, 1); in af9035_tuner_attach()
1443 ret = af9035_wr_reg(d, 0x00d8c1, 1); in af9035_tuner_attach()
1447 ret = af9035_wr_reg(d, 0x00d8bf, 0); in af9035_tuner_attach()
1451 ret = af9035_wr_reg(d, 0x00d8b4, 1); in af9035_tuner_attach()
1455 ret = af9035_wr_reg(d, 0x00d8b5, 1); in af9035_tuner_attach()
1459 ret = af9035_wr_reg(d, 0x00d8b3, 1); in af9035_tuner_attach()
1469 fe = dvb_attach(mxl5007t_attach, adap->fe[0], &d->i2c_adap, in af9035_tuner_attach()
1470 tuner_addr, &af9035_mxl5007t_config[adap->id]); in af9035_tuner_attach()
1474 fe = dvb_attach(tda18218_attach, adap->fe[0], in af9035_tuner_attach()
1475 &d->i2c_adap, &af9035_tda18218_config); in af9035_tuner_attach()
1479 .dvb_frontend = adap->fe[0], in af9035_tuner_attach()
1483 ret = af9035_wr_reg_mask(d, 0xd8eb, 0x01, 0x01); in af9035_tuner_attach()
1487 ret = af9035_wr_reg_mask(d, 0xd8ec, 0x01, 0x01); in af9035_tuner_attach()
1491 ret = af9035_wr_reg_mask(d, 0xd8ed, 0x01, 0x01); in af9035_tuner_attach()
1497 ret = af9035_add_i2c_dev(d, "fc2580", 0x56, &fc2580_pdata, in af9035_tuner_attach()
1498 &d->i2c_adap); in af9035_tuner_attach()
1502 fe = adap->fe[0]; in af9035_tuner_attach()
1512 if (adap->id == 0) { in af9035_tuner_attach()
1514 ret = af9035_wr_reg_mask(d, 0xd8eb, 0x01, 0x01); in af9035_tuner_attach()
1518 ret = af9035_wr_reg_mask(d, 0xd8ec, 0x01, 0x01); in af9035_tuner_attach()
1522 ret = af9035_wr_reg_mask(d, 0xd8ed, 0x01, 0x01); in af9035_tuner_attach()
1528 * Write 02 to FC0012 master tuner register 0d directly in af9035_tuner_attach()
1535 ret = i2c_transfer(&d->i2c_adap, msg, 1); in af9035_tuner_attach()
1542 fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap, in af9035_tuner_attach()
1543 &af9035_fc0012_config[adap->id]); in af9035_tuner_attach()
1555 .regmap = state->af9033_config[adap->id].regmap, in af9035_tuner_attach()
1556 .fe = adap->fe[0], in af9035_tuner_attach()
1559 switch (state->af9033_config[adap->id].tuner) { in af9035_tuner_attach()
1563 name = "it9133ax-tuner"; in af9035_tuner_attach()
1568 name = "it9133bx-tuner"; in af9035_tuner_attach()
1571 ret = -ENODEV; in af9035_tuner_attach()
1575 if (state->dual_mode) { in af9035_tuner_attach()
1576 if (adap->id == 0) in af9035_tuner_attach()
1585 pdev = platform_device_register_data(&d->intf->dev, name, in af9035_tuner_attach()
1589 if (IS_ERR(pdev) || !pdev->dev.driver) { in af9035_tuner_attach()
1590 ret = -ENODEV; in af9035_tuner_attach()
1593 if (!try_module_get(pdev->dev.driver->owner)) { in af9035_tuner_attach()
1595 ret = -ENODEV; in af9035_tuner_attach()
1599 state->platform_device_tuner[adap->id] = pdev; in af9035_tuner_attach()
1600 fe = adap->fe[0]; in af9035_tuner_attach()
1608 ret = -ENODEV; in af9035_tuner_attach()
1615 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_tuner_attach()
1623 struct dvb_usb_device *d = adap_to_d(adap); in it930x_tuner_attach() local
1624 struct usb_interface *intf = d->intf; in it930x_tuner_attach()
1628 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in it930x_tuner_attach()
1631 si2157_config.fe = adap->fe[0]; in it930x_tuner_attach()
1647 if ((le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_DEXATEK && in it930x_tuner_attach()
1648 le16_to_cpu(d->udev->descriptor.idProduct) == 0x0100) || in it930x_tuner_attach()
1649 (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_TERRATEC && in it930x_tuner_attach()
1650 le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_TERRATEC_CINERGY_TC2_STICK)) in it930x_tuner_attach()
1653 si2157_config.if_port = it930x_addresses_table[state->it930x_addresses].tuner_if_port; in it930x_tuner_attach()
1654 ret = af9035_add_i2c_dev(d, "si2157", in it930x_tuner_attach()
1655 it930x_addresses_table[state->it930x_addresses].tuner_i2c_addr, in it930x_tuner_attach()
1656 &si2157_config, state->i2c_adapter_demod); in it930x_tuner_attach()
1663 dev_dbg(&intf->dev, "failed=%d\n", ret); in it930x_tuner_attach()
1672 struct dvb_usb_device *d = adap_to_d(adap); in it930x_tuner_detach() local
1673 struct usb_interface *intf = d->intf; in it930x_tuner_detach()
1675 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in it930x_tuner_detach()
1677 if (adap->id == 1) { in it930x_tuner_detach()
1678 if (state->i2c_client[3]) in it930x_tuner_detach()
1679 af9035_del_i2c_dev(d); in it930x_tuner_detach()
1680 } else if (adap->id == 0) { in it930x_tuner_detach()
1681 if (state->i2c_client[1]) in it930x_tuner_detach()
1682 af9035_del_i2c_dev(d); in it930x_tuner_detach()
1692 struct dvb_usb_device *d = adap_to_d(adap); in af9035_tuner_detach() local
1693 struct usb_interface *intf = d->intf; in af9035_tuner_detach()
1695 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in af9035_tuner_detach()
1697 switch (state->af9033_config[adap->id].tuner) { in af9035_tuner_detach()
1700 if (adap->id == 1) { in af9035_tuner_detach()
1701 if (state->i2c_client[3]) in af9035_tuner_detach()
1702 af9035_del_i2c_dev(d); in af9035_tuner_detach()
1703 } else if (adap->id == 0) { in af9035_tuner_detach()
1704 if (state->i2c_client[1]) in af9035_tuner_detach()
1705 af9035_del_i2c_dev(d); in af9035_tuner_detach()
1717 pdev = state->platform_device_tuner[adap->id]; in af9035_tuner_detach()
1719 module_put(pdev->dev.driver->owner); in af9035_tuner_detach()
1729 static int af9035_init(struct dvb_usb_device *d) in af9035_init() argument
1731 struct state *state = d_to_priv(d); in af9035_init()
1732 struct usb_interface *intf = d->intf; in af9035_init()
1734 u16 frame_size = (d->udev->speed == USB_SPEED_FULL ? 5 : 87) * 188 / 4; in af9035_init()
1735 u8 packet_size = (d->udev->speed == USB_SPEED_FULL ? 64 : 512) / 4; in af9035_init()
1747 { 0x00dd11, state->dual_mode << 6, 0x40 }, in af9035_init()
1751 { 0x80f9a3, state->dual_mode, 0x01 }, in af9035_init()
1752 { 0x80f9cd, state->dual_mode, 0x01 }, in af9035_init()
1757 dev_dbg(&intf->dev, "USB speed=%d frame_size=%04x packet_size=%02x\n", in af9035_init()
1758 d->udev->speed, frame_size, packet_size); in af9035_init()
1762 ret = af9035_wr_reg_mask(d, tab[i].reg, tab[i].val, in af9035_init()
1771 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_init()
1776 static int it930x_init(struct dvb_usb_device *d) in it930x_init() argument
1778 struct state *state = d_to_priv(d); in it930x_init()
1779 struct usb_interface *intf = d->intf; in it930x_init()
1781 u16 frame_size = (d->udev->speed == USB_SPEED_FULL ? 5 : 816) * 188 / 4; in it930x_init()
1782 u8 packet_size = (d->udev->speed == USB_SPEED_FULL ? 64 : 512) / 4; in it930x_init()
1794 { 0x00dd11, state->dual_mode << 6, 0x40 }, /* enable EP5 */ in it930x_init()
1804 { 0x00d831, 0x01, 0xff }, /* Bit 1 of output driving control */ in it930x_init()
1807 /* suspend gpio1 for TS-C */ in it930x_init()
1812 /* suspend gpio7 for TS-D */ in it930x_init()
1817 /* suspend gpio13 for TS-B */ in it930x_init()
1822 /* suspend gpio14 for TS-E */ in it930x_init()
1827 /* suspend gpio15 for TS-A */ in it930x_init()
1839 dev_dbg(&intf->dev, "USB speed=%d frame_size=%04x packet_size=%02x\n", in it930x_init()
1840 d->udev->speed, frame_size, packet_size); in it930x_init()
1844 ret = af9035_wr_reg_mask(d, tab[i].reg, in it930x_init()
1853 dev_dbg(&intf->dev, "failed=%d\n", ret); in it930x_init()
1860 static int af9035_rc_query(struct dvb_usb_device *d) in af9035_rc_query() argument
1862 struct usb_interface *intf = d->intf; in af9035_rc_query()
1869 ret = af9035_ctrl_msg(d, &req); in af9035_rc_query()
1870 if (ret == 1) in af9035_rc_query()
1876 if ((buf[0] + buf[1]) == 0xff) { in af9035_rc_query()
1882 key = RC_SCANCODE_NECX(buf[0] << 8 | buf[1], buf[2]); in af9035_rc_query()
1887 key = RC_SCANCODE_NEC32(buf[0] << 24 | buf[1] << 16 | in af9035_rc_query()
1892 dev_dbg(&intf->dev, "%*ph\n", 4, buf); in af9035_rc_query()
1894 rc_keydown(d->rc_dev, proto, key, 0); in af9035_rc_query()
1899 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_rc_query()
1904 static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) in af9035_get_rc_config() argument
1906 struct state *state = d_to_priv(d); in af9035_get_rc_config()
1907 struct usb_interface *intf = d->intf; in af9035_get_rc_config()
1909 dev_dbg(&intf->dev, "ir_mode=%02x ir_type=%02x\n", in af9035_get_rc_config()
1910 state->ir_mode, state->ir_type); in af9035_get_rc_config()
1913 if (state->ir_mode == 0x05) { in af9035_get_rc_config()
1914 switch (state->ir_type) { in af9035_get_rc_config()
1917 rc->allowed_protos = RC_PROTO_BIT_NEC | in af9035_get_rc_config()
1920 case 1: /* RC6 */ in af9035_get_rc_config()
1921 rc->allowed_protos = RC_PROTO_BIT_RC6_MCE; in af9035_get_rc_config()
1925 rc->query = af9035_rc_query; in af9035_get_rc_config()
1926 rc->interval = 500; in af9035_get_rc_config()
1929 if (!rc->map_name) in af9035_get_rc_config()
1930 rc->map_name = RC_MAP_EMPTY; in af9035_get_rc_config()
1942 struct dvb_usb_device *d = fe_to_d(fe); in af9035_get_stream_config() local
1943 struct usb_interface *intf = d->intf; in af9035_get_stream_config()
1945 dev_dbg(&intf->dev, "adap=%d\n", fe_to_adap(fe)->id); in af9035_get_stream_config()
1947 if (d->udev->speed == USB_SPEED_FULL) in af9035_get_stream_config()
1948 stream->u.bulk.buffersize = 5 * 188; in af9035_get_stream_config()
1957 return state->ops.pid_filter_ctrl(adap->fe[0], onoff); in af9035_pid_filter_ctrl()
1965 return state->ops.pid_filter(adap->fe[0], index, pid, onoff); in af9035_pid_filter()
1975 usb_string(udev, udev->descriptor.iManufacturer, in af9035_probe()
1985 * iManufacturer 1 Afatech in af9035_probe()
1986 * iProduct 2 DVB-T 2 in af9035_probe()
1991 * iManufacturer 1 ITE Technologies, Inc. in af9035_probe()
1992 * iProduct 2 DVB-T TV Stick in af9035_probe()
1994 if ((le16_to_cpu(udev->descriptor.idVendor) == USB_VID_TERRATEC) && in af9035_probe()
1995 (le16_to_cpu(udev->descriptor.idProduct) == 0x0099)) { in af9035_probe()
1997 dev_dbg(&udev->dev, "rejecting device\n"); in af9035_probe()
1998 return -ENODEV; in af9035_probe()
2005 /* interface 0 is used by DVB-T receiver and
2006 interface 1 is for remote controller (HID) */
2074 * which have non-empty rc_map, so it's safe to enable it for every IT930x
2142 &af9035_props, "Kworld UB499-2T T09", RC_MAP_IT913X_V1) },
2144 &af9035_props, "Sveon STV22 Dual DVB-T HDTV",
2158 &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) },
2168 &it930x_props, "AVerMedia TD310 DVB-T2", RC_MAP_AVERMEDIA_RM_KS) },
2185 .no_dynamic_id = 1,
2186 .soft_unbind = 1,