• Home
  • Raw
  • Download

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 ret = -ENODEV; in af9035_add_i2c_dev()
218 if (!try_module_get(client->dev.driver->owner)) { in af9035_add_i2c_dev()
220 ret = -ENODEV; in af9035_add_i2c_dev()
224 state->i2c_client[num] = client; in af9035_add_i2c_dev()
227 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_add_i2c_dev()
231 static void af9035_del_i2c_dev(struct dvb_usb_device *d) in af9035_del_i2c_dev() argument
234 struct state *state = d_to_priv(d); in af9035_del_i2c_dev()
235 struct usb_interface *intf = d->intf; in af9035_del_i2c_dev()
240 while (num--) { in af9035_del_i2c_dev()
241 if (state->i2c_client[num] != NULL) in af9035_del_i2c_dev()
245 dev_dbg(&intf->dev, "num=%d\n", num); in af9035_del_i2c_dev()
247 if (num == -1) { in af9035_del_i2c_dev()
248 dev_err(&intf->dev, "I2C client out of index\n"); in af9035_del_i2c_dev()
252 client = state->i2c_client[num]; in af9035_del_i2c_dev()
255 module_put(client->dev.driver->owner); in af9035_del_i2c_dev()
260 state->i2c_client[num] = NULL; in af9035_del_i2c_dev()
263 dev_dbg(&intf->dev, "failed\n"); in af9035_del_i2c_dev()
269 struct dvb_usb_device *d = i2c_get_adapdata(adap); in af9035_i2c_master_xfer() local
270 struct state *state = d_to_priv(d); in af9035_i2c_master_xfer()
273 if (mutex_lock_interruptible(&d->i2c_mutex) < 0) in af9035_i2c_master_xfer()
274 return -EAGAIN; in af9035_i2c_master_xfer()
279 * 1: I2C addr << 1 in af9035_i2c_master_xfer()
285 * used when reg addr len is set to 1 or 2 in af9035_i2c_master_xfer()
296 * dual tuner configuration, is covered by firmware - actual USB IO in af9035_i2c_master_xfer()
308 * 1: I2C bus (0x03 seems to be only value used) in af9035_i2c_master_xfer()
309 * 2: I2C addr << 1 in af9035_i2c_master_xfer()
312 (_num == 2 && !(_msg[0].flags & I2C_M_RD) && (_msg[1].flags & I2C_M_RD)) in af9035_i2c_master_xfer()
314 (_num == 1 && !(_msg[0].flags & I2C_M_RD)) in af9035_i2c_master_xfer()
316 (_num == 1 && (_msg[0].flags & I2C_M_RD)) in af9035_i2c_master_xfer()
319 if (msg[0].len > 40 || msg[1].len > 40) { in af9035_i2c_master_xfer()
321 ret = -EOPNOTSUPP; in af9035_i2c_master_xfer()
322 } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || in af9035_i2c_master_xfer()
323 (msg[0].addr == state->af9033_i2c_addr[1])) { in af9035_i2c_master_xfer()
325 u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | in af9035_i2c_master_xfer()
328 if (msg[0].addr == state->af9033_i2c_addr[1]) in af9035_i2c_master_xfer()
331 ret = af9035_rd_regs(d, reg, &msg[1].buf[0], in af9035_i2c_master_xfer()
332 msg[1].len); in af9035_i2c_master_xfer()
333 } else if (state->no_read) { in af9035_i2c_master_xfer()
334 memset(msg[1].buf, 0, msg[1].len); in af9035_i2c_master_xfer()
340 buf, msg[1].len, msg[1].buf }; in af9035_i2c_master_xfer()
342 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
348 buf[0] = msg[1].len; in af9035_i2c_master_xfer()
349 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
350 buf[1] = 0x03; /* I2C bus */ in af9035_i2c_master_xfer()
351 buf[2] = msg[0].addr << 1; in af9035_i2c_master_xfer()
354 buf[1] = msg[0].addr << 1; in af9035_i2c_master_xfer()
369 buf[4] = msg[0].buf[1]; in af9035_i2c_master_xfer()
370 } else if (msg[0].len == 1) { in af9035_i2c_master_xfer()
375 ret = af9035_ctrl_msg(d, &req); in af9035_i2c_master_xfer()
380 ret = -EOPNOTSUPP; in af9035_i2c_master_xfer()
381 } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || in af9035_i2c_master_xfer()
382 (msg[0].addr == state->af9033_i2c_addr[1])) { in af9035_i2c_master_xfer()
384 u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | in af9035_i2c_master_xfer()
387 if (msg[0].addr == state->af9033_i2c_addr[1]) in af9035_i2c_master_xfer()
390 ret = (msg[0].len >= 3) ? af9035_wr_regs(d, reg, in af9035_i2c_master_xfer()
392 msg[0].len - 3) in af9035_i2c_master_xfer()
393 : -EOPNOTSUPP; in af9035_i2c_master_xfer()
400 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
407 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
408 buf[1] = 0x03; /* I2C bus */ in af9035_i2c_master_xfer()
409 buf[2] = msg[0].addr << 1; in af9035_i2c_master_xfer()
412 buf[1] = msg[0].addr << 1; in af9035_i2c_master_xfer()
418 ret = af9035_ctrl_msg(d, &req); in af9035_i2c_master_xfer()
423 ret = -EOPNOTSUPP; in af9035_i2c_master_xfer()
424 } else if (state->no_read) { in af9035_i2c_master_xfer()
433 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
439 if (state->chip_type == 0x9306) { in af9035_i2c_master_xfer()
440 buf[1] = 0x03; /* I2C bus */ in af9035_i2c_master_xfer()
441 buf[2] = msg[0].addr << 1; in af9035_i2c_master_xfer()
443 buf[1] = msg[0].addr << 1; in af9035_i2c_master_xfer()
448 ret = af9035_ctrl_msg(d, &req); in af9035_i2c_master_xfer()
453 * 1) 1 x write + 1 x read (repeated start) in af9035_i2c_master_xfer()
454 * 2) 1 x write in af9035_i2c_master_xfer()
455 * 3) 1 x read in af9035_i2c_master_xfer()
457 ret = -EOPNOTSUPP; in af9035_i2c_master_xfer()
460 mutex_unlock(&d->i2c_mutex); in af9035_i2c_master_xfer()
478 static int af9035_identify_state(struct dvb_usb_device *d, const char **name) in af9035_identify_state() argument
480 struct state *state = d_to_priv(d); in af9035_identify_state()
481 struct usb_interface *intf = d->intf; in af9035_identify_state()
485 u8 wbuf[1] = { 1 }; in af9035_identify_state()
490 ret = af9035_rd_regs(d, 0x1222, rbuf, 3); in af9035_identify_state()
494 state->chip_version = rbuf[0]; in af9035_identify_state()
495 state->chip_type = rbuf[2] << 8 | rbuf[1] << 0; in af9035_identify_state()
497 ret = af9035_rd_reg(d, 0x384f, &state->prechip_version); in af9035_identify_state()
501 dev_info(&intf->dev, "prechip_version=%02x chip_version=%02x chip_type=%04x\n", in af9035_identify_state()
502 state->prechip_version, state->chip_version, state->chip_type); in af9035_identify_state()
504 if (state->chip_type == 0x9135) { in af9035_identify_state()
505 if (state->chip_version == 0x02) { in af9035_identify_state()
514 ret = af9035_rd_reg(d, utmp, &tmp); in af9035_identify_state()
519 dev_dbg(&intf->dev, "no eeprom\n"); in af9035_identify_state()
520 state->no_eeprom = true; in af9035_identify_state()
525 } else if (state->chip_type == 0x9306) { in af9035_identify_state()
527 state->no_eeprom = true; in af9035_identify_state()
536 ret = af9035_rd_regs(d, eeprom_addr + i, &state->eeprom[i], 32); in af9035_identify_state()
541 dev_dbg(&intf->dev, "eeprom dump:\n"); in af9035_identify_state()
543 dev_dbg(&intf->dev, "%*ph\n", 16, &state->eeprom[i]); in af9035_identify_state()
546 tmp = state->eeprom[EEPROM_TS_MODE]; in af9035_identify_state()
551 case 1: in af9035_identify_state()
553 state->dual_mode = true; in af9035_identify_state()
556 if (state->chip_type != 0x9135 && state->chip_type != 0x9306) in af9035_identify_state()
557 state->dual_mode = true; /* AF9035 */ in af9035_identify_state()
559 ts_mode_invalid = 1; in af9035_identify_state()
562 ts_mode_invalid = 1; in af9035_identify_state()
565 dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, state->dual_mode); in af9035_identify_state()
568 dev_info(&intf->dev, "ts mode=%d not supported, defaulting to single tuner mode!", tmp); in af9035_identify_state()
571 ret = af9035_ctrl_msg(d, &req); in af9035_identify_state()
575 dev_dbg(&intf->dev, "reply=%*ph\n", 4, rbuf); in af9035_identify_state()
576 if (rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3]) in af9035_identify_state()
584 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_identify_state()
589 static int af9035_download_firmware_old(struct dvb_usb_device *d, in af9035_download_firmware_old() argument
592 struct usb_interface *intf = d->intf; in af9035_download_firmware_old()
594 u8 wbuf[1]; in af9035_download_firmware_old()
603 * Thanks to Daniel Glöckner <daniel-gl@gmx.net> about that info! in af9035_download_firmware_old()
606 * There are two inside the AF9035 (1=Link and 2=OFDM) with separate in af9035_download_firmware_old()
608 * byte 1-2: Big endian destination address in af9035_download_firmware_old()
609 * byte 3-4: Big endian number of data bytes following the header in af9035_download_firmware_old()
610 * byte 5-6: Big endian header checksum, apparently ignored by the chip in af9035_download_firmware_old()
611 * Calculated as ~(h[0]*256+h[1]+h[2]*256+h[3]+h[4]*256) in af9035_download_firmware_old()
614 for (i = fw->size; i > HDR_SIZE;) { in af9035_download_firmware_old()
615 hdr_core = fw->data[fw->size - i + 0]; in af9035_download_firmware_old()
616 hdr_addr = fw->data[fw->size - i + 1] << 8; in af9035_download_firmware_old()
617 hdr_addr |= fw->data[fw->size - i + 2] << 0; in af9035_download_firmware_old()
618 hdr_data_len = fw->data[fw->size - i + 3] << 8; in af9035_download_firmware_old()
619 hdr_data_len |= fw->data[fw->size - i + 4] << 0; in af9035_download_firmware_old()
620 hdr_checksum = fw->data[fw->size - i + 5] << 8; in af9035_download_firmware_old()
621 hdr_checksum |= fw->data[fw->size - i + 6] << 0; in af9035_download_firmware_old()
623 dev_dbg(&intf->dev, "core=%d addr=%04x data_len=%d checksum=%04x\n", in af9035_download_firmware_old()
626 if (((hdr_core != 1) && (hdr_core != 2)) || in af9035_download_firmware_old()
628 dev_dbg(&intf->dev, "bad firmware\n"); in af9035_download_firmware_old()
634 ret = af9035_ctrl_msg(d, &req); in af9035_download_firmware_old()
639 for (j = HDR_SIZE + hdr_data_len; j > 0; j -= MAX_DATA) { in af9035_download_firmware_old()
644 req_fw_dl.wbuf = (u8 *) &fw->data[fw->size - i + in af9035_download_firmware_old()
645 HDR_SIZE + hdr_data_len - j]; in af9035_download_firmware_old()
646 ret = af9035_ctrl_msg(d, &req_fw_dl); in af9035_download_firmware_old()
653 ret = af9035_ctrl_msg(d, &req); in af9035_download_firmware_old()
657 i -= hdr_data_len + HDR_SIZE; in af9035_download_firmware_old()
659 dev_dbg(&intf->dev, "data uploaded=%zu\n", fw->size - i); in af9035_download_firmware_old()
664 dev_warn(&intf->dev, "bad firmware\n"); in af9035_download_firmware_old()
669 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_download_firmware_old()
674 static int af9035_download_firmware_new(struct dvb_usb_device *d, in af9035_download_firmware_new() argument
677 struct usb_interface *intf = d->intf; in af9035_download_firmware_new()
683 * There seems to be following firmware header. Meaning of bytes 0-3 in af9035_download_firmware_new()
687 * 1: 0, 1 in af9035_download_firmware_new()
689 * 3: 1, 2, 3 in af9035_download_firmware_new()
694 for (i = HDR_SIZE, i_prev = 0; i <= fw->size; i++) { in af9035_download_firmware_new()
695 if (i == fw->size || in af9035_download_firmware_new()
696 (fw->data[i + 0] == 0x03 && in af9035_download_firmware_new()
697 (fw->data[i + 1] == 0x00 || in af9035_download_firmware_new()
698 fw->data[i + 1] == 0x01) && in af9035_download_firmware_new()
699 fw->data[i + 2] == 0x00)) { in af9035_download_firmware_new()
700 req_fw_dl.wlen = i - i_prev; in af9035_download_firmware_new()
701 req_fw_dl.wbuf = (u8 *) &fw->data[i_prev]; in af9035_download_firmware_new()
703 ret = af9035_ctrl_msg(d, &req_fw_dl); in af9035_download_firmware_new()
707 dev_dbg(&intf->dev, "data uploaded=%d\n", i); in af9035_download_firmware_new()
714 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_download_firmware_new()
719 static int af9035_download_firmware(struct dvb_usb_device *d, in af9035_download_firmware() argument
722 struct usb_interface *intf = d->intf; in af9035_download_firmware()
723 struct state *state = d_to_priv(d); in af9035_download_firmware()
725 u8 wbuf[1]; in af9035_download_firmware()
729 struct usb_req req_fw_ver = { CMD_FW_QUERYINFO, 0, 1, wbuf, 4, rbuf }; in af9035_download_firmware()
731 dev_dbg(&intf->dev, "\n"); in af9035_download_firmware()
739 if (state->dual_mode) { in af9035_download_firmware()
741 ret = af9035_wr_reg_mask(d, 0x00d8b0, 0x01, 0x01); in af9035_download_firmware()
745 ret = af9035_wr_reg_mask(d, 0x00d8b1, 0x01, 0x01); in af9035_download_firmware()
749 ret = af9035_wr_reg_mask(d, 0x00d8af, 0x00, 0x01); in af9035_download_firmware()
755 ret = af9035_wr_reg_mask(d, 0x00d8af, 0x01, 0x01); in af9035_download_firmware()
760 tmp = state->eeprom[EEPROM_2ND_DEMOD_ADDR]; in af9035_download_firmware()
764 tmp = 0x1d << 1; /* 8-bit format used by chip */ in af9035_download_firmware()
766 if ((state->chip_type == 0x9135) || in af9035_download_firmware()
767 (state->chip_type == 0x9306)) { in af9035_download_firmware()
768 ret = af9035_wr_reg(d, 0x004bfb, tmp); in af9035_download_firmware()
772 ret = af9035_wr_reg(d, 0x00417f, tmp); in af9035_download_firmware()
777 ret = af9035_wr_reg_mask(d, 0x00d81a, 0x01, 0x01); in af9035_download_firmware()
783 if (fw->data[0] == 0x01) in af9035_download_firmware()
784 ret = af9035_download_firmware_old(d, fw); in af9035_download_firmware()
786 ret = af9035_download_firmware_new(d, fw); in af9035_download_firmware()
792 ret = af9035_ctrl_msg(d, &req); in af9035_download_firmware()
797 wbuf[0] = 1; in af9035_download_firmware()
798 ret = af9035_ctrl_msg(d, &req_fw_ver); in af9035_download_firmware()
802 if (!(rbuf[0] || rbuf[1] || rbuf[2] || rbuf[3])) { in af9035_download_firmware()
803 dev_err(&intf->dev, "firmware did not run\n"); in af9035_download_firmware()
804 ret = -ENODEV; in af9035_download_firmware()
808 dev_info(&intf->dev, "firmware version=%d.%d.%d.%d", in af9035_download_firmware()
809 rbuf[0], rbuf[1], rbuf[2], rbuf[3]); in af9035_download_firmware()
814 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_download_firmware()
819 static int af9035_read_config(struct dvb_usb_device *d) in af9035_read_config() argument
821 struct usb_interface *intf = d->intf; in af9035_read_config()
822 struct state *state = d_to_priv(d); in af9035_read_config()
828 state->af9033_i2c_addr[0] = 0x1c; in af9035_read_config()
829 state->af9033_i2c_addr[1] = 0x1d; in af9035_read_config()
830 state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; in af9035_read_config()
831 state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; in af9035_read_config()
832 state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB; in af9035_read_config()
833 state->af9033_config[1].ts_mode = AF9033_TS_MODE_SERIAL; in af9035_read_config()
834 state->it930x_addresses = 0; in af9035_read_config()
836 if (state->chip_type == 0x9135) { in af9035_read_config()
838 state->af9033_config[0].dyn0_clk = true; in af9035_read_config()
839 state->af9033_config[1].dyn0_clk = true; in af9035_read_config()
841 if (state->chip_version == 0x02) { in af9035_read_config()
842 state->af9033_config[0].tuner = AF9033_TUNER_IT9135_60; in af9035_read_config()
843 state->af9033_config[1].tuner = AF9033_TUNER_IT9135_60; in af9035_read_config()
845 state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38; in af9035_read_config()
846 state->af9033_config[1].tuner = AF9033_TUNER_IT9135_38; in af9035_read_config()
849 if (state->no_eeprom) { in af9035_read_config()
851 state->ir_mode = 0x05; in af9035_read_config()
852 state->ir_type = 0x00; in af9035_read_config()
856 } else if (state->chip_type == 0x9306) { in af9035_read_config()
858 * IT930x is an USB bridge, only single demod-single tuner in af9035_read_config()
861 if ((le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA) && in af9035_read_config()
862 (le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_TD310)) { in af9035_read_config()
863 state->it930x_addresses = 1; in af9035_read_config()
869 state->ir_mode = state->eeprom[EEPROM_IR_MODE]; in af9035_read_config()
870 state->ir_type = state->eeprom[EEPROM_IR_TYPE]; in af9035_read_config()
872 if (state->dual_mode) { in af9035_read_config()
873 /* Read 2nd demodulator I2C address. 8-bit format on eeprom */ in af9035_read_config()
874 tmp = state->eeprom[EEPROM_2ND_DEMOD_ADDR]; in af9035_read_config()
876 state->af9033_i2c_addr[1] = tmp >> 1; in af9035_read_config()
878 dev_dbg(&intf->dev, "2nd demod I2C addr=%02x\n", in af9035_read_config()
879 state->af9033_i2c_addr[1]); in af9035_read_config()
882 for (i = 0; i < state->dual_mode + 1; i++) { in af9035_read_config()
886 tmp = state->eeprom[EEPROM_1_TUNER_ID + eeprom_offset]; in af9035_read_config()
887 dev_dbg(&intf->dev, "[%d]tuner=%02x\n", i, tmp); in af9035_read_config()
890 if (state->chip_type == 0x9135) { in af9035_read_config()
891 if (state->chip_version == 0x02) { in af9035_read_config()
897 state->af9033_config[i].tuner = tmp; in af9035_read_config()
906 state->af9033_config[i].tuner = tmp; in af9035_read_config()
912 state->af9033_config[i].tuner = tmp; in af9035_read_config()
915 if (state->af9033_config[i].tuner != tmp) { in af9035_read_config()
916 dev_info(&intf->dev, "[%d] overriding tuner from %02x to %02x\n", in af9035_read_config()
917 i, tmp, state->af9033_config[i].tuner); in af9035_read_config()
920 switch (state->af9033_config[i].tuner) { in af9035_read_config()
927 state->af9033_config[i].spec_inv = 1; in af9035_read_config()
937 dev_warn(&intf->dev, "tuner id=%02x not supported, please report!", in af9035_read_config()
942 if (i == 1) in af9035_read_config()
943 switch (state->af9033_config[i].tuner) { in af9035_read_config()
954 state->dual_mode = false; in af9035_read_config()
955 dev_info(&intf->dev, "driver does not support 2nd tuner and will disable it"); in af9035_read_config()
959 tmp = state->eeprom[EEPROM_1_IF_L + eeprom_offset]; in af9035_read_config()
961 tmp = state->eeprom[EEPROM_1_IF_H + eeprom_offset]; in af9035_read_config()
963 dev_dbg(&intf->dev, "[%d]IF=%d\n", i, tmp16); in af9035_read_config()
970 ret = af9035_rd_reg(d, 0x00d800, &tmp); in af9035_read_config()
976 for (i = 0; i < ARRAY_SIZE(state->af9033_config); i++) { in af9035_read_config()
977 if (state->chip_type == 0x9135) in af9035_read_config()
978 state->af9033_config[i].clock = clock_lut_it9135[tmp]; in af9035_read_config()
980 state->af9033_config[i].clock = clock_lut_af9035[tmp]; in af9035_read_config()
983 state->no_read = false; in af9035_read_config()
985 if (state->af9033_config[0].tuner == AF9033_TUNER_MXL5007T && in af9035_read_config()
986 le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA) in af9035_read_config()
988 switch (le16_to_cpu(d->udev->descriptor.idProduct)) { in af9035_read_config()
991 dev_info(&intf->dev, in af9035_read_config()
993 state->no_read = true; in af9035_read_config()
1000 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_read_config()
1005 static int af9035_tua9001_tuner_callback(struct dvb_usb_device *d, in af9035_tua9001_tuner_callback() argument
1008 struct usb_interface *intf = d->intf; in af9035_tua9001_tuner_callback()
1012 dev_dbg(&intf->dev, "cmd=%d arg=%d\n", cmd, arg); in af9035_tua9001_tuner_callback()
1027 ret = af9035_wr_reg_mask(d, 0x00d8e7, val, 0x01); in af9035_tua9001_tuner_callback()
1037 ret = af9035_wr_reg_mask(d, 0x00d8eb, val, 0x01); in af9035_tua9001_tuner_callback()
1046 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_tua9001_tuner_callback()
1052 static int af9035_fc0011_tuner_callback(struct dvb_usb_device *d, in af9035_fc0011_tuner_callback() argument
1055 struct usb_interface *intf = d->intf; in af9035_fc0011_tuner_callback()
1061 ret = af9035_wr_reg_mask(d, 0xd8eb, 1, 1); in af9035_fc0011_tuner_callback()
1065 ret = af9035_wr_reg_mask(d, 0xd8ec, 1, 1); in af9035_fc0011_tuner_callback()
1069 ret = af9035_wr_reg_mask(d, 0xd8ed, 1, 1); in af9035_fc0011_tuner_callback()
1074 ret = af9035_wr_reg_mask(d, 0xd8d0, 1, 1); in af9035_fc0011_tuner_callback()
1078 ret = af9035_wr_reg_mask(d, 0xd8d1, 1, 1); in af9035_fc0011_tuner_callback()
1085 ret = af9035_wr_reg(d, 0xd8e9, 1); in af9035_fc0011_tuner_callback()
1089 ret = af9035_wr_reg(d, 0xd8e8, 1); in af9035_fc0011_tuner_callback()
1093 ret = af9035_wr_reg(d, 0xd8e7, 1); in af9035_fc0011_tuner_callback()
1099 ret = af9035_wr_reg(d, 0xd8e7, 0); in af9035_fc0011_tuner_callback()
1106 ret = -EINVAL; in af9035_fc0011_tuner_callback()
1113 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_fc0011_tuner_callback()
1118 static int af9035_tuner_callback(struct dvb_usb_device *d, int cmd, int arg) in af9035_tuner_callback() argument
1120 struct state *state = d_to_priv(d); in af9035_tuner_callback()
1122 switch (state->af9033_config[0].tuner) { in af9035_tuner_callback()
1124 return af9035_fc0011_tuner_callback(d, cmd, arg); in af9035_tuner_callback()
1126 return af9035_tua9001_tuner_callback(d, cmd, arg); in af9035_tuner_callback()
1138 struct dvb_usb_device *d = i2c_get_adapdata(adap); in af9035_frontend_callback() local
1139 struct usb_interface *intf = d->intf; in af9035_frontend_callback()
1141 dev_dbg(&intf->dev, "component=%d cmd=%d arg=%d\n", in af9035_frontend_callback()
1146 return af9035_tuner_callback(d, cmd, arg); in af9035_frontend_callback()
1154 static int af9035_get_adapter_count(struct dvb_usb_device *d) in af9035_get_adapter_count() argument
1156 struct state *state = d_to_priv(d); in af9035_get_adapter_count()
1158 return state->dual_mode + 1; in af9035_get_adapter_count()
1164 struct dvb_usb_device *d = adap_to_d(adap); in af9035_frontend_attach() local
1165 struct usb_interface *intf = d->intf; in af9035_frontend_attach()
1168 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in af9035_frontend_attach()
1170 if (!state->af9033_config[adap->id].tuner) { in af9035_frontend_attach()
1172 ret = -ENODEV; in af9035_frontend_attach()
1176 state->af9033_config[adap->id].fe = &adap->fe[0]; in af9035_frontend_attach()
1177 state->af9033_config[adap->id].ops = &state->ops; in af9035_frontend_attach()
1178 ret = af9035_add_i2c_dev(d, "af9033", state->af9033_i2c_addr[adap->id], in af9035_frontend_attach()
1179 &state->af9033_config[adap->id], &d->i2c_adap); in af9035_frontend_attach()
1183 if (adap->fe[0] == NULL) { in af9035_frontend_attach()
1184 ret = -ENODEV; in af9035_frontend_attach()
1188 /* disable I2C-gate */ in af9035_frontend_attach()
1189 adap->fe[0]->ops.i2c_gate_ctrl = NULL; in af9035_frontend_attach()
1190 adap->fe[0]->callback = af9035_frontend_callback; in af9035_frontend_attach()
1195 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_frontend_attach()
1212 struct dvb_usb_device *d = adap_to_d(adap); in it930x_frontend_attach() local
1213 struct usb_interface *intf = d->intf; in it930x_frontend_attach()
1218 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in it930x_frontend_attach()
1221 ret = af9035_wr_reg(d, 0x00f6a7, I2C_SPEED_366K); in it930x_frontend_attach()
1225 /* I2C master bus 1,3 clock speed 366k */ in it930x_frontend_attach()
1226 ret = af9035_wr_reg(d, 0x00f103, I2C_SPEED_366K); in it930x_frontend_attach()
1231 ret = af9035_wr_reg_mask(d, 0xd8d4, 0x01, 0x01); in it930x_frontend_attach()
1235 ret = af9035_wr_reg_mask(d, 0xd8d5, 0x01, 0x01); in it930x_frontend_attach()
1239 ret = af9035_wr_reg_mask(d, 0xd8d3, 0x01, 0x01); in it930x_frontend_attach()
1244 ret = af9035_wr_reg_mask(d, 0xd8b8, 0x01, 0x01); in it930x_frontend_attach()
1248 ret = af9035_wr_reg_mask(d, 0xd8b9, 0x01, 0x01); in it930x_frontend_attach()
1252 ret = af9035_wr_reg_mask(d, 0xd8b7, 0x00, 0x01); in it930x_frontend_attach()
1258 ret = af9035_wr_reg_mask(d, 0xd8b7, 0x01, 0x01); in it930x_frontend_attach()
1264 si2168_config.fe = &adap->fe[0]; in it930x_frontend_attach()
1267 state->af9033_config[adap->id].fe = &adap->fe[0]; in it930x_frontend_attach()
1268 state->af9033_config[adap->id].ops = &state->ops; in it930x_frontend_attach()
1269 ret = af9035_add_i2c_dev(d, "si2168", in it930x_frontend_attach()
1270 it930x_addresses_table[state->it930x_addresses].frontend_i2c_addr, in it930x_frontend_attach()
1271 &si2168_config, &d->i2c_adap); in it930x_frontend_attach()
1275 if (adap->fe[0] == NULL) { in it930x_frontend_attach()
1276 ret = -ENODEV; in it930x_frontend_attach()
1279 state->i2c_adapter_demod = adapter; in it930x_frontend_attach()
1284 dev_dbg(&intf->dev, "failed=%d\n", ret); in it930x_frontend_attach()
1292 struct dvb_usb_device *d = adap_to_d(adap); in af9035_frontend_detach() local
1293 struct usb_interface *intf = d->intf; in af9035_frontend_detach()
1295 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in af9035_frontend_detach()
1297 if (adap->id == 1) { in af9035_frontend_detach()
1298 if (state->i2c_client[1]) in af9035_frontend_detach()
1299 af9035_del_i2c_dev(d); in af9035_frontend_detach()
1300 } else if (adap->id == 0) { in af9035_frontend_detach()
1301 if (state->i2c_client[0]) in af9035_frontend_detach()
1302 af9035_del_i2c_dev(d); in af9035_frontend_detach()
1324 .loop_thru_enable = 1,
1325 .clk_out_enable = 1,
1352 struct dvb_usb_device *d = adap_to_d(adap); in af9035_tuner_attach() local
1353 struct usb_interface *intf = d->intf; in af9035_tuner_attach()
1356 struct i2c_msg msg[1]; in af9035_tuner_attach()
1359 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in af9035_tuner_attach()
1366 switch (state->af9033_config[adap->id].tuner) { in af9035_tuner_attach()
1369 .dvb_frontend = adap->fe[0], in af9035_tuner_attach()
1378 ret = af9035_wr_reg_mask(d, 0x00d8ec, 0x01, 0x01); in af9035_tuner_attach()
1382 ret = af9035_wr_reg_mask(d, 0x00d8ed, 0x01, 0x01); in af9035_tuner_attach()
1386 ret = af9035_wr_reg_mask(d, 0x00d8e8, 0x01, 0x01); in af9035_tuner_attach()
1390 ret = af9035_wr_reg_mask(d, 0x00d8e9, 0x01, 0x01); in af9035_tuner_attach()
1395 ret = af9035_add_i2c_dev(d, "tua9001", 0x60, &tua9001_pdata, in af9035_tuner_attach()
1396 &d->i2c_adap); in af9035_tuner_attach()
1400 fe = adap->fe[0]; in af9035_tuner_attach()
1404 fe = dvb_attach(fc0011_attach, adap->fe[0], in af9035_tuner_attach()
1405 &d->i2c_adap, &af9035_fc0011_config); in af9035_tuner_attach()
1408 if (adap->id == 0) { in af9035_tuner_attach()
1409 ret = af9035_wr_reg(d, 0x00d8e0, 1); in af9035_tuner_attach()
1413 ret = af9035_wr_reg(d, 0x00d8e1, 1); in af9035_tuner_attach()
1417 ret = af9035_wr_reg(d, 0x00d8df, 0); in af9035_tuner_attach()
1423 ret = af9035_wr_reg(d, 0x00d8df, 1); in af9035_tuner_attach()
1429 ret = af9035_wr_reg(d, 0x00d8c0, 1); in af9035_tuner_attach()
1433 ret = af9035_wr_reg(d, 0x00d8c1, 1); in af9035_tuner_attach()
1437 ret = af9035_wr_reg(d, 0x00d8bf, 0); in af9035_tuner_attach()
1441 ret = af9035_wr_reg(d, 0x00d8b4, 1); in af9035_tuner_attach()
1445 ret = af9035_wr_reg(d, 0x00d8b5, 1); in af9035_tuner_attach()
1449 ret = af9035_wr_reg(d, 0x00d8b3, 1); in af9035_tuner_attach()
1459 fe = dvb_attach(mxl5007t_attach, adap->fe[0], &d->i2c_adap, in af9035_tuner_attach()
1460 tuner_addr, &af9035_mxl5007t_config[adap->id]); in af9035_tuner_attach()
1464 fe = dvb_attach(tda18218_attach, adap->fe[0], in af9035_tuner_attach()
1465 &d->i2c_adap, &af9035_tda18218_config); in af9035_tuner_attach()
1469 .dvb_frontend = adap->fe[0], in af9035_tuner_attach()
1473 ret = af9035_wr_reg_mask(d, 0xd8eb, 0x01, 0x01); in af9035_tuner_attach()
1477 ret = af9035_wr_reg_mask(d, 0xd8ec, 0x01, 0x01); in af9035_tuner_attach()
1481 ret = af9035_wr_reg_mask(d, 0xd8ed, 0x01, 0x01); in af9035_tuner_attach()
1487 ret = af9035_add_i2c_dev(d, "fc2580", 0x56, &fc2580_pdata, in af9035_tuner_attach()
1488 &d->i2c_adap); in af9035_tuner_attach()
1492 fe = adap->fe[0]; in af9035_tuner_attach()
1502 if (adap->id == 0) { in af9035_tuner_attach()
1504 ret = af9035_wr_reg_mask(d, 0xd8eb, 0x01, 0x01); in af9035_tuner_attach()
1508 ret = af9035_wr_reg_mask(d, 0xd8ec, 0x01, 0x01); in af9035_tuner_attach()
1512 ret = af9035_wr_reg_mask(d, 0xd8ed, 0x01, 0x01); in af9035_tuner_attach()
1518 * Write 02 to FC0012 master tuner register 0d directly in af9035_tuner_attach()
1525 ret = i2c_transfer(&d->i2c_adap, msg, 1); in af9035_tuner_attach()
1532 fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap, in af9035_tuner_attach()
1533 &af9035_fc0012_config[adap->id]); in af9035_tuner_attach()
1545 .regmap = state->af9033_config[adap->id].regmap, in af9035_tuner_attach()
1546 .fe = adap->fe[0], in af9035_tuner_attach()
1549 switch (state->af9033_config[adap->id].tuner) { in af9035_tuner_attach()
1553 name = "it9133ax-tuner"; in af9035_tuner_attach()
1558 name = "it9133bx-tuner"; in af9035_tuner_attach()
1561 ret = -ENODEV; in af9035_tuner_attach()
1565 if (state->dual_mode) { in af9035_tuner_attach()
1566 if (adap->id == 0) in af9035_tuner_attach()
1575 pdev = platform_device_register_data(&d->intf->dev, name, in af9035_tuner_attach()
1579 if (IS_ERR(pdev) || !pdev->dev.driver) { in af9035_tuner_attach()
1580 ret = -ENODEV; in af9035_tuner_attach()
1583 if (!try_module_get(pdev->dev.driver->owner)) { in af9035_tuner_attach()
1585 ret = -ENODEV; in af9035_tuner_attach()
1589 state->platform_device_tuner[adap->id] = pdev; in af9035_tuner_attach()
1590 fe = adap->fe[0]; in af9035_tuner_attach()
1598 ret = -ENODEV; in af9035_tuner_attach()
1605 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_tuner_attach()
1613 struct dvb_usb_device *d = adap_to_d(adap); in it930x_tuner_attach() local
1614 struct usb_interface *intf = d->intf; in it930x_tuner_attach()
1618 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in it930x_tuner_attach()
1621 si2157_config.fe = adap->fe[0]; in it930x_tuner_attach()
1637 if ((le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_DEXATEK && in it930x_tuner_attach()
1638 le16_to_cpu(d->udev->descriptor.idProduct) == 0x0100) || in it930x_tuner_attach()
1639 (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_TERRATEC && in it930x_tuner_attach()
1640 le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_TERRATEC_CINERGY_TC2_STICK)) in it930x_tuner_attach()
1643 si2157_config.if_port = it930x_addresses_table[state->it930x_addresses].tuner_if_port; in it930x_tuner_attach()
1644 ret = af9035_add_i2c_dev(d, "si2157", in it930x_tuner_attach()
1645 it930x_addresses_table[state->it930x_addresses].tuner_i2c_addr, in it930x_tuner_attach()
1646 &si2157_config, state->i2c_adapter_demod); in it930x_tuner_attach()
1653 dev_dbg(&intf->dev, "failed=%d\n", ret); in it930x_tuner_attach()
1662 struct dvb_usb_device *d = adap_to_d(adap); in it930x_tuner_detach() local
1663 struct usb_interface *intf = d->intf; in it930x_tuner_detach()
1665 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in it930x_tuner_detach()
1667 if (adap->id == 1) { in it930x_tuner_detach()
1668 if (state->i2c_client[3]) in it930x_tuner_detach()
1669 af9035_del_i2c_dev(d); in it930x_tuner_detach()
1670 } else if (adap->id == 0) { in it930x_tuner_detach()
1671 if (state->i2c_client[1]) in it930x_tuner_detach()
1672 af9035_del_i2c_dev(d); in it930x_tuner_detach()
1682 struct dvb_usb_device *d = adap_to_d(adap); in af9035_tuner_detach() local
1683 struct usb_interface *intf = d->intf; in af9035_tuner_detach()
1685 dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); in af9035_tuner_detach()
1687 switch (state->af9033_config[adap->id].tuner) { in af9035_tuner_detach()
1690 if (adap->id == 1) { in af9035_tuner_detach()
1691 if (state->i2c_client[3]) in af9035_tuner_detach()
1692 af9035_del_i2c_dev(d); in af9035_tuner_detach()
1693 } else if (adap->id == 0) { in af9035_tuner_detach()
1694 if (state->i2c_client[1]) in af9035_tuner_detach()
1695 af9035_del_i2c_dev(d); in af9035_tuner_detach()
1707 pdev = state->platform_device_tuner[adap->id]; in af9035_tuner_detach()
1709 module_put(pdev->dev.driver->owner); in af9035_tuner_detach()
1719 static int af9035_init(struct dvb_usb_device *d) in af9035_init() argument
1721 struct state *state = d_to_priv(d); in af9035_init()
1722 struct usb_interface *intf = d->intf; in af9035_init()
1724 u16 frame_size = (d->udev->speed == USB_SPEED_FULL ? 5 : 87) * 188 / 4; in af9035_init()
1725 u8 packet_size = (d->udev->speed == USB_SPEED_FULL ? 64 : 512) / 4; in af9035_init()
1737 { 0x00dd11, state->dual_mode << 6, 0x40 }, in af9035_init()
1741 { 0x80f9a3, state->dual_mode, 0x01 }, in af9035_init()
1742 { 0x80f9cd, state->dual_mode, 0x01 }, in af9035_init()
1747 dev_dbg(&intf->dev, "USB speed=%d frame_size=%04x packet_size=%02x\n", in af9035_init()
1748 d->udev->speed, frame_size, packet_size); in af9035_init()
1752 ret = af9035_wr_reg_mask(d, tab[i].reg, tab[i].val, in af9035_init()
1761 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_init()
1766 static int it930x_init(struct dvb_usb_device *d) in it930x_init() argument
1768 struct state *state = d_to_priv(d); in it930x_init()
1769 struct usb_interface *intf = d->intf; in it930x_init()
1771 u16 frame_size = (d->udev->speed == USB_SPEED_FULL ? 5 : 816) * 188 / 4; in it930x_init()
1772 u8 packet_size = (d->udev->speed == USB_SPEED_FULL ? 64 : 512) / 4; in it930x_init()
1784 { 0x00dd11, state->dual_mode << 6, 0x40 }, /* enable EP5 */ in it930x_init()
1794 { 0x00d831, 0x01, 0xff }, /* Bit 1 of output driving control */ in it930x_init()
1797 /* suspend gpio1 for TS-C */ in it930x_init()
1802 /* suspend gpio7 for TS-D */ in it930x_init()
1807 /* suspend gpio13 for TS-B */ in it930x_init()
1812 /* suspend gpio14 for TS-E */ in it930x_init()
1817 /* suspend gpio15 for TS-A */ in it930x_init()
1829 dev_dbg(&intf->dev, "USB speed=%d frame_size=%04x packet_size=%02x\n", in it930x_init()
1830 d->udev->speed, frame_size, packet_size); in it930x_init()
1834 ret = af9035_wr_reg_mask(d, tab[i].reg, in it930x_init()
1843 dev_dbg(&intf->dev, "failed=%d\n", ret); in it930x_init()
1850 static int af9035_rc_query(struct dvb_usb_device *d) in af9035_rc_query() argument
1852 struct usb_interface *intf = d->intf; in af9035_rc_query()
1859 ret = af9035_ctrl_msg(d, &req); in af9035_rc_query()
1860 if (ret == 1) in af9035_rc_query()
1866 if ((buf[0] + buf[1]) == 0xff) { in af9035_rc_query()
1872 key = RC_SCANCODE_NECX(buf[0] << 8 | buf[1], buf[2]); in af9035_rc_query()
1877 key = RC_SCANCODE_NEC32(buf[0] << 24 | buf[1] << 16 | in af9035_rc_query()
1882 dev_dbg(&intf->dev, "%*ph\n", 4, buf); in af9035_rc_query()
1884 rc_keydown(d->rc_dev, proto, key, 0); in af9035_rc_query()
1889 dev_dbg(&intf->dev, "failed=%d\n", ret); in af9035_rc_query()
1894 static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) in af9035_get_rc_config() argument
1896 struct state *state = d_to_priv(d); in af9035_get_rc_config()
1897 struct usb_interface *intf = d->intf; in af9035_get_rc_config()
1899 dev_dbg(&intf->dev, "ir_mode=%02x ir_type=%02x\n", in af9035_get_rc_config()
1900 state->ir_mode, state->ir_type); in af9035_get_rc_config()
1903 if (state->ir_mode == 0x05) { in af9035_get_rc_config()
1904 switch (state->ir_type) { in af9035_get_rc_config()
1907 rc->allowed_protos = RC_PROTO_BIT_NEC | in af9035_get_rc_config()
1910 case 1: /* RC6 */ in af9035_get_rc_config()
1911 rc->allowed_protos = RC_PROTO_BIT_RC6_MCE; in af9035_get_rc_config()
1915 rc->query = af9035_rc_query; in af9035_get_rc_config()
1916 rc->interval = 500; in af9035_get_rc_config()
1919 if (!rc->map_name) in af9035_get_rc_config()
1920 rc->map_name = RC_MAP_EMPTY; in af9035_get_rc_config()
1932 struct dvb_usb_device *d = fe_to_d(fe); in af9035_get_stream_config() local
1933 struct usb_interface *intf = d->intf; in af9035_get_stream_config()
1935 dev_dbg(&intf->dev, "adap=%d\n", fe_to_adap(fe)->id); in af9035_get_stream_config()
1937 if (d->udev->speed == USB_SPEED_FULL) in af9035_get_stream_config()
1938 stream->u.bulk.buffersize = 5 * 188; in af9035_get_stream_config()
1947 return state->ops.pid_filter_ctrl(adap->fe[0], onoff); in af9035_pid_filter_ctrl()
1955 return state->ops.pid_filter(adap->fe[0], index, pid, onoff); in af9035_pid_filter()
1965 usb_string(udev, udev->descriptor.iManufacturer, in af9035_probe()
1975 * iManufacturer 1 Afatech in af9035_probe()
1976 * iProduct 2 DVB-T 2 in af9035_probe()
1981 * iManufacturer 1 ITE Technologies, Inc. in af9035_probe()
1982 * iProduct 2 DVB-T TV Stick in af9035_probe()
1984 if ((le16_to_cpu(udev->descriptor.idVendor) == USB_VID_TERRATEC) && in af9035_probe()
1985 (le16_to_cpu(udev->descriptor.idProduct) == 0x0099)) { in af9035_probe()
1987 dev_dbg(&udev->dev, "rejecting device\n"); in af9035_probe()
1988 return -ENODEV; in af9035_probe()
1995 /* interface 0 is used by DVB-T receiver and
1996 interface 1 is for remote controller (HID) */
2127 &af9035_props, "Kworld UB499-2T T09", RC_MAP_IT913X_V1) },
2129 &af9035_props, "Sveon STV22 Dual DVB-T HDTV",
2143 &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) },
2153 &it930x_props, "AVerMedia TD310 DVB-T2", NULL) },
2170 .no_dynamic_id = 1,
2171 .soft_unbind = 1,