2 * Afatech AF9035 DVB USB driver
4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
5 * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 /* Max transfer size done by I2C transfer functions */
25 #define MAX_XFER_SIZE 64
27 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
29 static u16
af9035_checksum(const u8
*buf
, size_t len
)
34 for (i
= 1; i
< len
; i
++) {
36 checksum
+= buf
[i
] << 8;
45 static int af9035_ctrl_msg(struct dvb_usb_device
*d
, struct usb_req
*req
)
47 #define REQ_HDR_LEN 4 /* send header size */
48 #define ACK_HDR_LEN 3 /* rece header size */
49 #define CHECKSUM_LEN 2
50 #define USB_TIMEOUT 2000
51 struct state
*state
= d_to_priv(d
);
53 u16 checksum
, tmp_checksum
;
55 mutex_lock(&d
->usb_mutex
);
57 /* buffer overflow check */
58 if (req
->wlen
> (BUF_LEN
- REQ_HDR_LEN
- CHECKSUM_LEN
) ||
59 req
->rlen
> (BUF_LEN
- ACK_HDR_LEN
- CHECKSUM_LEN
)) {
60 dev_err(&d
->udev
->dev
, "%s: too much data wlen=%d rlen=%d\n",
61 KBUILD_MODNAME
, req
->wlen
, req
->rlen
);
66 state
->buf
[0] = REQ_HDR_LEN
+ req
->wlen
+ CHECKSUM_LEN
- 1;
67 state
->buf
[1] = req
->mbox
;
68 state
->buf
[2] = req
->cmd
;
69 state
->buf
[3] = state
->seq
++;
70 memcpy(&state
->buf
[REQ_HDR_LEN
], req
->wbuf
, req
->wlen
);
72 wlen
= REQ_HDR_LEN
+ req
->wlen
+ CHECKSUM_LEN
;
73 rlen
= ACK_HDR_LEN
+ req
->rlen
+ CHECKSUM_LEN
;
75 /* calc and add checksum */
76 checksum
= af9035_checksum(state
->buf
, state
->buf
[0] - 1);
77 state
->buf
[state
->buf
[0] - 1] = (checksum
>> 8);
78 state
->buf
[state
->buf
[0] - 0] = (checksum
& 0xff);
80 /* no ack for these packets */
81 if (req
->cmd
== CMD_FW_DL
)
84 ret
= dvb_usbv2_generic_rw_locked(d
,
85 state
->buf
, wlen
, state
->buf
, rlen
);
89 /* no ack for those packets */
90 if (req
->cmd
== CMD_FW_DL
)
94 checksum
= af9035_checksum(state
->buf
, rlen
- 2);
95 tmp_checksum
= (state
->buf
[rlen
- 2] << 8) | state
->buf
[rlen
- 1];
96 if (tmp_checksum
!= checksum
) {
97 dev_err(&d
->udev
->dev
,
98 "%s: command=%02x checksum mismatch (%04x != %04x)\n",
99 KBUILD_MODNAME
, req
->cmd
, tmp_checksum
,
107 /* fw returns status 1 when IR code was not received */
108 if (req
->cmd
== CMD_IR_GET
|| state
->buf
[2] == 1) {
113 dev_dbg(&d
->udev
->dev
, "%s: command=%02x failed fw error=%d\n",
114 __func__
, req
->cmd
, state
->buf
[2]);
119 /* read request, copy returned data to return buf */
121 memcpy(req
->rbuf
, &state
->buf
[ACK_HDR_LEN
], req
->rlen
);
123 mutex_unlock(&d
->usb_mutex
);
125 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
129 /* write multiple registers */
130 static int af9035_wr_regs(struct dvb_usb_device
*d
, u32 reg
, u8
*val
, int len
)
132 u8 wbuf
[MAX_XFER_SIZE
];
133 u8 mbox
= (reg
>> 16) & 0xff;
134 struct usb_req req
= { CMD_MEM_WR
, mbox
, 6 + len
, wbuf
, 0, NULL
};
136 if (6 + len
> sizeof(wbuf
)) {
137 dev_warn(&d
->udev
->dev
, "%s: i2c wr: len=%d is too big!\n",
138 KBUILD_MODNAME
, len
);
146 wbuf
[4] = (reg
>> 8) & 0xff;
147 wbuf
[5] = (reg
>> 0) & 0xff;
148 memcpy(&wbuf
[6], val
, len
);
150 return af9035_ctrl_msg(d
, &req
);
153 /* read multiple registers */
154 static int af9035_rd_regs(struct dvb_usb_device
*d
, u32 reg
, u8
*val
, int len
)
156 u8 wbuf
[] = { len
, 2, 0, 0, (reg
>> 8) & 0xff, reg
& 0xff };
157 u8 mbox
= (reg
>> 16) & 0xff;
158 struct usb_req req
= { CMD_MEM_RD
, mbox
, sizeof(wbuf
), wbuf
, len
, val
};
160 return af9035_ctrl_msg(d
, &req
);
163 /* write single register */
164 static int af9035_wr_reg(struct dvb_usb_device
*d
, u32 reg
, u8 val
)
166 return af9035_wr_regs(d
, reg
, &val
, 1);
169 /* read single register */
170 static int af9035_rd_reg(struct dvb_usb_device
*d
, u32 reg
, u8
*val
)
172 return af9035_rd_regs(d
, reg
, val
, 1);
175 /* write single register with mask */
176 static int af9035_wr_reg_mask(struct dvb_usb_device
*d
, u32 reg
, u8 val
,
182 /* no need for read if whole reg is written */
184 ret
= af9035_rd_regs(d
, reg
, &tmp
, 1);
193 return af9035_wr_regs(d
, reg
, &val
, 1);
196 static int af9035_i2c_master_xfer(struct i2c_adapter
*adap
,
197 struct i2c_msg msg
[], int num
)
199 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
200 struct state
*state
= d_to_priv(d
);
203 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
207 * I2C sub header is 5 bytes long. Meaning of those bytes are:
211 * byte 3 and 4 can be used as reg addr
213 * used when reg addr len is set to 2
215 * used when reg addr len is set to 1 or 2
217 * For the simplify we do not use register addr at all.
218 * NOTE: As a firmware knows tuner type there is very small possibility
219 * there could be some tuner I2C hacks done by firmware and this may
220 * lead problems if firmware expects those bytes are used.
222 if (num
== 2 && !(msg
[0].flags
& I2C_M_RD
) &&
223 (msg
[1].flags
& I2C_M_RD
)) {
224 if (msg
[0].len
> 40 || msg
[1].len
> 40) {
225 /* TODO: correct limits > 40 */
227 } else if ((msg
[0].addr
== state
->af9033_config
[0].i2c_addr
) ||
228 (msg
[0].addr
== state
->af9033_config
[1].i2c_addr
)) {
229 /* demod access via firmware interface */
230 u32 reg
= msg
[0].buf
[0] << 16 | msg
[0].buf
[1] << 8 |
233 if (msg
[0].addr
== state
->af9033_config
[1].i2c_addr
)
236 ret
= af9035_rd_regs(d
, reg
, &msg
[1].buf
[0],
240 u8 buf
[MAX_XFER_SIZE
];
241 struct usb_req req
= { CMD_I2C_RD
, 0, 5 + msg
[0].len
,
242 buf
, msg
[1].len
, msg
[1].buf
};
244 if (5 + msg
[0].len
> sizeof(buf
)) {
245 dev_warn(&d
->udev
->dev
,
246 "%s: i2c xfer: len=%d is too big!\n",
247 KBUILD_MODNAME
, msg
[0].len
);
251 req
.mbox
|= ((msg
[0].addr
& 0x80) >> 3);
253 buf
[1] = msg
[0].addr
<< 1;
254 buf
[2] = 0x00; /* reg addr len */
255 buf
[3] = 0x00; /* reg addr MSB */
256 buf
[4] = 0x00; /* reg addr LSB */
257 memcpy(&buf
[5], msg
[0].buf
, msg
[0].len
);
258 ret
= af9035_ctrl_msg(d
, &req
);
260 } else if (num
== 1 && !(msg
[0].flags
& I2C_M_RD
)) {
261 if (msg
[0].len
> 40) {
262 /* TODO: correct limits > 40 */
264 } else if ((msg
[0].addr
== state
->af9033_config
[0].i2c_addr
) ||
265 (msg
[0].addr
== state
->af9033_config
[1].i2c_addr
)) {
266 /* demod access via firmware interface */
267 u32 reg
= msg
[0].buf
[0] << 16 | msg
[0].buf
[1] << 8 |
270 if (msg
[0].addr
== state
->af9033_config
[1].i2c_addr
)
273 ret
= af9035_wr_regs(d
, reg
, &msg
[0].buf
[3],
277 u8 buf
[MAX_XFER_SIZE
];
278 struct usb_req req
= { CMD_I2C_WR
, 0, 5 + msg
[0].len
,
281 if (5 + msg
[0].len
> sizeof(buf
)) {
282 dev_warn(&d
->udev
->dev
,
283 "%s: i2c xfer: len=%d is too big!\n",
284 KBUILD_MODNAME
, msg
[0].len
);
288 req
.mbox
|= ((msg
[0].addr
& 0x80) >> 3);
290 buf
[1] = msg
[0].addr
<< 1;
291 buf
[2] = 0x00; /* reg addr len */
292 buf
[3] = 0x00; /* reg addr MSB */
293 buf
[4] = 0x00; /* reg addr LSB */
294 memcpy(&buf
[5], msg
[0].buf
, msg
[0].len
);
295 ret
= af9035_ctrl_msg(d
, &req
);
297 } else if (num
== 1 && (msg
[0].flags
& I2C_M_RD
)) {
298 if (msg
[0].len
> 40) {
299 /* TODO: correct limits > 40 */
304 struct usb_req req
= { CMD_I2C_RD
, 0, sizeof(buf
),
305 buf
, msg
[0].len
, msg
[0].buf
};
306 req
.mbox
|= ((msg
[0].addr
& 0x80) >> 3);
308 buf
[1] = msg
[0].addr
<< 1;
309 buf
[2] = 0x00; /* reg addr len */
310 buf
[3] = 0x00; /* reg addr MSB */
311 buf
[4] = 0x00; /* reg addr LSB */
312 ret
= af9035_ctrl_msg(d
, &req
);
316 * We support only three kind of I2C transactions:
317 * 1) 1 x read + 1 x write (repeated start)
325 mutex_unlock(&d
->i2c_mutex
);
333 static u32
af9035_i2c_functionality(struct i2c_adapter
*adapter
)
338 static struct i2c_algorithm af9035_i2c_algo
= {
339 .master_xfer
= af9035_i2c_master_xfer
,
340 .functionality
= af9035_i2c_functionality
,
343 static int af9035_identify_state(struct dvb_usb_device
*d
, const char **name
)
345 struct state
*state
= d_to_priv(d
);
349 struct usb_req req
= { CMD_FW_QUERYINFO
, 0, sizeof(wbuf
), wbuf
,
350 sizeof(rbuf
), rbuf
};
352 ret
= af9035_rd_regs(d
, 0x1222, rbuf
, 3);
356 state
->chip_version
= rbuf
[0];
357 state
->chip_type
= rbuf
[2] << 8 | rbuf
[1] << 0;
359 ret
= af9035_rd_reg(d
, 0x384f, &state
->prechip_version
);
363 dev_info(&d
->udev
->dev
,
364 "%s: prechip_version=%02x chip_version=%02x chip_type=%04x\n",
365 KBUILD_MODNAME
, state
->prechip_version
,
366 state
->chip_version
, state
->chip_type
);
368 if (state
->chip_type
== 0x9135) {
369 if (state
->chip_version
== 0x02)
370 *name
= AF9035_FIRMWARE_IT9135_V2
;
372 *name
= AF9035_FIRMWARE_IT9135_V1
;
373 state
->eeprom_addr
= EEPROM_BASE_IT9135
;
375 *name
= AF9035_FIRMWARE_AF9035
;
376 state
->eeprom_addr
= EEPROM_BASE_AF9035
;
379 ret
= af9035_ctrl_msg(d
, &req
);
383 dev_dbg(&d
->udev
->dev
, "%s: reply=%*ph\n", __func__
, 4, rbuf
);
384 if (rbuf
[0] || rbuf
[1] || rbuf
[2] || rbuf
[3])
392 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
397 static int af9035_download_firmware_old(struct dvb_usb_device
*d
,
398 const struct firmware
*fw
)
402 struct usb_req req
= { 0, 0, 0, NULL
, 0, NULL
};
403 struct usb_req req_fw_dl
= { CMD_FW_DL
, 0, 0, wbuf
, 0, NULL
};
405 u16 hdr_addr
, hdr_data_len
, hdr_checksum
;
410 * Thanks to Daniel Glöckner <daniel-gl@gmx.net> about that info!
412 * byte 0: MCS 51 core
413 * There are two inside the AF9035 (1=Link and 2=OFDM) with separate
415 * byte 1-2: Big endian destination address
416 * byte 3-4: Big endian number of data bytes following the header
417 * byte 5-6: Big endian header checksum, apparently ignored by the chip
418 * Calculated as ~(h[0]*256+h[1]+h[2]*256+h[3]+h[4]*256)
421 for (i
= fw
->size
; i
> HDR_SIZE
;) {
422 hdr_core
= fw
->data
[fw
->size
- i
+ 0];
423 hdr_addr
= fw
->data
[fw
->size
- i
+ 1] << 8;
424 hdr_addr
|= fw
->data
[fw
->size
- i
+ 2] << 0;
425 hdr_data_len
= fw
->data
[fw
->size
- i
+ 3] << 8;
426 hdr_data_len
|= fw
->data
[fw
->size
- i
+ 4] << 0;
427 hdr_checksum
= fw
->data
[fw
->size
- i
+ 5] << 8;
428 hdr_checksum
|= fw
->data
[fw
->size
- i
+ 6] << 0;
430 dev_dbg(&d
->udev
->dev
,
431 "%s: core=%d addr=%04x data_len=%d checksum=%04x\n",
432 __func__
, hdr_core
, hdr_addr
, hdr_data_len
,
435 if (((hdr_core
!= 1) && (hdr_core
!= 2)) ||
436 (hdr_data_len
> i
)) {
437 dev_dbg(&d
->udev
->dev
, "%s: bad firmware\n", __func__
);
441 /* download begin packet */
442 req
.cmd
= CMD_FW_DL_BEGIN
;
443 ret
= af9035_ctrl_msg(d
, &req
);
447 /* download firmware packet(s) */
448 for (j
= HDR_SIZE
+ hdr_data_len
; j
> 0; j
-= MAX_DATA
) {
452 req_fw_dl
.wlen
= len
;
453 req_fw_dl
.wbuf
= (u8
*) &fw
->data
[fw
->size
- i
+
454 HDR_SIZE
+ hdr_data_len
- j
];
455 ret
= af9035_ctrl_msg(d
, &req_fw_dl
);
460 /* download end packet */
461 req
.cmd
= CMD_FW_DL_END
;
462 ret
= af9035_ctrl_msg(d
, &req
);
466 i
-= hdr_data_len
+ HDR_SIZE
;
468 dev_dbg(&d
->udev
->dev
, "%s: data uploaded=%zu\n",
469 __func__
, fw
->size
- i
);
472 /* print warn if firmware is bad, continue and see what happens */
474 dev_warn(&d
->udev
->dev
, "%s: bad firmware\n", KBUILD_MODNAME
);
479 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
484 static int af9035_download_firmware_new(struct dvb_usb_device
*d
,
485 const struct firmware
*fw
)
488 struct usb_req req_fw_dl
= { CMD_FW_SCATTER_WR
, 0, 0, NULL
, 0, NULL
};
492 * There seems to be following firmware header. Meaning of bytes 0-3
501 * 6: count of data bytes ?
503 for (i
= HDR_SIZE
, i_prev
= 0; i
<= fw
->size
; i
++) {
505 (fw
->data
[i
+ 0] == 0x03 &&
506 (fw
->data
[i
+ 1] == 0x00 ||
507 fw
->data
[i
+ 1] == 0x01) &&
508 fw
->data
[i
+ 2] == 0x00)) {
509 req_fw_dl
.wlen
= i
- i_prev
;
510 req_fw_dl
.wbuf
= (u8
*) &fw
->data
[i_prev
];
512 ret
= af9035_ctrl_msg(d
, &req_fw_dl
);
516 dev_dbg(&d
->udev
->dev
, "%s: data uploaded=%d\n",
524 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
529 static int af9035_download_firmware(struct dvb_usb_device
*d
,
530 const struct firmware
*fw
)
532 struct state
*state
= d_to_priv(d
);
537 struct usb_req req
= { 0, 0, 0, NULL
, 0, NULL
};
538 struct usb_req req_fw_ver
= { CMD_FW_QUERYINFO
, 0, 1, wbuf
, 4, rbuf
};
539 dev_dbg(&d
->udev
->dev
, "%s:\n", __func__
);
542 * In case of dual tuner configuration we need to do some extra
543 * initialization in order to download firmware to slave demod too,
544 * which is done by master demod.
545 * Master feeds also clock and controls power via GPIO.
547 ret
= af9035_rd_reg(d
, state
->eeprom_addr
+ EEPROM_TS_MODE
, &tmp
);
551 if (tmp
== 1 || tmp
== 3) {
552 /* configure gpioh1, reset & power slave demod */
553 ret
= af9035_wr_reg_mask(d
, 0x00d8b0, 0x01, 0x01);
557 ret
= af9035_wr_reg_mask(d
, 0x00d8b1, 0x01, 0x01);
561 ret
= af9035_wr_reg_mask(d
, 0x00d8af, 0x00, 0x01);
565 usleep_range(10000, 50000);
567 ret
= af9035_wr_reg_mask(d
, 0x00d8af, 0x01, 0x01);
571 /* tell the slave I2C address */
572 ret
= af9035_rd_reg(d
,
573 state
->eeprom_addr
+ EEPROM_2ND_DEMOD_ADDR
,
578 /* use default I2C address if eeprom has no address set */
582 if (state
->chip_type
== 0x9135) {
583 ret
= af9035_wr_reg(d
, 0x004bfb, tmp
);
587 ret
= af9035_wr_reg(d
, 0x00417f, tmp
);
591 /* enable clock out */
592 ret
= af9035_wr_reg_mask(d
, 0x00d81a, 0x01, 0x01);
598 if (fw
->data
[0] == 0x01)
599 ret
= af9035_download_firmware_old(d
, fw
);
601 ret
= af9035_download_firmware_new(d
, fw
);
605 /* firmware loaded, request boot */
606 req
.cmd
= CMD_FW_BOOT
;
607 ret
= af9035_ctrl_msg(d
, &req
);
611 /* ensure firmware starts */
613 ret
= af9035_ctrl_msg(d
, &req_fw_ver
);
617 if (!(rbuf
[0] || rbuf
[1] || rbuf
[2] || rbuf
[3])) {
618 dev_err(&d
->udev
->dev
, "%s: firmware did not run\n",
624 dev_info(&d
->udev
->dev
, "%s: firmware version=%d.%d.%d.%d",
625 KBUILD_MODNAME
, rbuf
[0], rbuf
[1], rbuf
[2], rbuf
[3]);
630 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
635 static int af9035_read_config(struct dvb_usb_device
*d
)
637 struct state
*state
= d_to_priv(d
);
642 /* demod I2C "address" */
643 state
->af9033_config
[0].i2c_addr
= 0x38;
644 state
->af9033_config
[1].i2c_addr
= 0x3a;
645 state
->af9033_config
[0].adc_multiplier
= AF9033_ADC_MULTIPLIER_2X
;
646 state
->af9033_config
[1].adc_multiplier
= AF9033_ADC_MULTIPLIER_2X
;
647 state
->af9033_config
[0].ts_mode
= AF9033_TS_MODE_USB
;
648 state
->af9033_config
[1].ts_mode
= AF9033_TS_MODE_SERIAL
;
650 /* eeprom memory mapped location */
651 if (state
->chip_type
== 0x9135) {
652 if (state
->chip_version
== 0x02) {
653 state
->af9033_config
[0].tuner
= AF9033_TUNER_IT9135_60
;
654 state
->af9033_config
[1].tuner
= AF9033_TUNER_IT9135_60
;
657 state
->af9033_config
[0].tuner
= AF9033_TUNER_IT9135_38
;
658 state
->af9033_config
[1].tuner
= AF9033_TUNER_IT9135_38
;
662 /* check if eeprom exists */
663 ret
= af9035_rd_reg(d
, tmp16
, &tmp
);
668 dev_dbg(&d
->udev
->dev
, "%s: no eeprom\n", __func__
);
673 /* check if there is dual tuners */
674 ret
= af9035_rd_reg(d
, state
->eeprom_addr
+ EEPROM_TS_MODE
, &tmp
);
678 if (tmp
== 1 || tmp
== 3)
679 state
->dual_mode
= true;
681 dev_dbg(&d
->udev
->dev
, "%s: ts mode=%d dual mode=%d\n", __func__
,
682 tmp
, state
->dual_mode
);
684 if (state
->dual_mode
) {
685 /* read 2nd demodulator I2C address */
686 ret
= af9035_rd_reg(d
,
687 state
->eeprom_addr
+ EEPROM_2ND_DEMOD_ADDR
,
693 state
->af9033_config
[1].i2c_addr
= tmp
;
695 dev_dbg(&d
->udev
->dev
, "%s: 2nd demod I2C addr=%02x\n",
699 addr
= state
->eeprom_addr
;
701 for (i
= 0; i
< state
->dual_mode
+ 1; i
++) {
703 ret
= af9035_rd_reg(d
, addr
+ EEPROM_1_TUNER_ID
, &tmp
);
707 dev_dbg(&d
->udev
->dev
, "%s: [%d]tuner=%02x\n",
710 /* tuner sanity check */
711 if (state
->chip_type
== 0x9135) {
712 if (state
->chip_version
== 0x02) {
715 case AF9033_TUNER_IT9135_60
:
716 case AF9033_TUNER_IT9135_61
:
717 case AF9033_TUNER_IT9135_62
:
718 state
->af9033_config
[i
].tuner
= tmp
;
724 case AF9033_TUNER_IT9135_38
:
725 case AF9033_TUNER_IT9135_51
:
726 case AF9033_TUNER_IT9135_52
:
727 state
->af9033_config
[i
].tuner
= tmp
;
733 state
->af9033_config
[i
].tuner
= tmp
;
736 if (state
->af9033_config
[i
].tuner
!= tmp
) {
737 dev_info(&d
->udev
->dev
,
738 "%s: [%d] overriding tuner from %02x to %02x\n",
739 KBUILD_MODNAME
, i
, tmp
,
740 state
->af9033_config
[i
].tuner
);
743 switch (state
->af9033_config
[i
].tuner
) {
744 case AF9033_TUNER_TUA9001
:
745 case AF9033_TUNER_FC0011
:
746 case AF9033_TUNER_MXL5007T
:
747 case AF9033_TUNER_TDA18218
:
748 case AF9033_TUNER_FC2580
:
749 case AF9033_TUNER_FC0012
:
750 state
->af9033_config
[i
].spec_inv
= 1;
752 case AF9033_TUNER_IT9135_38
:
753 case AF9033_TUNER_IT9135_51
:
754 case AF9033_TUNER_IT9135_52
:
755 case AF9033_TUNER_IT9135_60
:
756 case AF9033_TUNER_IT9135_61
:
757 case AF9033_TUNER_IT9135_62
:
760 dev_warn(&d
->udev
->dev
,
761 "%s: tuner id=%02x not supported, please report!",
762 KBUILD_MODNAME
, tmp
);
765 /* disable dual mode if driver does not support it */
767 switch (state
->af9033_config
[i
].tuner
) {
768 case AF9033_TUNER_FC0012
:
769 case AF9033_TUNER_IT9135_38
:
770 case AF9033_TUNER_IT9135_51
:
771 case AF9033_TUNER_IT9135_52
:
772 case AF9033_TUNER_IT9135_60
:
773 case AF9033_TUNER_IT9135_61
:
774 case AF9033_TUNER_IT9135_62
:
775 case AF9033_TUNER_MXL5007T
:
778 state
->dual_mode
= false;
779 dev_info(&d
->udev
->dev
,
780 "%s: driver does not support 2nd tuner and will disable it",
784 /* tuner IF frequency */
785 ret
= af9035_rd_reg(d
, addr
+ EEPROM_1_IF_L
, &tmp
);
791 ret
= af9035_rd_reg(d
, addr
+ EEPROM_1_IF_H
, &tmp
);
797 dev_dbg(&d
->udev
->dev
, "%s: [%d]IF=%d\n", __func__
, i
, tmp16
);
799 addr
+= 0x10; /* shift for the 2nd tuner params */
803 /* get demod clock */
804 ret
= af9035_rd_reg(d
, 0x00d800, &tmp
);
808 tmp
= (tmp
>> 0) & 0x0f;
810 for (i
= 0; i
< ARRAY_SIZE(state
->af9033_config
); i
++) {
811 if (state
->chip_type
== 0x9135)
812 state
->af9033_config
[i
].clock
= clock_lut_it9135
[tmp
];
814 state
->af9033_config
[i
].clock
= clock_lut_af9035
[tmp
];
820 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
825 static int af9035_tua9001_tuner_callback(struct dvb_usb_device
*d
,
831 dev_dbg(&d
->udev
->dev
, "%s: cmd=%d arg=%d\n", __func__
, cmd
, arg
);
834 * CEN always enabled by hardware wiring
840 case TUA9001_CMD_RESETN
:
846 ret
= af9035_wr_reg_mask(d
, 0x00d8e7, val
, 0x01);
850 case TUA9001_CMD_RXEN
:
856 ret
= af9035_wr_reg_mask(d
, 0x00d8eb, val
, 0x01);
865 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
871 static int af9035_fc0011_tuner_callback(struct dvb_usb_device
*d
,
877 case FC0011_FE_CALLBACK_POWER
:
879 ret
= af9035_wr_reg_mask(d
, 0xd8eb, 1, 1);
883 ret
= af9035_wr_reg_mask(d
, 0xd8ec, 1, 1);
887 ret
= af9035_wr_reg_mask(d
, 0xd8ed, 1, 1);
892 ret
= af9035_wr_reg_mask(d
, 0xd8d0, 1, 1);
896 ret
= af9035_wr_reg_mask(d
, 0xd8d1, 1, 1);
900 usleep_range(10000, 50000);
902 case FC0011_FE_CALLBACK_RESET
:
903 ret
= af9035_wr_reg(d
, 0xd8e9, 1);
907 ret
= af9035_wr_reg(d
, 0xd8e8, 1);
911 ret
= af9035_wr_reg(d
, 0xd8e7, 1);
915 usleep_range(10000, 20000);
917 ret
= af9035_wr_reg(d
, 0xd8e7, 0);
921 usleep_range(10000, 20000);
931 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
936 static int af9035_tuner_callback(struct dvb_usb_device
*d
, int cmd
, int arg
)
938 struct state
*state
= d_to_priv(d
);
940 switch (state
->af9033_config
[0].tuner
) {
941 case AF9033_TUNER_FC0011
:
942 return af9035_fc0011_tuner_callback(d
, cmd
, arg
);
943 case AF9033_TUNER_TUA9001
:
944 return af9035_tua9001_tuner_callback(d
, cmd
, arg
);
952 static int af9035_frontend_callback(void *adapter_priv
, int component
,
955 struct i2c_adapter
*adap
= adapter_priv
;
956 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
958 dev_dbg(&d
->udev
->dev
, "%s: component=%d cmd=%d arg=%d\n",
959 __func__
, component
, cmd
, arg
);
962 case DVB_FRONTEND_COMPONENT_TUNER
:
963 return af9035_tuner_callback(d
, cmd
, arg
);
971 static int af9035_get_adapter_count(struct dvb_usb_device
*d
)
973 struct state
*state
= d_to_priv(d
);
974 return state
->dual_mode
+ 1;
977 static int af9035_frontend_attach(struct dvb_usb_adapter
*adap
)
979 struct state
*state
= adap_to_priv(adap
);
980 struct dvb_usb_device
*d
= adap_to_d(adap
);
982 dev_dbg(&d
->udev
->dev
, "%s:\n", __func__
);
984 if (!state
->af9033_config
[adap
->id
].tuner
) {
985 /* unsupported tuner */
990 /* attach demodulator */
991 adap
->fe
[0] = dvb_attach(af9033_attach
, &state
->af9033_config
[adap
->id
],
992 &d
->i2c_adap
, &state
->ops
);
993 if (adap
->fe
[0] == NULL
) {
998 /* disable I2C-gate */
999 adap
->fe
[0]->ops
.i2c_gate_ctrl
= NULL
;
1000 adap
->fe
[0]->callback
= af9035_frontend_callback
;
1005 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
1010 static struct tua9001_config af9035_tua9001_config
= {
1014 static const struct fc0011_config af9035_fc0011_config
= {
1015 .i2c_address
= 0x60,
1018 static struct mxl5007t_config af9035_mxl5007t_config
[] = {
1020 .xtal_freq_hz
= MxL_XTAL_24_MHZ
,
1021 .if_freq_hz
= MxL_IF_4_57_MHZ
,
1023 .loop_thru_enable
= 0,
1024 .clk_out_enable
= 0,
1025 .clk_out_amp
= MxL_CLKOUT_AMP_0_94V
,
1027 .xtal_freq_hz
= MxL_XTAL_24_MHZ
,
1028 .if_freq_hz
= MxL_IF_4_57_MHZ
,
1030 .loop_thru_enable
= 1,
1031 .clk_out_enable
= 1,
1032 .clk_out_amp
= MxL_CLKOUT_AMP_0_94V
,
1036 static struct tda18218_config af9035_tda18218_config
= {
1037 .i2c_address
= 0x60,
1041 static const struct fc2580_config af9035_fc2580_config
= {
1046 static const struct fc0012_config af9035_fc0012_config
[] = {
1048 .i2c_address
= 0x63,
1049 .xtal_freq
= FC_XTAL_36_MHZ
,
1050 .dual_master
= true,
1051 .loop_through
= true,
1054 .i2c_address
= 0x63 | 0x80, /* I2C bus select hack */
1055 .xtal_freq
= FC_XTAL_36_MHZ
,
1056 .dual_master
= true,
1060 static int af9035_tuner_attach(struct dvb_usb_adapter
*adap
)
1062 struct state
*state
= adap_to_priv(adap
);
1063 struct dvb_usb_device
*d
= adap_to_d(adap
);
1065 struct dvb_frontend
*fe
;
1066 struct i2c_msg msg
[1];
1068 dev_dbg(&d
->udev
->dev
, "%s:\n", __func__
);
1071 * XXX: Hack used in that function: we abuse unused I2C address bit [7]
1072 * to carry info about used I2C bus for dual tuner configuration.
1075 switch (state
->af9033_config
[adap
->id
].tuner
) {
1076 case AF9033_TUNER_TUA9001
:
1077 /* AF9035 gpiot3 = TUA9001 RESETN
1078 AF9035 gpiot2 = TUA9001 RXEN */
1080 /* configure gpiot2 and gpiot2 as output */
1081 ret
= af9035_wr_reg_mask(d
, 0x00d8ec, 0x01, 0x01);
1085 ret
= af9035_wr_reg_mask(d
, 0x00d8ed, 0x01, 0x01);
1089 ret
= af9035_wr_reg_mask(d
, 0x00d8e8, 0x01, 0x01);
1093 ret
= af9035_wr_reg_mask(d
, 0x00d8e9, 0x01, 0x01);
1098 fe
= dvb_attach(tua9001_attach
, adap
->fe
[0],
1099 &d
->i2c_adap
, &af9035_tua9001_config
);
1101 case AF9033_TUNER_FC0011
:
1102 fe
= dvb_attach(fc0011_attach
, adap
->fe
[0],
1103 &d
->i2c_adap
, &af9035_fc0011_config
);
1105 case AF9033_TUNER_MXL5007T
:
1106 if (adap
->id
== 0) {
1107 ret
= af9035_wr_reg(d
, 0x00d8e0, 1);
1111 ret
= af9035_wr_reg(d
, 0x00d8e1, 1);
1115 ret
= af9035_wr_reg(d
, 0x00d8df, 0);
1121 ret
= af9035_wr_reg(d
, 0x00d8df, 1);
1127 ret
= af9035_wr_reg(d
, 0x00d8c0, 1);
1131 ret
= af9035_wr_reg(d
, 0x00d8c1, 1);
1135 ret
= af9035_wr_reg(d
, 0x00d8bf, 0);
1139 ret
= af9035_wr_reg(d
, 0x00d8b4, 1);
1143 ret
= af9035_wr_reg(d
, 0x00d8b5, 1);
1147 ret
= af9035_wr_reg(d
, 0x00d8b3, 1);
1153 tuner_addr
= 0x60 | 0x80; /* I2C bus hack */
1157 fe
= dvb_attach(mxl5007t_attach
, adap
->fe
[0], &d
->i2c_adap
,
1158 tuner_addr
, &af9035_mxl5007t_config
[adap
->id
]);
1160 case AF9033_TUNER_TDA18218
:
1162 fe
= dvb_attach(tda18218_attach
, adap
->fe
[0],
1163 &d
->i2c_adap
, &af9035_tda18218_config
);
1165 case AF9033_TUNER_FC2580
:
1166 /* Tuner enable using gpiot2_o, gpiot2_en and gpiot2_on */
1167 ret
= af9035_wr_reg_mask(d
, 0xd8eb, 0x01, 0x01);
1171 ret
= af9035_wr_reg_mask(d
, 0xd8ec, 0x01, 0x01);
1175 ret
= af9035_wr_reg_mask(d
, 0xd8ed, 0x01, 0x01);
1179 usleep_range(10000, 50000);
1181 fe
= dvb_attach(fc2580_attach
, adap
->fe
[0],
1182 &d
->i2c_adap
, &af9035_fc2580_config
);
1184 case AF9033_TUNER_FC0012
:
1186 * AF9035 gpiot2 = FC0012 enable
1187 * XXX: there seems to be something on gpioh8 too, but on my
1188 * my test I didn't find any difference.
1191 if (adap
->id
== 0) {
1192 /* configure gpiot2 as output and high */
1193 ret
= af9035_wr_reg_mask(d
, 0xd8eb, 0x01, 0x01);
1197 ret
= af9035_wr_reg_mask(d
, 0xd8ec, 0x01, 0x01);
1201 ret
= af9035_wr_reg_mask(d
, 0xd8ed, 0x01, 0x01);
1206 * FIXME: That belongs for the FC0012 driver.
1207 * Write 02 to FC0012 master tuner register 0d directly
1208 * in order to make slave tuner working.
1213 msg
[0].buf
= "\x0d\x02";
1214 ret
= i2c_transfer(&d
->i2c_adap
, msg
, 1);
1219 usleep_range(10000, 50000);
1221 fe
= dvb_attach(fc0012_attach
, adap
->fe
[0], &d
->i2c_adap
,
1222 &af9035_fc0012_config
[adap
->id
]);
1224 case AF9033_TUNER_IT9135_38
:
1225 case AF9033_TUNER_IT9135_51
:
1226 case AF9033_TUNER_IT9135_52
:
1227 case AF9033_TUNER_IT9135_60
:
1228 case AF9033_TUNER_IT9135_61
:
1229 case AF9033_TUNER_IT9135_62
:
1231 fe
= dvb_attach(it913x_attach
, adap
->fe
[0], &d
->i2c_adap
,
1232 state
->af9033_config
[adap
->id
].i2c_addr
,
1233 state
->af9033_config
[0].tuner
);
1247 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
1252 static int af9035_init(struct dvb_usb_device
*d
)
1254 struct state
*state
= d_to_priv(d
);
1256 u16 frame_size
= (d
->udev
->speed
== USB_SPEED_FULL
? 5 : 87) * 188 / 4;
1257 u8 packet_size
= (d
->udev
->speed
== USB_SPEED_FULL
? 64 : 512) / 4;
1258 struct reg_val_mask tab
[] = {
1259 { 0x80f99d, 0x01, 0x01 },
1260 { 0x80f9a4, 0x01, 0x01 },
1261 { 0x00dd11, 0x00, 0x20 },
1262 { 0x00dd11, 0x00, 0x40 },
1263 { 0x00dd13, 0x00, 0x20 },
1264 { 0x00dd13, 0x00, 0x40 },
1265 { 0x00dd11, 0x20, 0x20 },
1266 { 0x00dd88, (frame_size
>> 0) & 0xff, 0xff},
1267 { 0x00dd89, (frame_size
>> 8) & 0xff, 0xff},
1268 { 0x00dd0c, packet_size
, 0xff},
1269 { 0x00dd11, state
->dual_mode
<< 6, 0x40 },
1270 { 0x00dd8a, (frame_size
>> 0) & 0xff, 0xff},
1271 { 0x00dd8b, (frame_size
>> 8) & 0xff, 0xff},
1272 { 0x00dd0d, packet_size
, 0xff },
1273 { 0x80f9a3, state
->dual_mode
, 0x01 },
1274 { 0x80f9cd, state
->dual_mode
, 0x01 },
1275 { 0x80f99d, 0x00, 0x01 },
1276 { 0x80f9a4, 0x00, 0x01 },
1279 dev_dbg(&d
->udev
->dev
,
1280 "%s: USB speed=%d frame_size=%04x packet_size=%02x\n",
1281 __func__
, d
->udev
->speed
, frame_size
, packet_size
);
1283 /* init endpoints */
1284 for (i
= 0; i
< ARRAY_SIZE(tab
); i
++) {
1285 ret
= af9035_wr_reg_mask(d
, tab
[i
].reg
, tab
[i
].val
,
1294 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
1299 #if IS_ENABLED(CONFIG_RC_CORE)
1300 static int af9035_rc_query(struct dvb_usb_device
*d
)
1305 struct usb_req req
= { CMD_IR_GET
, 0, 0, NULL
, 4, buf
};
1307 ret
= af9035_ctrl_msg(d
, &req
);
1313 if ((buf
[2] + buf
[3]) == 0xff) {
1314 if ((buf
[0] + buf
[1]) == 0xff) {
1315 /* NEC standard 16bit */
1316 key
= buf
[0] << 8 | buf
[2];
1318 /* NEC extended 24bit */
1319 key
= buf
[0] << 16 | buf
[1] << 8 | buf
[2];
1322 /* NEC full code 32bit */
1323 key
= buf
[0] << 24 | buf
[1] << 16 | buf
[2] << 8 | buf
[3];
1326 dev_dbg(&d
->udev
->dev
, "%s: %*ph\n", __func__
, 4, buf
);
1328 rc_keydown(d
->rc_dev
, key
, 0);
1333 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
1338 static int af9035_get_rc_config(struct dvb_usb_device
*d
, struct dvb_usb_rc
*rc
)
1340 struct state
*state
= d_to_priv(d
);
1344 ret
= af9035_rd_reg(d
, state
->eeprom_addr
+ EEPROM_IR_MODE
, &tmp
);
1348 dev_dbg(&d
->udev
->dev
, "%s: ir_mode=%02x\n", __func__
, tmp
);
1350 /* don't activate rc if in HID mode or if not available */
1352 ret
= af9035_rd_reg(d
, state
->eeprom_addr
+ EEPROM_IR_TYPE
,
1357 dev_dbg(&d
->udev
->dev
, "%s: ir_type=%02x\n", __func__
, tmp
);
1362 rc
->allowed_protos
= RC_BIT_NEC
;
1365 rc
->allowed_protos
= RC_BIT_RC6_MCE
;
1369 rc
->query
= af9035_rc_query
;
1372 /* load empty to enable rc */
1374 rc
->map_name
= RC_MAP_EMPTY
;
1380 dev_dbg(&d
->udev
->dev
, "%s: failed=%d\n", __func__
, ret
);
1385 #define af9035_get_rc_config NULL
1388 static int af9035_get_stream_config(struct dvb_frontend
*fe
, u8
*ts_type
,
1389 struct usb_data_stream_properties
*stream
)
1391 struct dvb_usb_device
*d
= fe_to_d(fe
);
1392 dev_dbg(&d
->udev
->dev
, "%s: adap=%d\n", __func__
, fe_to_adap(fe
)->id
);
1394 if (d
->udev
->speed
== USB_SPEED_FULL
)
1395 stream
->u
.bulk
.buffersize
= 5 * 188;
1400 static int af9035_pid_filter_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
1402 struct state
*state
= adap_to_priv(adap
);
1404 return state
->ops
.pid_filter_ctrl(adap
->fe
[0], onoff
);
1407 static int af9035_pid_filter(struct dvb_usb_adapter
*adap
, int index
, u16 pid
,
1410 struct state
*state
= adap_to_priv(adap
);
1412 return state
->ops
.pid_filter(adap
->fe
[0], index
, pid
, onoff
);
1415 static int af9035_probe(struct usb_interface
*intf
,
1416 const struct usb_device_id
*id
)
1418 struct usb_device
*udev
= interface_to_usbdev(intf
);
1419 char manufacturer
[sizeof("Afatech")];
1421 memset(manufacturer
, 0, sizeof(manufacturer
));
1422 usb_string(udev
, udev
->descriptor
.iManufacturer
,
1423 manufacturer
, sizeof(manufacturer
));
1425 * There is two devices having same ID but different chipset. One uses
1426 * AF9015 and the other IT9135 chipset. Only difference seen on lsusb
1427 * is iManufacturer string.
1429 * idVendor 0x0ccd TerraTec Electronic GmbH
1432 * iManufacturer 1 Afatech
1433 * iProduct 2 DVB-T 2
1435 * idVendor 0x0ccd TerraTec Electronic GmbH
1438 * iManufacturer 1 ITE Technologies, Inc.
1439 * iProduct 2 DVB-T TV Stick
1441 if ((le16_to_cpu(udev
->descriptor
.idVendor
) == USB_VID_TERRATEC
) &&
1442 (le16_to_cpu(udev
->descriptor
.idProduct
) == 0x0099)) {
1443 if (!strcmp("Afatech", manufacturer
)) {
1444 dev_dbg(&udev
->dev
, "%s: rejecting device\n", __func__
);
1449 return dvb_usbv2_probe(intf
, id
);
1452 /* interface 0 is used by DVB-T receiver and
1453 interface 1 is for remote controller (HID) */
1454 static const struct dvb_usb_device_properties af9035_props
= {
1455 .driver_name
= KBUILD_MODNAME
,
1456 .owner
= THIS_MODULE
,
1457 .adapter_nr
= adapter_nr
,
1458 .size_of_priv
= sizeof(struct state
),
1460 .generic_bulk_ctrl_endpoint
= 0x02,
1461 .generic_bulk_ctrl_endpoint_response
= 0x81,
1463 .identify_state
= af9035_identify_state
,
1464 .download_firmware
= af9035_download_firmware
,
1466 .i2c_algo
= &af9035_i2c_algo
,
1467 .read_config
= af9035_read_config
,
1468 .frontend_attach
= af9035_frontend_attach
,
1469 .tuner_attach
= af9035_tuner_attach
,
1470 .init
= af9035_init
,
1471 .get_rc_config
= af9035_get_rc_config
,
1472 .get_stream_config
= af9035_get_stream_config
,
1474 .get_adapter_count
= af9035_get_adapter_count
,
1477 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
1478 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
1480 .pid_filter_count
= 32,
1481 .pid_filter_ctrl
= af9035_pid_filter_ctrl
,
1482 .pid_filter
= af9035_pid_filter
,
1484 .stream
= DVB_USB_STREAM_BULK(0x84, 6, 87 * 188),
1486 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
1487 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
1489 .pid_filter_count
= 32,
1490 .pid_filter_ctrl
= af9035_pid_filter_ctrl
,
1491 .pid_filter
= af9035_pid_filter
,
1493 .stream
= DVB_USB_STREAM_BULK(0x85, 6, 87 * 188),
1498 static const struct usb_device_id af9035_id_table
[] = {
1499 /* AF9035 devices */
1500 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9035_9035
,
1501 &af9035_props
, "Afatech AF9035 reference design", NULL
) },
1502 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9035_1000
,
1503 &af9035_props
, "Afatech AF9035 reference design", NULL
) },
1504 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9035_1001
,
1505 &af9035_props
, "Afatech AF9035 reference design", NULL
) },
1506 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9035_1002
,
1507 &af9035_props
, "Afatech AF9035 reference design", NULL
) },
1508 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9035_1003
,
1509 &af9035_props
, "Afatech AF9035 reference design", NULL
) },
1510 { DVB_USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_STICK
,
1511 &af9035_props
, "TerraTec Cinergy T Stick", NULL
) },
1512 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A835
,
1513 &af9035_props
, "AVerMedia AVerTV Volar HD/PRO (A835)", NULL
) },
1514 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_B835
,
1515 &af9035_props
, "AVerMedia AVerTV Volar HD/PRO (A835)", NULL
) },
1516 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_1867
,
1517 &af9035_props
, "AVerMedia HD Volar (A867)", NULL
) },
1518 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A867
,
1519 &af9035_props
, "AVerMedia HD Volar (A867)", NULL
) },
1520 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_TWINSTAR
,
1521 &af9035_props
, "AVerMedia Twinstar (A825)", NULL
) },
1522 { DVB_USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3100MINI_PLUS
,
1523 &af9035_props
, "Asus U3100Mini Plus", NULL
) },
1524 { DVB_USB_DEVICE(USB_VID_TERRATEC
, 0x00aa,
1525 &af9035_props
, "TerraTec Cinergy T Stick (rev. 2)", NULL
) },
1526 /* IT9135 devices */
1527 { DVB_USB_DEVICE(USB_VID_ITETECH
, USB_PID_ITETECH_IT9135
,
1528 &af9035_props
, "ITE 9135 Generic", RC_MAP_IT913X_V1
) },
1529 { DVB_USB_DEVICE(USB_VID_ITETECH
, USB_PID_ITETECH_IT9135_9005
,
1530 &af9035_props
, "ITE 9135(9005) Generic", RC_MAP_IT913X_V2
) },
1531 { DVB_USB_DEVICE(USB_VID_ITETECH
, USB_PID_ITETECH_IT9135_9006
,
1532 &af9035_props
, "ITE 9135(9006) Generic", RC_MAP_IT913X_V1
) },
1533 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A835B_1835
,
1534 &af9035_props
, "Avermedia A835B(1835)", RC_MAP_IT913X_V2
) },
1535 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A835B_2835
,
1536 &af9035_props
, "Avermedia A835B(2835)", RC_MAP_IT913X_V2
) },
1537 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A835B_3835
,
1538 &af9035_props
, "Avermedia A835B(3835)", RC_MAP_IT913X_V2
) },
1539 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A835B_4835
,
1540 &af9035_props
, "Avermedia A835B(4835)", RC_MAP_IT913X_V2
) },
1541 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_H335
,
1542 &af9035_props
, "Avermedia H335", RC_MAP_IT913X_V2
) },
1543 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_UB499_2T_T09
,
1544 &af9035_props
, "Kworld UB499-2T T09", RC_MAP_IT913X_V1
) },
1545 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_SVEON_STV22_IT9137
,
1546 &af9035_props
, "Sveon STV22 Dual DVB-T HDTV",
1547 RC_MAP_IT913X_V1
) },
1548 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_CTVDIGDUAL_V2
,
1549 &af9035_props
, "Digital Dual TV Receiver CTVDIGDUAL_V2",
1550 RC_MAP_IT913X_V1
) },
1551 /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */
1552 { DVB_USB_DEVICE(USB_VID_TERRATEC
, 0x0099,
1553 &af9035_props
, "TerraTec Cinergy T Stick Dual RC (rev. 2)", NULL
) },
1554 { DVB_USB_DEVICE(USB_VID_LEADTEK
, 0x6a05,
1555 &af9035_props
, "Leadtek WinFast DTV Dongle Dual", NULL
) },
1556 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE
, 0xf900,
1557 &af9035_props
, "Hauppauge WinTV-MiniStick 2", NULL
) },
1560 MODULE_DEVICE_TABLE(usb
, af9035_id_table
);
1562 static struct usb_driver af9035_usb_driver
= {
1563 .name
= KBUILD_MODNAME
,
1564 .id_table
= af9035_id_table
,
1565 .probe
= af9035_probe
,
1566 .disconnect
= dvb_usbv2_disconnect
,
1567 .suspend
= dvb_usbv2_suspend
,
1568 .resume
= dvb_usbv2_resume
,
1569 .reset_resume
= dvb_usbv2_reset_resume
,
1574 module_usb_driver(af9035_usb_driver
);
1576 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
1577 MODULE_DESCRIPTION("Afatech AF9035 driver");
1578 MODULE_LICENSE("GPL");
1579 MODULE_FIRMWARE(AF9035_FIRMWARE_AF9035
);
1580 MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135_V1
);
1581 MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135_V2
);