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
);
52 struct usb_interface
*intf
= d
->intf
;
54 u16 checksum
, tmp_checksum
;
56 mutex_lock(&d
->usb_mutex
);
58 /* buffer overflow check */
59 if (req
->wlen
> (BUF_LEN
- REQ_HDR_LEN
- CHECKSUM_LEN
) ||
60 req
->rlen
> (BUF_LEN
- ACK_HDR_LEN
- CHECKSUM_LEN
)) {
61 dev_err(&intf
->dev
, "too much data wlen=%d rlen=%d\n",
62 req
->wlen
, req
->rlen
);
67 state
->buf
[0] = REQ_HDR_LEN
+ req
->wlen
+ CHECKSUM_LEN
- 1;
68 state
->buf
[1] = req
->mbox
;
69 state
->buf
[2] = req
->cmd
;
70 state
->buf
[3] = state
->seq
++;
71 memcpy(&state
->buf
[REQ_HDR_LEN
], req
->wbuf
, req
->wlen
);
73 wlen
= REQ_HDR_LEN
+ req
->wlen
+ CHECKSUM_LEN
;
74 rlen
= ACK_HDR_LEN
+ req
->rlen
+ CHECKSUM_LEN
;
76 /* calc and add checksum */
77 checksum
= af9035_checksum(state
->buf
, state
->buf
[0] - 1);
78 state
->buf
[state
->buf
[0] - 1] = (checksum
>> 8);
79 state
->buf
[state
->buf
[0] - 0] = (checksum
& 0xff);
81 /* no ack for these packets */
82 if (req
->cmd
== CMD_FW_DL
)
85 ret
= dvb_usbv2_generic_rw_locked(d
,
86 state
->buf
, wlen
, state
->buf
, rlen
);
90 /* no ack for those packets */
91 if (req
->cmd
== CMD_FW_DL
)
95 checksum
= af9035_checksum(state
->buf
, rlen
- 2);
96 tmp_checksum
= (state
->buf
[rlen
- 2] << 8) | state
->buf
[rlen
- 1];
97 if (tmp_checksum
!= checksum
) {
98 dev_err(&intf
->dev
, "command=%02x checksum mismatch (%04x != %04x)\n",
99 req
->cmd
, tmp_checksum
, checksum
);
106 /* fw returns status 1 when IR code was not received */
107 if (req
->cmd
== CMD_IR_GET
|| state
->buf
[2] == 1) {
112 dev_dbg(&intf
->dev
, "command=%02x failed fw error=%d\n",
113 req
->cmd
, state
->buf
[2]);
118 /* read request, copy returned data to return buf */
120 memcpy(req
->rbuf
, &state
->buf
[ACK_HDR_LEN
], req
->rlen
);
122 mutex_unlock(&d
->usb_mutex
);
124 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
128 /* write multiple registers */
129 static int af9035_wr_regs(struct dvb_usb_device
*d
, u32 reg
, u8
*val
, int len
)
131 struct usb_interface
*intf
= d
->intf
;
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(&intf
->dev
, "i2c wr: len=%d is too big!\n", len
);
145 wbuf
[4] = (reg
>> 8) & 0xff;
146 wbuf
[5] = (reg
>> 0) & 0xff;
147 memcpy(&wbuf
[6], val
, len
);
149 return af9035_ctrl_msg(d
, &req
);
152 /* read multiple registers */
153 static int af9035_rd_regs(struct dvb_usb_device
*d
, u32 reg
, u8
*val
, int len
)
155 u8 wbuf
[] = { len
, 2, 0, 0, (reg
>> 8) & 0xff, reg
& 0xff };
156 u8 mbox
= (reg
>> 16) & 0xff;
157 struct usb_req req
= { CMD_MEM_RD
, mbox
, sizeof(wbuf
), wbuf
, len
, val
};
159 return af9035_ctrl_msg(d
, &req
);
162 /* write single register */
163 static int af9035_wr_reg(struct dvb_usb_device
*d
, u32 reg
, u8 val
)
165 return af9035_wr_regs(d
, reg
, &val
, 1);
168 /* read single register */
169 static int af9035_rd_reg(struct dvb_usb_device
*d
, u32 reg
, u8
*val
)
171 return af9035_rd_regs(d
, reg
, val
, 1);
174 /* write single register with mask */
175 static int af9035_wr_reg_mask(struct dvb_usb_device
*d
, u32 reg
, u8 val
,
181 /* no need for read if whole reg is written */
183 ret
= af9035_rd_regs(d
, reg
, &tmp
, 1);
192 return af9035_wr_regs(d
, reg
, &val
, 1);
195 static int af9035_add_i2c_dev(struct dvb_usb_device
*d
, const char *type
,
196 u8 addr
, void *platform_data
, struct i2c_adapter
*adapter
)
199 struct state
*state
= d_to_priv(d
);
200 struct usb_interface
*intf
= d
->intf
;
201 struct i2c_client
*client
;
202 struct i2c_board_info board_info
= {
204 .platform_data
= platform_data
,
207 strlcpy(board_info
.type
, type
, I2C_NAME_SIZE
);
209 /* find first free client */
210 for (num
= 0; num
< AF9035_I2C_CLIENT_MAX
; num
++) {
211 if (state
->i2c_client
[num
] == NULL
)
215 dev_dbg(&intf
->dev
, "num=%d\n", num
);
217 if (num
== AF9035_I2C_CLIENT_MAX
) {
218 dev_err(&intf
->dev
, "I2C client out of index\n");
223 request_module("%s", board_info
.type
);
225 /* register I2C device */
226 client
= i2c_new_device(adapter
, &board_info
);
227 if (client
== NULL
|| client
->dev
.driver
== NULL
) {
232 /* increase I2C driver usage count */
233 if (!try_module_get(client
->dev
.driver
->owner
)) {
234 i2c_unregister_device(client
);
239 state
->i2c_client
[num
] = client
;
242 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
246 static void af9035_del_i2c_dev(struct dvb_usb_device
*d
)
249 struct state
*state
= d_to_priv(d
);
250 struct usb_interface
*intf
= d
->intf
;
251 struct i2c_client
*client
;
253 /* find last used client */
254 num
= AF9035_I2C_CLIENT_MAX
;
256 if (state
->i2c_client
[num
] != NULL
)
260 dev_dbg(&intf
->dev
, "num=%d\n", num
);
263 dev_err(&intf
->dev
, "I2C client out of index\n");
267 client
= state
->i2c_client
[num
];
269 /* decrease I2C driver usage count */
270 module_put(client
->dev
.driver
->owner
);
272 /* unregister I2C device */
273 i2c_unregister_device(client
);
275 state
->i2c_client
[num
] = NULL
;
278 dev_dbg(&intf
->dev
, "failed\n");
281 static int af9035_i2c_master_xfer(struct i2c_adapter
*adap
,
282 struct i2c_msg msg
[], int num
)
284 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
285 struct state
*state
= d_to_priv(d
);
288 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
292 * AF9035 I2C sub header is 5 bytes long. Meaning of those bytes are:
296 * byte 3 and 4 can be used as reg addr
298 * used when reg addr len is set to 2
300 * used when reg addr len is set to 1 or 2
302 * For the simplify we do not use register addr at all.
303 * NOTE: As a firmware knows tuner type there is very small possibility
304 * there could be some tuner I2C hacks done by firmware and this may
305 * lead problems if firmware expects those bytes are used.
307 * TODO: Here is few hacks. AF9035 chip integrates AF9033 demodulator.
308 * IT9135 chip integrates AF9033 demodulator and RF tuner. For dual
309 * tuner devices, there is also external AF9033 demodulator connected
310 * via external I2C bus. All AF9033 demod I2C traffic, both single and
311 * dual tuner configuration, is covered by firmware - actual USB IO
312 * looks just like a memory access.
313 * In case of IT913x chip, there is own tuner driver. It is implemented
314 * currently as a I2C driver, even tuner IP block is likely build
315 * directly into the demodulator memory space and there is no own I2C
316 * bus. I2C subsystem does not allow register multiple devices to same
317 * bus, having same slave address. Due to that we reuse demod address,
318 * shifted by one bit, on that case.
320 * For IT930x we use a different command and the sub header is
323 * 1: I2C bus (0x03 seems to be only value used)
326 #define AF9035_IS_I2C_XFER_WRITE_READ(_msg, _num) \
327 (_num == 2 && !(_msg[0].flags & I2C_M_RD) && (_msg[1].flags & I2C_M_RD))
328 #define AF9035_IS_I2C_XFER_WRITE(_msg, _num) \
329 (_num == 1 && !(_msg[0].flags & I2C_M_RD))
330 #define AF9035_IS_I2C_XFER_READ(_msg, _num) \
331 (_num == 1 && (_msg[0].flags & I2C_M_RD))
333 if (AF9035_IS_I2C_XFER_WRITE_READ(msg
, num
)) {
334 if (msg
[0].len
> 40 || msg
[1].len
> 40) {
335 /* TODO: correct limits > 40 */
337 } else if ((msg
[0].addr
== state
->af9033_i2c_addr
[0]) ||
338 (msg
[0].addr
== state
->af9033_i2c_addr
[1])) {
339 /* demod access via firmware interface */
340 u32 reg
= msg
[0].buf
[0] << 16 | msg
[0].buf
[1] << 8 |
343 if (msg
[0].addr
== state
->af9033_i2c_addr
[1])
346 ret
= af9035_rd_regs(d
, reg
, &msg
[1].buf
[0],
348 } else if (state
->no_read
) {
349 memset(msg
[1].buf
, 0, msg
[1].len
);
352 /* I2C write + read */
353 u8 buf
[MAX_XFER_SIZE
];
354 struct usb_req req
= { CMD_I2C_RD
, 0, 5 + msg
[0].len
,
355 buf
, msg
[1].len
, msg
[1].buf
};
357 if (state
->chip_type
== 0x9306) {
358 req
.cmd
= CMD_GENERIC_I2C_RD
;
359 req
.wlen
= 3 + msg
[0].len
;
361 req
.mbox
|= ((msg
[0].addr
& 0x80) >> 3);
364 if (state
->chip_type
== 0x9306) {
365 buf
[1] = 0x03; /* I2C bus */
366 buf
[2] = msg
[0].addr
<< 1;
367 memcpy(&buf
[3], msg
[0].buf
, msg
[0].len
);
369 buf
[1] = msg
[0].addr
<< 1;
370 buf
[3] = 0x00; /* reg addr MSB */
371 buf
[4] = 0x00; /* reg addr LSB */
373 /* Keep prev behavior for write req len > 2*/
374 if (msg
[0].len
> 2) {
375 buf
[2] = 0x00; /* reg addr len */
376 memcpy(&buf
[5], msg
[0].buf
, msg
[0].len
);
378 /* Use reg addr fields if write req len <= 2 */
382 if (msg
[0].len
== 2) {
383 buf
[3] = msg
[0].buf
[0];
384 buf
[4] = msg
[0].buf
[1];
385 } else if (msg
[0].len
== 1) {
386 buf
[4] = msg
[0].buf
[0];
390 ret
= af9035_ctrl_msg(d
, &req
);
392 } else if (AF9035_IS_I2C_XFER_WRITE(msg
, num
)) {
393 if (msg
[0].len
> 40) {
394 /* TODO: correct limits > 40 */
396 } else if ((msg
[0].addr
== state
->af9033_i2c_addr
[0]) ||
397 (msg
[0].addr
== state
->af9033_i2c_addr
[1])) {
398 /* demod access via firmware interface */
399 u32 reg
= msg
[0].buf
[0] << 16 | msg
[0].buf
[1] << 8 |
402 if (msg
[0].addr
== state
->af9033_i2c_addr
[1])
405 ret
= af9035_wr_regs(d
, reg
, &msg
[0].buf
[3],
409 u8 buf
[MAX_XFER_SIZE
];
410 struct usb_req req
= { CMD_I2C_WR
, 0, 5 + msg
[0].len
,
413 if (state
->chip_type
== 0x9306) {
414 req
.cmd
= CMD_GENERIC_I2C_WR
;
415 req
.wlen
= 3 + msg
[0].len
;
418 req
.mbox
|= ((msg
[0].addr
& 0x80) >> 3);
420 if (state
->chip_type
== 0x9306) {
421 buf
[1] = 0x03; /* I2C bus */
422 buf
[2] = msg
[0].addr
<< 1;
423 memcpy(&buf
[3], msg
[0].buf
, msg
[0].len
);
425 buf
[1] = msg
[0].addr
<< 1;
426 buf
[2] = 0x00; /* reg addr len */
427 buf
[3] = 0x00; /* reg addr MSB */
428 buf
[4] = 0x00; /* reg addr LSB */
429 memcpy(&buf
[5], msg
[0].buf
, msg
[0].len
);
431 ret
= af9035_ctrl_msg(d
, &req
);
433 } else if (AF9035_IS_I2C_XFER_READ(msg
, num
)) {
434 if (msg
[0].len
> 40) {
435 /* TODO: correct limits > 40 */
437 } else if (state
->no_read
) {
438 memset(msg
[0].buf
, 0, msg
[0].len
);
443 struct usb_req req
= { CMD_I2C_RD
, 0, sizeof(buf
),
444 buf
, msg
[0].len
, msg
[0].buf
};
446 if (state
->chip_type
== 0x9306) {
447 req
.cmd
= CMD_GENERIC_I2C_RD
;
450 req
.mbox
|= ((msg
[0].addr
& 0x80) >> 3);
452 if (state
->chip_type
== 0x9306) {
453 buf
[1] = 0x03; /* I2C bus */
454 buf
[2] = msg
[0].addr
<< 1;
456 buf
[1] = msg
[0].addr
<< 1;
457 buf
[2] = 0x00; /* reg addr len */
458 buf
[3] = 0x00; /* reg addr MSB */
459 buf
[4] = 0x00; /* reg addr LSB */
461 ret
= af9035_ctrl_msg(d
, &req
);
465 * We support only three kind of I2C transactions:
466 * 1) 1 x write + 1 x read (repeated start)
473 mutex_unlock(&d
->i2c_mutex
);
481 static u32
af9035_i2c_functionality(struct i2c_adapter
*adapter
)
486 static struct i2c_algorithm af9035_i2c_algo
= {
487 .master_xfer
= af9035_i2c_master_xfer
,
488 .functionality
= af9035_i2c_functionality
,
491 static int af9035_identify_state(struct dvb_usb_device
*d
, const char **name
)
493 struct state
*state
= d_to_priv(d
);
494 struct usb_interface
*intf
= d
->intf
;
495 int ret
, i
, ts_mode_invalid
;
496 unsigned int utmp
, eeprom_addr
;
500 struct usb_req req
= { CMD_FW_QUERYINFO
, 0, sizeof(wbuf
), wbuf
,
501 sizeof(rbuf
), rbuf
};
503 ret
= af9035_rd_regs(d
, 0x1222, rbuf
, 3);
507 state
->chip_version
= rbuf
[0];
508 state
->chip_type
= rbuf
[2] << 8 | rbuf
[1] << 0;
510 ret
= af9035_rd_reg(d
, 0x384f, &state
->prechip_version
);
514 dev_info(&intf
->dev
, "prechip_version=%02x chip_version=%02x chip_type=%04x\n",
515 state
->prechip_version
, state
->chip_version
, state
->chip_type
);
517 if (state
->chip_type
== 0x9135) {
518 if (state
->chip_version
== 0x02) {
519 *name
= AF9035_FIRMWARE_IT9135_V2
;
522 *name
= AF9035_FIRMWARE_IT9135_V1
;
526 /* Check if eeprom exists */
527 ret
= af9035_rd_reg(d
, utmp
, &tmp
);
532 dev_dbg(&intf
->dev
, "no eeprom\n");
533 state
->no_eeprom
= true;
534 goto check_firmware_status
;
537 eeprom_addr
= EEPROM_BASE_IT9135
;
538 } else if (state
->chip_type
== 0x9306) {
539 *name
= AF9035_FIRMWARE_IT9303
;
540 state
->no_eeprom
= true;
541 goto check_firmware_status
;
543 *name
= AF9035_FIRMWARE_AF9035
;
544 eeprom_addr
= EEPROM_BASE_AF9035
;
547 /* Read and store eeprom */
548 for (i
= 0; i
< 256; i
+= 32) {
549 ret
= af9035_rd_regs(d
, eeprom_addr
+ i
, &state
->eeprom
[i
], 32);
554 dev_dbg(&intf
->dev
, "eeprom dump:\n");
555 for (i
= 0; i
< 256; i
+= 16)
556 dev_dbg(&intf
->dev
, "%*ph\n", 16, &state
->eeprom
[i
]);
558 /* check for dual tuner mode */
559 tmp
= state
->eeprom
[EEPROM_TS_MODE
];
566 state
->dual_mode
= true;
569 if (state
->chip_type
!= 0x9135 && state
->chip_type
!= 0x9306)
570 state
->dual_mode
= true; /* AF9035 */
578 dev_dbg(&intf
->dev
, "ts mode=%d dual mode=%d\n", tmp
, state
->dual_mode
);
581 dev_info(&intf
->dev
, "ts mode=%d not supported, defaulting to single tuner mode!", tmp
);
583 check_firmware_status
:
584 ret
= af9035_ctrl_msg(d
, &req
);
588 dev_dbg(&intf
->dev
, "reply=%*ph\n", 4, rbuf
);
589 if (rbuf
[0] || rbuf
[1] || rbuf
[2] || rbuf
[3])
597 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
602 static int af9035_download_firmware_old(struct dvb_usb_device
*d
,
603 const struct firmware
*fw
)
605 struct usb_interface
*intf
= d
->intf
;
608 struct usb_req req
= { 0, 0, 0, NULL
, 0, NULL
};
609 struct usb_req req_fw_dl
= { CMD_FW_DL
, 0, 0, wbuf
, 0, NULL
};
611 u16 hdr_addr
, hdr_data_len
, hdr_checksum
;
616 * Thanks to Daniel Glöckner <daniel-gl@gmx.net> about that info!
618 * byte 0: MCS 51 core
619 * There are two inside the AF9035 (1=Link and 2=OFDM) with separate
621 * byte 1-2: Big endian destination address
622 * byte 3-4: Big endian number of data bytes following the header
623 * byte 5-6: Big endian header checksum, apparently ignored by the chip
624 * Calculated as ~(h[0]*256+h[1]+h[2]*256+h[3]+h[4]*256)
627 for (i
= fw
->size
; i
> HDR_SIZE
;) {
628 hdr_core
= fw
->data
[fw
->size
- i
+ 0];
629 hdr_addr
= fw
->data
[fw
->size
- i
+ 1] << 8;
630 hdr_addr
|= fw
->data
[fw
->size
- i
+ 2] << 0;
631 hdr_data_len
= fw
->data
[fw
->size
- i
+ 3] << 8;
632 hdr_data_len
|= fw
->data
[fw
->size
- i
+ 4] << 0;
633 hdr_checksum
= fw
->data
[fw
->size
- i
+ 5] << 8;
634 hdr_checksum
|= fw
->data
[fw
->size
- i
+ 6] << 0;
636 dev_dbg(&intf
->dev
, "core=%d addr=%04x data_len=%d checksum=%04x\n",
637 hdr_core
, hdr_addr
, hdr_data_len
, hdr_checksum
);
639 if (((hdr_core
!= 1) && (hdr_core
!= 2)) ||
640 (hdr_data_len
> i
)) {
641 dev_dbg(&intf
->dev
, "bad firmware\n");
645 /* download begin packet */
646 req
.cmd
= CMD_FW_DL_BEGIN
;
647 ret
= af9035_ctrl_msg(d
, &req
);
651 /* download firmware packet(s) */
652 for (j
= HDR_SIZE
+ hdr_data_len
; j
> 0; j
-= MAX_DATA
) {
656 req_fw_dl
.wlen
= len
;
657 req_fw_dl
.wbuf
= (u8
*) &fw
->data
[fw
->size
- i
+
658 HDR_SIZE
+ hdr_data_len
- j
];
659 ret
= af9035_ctrl_msg(d
, &req_fw_dl
);
664 /* download end packet */
665 req
.cmd
= CMD_FW_DL_END
;
666 ret
= af9035_ctrl_msg(d
, &req
);
670 i
-= hdr_data_len
+ HDR_SIZE
;
672 dev_dbg(&intf
->dev
, "data uploaded=%zu\n", fw
->size
- i
);
675 /* print warn if firmware is bad, continue and see what happens */
677 dev_warn(&intf
->dev
, "bad firmware\n");
682 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
687 static int af9035_download_firmware_new(struct dvb_usb_device
*d
,
688 const struct firmware
*fw
)
690 struct usb_interface
*intf
= d
->intf
;
692 struct usb_req req_fw_dl
= { CMD_FW_SCATTER_WR
, 0, 0, NULL
, 0, NULL
};
696 * There seems to be following firmware header. Meaning of bytes 0-3
705 * 6: count of data bytes ?
707 for (i
= HDR_SIZE
, i_prev
= 0; i
<= fw
->size
; i
++) {
709 (fw
->data
[i
+ 0] == 0x03 &&
710 (fw
->data
[i
+ 1] == 0x00 ||
711 fw
->data
[i
+ 1] == 0x01) &&
712 fw
->data
[i
+ 2] == 0x00)) {
713 req_fw_dl
.wlen
= i
- i_prev
;
714 req_fw_dl
.wbuf
= (u8
*) &fw
->data
[i_prev
];
716 ret
= af9035_ctrl_msg(d
, &req_fw_dl
);
720 dev_dbg(&intf
->dev
, "data uploaded=%d\n", i
);
727 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
732 static int af9035_download_firmware(struct dvb_usb_device
*d
,
733 const struct firmware
*fw
)
735 struct usb_interface
*intf
= d
->intf
;
736 struct state
*state
= d_to_priv(d
);
741 struct usb_req req
= { 0, 0, 0, NULL
, 0, NULL
};
742 struct usb_req req_fw_ver
= { CMD_FW_QUERYINFO
, 0, 1, wbuf
, 4, rbuf
};
744 dev_dbg(&intf
->dev
, "\n");
747 * In case of dual tuner configuration we need to do some extra
748 * initialization in order to download firmware to slave demod too,
749 * which is done by master demod.
750 * Master feeds also clock and controls power via GPIO.
752 if (state
->dual_mode
) {
753 /* configure gpioh1, reset & power slave demod */
754 ret
= af9035_wr_reg_mask(d
, 0x00d8b0, 0x01, 0x01);
758 ret
= af9035_wr_reg_mask(d
, 0x00d8b1, 0x01, 0x01);
762 ret
= af9035_wr_reg_mask(d
, 0x00d8af, 0x00, 0x01);
766 usleep_range(10000, 50000);
768 ret
= af9035_wr_reg_mask(d
, 0x00d8af, 0x01, 0x01);
772 /* tell the slave I2C address */
773 tmp
= state
->eeprom
[EEPROM_2ND_DEMOD_ADDR
];
775 /* Use default I2C address if eeprom has no address set */
777 tmp
= 0x1d << 1; /* 8-bit format used by chip */
779 if ((state
->chip_type
== 0x9135) ||
780 (state
->chip_type
== 0x9306)) {
781 ret
= af9035_wr_reg(d
, 0x004bfb, tmp
);
785 ret
= af9035_wr_reg(d
, 0x00417f, tmp
);
789 /* enable clock out */
790 ret
= af9035_wr_reg_mask(d
, 0x00d81a, 0x01, 0x01);
796 if (fw
->data
[0] == 0x01)
797 ret
= af9035_download_firmware_old(d
, fw
);
799 ret
= af9035_download_firmware_new(d
, fw
);
803 /* firmware loaded, request boot */
804 req
.cmd
= CMD_FW_BOOT
;
805 ret
= af9035_ctrl_msg(d
, &req
);
809 /* ensure firmware starts */
811 ret
= af9035_ctrl_msg(d
, &req_fw_ver
);
815 if (!(rbuf
[0] || rbuf
[1] || rbuf
[2] || rbuf
[3])) {
816 dev_err(&intf
->dev
, "firmware did not run\n");
821 dev_info(&intf
->dev
, "firmware version=%d.%d.%d.%d",
822 rbuf
[0], rbuf
[1], rbuf
[2], rbuf
[3]);
827 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
832 static int af9035_read_config(struct dvb_usb_device
*d
)
834 struct usb_interface
*intf
= d
->intf
;
835 struct state
*state
= d_to_priv(d
);
840 /* Demod I2C address */
841 state
->af9033_i2c_addr
[0] = 0x1c;
842 state
->af9033_i2c_addr
[1] = 0x1d;
843 state
->af9033_config
[0].adc_multiplier
= AF9033_ADC_MULTIPLIER_2X
;
844 state
->af9033_config
[1].adc_multiplier
= AF9033_ADC_MULTIPLIER_2X
;
845 state
->af9033_config
[0].ts_mode
= AF9033_TS_MODE_USB
;
846 state
->af9033_config
[1].ts_mode
= AF9033_TS_MODE_SERIAL
;
848 if (state
->chip_type
== 0x9135) {
849 /* feed clock for integrated RF tuner */
850 state
->af9033_config
[0].dyn0_clk
= true;
851 state
->af9033_config
[1].dyn0_clk
= true;
853 if (state
->chip_version
== 0x02) {
854 state
->af9033_config
[0].tuner
= AF9033_TUNER_IT9135_60
;
855 state
->af9033_config
[1].tuner
= AF9033_TUNER_IT9135_60
;
857 state
->af9033_config
[0].tuner
= AF9033_TUNER_IT9135_38
;
858 state
->af9033_config
[1].tuner
= AF9033_TUNER_IT9135_38
;
861 if (state
->no_eeprom
) {
862 /* Remote controller to NEC polling by default */
863 state
->ir_mode
= 0x05;
864 state
->ir_type
= 0x00;
868 } else if (state
->chip_type
== 0x9306) {
870 * IT930x is an USB bridge, only single demod-single tuner
871 * configurations seen so far.
876 /* Remote controller */
877 state
->ir_mode
= state
->eeprom
[EEPROM_IR_MODE
];
878 state
->ir_type
= state
->eeprom
[EEPROM_IR_TYPE
];
880 if (state
->dual_mode
) {
881 /* Read 2nd demodulator I2C address. 8-bit format on eeprom */
882 tmp
= state
->eeprom
[EEPROM_2ND_DEMOD_ADDR
];
884 state
->af9033_i2c_addr
[1] = tmp
>> 1;
886 dev_dbg(&intf
->dev
, "2nd demod I2C addr=%02x\n",
887 state
->af9033_i2c_addr
[1]);
890 for (i
= 0; i
< state
->dual_mode
+ 1; i
++) {
891 unsigned int eeprom_offset
= 0;
894 tmp
= state
->eeprom
[EEPROM_1_TUNER_ID
+ eeprom_offset
];
895 dev_dbg(&intf
->dev
, "[%d]tuner=%02x\n", i
, tmp
);
897 /* tuner sanity check */
898 if (state
->chip_type
== 0x9135) {
899 if (state
->chip_version
== 0x02) {
902 case AF9033_TUNER_IT9135_60
:
903 case AF9033_TUNER_IT9135_61
:
904 case AF9033_TUNER_IT9135_62
:
905 state
->af9033_config
[i
].tuner
= tmp
;
911 case AF9033_TUNER_IT9135_38
:
912 case AF9033_TUNER_IT9135_51
:
913 case AF9033_TUNER_IT9135_52
:
914 state
->af9033_config
[i
].tuner
= tmp
;
920 state
->af9033_config
[i
].tuner
= tmp
;
923 if (state
->af9033_config
[i
].tuner
!= tmp
) {
924 dev_info(&intf
->dev
, "[%d] overriding tuner from %02x to %02x\n",
925 i
, tmp
, state
->af9033_config
[i
].tuner
);
928 switch (state
->af9033_config
[i
].tuner
) {
929 case AF9033_TUNER_TUA9001
:
930 case AF9033_TUNER_FC0011
:
931 case AF9033_TUNER_MXL5007T
:
932 case AF9033_TUNER_TDA18218
:
933 case AF9033_TUNER_FC2580
:
934 case AF9033_TUNER_FC0012
:
935 state
->af9033_config
[i
].spec_inv
= 1;
937 case AF9033_TUNER_IT9135_38
:
938 case AF9033_TUNER_IT9135_51
:
939 case AF9033_TUNER_IT9135_52
:
940 case AF9033_TUNER_IT9135_60
:
941 case AF9033_TUNER_IT9135_61
:
942 case AF9033_TUNER_IT9135_62
:
945 dev_warn(&intf
->dev
, "tuner id=%02x not supported, please report!",
949 /* disable dual mode if driver does not support it */
951 switch (state
->af9033_config
[i
].tuner
) {
952 case AF9033_TUNER_FC0012
:
953 case AF9033_TUNER_IT9135_38
:
954 case AF9033_TUNER_IT9135_51
:
955 case AF9033_TUNER_IT9135_52
:
956 case AF9033_TUNER_IT9135_60
:
957 case AF9033_TUNER_IT9135_61
:
958 case AF9033_TUNER_IT9135_62
:
959 case AF9033_TUNER_MXL5007T
:
962 state
->dual_mode
= false;
963 dev_info(&intf
->dev
, "driver does not support 2nd tuner and will disable it");
966 /* tuner IF frequency */
967 tmp
= state
->eeprom
[EEPROM_1_IF_L
+ eeprom_offset
];
969 tmp
= state
->eeprom
[EEPROM_1_IF_H
+ eeprom_offset
];
971 dev_dbg(&intf
->dev
, "[%d]IF=%d\n", i
, tmp16
);
973 eeprom_offset
+= 0x10; /* shift for the 2nd tuner params */
977 /* get demod clock */
978 ret
= af9035_rd_reg(d
, 0x00d800, &tmp
);
982 tmp
= (tmp
>> 0) & 0x0f;
984 for (i
= 0; i
< ARRAY_SIZE(state
->af9033_config
); i
++) {
985 if (state
->chip_type
== 0x9135)
986 state
->af9033_config
[i
].clock
= clock_lut_it9135
[tmp
];
988 state
->af9033_config
[i
].clock
= clock_lut_af9035
[tmp
];
991 state
->no_read
= false;
992 /* Some MXL5007T devices cannot properly handle tuner I2C read ops. */
993 if (state
->af9033_config
[0].tuner
== AF9033_TUNER_MXL5007T
&&
994 le16_to_cpu(d
->udev
->descriptor
.idVendor
) == USB_VID_AVERMEDIA
)
996 switch (le16_to_cpu(d
->udev
->descriptor
.idProduct
)) {
997 case USB_PID_AVERMEDIA_A867
:
998 case USB_PID_AVERMEDIA_TWINSTAR
:
1000 "Device may have issues with I2C read operations. Enabling fix.\n");
1001 state
->no_read
= true;
1008 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
1013 static int af9035_tua9001_tuner_callback(struct dvb_usb_device
*d
,
1016 struct usb_interface
*intf
= d
->intf
;
1020 dev_dbg(&intf
->dev
, "cmd=%d arg=%d\n", cmd
, arg
);
1023 * CEN always enabled by hardware wiring
1029 case TUA9001_CMD_RESETN
:
1035 ret
= af9035_wr_reg_mask(d
, 0x00d8e7, val
, 0x01);
1039 case TUA9001_CMD_RXEN
:
1045 ret
= af9035_wr_reg_mask(d
, 0x00d8eb, val
, 0x01);
1054 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
1060 static int af9035_fc0011_tuner_callback(struct dvb_usb_device
*d
,
1063 struct usb_interface
*intf
= d
->intf
;
1067 case FC0011_FE_CALLBACK_POWER
:
1069 ret
= af9035_wr_reg_mask(d
, 0xd8eb, 1, 1);
1073 ret
= af9035_wr_reg_mask(d
, 0xd8ec, 1, 1);
1077 ret
= af9035_wr_reg_mask(d
, 0xd8ed, 1, 1);
1082 ret
= af9035_wr_reg_mask(d
, 0xd8d0, 1, 1);
1086 ret
= af9035_wr_reg_mask(d
, 0xd8d1, 1, 1);
1090 usleep_range(10000, 50000);
1092 case FC0011_FE_CALLBACK_RESET
:
1093 ret
= af9035_wr_reg(d
, 0xd8e9, 1);
1097 ret
= af9035_wr_reg(d
, 0xd8e8, 1);
1101 ret
= af9035_wr_reg(d
, 0xd8e7, 1);
1105 usleep_range(10000, 20000);
1107 ret
= af9035_wr_reg(d
, 0xd8e7, 0);
1111 usleep_range(10000, 20000);
1121 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
1126 static int af9035_tuner_callback(struct dvb_usb_device
*d
, int cmd
, int arg
)
1128 struct state
*state
= d_to_priv(d
);
1130 switch (state
->af9033_config
[0].tuner
) {
1131 case AF9033_TUNER_FC0011
:
1132 return af9035_fc0011_tuner_callback(d
, cmd
, arg
);
1133 case AF9033_TUNER_TUA9001
:
1134 return af9035_tua9001_tuner_callback(d
, cmd
, arg
);
1142 static int af9035_frontend_callback(void *adapter_priv
, int component
,
1145 struct i2c_adapter
*adap
= adapter_priv
;
1146 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
1147 struct usb_interface
*intf
= d
->intf
;
1149 dev_dbg(&intf
->dev
, "component=%d cmd=%d arg=%d\n",
1150 component
, cmd
, arg
);
1152 switch (component
) {
1153 case DVB_FRONTEND_COMPONENT_TUNER
:
1154 return af9035_tuner_callback(d
, cmd
, arg
);
1162 static int af9035_get_adapter_count(struct dvb_usb_device
*d
)
1164 struct state
*state
= d_to_priv(d
);
1166 return state
->dual_mode
+ 1;
1169 static int af9035_frontend_attach(struct dvb_usb_adapter
*adap
)
1171 struct state
*state
= adap_to_priv(adap
);
1172 struct dvb_usb_device
*d
= adap_to_d(adap
);
1173 struct usb_interface
*intf
= d
->intf
;
1176 dev_dbg(&intf
->dev
, "adap->id=%d\n", adap
->id
);
1178 if (!state
->af9033_config
[adap
->id
].tuner
) {
1179 /* unsupported tuner */
1184 state
->af9033_config
[adap
->id
].fe
= &adap
->fe
[0];
1185 state
->af9033_config
[adap
->id
].ops
= &state
->ops
;
1186 ret
= af9035_add_i2c_dev(d
, "af9033", state
->af9033_i2c_addr
[adap
->id
],
1187 &state
->af9033_config
[adap
->id
], &d
->i2c_adap
);
1191 if (adap
->fe
[0] == NULL
) {
1196 /* disable I2C-gate */
1197 adap
->fe
[0]->ops
.i2c_gate_ctrl
= NULL
;
1198 adap
->fe
[0]->callback
= af9035_frontend_callback
;
1203 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
1208 static int it930x_frontend_attach(struct dvb_usb_adapter
*adap
)
1210 struct state
*state
= adap_to_priv(adap
);
1211 struct dvb_usb_device
*d
= adap_to_d(adap
);
1212 struct usb_interface
*intf
= d
->intf
;
1214 struct si2168_config si2168_config
;
1215 struct i2c_adapter
*adapter
;
1217 dev_dbg(&intf
->dev
, "adap->id=%d\n", adap
->id
);
1219 memset(&si2168_config
, 0, sizeof(si2168_config
));
1220 si2168_config
.i2c_adapter
= &adapter
;
1221 si2168_config
.fe
= &adap
->fe
[0];
1222 si2168_config
.ts_mode
= SI2168_TS_SERIAL
;
1224 state
->af9033_config
[adap
->id
].fe
= &adap
->fe
[0];
1225 state
->af9033_config
[adap
->id
].ops
= &state
->ops
;
1226 ret
= af9035_add_i2c_dev(d
, "si2168", 0x67, &si2168_config
,
1231 if (adap
->fe
[0] == NULL
) {
1235 state
->i2c_adapter_demod
= adapter
;
1240 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
1245 static int af9035_frontend_detach(struct dvb_usb_adapter
*adap
)
1247 struct state
*state
= adap_to_priv(adap
);
1248 struct dvb_usb_device
*d
= adap_to_d(adap
);
1249 struct usb_interface
*intf
= d
->intf
;
1251 dev_dbg(&intf
->dev
, "adap->id=%d\n", adap
->id
);
1253 if (adap
->id
== 1) {
1254 if (state
->i2c_client
[1])
1255 af9035_del_i2c_dev(d
);
1256 } else if (adap
->id
== 0) {
1257 if (state
->i2c_client
[0])
1258 af9035_del_i2c_dev(d
);
1264 static const struct fc0011_config af9035_fc0011_config
= {
1265 .i2c_address
= 0x60,
1268 static struct mxl5007t_config af9035_mxl5007t_config
[] = {
1270 .xtal_freq_hz
= MxL_XTAL_24_MHZ
,
1271 .if_freq_hz
= MxL_IF_4_57_MHZ
,
1273 .loop_thru_enable
= 0,
1274 .clk_out_enable
= 0,
1275 .clk_out_amp
= MxL_CLKOUT_AMP_0_94V
,
1277 .xtal_freq_hz
= MxL_XTAL_24_MHZ
,
1278 .if_freq_hz
= MxL_IF_4_57_MHZ
,
1280 .loop_thru_enable
= 1,
1281 .clk_out_enable
= 1,
1282 .clk_out_amp
= MxL_CLKOUT_AMP_0_94V
,
1286 static struct tda18218_config af9035_tda18218_config
= {
1287 .i2c_address
= 0x60,
1291 static const struct fc0012_config af9035_fc0012_config
[] = {
1293 .i2c_address
= 0x63,
1294 .xtal_freq
= FC_XTAL_36_MHZ
,
1295 .dual_master
= true,
1296 .loop_through
= true,
1299 .i2c_address
= 0x63 | 0x80, /* I2C bus select hack */
1300 .xtal_freq
= FC_XTAL_36_MHZ
,
1301 .dual_master
= true,
1305 static int af9035_tuner_attach(struct dvb_usb_adapter
*adap
)
1307 struct state
*state
= adap_to_priv(adap
);
1308 struct dvb_usb_device
*d
= adap_to_d(adap
);
1309 struct usb_interface
*intf
= d
->intf
;
1311 struct dvb_frontend
*fe
;
1312 struct i2c_msg msg
[1];
1315 dev_dbg(&intf
->dev
, "adap->id=%d\n", adap
->id
);
1318 * XXX: Hack used in that function: we abuse unused I2C address bit [7]
1319 * to carry info about used I2C bus for dual tuner configuration.
1322 switch (state
->af9033_config
[adap
->id
].tuner
) {
1323 case AF9033_TUNER_TUA9001
: {
1324 struct tua9001_platform_data tua9001_pdata
= {
1325 .dvb_frontend
= adap
->fe
[0],
1329 * AF9035 gpiot3 = TUA9001 RESETN
1330 * AF9035 gpiot2 = TUA9001 RXEN
1333 /* configure gpiot2 and gpiot2 as output */
1334 ret
= af9035_wr_reg_mask(d
, 0x00d8ec, 0x01, 0x01);
1338 ret
= af9035_wr_reg_mask(d
, 0x00d8ed, 0x01, 0x01);
1342 ret
= af9035_wr_reg_mask(d
, 0x00d8e8, 0x01, 0x01);
1346 ret
= af9035_wr_reg_mask(d
, 0x00d8e9, 0x01, 0x01);
1351 ret
= af9035_add_i2c_dev(d
, "tua9001", 0x60, &tua9001_pdata
,
1359 case AF9033_TUNER_FC0011
:
1360 fe
= dvb_attach(fc0011_attach
, adap
->fe
[0],
1361 &d
->i2c_adap
, &af9035_fc0011_config
);
1363 case AF9033_TUNER_MXL5007T
:
1364 if (adap
->id
== 0) {
1365 ret
= af9035_wr_reg(d
, 0x00d8e0, 1);
1369 ret
= af9035_wr_reg(d
, 0x00d8e1, 1);
1373 ret
= af9035_wr_reg(d
, 0x00d8df, 0);
1379 ret
= af9035_wr_reg(d
, 0x00d8df, 1);
1385 ret
= af9035_wr_reg(d
, 0x00d8c0, 1);
1389 ret
= af9035_wr_reg(d
, 0x00d8c1, 1);
1393 ret
= af9035_wr_reg(d
, 0x00d8bf, 0);
1397 ret
= af9035_wr_reg(d
, 0x00d8b4, 1);
1401 ret
= af9035_wr_reg(d
, 0x00d8b5, 1);
1405 ret
= af9035_wr_reg(d
, 0x00d8b3, 1);
1411 tuner_addr
= 0x60 | 0x80; /* I2C bus hack */
1415 fe
= dvb_attach(mxl5007t_attach
, adap
->fe
[0], &d
->i2c_adap
,
1416 tuner_addr
, &af9035_mxl5007t_config
[adap
->id
]);
1418 case AF9033_TUNER_TDA18218
:
1420 fe
= dvb_attach(tda18218_attach
, adap
->fe
[0],
1421 &d
->i2c_adap
, &af9035_tda18218_config
);
1423 case AF9033_TUNER_FC2580
: {
1424 struct fc2580_platform_data fc2580_pdata
= {
1425 .dvb_frontend
= adap
->fe
[0],
1428 /* Tuner enable using gpiot2_o, gpiot2_en and gpiot2_on */
1429 ret
= af9035_wr_reg_mask(d
, 0xd8eb, 0x01, 0x01);
1433 ret
= af9035_wr_reg_mask(d
, 0xd8ec, 0x01, 0x01);
1437 ret
= af9035_wr_reg_mask(d
, 0xd8ed, 0x01, 0x01);
1441 usleep_range(10000, 50000);
1443 ret
= af9035_add_i2c_dev(d
, "fc2580", 0x56, &fc2580_pdata
,
1451 case AF9033_TUNER_FC0012
:
1453 * AF9035 gpiot2 = FC0012 enable
1454 * XXX: there seems to be something on gpioh8 too, but on my
1455 * my test I didn't find any difference.
1458 if (adap
->id
== 0) {
1459 /* configure gpiot2 as output and high */
1460 ret
= af9035_wr_reg_mask(d
, 0xd8eb, 0x01, 0x01);
1464 ret
= af9035_wr_reg_mask(d
, 0xd8ec, 0x01, 0x01);
1468 ret
= af9035_wr_reg_mask(d
, 0xd8ed, 0x01, 0x01);
1473 * FIXME: That belongs for the FC0012 driver.
1474 * Write 02 to FC0012 master tuner register 0d directly
1475 * in order to make slave tuner working.
1480 msg
[0].buf
= "\x0d\x02";
1481 ret
= i2c_transfer(&d
->i2c_adap
, msg
, 1);
1486 usleep_range(10000, 50000);
1488 fe
= dvb_attach(fc0012_attach
, adap
->fe
[0], &d
->i2c_adap
,
1489 &af9035_fc0012_config
[adap
->id
]);
1491 case AF9033_TUNER_IT9135_38
:
1492 case AF9033_TUNER_IT9135_51
:
1493 case AF9033_TUNER_IT9135_52
:
1494 case AF9033_TUNER_IT9135_60
:
1495 case AF9033_TUNER_IT9135_61
:
1496 case AF9033_TUNER_IT9135_62
:
1498 struct platform_device
*pdev
;
1500 struct it913x_platform_data it913x_pdata
= {
1501 .regmap
= state
->af9033_config
[adap
->id
].regmap
,
1505 switch (state
->af9033_config
[adap
->id
].tuner
) {
1506 case AF9033_TUNER_IT9135_38
:
1507 case AF9033_TUNER_IT9135_51
:
1508 case AF9033_TUNER_IT9135_52
:
1509 name
= "it9133ax-tuner";
1511 case AF9033_TUNER_IT9135_60
:
1512 case AF9033_TUNER_IT9135_61
:
1513 case AF9033_TUNER_IT9135_62
:
1514 name
= "it9133bx-tuner";
1521 if (state
->dual_mode
) {
1523 it913x_pdata
.role
= IT913X_ROLE_DUAL_MASTER
;
1525 it913x_pdata
.role
= IT913X_ROLE_DUAL_SLAVE
;
1527 it913x_pdata
.role
= IT913X_ROLE_SINGLE
;
1530 request_module("%s", "it913x");
1531 pdev
= platform_device_register_data(&d
->intf
->dev
, name
,
1532 PLATFORM_DEVID_AUTO
,
1534 sizeof(it913x_pdata
));
1535 if (IS_ERR(pdev
) || !pdev
->dev
.driver
) {
1539 if (!try_module_get(pdev
->dev
.driver
->owner
)) {
1540 platform_device_unregister(pdev
);
1545 state
->platform_device_tuner
[adap
->id
] = pdev
;
1561 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
1566 static int it930x_tuner_attach(struct dvb_usb_adapter
*adap
)
1568 struct state
*state
= adap_to_priv(adap
);
1569 struct dvb_usb_device
*d
= adap_to_d(adap
);
1570 struct usb_interface
*intf
= d
->intf
;
1572 struct si2157_config si2157_config
;
1574 dev_dbg(&intf
->dev
, "adap->id=%d\n", adap
->id
);
1576 /* I2C master bus 2 clock speed 300k */
1577 ret
= af9035_wr_reg(d
, 0x00f6a7, 0x07);
1581 /* I2C master bus 1,3 clock speed 300k */
1582 ret
= af9035_wr_reg(d
, 0x00f103, 0x07);
1586 /* set gpio11 low */
1587 ret
= af9035_wr_reg_mask(d
, 0xd8d4, 0x01, 0x01);
1591 ret
= af9035_wr_reg_mask(d
, 0xd8d5, 0x01, 0x01);
1595 ret
= af9035_wr_reg_mask(d
, 0xd8d3, 0x01, 0x01);
1599 /* Tuner enable using gpiot2_en, gpiot2_on and gpiot2_o (reset) */
1600 ret
= af9035_wr_reg_mask(d
, 0xd8b8, 0x01, 0x01);
1604 ret
= af9035_wr_reg_mask(d
, 0xd8b9, 0x01, 0x01);
1608 ret
= af9035_wr_reg_mask(d
, 0xd8b7, 0x00, 0x01);
1614 ret
= af9035_wr_reg_mask(d
, 0xd8b7, 0x01, 0x01);
1618 memset(&si2157_config
, 0, sizeof(si2157_config
));
1619 si2157_config
.fe
= adap
->fe
[0];
1620 si2157_config
.if_port
= 1;
1621 ret
= af9035_add_i2c_dev(d
, "si2157", 0x63,
1622 &si2157_config
, state
->i2c_adapter_demod
);
1630 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
1636 static int it930x_tuner_detach(struct dvb_usb_adapter
*adap
)
1638 struct state
*state
= adap_to_priv(adap
);
1639 struct dvb_usb_device
*d
= adap_to_d(adap
);
1640 struct usb_interface
*intf
= d
->intf
;
1642 dev_dbg(&intf
->dev
, "adap->id=%d\n", adap
->id
);
1644 if (adap
->id
== 1) {
1645 if (state
->i2c_client
[3])
1646 af9035_del_i2c_dev(d
);
1647 } else if (adap
->id
== 0) {
1648 if (state
->i2c_client
[1])
1649 af9035_del_i2c_dev(d
);
1656 static int af9035_tuner_detach(struct dvb_usb_adapter
*adap
)
1658 struct state
*state
= adap_to_priv(adap
);
1659 struct dvb_usb_device
*d
= adap_to_d(adap
);
1660 struct usb_interface
*intf
= d
->intf
;
1662 dev_dbg(&intf
->dev
, "adap->id=%d\n", adap
->id
);
1664 switch (state
->af9033_config
[adap
->id
].tuner
) {
1665 case AF9033_TUNER_TUA9001
:
1666 case AF9033_TUNER_FC2580
:
1667 if (adap
->id
== 1) {
1668 if (state
->i2c_client
[3])
1669 af9035_del_i2c_dev(d
);
1670 } else if (adap
->id
== 0) {
1671 if (state
->i2c_client
[1])
1672 af9035_del_i2c_dev(d
);
1675 case AF9033_TUNER_IT9135_38
:
1676 case AF9033_TUNER_IT9135_51
:
1677 case AF9033_TUNER_IT9135_52
:
1678 case AF9033_TUNER_IT9135_60
:
1679 case AF9033_TUNER_IT9135_61
:
1680 case AF9033_TUNER_IT9135_62
:
1682 struct platform_device
*pdev
;
1684 pdev
= state
->platform_device_tuner
[adap
->id
];
1686 module_put(pdev
->dev
.driver
->owner
);
1687 platform_device_unregister(pdev
);
1696 static int af9035_init(struct dvb_usb_device
*d
)
1698 struct state
*state
= d_to_priv(d
);
1699 struct usb_interface
*intf
= d
->intf
;
1701 u16 frame_size
= (d
->udev
->speed
== USB_SPEED_FULL
? 5 : 87) * 188 / 4;
1702 u8 packet_size
= (d
->udev
->speed
== USB_SPEED_FULL
? 64 : 512) / 4;
1703 struct reg_val_mask tab
[] = {
1704 { 0x80f99d, 0x01, 0x01 },
1705 { 0x80f9a4, 0x01, 0x01 },
1706 { 0x00dd11, 0x00, 0x20 },
1707 { 0x00dd11, 0x00, 0x40 },
1708 { 0x00dd13, 0x00, 0x20 },
1709 { 0x00dd13, 0x00, 0x40 },
1710 { 0x00dd11, 0x20, 0x20 },
1711 { 0x00dd88, (frame_size
>> 0) & 0xff, 0xff},
1712 { 0x00dd89, (frame_size
>> 8) & 0xff, 0xff},
1713 { 0x00dd0c, packet_size
, 0xff},
1714 { 0x00dd11, state
->dual_mode
<< 6, 0x40 },
1715 { 0x00dd8a, (frame_size
>> 0) & 0xff, 0xff},
1716 { 0x00dd8b, (frame_size
>> 8) & 0xff, 0xff},
1717 { 0x00dd0d, packet_size
, 0xff },
1718 { 0x80f9a3, state
->dual_mode
, 0x01 },
1719 { 0x80f9cd, state
->dual_mode
, 0x01 },
1720 { 0x80f99d, 0x00, 0x01 },
1721 { 0x80f9a4, 0x00, 0x01 },
1724 dev_dbg(&intf
->dev
, "USB speed=%d frame_size=%04x packet_size=%02x\n",
1725 d
->udev
->speed
, frame_size
, packet_size
);
1727 /* init endpoints */
1728 for (i
= 0; i
< ARRAY_SIZE(tab
); i
++) {
1729 ret
= af9035_wr_reg_mask(d
, tab
[i
].reg
, tab
[i
].val
,
1738 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
1743 static int it930x_init(struct dvb_usb_device
*d
)
1745 struct state
*state
= d_to_priv(d
);
1746 struct usb_interface
*intf
= d
->intf
;
1748 u16 frame_size
= (d
->udev
->speed
== USB_SPEED_FULL
? 5 : 816) * 188 / 4;
1749 u8 packet_size
= (d
->udev
->speed
== USB_SPEED_FULL
? 64 : 512) / 4;
1750 struct reg_val_mask tab
[] = {
1751 { 0x00da1a, 0x00, 0x01 }, /* ignore_sync_byte */
1752 { 0x00f41f, 0x04, 0x04 }, /* dvbt_inten */
1753 { 0x00da10, 0x00, 0x01 }, /* mpeg_full_speed */
1754 { 0x00f41a, 0x01, 0x01 }, /* dvbt_en */
1755 { 0x00da1d, 0x01, 0x01 }, /* mp2_sw_rst, reset EP4 */
1756 { 0x00dd11, 0x00, 0x20 }, /* ep4_tx_en, disable EP4 */
1757 { 0x00dd13, 0x00, 0x20 }, /* ep4_tx_nak, disable EP4 NAK */
1758 { 0x00dd11, 0x20, 0x20 }, /* ep4_tx_en, enable EP4 */
1759 { 0x00dd11, 0x00, 0x40 }, /* ep5_tx_en, disable EP5 */
1760 { 0x00dd13, 0x00, 0x40 }, /* ep5_tx_nak, disable EP5 NAK */
1761 { 0x00dd11, state
->dual_mode
<< 6, 0x40 }, /* enable EP5 */
1762 { 0x00dd88, (frame_size
>> 0) & 0xff, 0xff},
1763 { 0x00dd89, (frame_size
>> 8) & 0xff, 0xff},
1764 { 0x00dd0c, packet_size
, 0xff},
1765 { 0x00dd8a, (frame_size
>> 0) & 0xff, 0xff},
1766 { 0x00dd8b, (frame_size
>> 8) & 0xff, 0xff},
1767 { 0x00dd0d, packet_size
, 0xff },
1768 { 0x00da1d, 0x00, 0x01 }, /* mp2_sw_rst, disable */
1769 { 0x00d833, 0x01, 0xff }, /* slew rate ctrl: slew rate boosts */
1770 { 0x00d830, 0x00, 0xff }, /* Bit 0 of output driving control */
1771 { 0x00d831, 0x01, 0xff }, /* Bit 1 of output driving control */
1772 { 0x00d832, 0x00, 0xff }, /* Bit 2 of output driving control */
1774 /* suspend gpio1 for TS-C */
1775 { 0x00d8b0, 0x01, 0xff }, /* gpio1 */
1776 { 0x00d8b1, 0x01, 0xff }, /* gpio1 */
1777 { 0x00d8af, 0x00, 0xff }, /* gpio1 */
1779 /* suspend gpio7 for TS-D */
1780 { 0x00d8c4, 0x01, 0xff }, /* gpio7 */
1781 { 0x00d8c5, 0x01, 0xff }, /* gpio7 */
1782 { 0x00d8c3, 0x00, 0xff }, /* gpio7 */
1784 /* suspend gpio13 for TS-B */
1785 { 0x00d8dc, 0x01, 0xff }, /* gpio13 */
1786 { 0x00d8dd, 0x01, 0xff }, /* gpio13 */
1787 { 0x00d8db, 0x00, 0xff }, /* gpio13 */
1789 /* suspend gpio14 for TS-E */
1790 { 0x00d8e4, 0x01, 0xff }, /* gpio14 */
1791 { 0x00d8e5, 0x01, 0xff }, /* gpio14 */
1792 { 0x00d8e3, 0x00, 0xff }, /* gpio14 */
1794 /* suspend gpio15 for TS-A */
1795 { 0x00d8e8, 0x01, 0xff }, /* gpio15 */
1796 { 0x00d8e9, 0x01, 0xff }, /* gpio15 */
1797 { 0x00d8e7, 0x00, 0xff }, /* gpio15 */
1799 { 0x00da58, 0x00, 0x01 }, /* ts_in_src, serial */
1800 { 0x00da73, 0x01, 0xff }, /* ts0_aggre_mode */
1801 { 0x00da78, 0x47, 0xff }, /* ts0_sync_byte */
1802 { 0x00da4c, 0x01, 0xff }, /* ts0_en */
1803 { 0x00da5a, 0x1f, 0xff }, /* ts_fail_ignore */
1806 dev_dbg(&intf
->dev
, "USB speed=%d frame_size=%04x packet_size=%02x\n",
1807 d
->udev
->speed
, frame_size
, packet_size
);
1809 /* init endpoints */
1810 for (i
= 0; i
< ARRAY_SIZE(tab
); i
++) {
1811 ret
= af9035_wr_reg_mask(d
, tab
[i
].reg
,
1812 tab
[i
].val
, tab
[i
].mask
);
1820 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
1826 #if IS_ENABLED(CONFIG_RC_CORE)
1827 static int af9035_rc_query(struct dvb_usb_device
*d
)
1829 struct usb_interface
*intf
= d
->intf
;
1831 enum rc_proto proto
;
1834 struct usb_req req
= { CMD_IR_GET
, 0, 0, NULL
, 4, buf
};
1836 ret
= af9035_ctrl_msg(d
, &req
);
1842 if ((buf
[2] + buf
[3]) == 0xff) {
1843 if ((buf
[0] + buf
[1]) == 0xff) {
1844 /* NEC standard 16bit */
1845 key
= RC_SCANCODE_NEC(buf
[0], buf
[2]);
1846 proto
= RC_PROTO_NEC
;
1848 /* NEC extended 24bit */
1849 key
= RC_SCANCODE_NECX(buf
[0] << 8 | buf
[1], buf
[2]);
1850 proto
= RC_PROTO_NECX
;
1853 /* NEC full code 32bit */
1854 key
= RC_SCANCODE_NEC32(buf
[0] << 24 | buf
[1] << 16 |
1855 buf
[2] << 8 | buf
[3]);
1856 proto
= RC_PROTO_NEC32
;
1859 dev_dbg(&intf
->dev
, "%*ph\n", 4, buf
);
1861 rc_keydown(d
->rc_dev
, proto
, key
, 0);
1866 dev_dbg(&intf
->dev
, "failed=%d\n", ret
);
1871 static int af9035_get_rc_config(struct dvb_usb_device
*d
, struct dvb_usb_rc
*rc
)
1873 struct state
*state
= d_to_priv(d
);
1874 struct usb_interface
*intf
= d
->intf
;
1876 dev_dbg(&intf
->dev
, "ir_mode=%02x ir_type=%02x\n",
1877 state
->ir_mode
, state
->ir_type
);
1879 /* don't activate rc if in HID mode or if not available */
1880 if (state
->ir_mode
== 0x05) {
1881 switch (state
->ir_type
) {
1884 rc
->allowed_protos
= RC_PROTO_BIT_NEC
|
1885 RC_PROTO_BIT_NECX
| RC_PROTO_BIT_NEC32
;
1888 rc
->allowed_protos
= RC_PROTO_BIT_RC6_MCE
;
1892 rc
->query
= af9035_rc_query
;
1895 /* load empty to enable rc */
1897 rc
->map_name
= RC_MAP_EMPTY
;
1903 #define af9035_get_rc_config NULL
1906 static int af9035_get_stream_config(struct dvb_frontend
*fe
, u8
*ts_type
,
1907 struct usb_data_stream_properties
*stream
)
1909 struct dvb_usb_device
*d
= fe_to_d(fe
);
1910 struct usb_interface
*intf
= d
->intf
;
1912 dev_dbg(&intf
->dev
, "adap=%d\n", fe_to_adap(fe
)->id
);
1914 if (d
->udev
->speed
== USB_SPEED_FULL
)
1915 stream
->u
.bulk
.buffersize
= 5 * 188;
1920 static int af9035_pid_filter_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
1922 struct state
*state
= adap_to_priv(adap
);
1924 return state
->ops
.pid_filter_ctrl(adap
->fe
[0], onoff
);
1927 static int af9035_pid_filter(struct dvb_usb_adapter
*adap
, int index
, u16 pid
,
1930 struct state
*state
= adap_to_priv(adap
);
1932 return state
->ops
.pid_filter(adap
->fe
[0], index
, pid
, onoff
);
1935 static int af9035_probe(struct usb_interface
*intf
,
1936 const struct usb_device_id
*id
)
1938 struct usb_device
*udev
= interface_to_usbdev(intf
);
1939 char manufacturer
[sizeof("Afatech")];
1941 memset(manufacturer
, 0, sizeof(manufacturer
));
1942 usb_string(udev
, udev
->descriptor
.iManufacturer
,
1943 manufacturer
, sizeof(manufacturer
));
1945 * There is two devices having same ID but different chipset. One uses
1946 * AF9015 and the other IT9135 chipset. Only difference seen on lsusb
1947 * is iManufacturer string.
1949 * idVendor 0x0ccd TerraTec Electronic GmbH
1952 * iManufacturer 1 Afatech
1953 * iProduct 2 DVB-T 2
1955 * idVendor 0x0ccd TerraTec Electronic GmbH
1958 * iManufacturer 1 ITE Technologies, Inc.
1959 * iProduct 2 DVB-T TV Stick
1961 if ((le16_to_cpu(udev
->descriptor
.idVendor
) == USB_VID_TERRATEC
) &&
1962 (le16_to_cpu(udev
->descriptor
.idProduct
) == 0x0099)) {
1963 if (!strcmp("Afatech", manufacturer
)) {
1964 dev_dbg(&udev
->dev
, "rejecting device\n");
1969 return dvb_usbv2_probe(intf
, id
);
1972 /* interface 0 is used by DVB-T receiver and
1973 interface 1 is for remote controller (HID) */
1974 static const struct dvb_usb_device_properties af9035_props
= {
1975 .driver_name
= KBUILD_MODNAME
,
1976 .owner
= THIS_MODULE
,
1977 .adapter_nr
= adapter_nr
,
1978 .size_of_priv
= sizeof(struct state
),
1980 .generic_bulk_ctrl_endpoint
= 0x02,
1981 .generic_bulk_ctrl_endpoint_response
= 0x81,
1983 .identify_state
= af9035_identify_state
,
1984 .download_firmware
= af9035_download_firmware
,
1986 .i2c_algo
= &af9035_i2c_algo
,
1987 .read_config
= af9035_read_config
,
1988 .frontend_attach
= af9035_frontend_attach
,
1989 .frontend_detach
= af9035_frontend_detach
,
1990 .tuner_attach
= af9035_tuner_attach
,
1991 .tuner_detach
= af9035_tuner_detach
,
1992 .init
= af9035_init
,
1993 .get_rc_config
= af9035_get_rc_config
,
1994 .get_stream_config
= af9035_get_stream_config
,
1996 .get_adapter_count
= af9035_get_adapter_count
,
1999 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
2000 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
2002 .pid_filter_count
= 32,
2003 .pid_filter_ctrl
= af9035_pid_filter_ctrl
,
2004 .pid_filter
= af9035_pid_filter
,
2006 .stream
= DVB_USB_STREAM_BULK(0x84, 6, 87 * 188),
2008 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
2009 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
2011 .pid_filter_count
= 32,
2012 .pid_filter_ctrl
= af9035_pid_filter_ctrl
,
2013 .pid_filter
= af9035_pid_filter
,
2015 .stream
= DVB_USB_STREAM_BULK(0x85, 6, 87 * 188),
2020 static const struct dvb_usb_device_properties it930x_props
= {
2021 .driver_name
= KBUILD_MODNAME
,
2022 .owner
= THIS_MODULE
,
2023 .adapter_nr
= adapter_nr
,
2024 .size_of_priv
= sizeof(struct state
),
2026 .generic_bulk_ctrl_endpoint
= 0x02,
2027 .generic_bulk_ctrl_endpoint_response
= 0x81,
2029 .identify_state
= af9035_identify_state
,
2030 .download_firmware
= af9035_download_firmware
,
2032 .i2c_algo
= &af9035_i2c_algo
,
2033 .read_config
= af9035_read_config
,
2034 .frontend_attach
= it930x_frontend_attach
,
2035 .frontend_detach
= af9035_frontend_detach
,
2036 .tuner_attach
= it930x_tuner_attach
,
2037 .tuner_detach
= it930x_tuner_detach
,
2038 .init
= it930x_init
,
2039 .get_stream_config
= af9035_get_stream_config
,
2041 .get_adapter_count
= af9035_get_adapter_count
,
2044 .stream
= DVB_USB_STREAM_BULK(0x84, 4, 816 * 188),
2046 .stream
= DVB_USB_STREAM_BULK(0x85, 4, 816 * 188),
2051 static const struct usb_device_id af9035_id_table
[] = {
2052 /* AF9035 devices */
2053 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9035_9035
,
2054 &af9035_props
, "Afatech AF9035 reference design", NULL
) },
2055 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9035_1000
,
2056 &af9035_props
, "Afatech AF9035 reference design", NULL
) },
2057 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9035_1001
,
2058 &af9035_props
, "Afatech AF9035 reference design", NULL
) },
2059 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9035_1002
,
2060 &af9035_props
, "Afatech AF9035 reference design", NULL
) },
2061 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9035_1003
,
2062 &af9035_props
, "Afatech AF9035 reference design", NULL
) },
2063 { DVB_USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_STICK
,
2064 &af9035_props
, "TerraTec Cinergy T Stick", NULL
) },
2065 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A835
,
2066 &af9035_props
, "AVerMedia AVerTV Volar HD/PRO (A835)", NULL
) },
2067 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_B835
,
2068 &af9035_props
, "AVerMedia AVerTV Volar HD/PRO (A835)", NULL
) },
2069 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_1867
,
2070 &af9035_props
, "AVerMedia HD Volar (A867)", NULL
) },
2071 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A867
,
2072 &af9035_props
, "AVerMedia HD Volar (A867)", NULL
) },
2073 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_TWINSTAR
,
2074 &af9035_props
, "AVerMedia Twinstar (A825)", NULL
) },
2075 { DVB_USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3100MINI_PLUS
,
2076 &af9035_props
, "Asus U3100Mini Plus", NULL
) },
2077 { DVB_USB_DEVICE(USB_VID_TERRATEC
, 0x00aa,
2078 &af9035_props
, "TerraTec Cinergy T Stick (rev. 2)", NULL
) },
2079 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, 0x0337,
2080 &af9035_props
, "AVerMedia HD Volar (A867)", NULL
) },
2081 { DVB_USB_DEVICE(USB_VID_GTEK
, USB_PID_EVOLVEO_XTRATV_STICK
,
2082 &af9035_props
, "EVOLVEO XtraTV stick", NULL
) },
2084 /* IT9135 devices */
2085 { DVB_USB_DEVICE(USB_VID_ITETECH
, USB_PID_ITETECH_IT9135
,
2086 &af9035_props
, "ITE 9135 Generic", RC_MAP_IT913X_V1
) },
2087 { DVB_USB_DEVICE(USB_VID_ITETECH
, USB_PID_ITETECH_IT9135_9005
,
2088 &af9035_props
, "ITE 9135(9005) Generic", RC_MAP_IT913X_V2
) },
2089 { DVB_USB_DEVICE(USB_VID_ITETECH
, USB_PID_ITETECH_IT9135_9006
,
2090 &af9035_props
, "ITE 9135(9006) Generic", RC_MAP_IT913X_V1
) },
2091 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A835B_1835
,
2092 &af9035_props
, "Avermedia A835B(1835)", RC_MAP_IT913X_V2
) },
2093 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A835B_2835
,
2094 &af9035_props
, "Avermedia A835B(2835)", RC_MAP_IT913X_V2
) },
2095 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A835B_3835
,
2096 &af9035_props
, "Avermedia A835B(3835)", RC_MAP_IT913X_V2
) },
2097 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A835B_4835
,
2098 &af9035_props
, "Avermedia A835B(4835)", RC_MAP_IT913X_V2
) },
2099 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_TD110
,
2100 &af9035_props
, "Avermedia AverTV Volar HD 2 (TD110)", RC_MAP_AVERMEDIA_RM_KS
) },
2101 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_H335
,
2102 &af9035_props
, "Avermedia H335", RC_MAP_IT913X_V2
) },
2103 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_UB499_2T_T09
,
2104 &af9035_props
, "Kworld UB499-2T T09", RC_MAP_IT913X_V1
) },
2105 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_SVEON_STV22_IT9137
,
2106 &af9035_props
, "Sveon STV22 Dual DVB-T HDTV",
2107 RC_MAP_IT913X_V1
) },
2108 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_CTVDIGDUAL_V2
,
2109 &af9035_props
, "Digital Dual TV Receiver CTVDIGDUAL_V2",
2110 RC_MAP_IT913X_V1
) },
2111 { DVB_USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_T1
,
2112 &af9035_props
, "TerraTec T1", RC_MAP_IT913X_V1
) },
2113 /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */
2114 { DVB_USB_DEVICE(USB_VID_TERRATEC
, 0x0099,
2115 &af9035_props
, "TerraTec Cinergy T Stick Dual RC (rev. 2)",
2117 { DVB_USB_DEVICE(USB_VID_LEADTEK
, 0x6a05,
2118 &af9035_props
, "Leadtek WinFast DTV Dongle Dual", NULL
) },
2119 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE
, 0xf900,
2120 &af9035_props
, "Hauppauge WinTV-MiniStick 2", NULL
) },
2121 { DVB_USB_DEVICE(USB_VID_PCTV
, USB_PID_PCTV_78E
,
2122 &af9035_props
, "PCTV AndroiDTV (78e)", RC_MAP_IT913X_V1
) },
2123 { DVB_USB_DEVICE(USB_VID_PCTV
, USB_PID_PCTV_79E
,
2124 &af9035_props
, "PCTV microStick (79e)", RC_MAP_IT913X_V2
) },
2126 /* IT930x devices */
2127 { DVB_USB_DEVICE(USB_VID_ITETECH
, USB_PID_ITETECH_IT9303
,
2128 &it930x_props
, "ITE 9303 Generic", NULL
) },
2131 MODULE_DEVICE_TABLE(usb
, af9035_id_table
);
2133 static struct usb_driver af9035_usb_driver
= {
2134 .name
= KBUILD_MODNAME
,
2135 .id_table
= af9035_id_table
,
2136 .probe
= af9035_probe
,
2137 .disconnect
= dvb_usbv2_disconnect
,
2138 .suspend
= dvb_usbv2_suspend
,
2139 .resume
= dvb_usbv2_resume
,
2140 .reset_resume
= dvb_usbv2_reset_resume
,
2145 module_usb_driver(af9035_usb_driver
);
2147 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
2148 MODULE_DESCRIPTION("Afatech AF9035 driver");
2149 MODULE_LICENSE("GPL");
2150 MODULE_FIRMWARE(AF9035_FIRMWARE_AF9035
);
2151 MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135_V1
);
2152 MODULE_FIRMWARE(AF9035_FIRMWARE_IT9135_V2
);
2153 MODULE_FIRMWARE(AF9035_FIRMWARE_IT9303
);