2 * DVB USB Linux driver for Afatech AF9015 DVB-T USB2.0 receiver
4 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
6 * Thanks to Afatech who kindly provided information.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 static int dvb_usb_af9015_remote
;
27 module_param_named(remote
, dvb_usb_af9015_remote
, int, 0644);
28 MODULE_PARM_DESC(remote
, "select remote");
29 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
31 static int af9015_ctrl_msg(struct dvb_usb_device
*d
, struct req_t
*req
)
33 #define REQ_HDR_LEN 8 /* send header size */
34 #define ACK_HDR_LEN 2 /* rece header size */
35 struct af9015_state
*state
= d_to_priv(d
);
39 mutex_lock(&d
->usb_mutex
);
41 state
->buf
[0] = req
->cmd
;
42 state
->buf
[1] = state
->seq
++;
43 state
->buf
[2] = req
->i2c_addr
;
44 state
->buf
[3] = req
->addr
>> 8;
45 state
->buf
[4] = req
->addr
& 0xff;
46 state
->buf
[5] = req
->mbox
;
47 state
->buf
[6] = req
->addr_len
;
48 state
->buf
[7] = req
->data_len
;
58 state
->buf
[2] |= 0x01; /* set I2C direction */
60 state
->buf
[0] = READ_WRITE_I2C
;
63 if (((req
->addr
& 0xff00) == 0xff00) ||
64 ((req
->addr
& 0xff00) == 0xae00))
65 state
->buf
[0] = WRITE_VIRTUAL_MEMORY
;
66 case WRITE_VIRTUAL_MEMORY
:
68 case DOWNLOAD_FIRMWARE
:
72 dev_err(&d
->udev
->dev
, "%s: unknown command=%d\n",
73 KBUILD_MODNAME
, req
->cmd
);
78 /* buffer overflow check */
79 if ((write
&& (req
->data_len
> BUF_LEN
- REQ_HDR_LEN
)) ||
80 (!write
&& (req
->data_len
> BUF_LEN
- ACK_HDR_LEN
))) {
81 dev_err(&d
->udev
->dev
, "%s: too much data; cmd=%d len=%d\n",
82 KBUILD_MODNAME
, req
->cmd
, req
->data_len
);
87 /* write receives seq + status = 2 bytes
88 read receives seq + status + data = 2 + N bytes */
92 wlen
+= req
->data_len
;
93 memcpy(&state
->buf
[REQ_HDR_LEN
], req
->data
, req
->data_len
);
95 rlen
+= req
->data_len
;
98 /* no ack for these packets */
99 if (req
->cmd
== DOWNLOAD_FIRMWARE
|| req
->cmd
== RECONNECT_USB
)
102 ret
= dvb_usbv2_generic_rw_locked(d
,
103 state
->buf
, wlen
, state
->buf
, rlen
);
108 if (rlen
&& state
->buf
[1]) {
109 dev_err(&d
->udev
->dev
, "%s: command failed=%d\n",
110 KBUILD_MODNAME
, state
->buf
[1]);
115 /* read request, copy returned data to return buf */
117 memcpy(req
->data
, &state
->buf
[ACK_HDR_LEN
], req
->data_len
);
119 mutex_unlock(&d
->usb_mutex
);
124 static int af9015_write_regs(struct dvb_usb_device
*d
, u16 addr
, u8
*val
,
127 struct req_t req
= {WRITE_MEMORY
, AF9015_I2C_DEMOD
, addr
, 0, 0, len
,
129 return af9015_ctrl_msg(d
, &req
);
132 static int af9015_read_regs(struct dvb_usb_device
*d
, u16 addr
, u8
*val
, u8 len
)
134 struct req_t req
= {READ_MEMORY
, AF9015_I2C_DEMOD
, addr
, 0, 0, len
,
136 return af9015_ctrl_msg(d
, &req
);
139 static int af9015_write_reg(struct dvb_usb_device
*d
, u16 addr
, u8 val
)
141 return af9015_write_regs(d
, addr
, &val
, 1);
144 static int af9015_read_reg(struct dvb_usb_device
*d
, u16 addr
, u8
*val
)
146 return af9015_read_regs(d
, addr
, val
, 1);
149 static int af9015_write_reg_i2c(struct dvb_usb_device
*d
, u8 addr
, u16 reg
,
152 struct af9015_state
*state
= d_to_priv(d
);
153 struct req_t req
= {WRITE_I2C
, addr
, reg
, 1, 1, 1, &val
};
155 if (addr
== state
->af9013_config
[0].i2c_addr
||
156 addr
== state
->af9013_config
[1].i2c_addr
)
159 return af9015_ctrl_msg(d
, &req
);
162 static int af9015_read_reg_i2c(struct dvb_usb_device
*d
, u8 addr
, u16 reg
,
165 struct af9015_state
*state
= d_to_priv(d
);
166 struct req_t req
= {READ_I2C
, addr
, reg
, 0, 1, 1, val
};
168 if (addr
== state
->af9013_config
[0].i2c_addr
||
169 addr
== state
->af9013_config
[1].i2c_addr
)
172 return af9015_ctrl_msg(d
, &req
);
175 static int af9015_do_reg_bit(struct dvb_usb_device
*d
, u16 addr
, u8 bit
, u8 op
)
180 ret
= af9015_read_reg(d
, addr
, &val
);
194 return af9015_write_reg(d
, addr
, val
);
197 static int af9015_set_reg_bit(struct dvb_usb_device
*d
, u16 addr
, u8 bit
)
199 return af9015_do_reg_bit(d
, addr
, bit
, 1);
202 static int af9015_clear_reg_bit(struct dvb_usb_device
*d
, u16 addr
, u8 bit
)
204 return af9015_do_reg_bit(d
, addr
, bit
, 0);
207 static int af9015_i2c_xfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[],
210 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
211 struct af9015_state
*state
= d_to_priv(d
);
214 u8
uninitialized_var(mbox
), addr_len
;
218 The bus lock is needed because there is two tuners both using same I2C-address.
219 Due to that the only way to select correct tuner is use demodulator I2C-gate.
221 ................................................
222 . AF9015 includes integrated AF9013 demodulator.
223 . ____________ ____________ . ____________
224 .| uC | | demod | . | tuner |
225 .|------------| |------------| . |------------|
226 .| AF9015 | | AF9013/5 | . | MXL5003 |
227 .| |--+----I2C-------|-----/ -----|-.-----I2C-------| |
228 .| | | | addr 0x38 | . | addr 0xc6 |
229 .|____________| | |____________| . |____________|
230 .................|..............................
231 | ____________ ____________
232 | | demod | | tuner |
233 | |------------| |------------|
234 | | AF9013 | | MXL5003 |
235 +----I2C-------|-----/ -----|-------I2C-------| |
236 | addr 0x3a | | addr 0xc6 |
237 |____________| |____________|
239 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
243 if (msg
[i
].addr
== state
->af9013_config
[0].i2c_addr
||
244 msg
[i
].addr
== state
->af9013_config
[1].i2c_addr
) {
245 addr
= msg
[i
].buf
[0] << 8;
246 addr
+= msg
[i
].buf
[1];
247 mbox
= msg
[i
].buf
[2];
250 addr
= msg
[i
].buf
[0];
252 /* mbox is don't care in that case */
255 if (num
> i
+ 1 && (msg
[i
+1].flags
& I2C_M_RD
)) {
256 if (msg
[i
].len
> 3 || msg
[i
+1].len
> 61) {
260 if (msg
[i
].addr
== state
->af9013_config
[0].i2c_addr
)
261 req
.cmd
= READ_MEMORY
;
264 req
.i2c_addr
= msg
[i
].addr
;
267 req
.addr_len
= addr_len
;
268 req
.data_len
= msg
[i
+1].len
;
269 req
.data
= &msg
[i
+1].buf
[0];
270 ret
= af9015_ctrl_msg(d
, &req
);
272 } else if (msg
[i
].flags
& I2C_M_RD
) {
273 if (msg
[i
].len
> 61) {
277 if (msg
[i
].addr
== state
->af9013_config
[0].i2c_addr
) {
282 req
.i2c_addr
= msg
[i
].addr
;
285 req
.addr_len
= addr_len
;
286 req
.data_len
= msg
[i
].len
;
287 req
.data
= &msg
[i
].buf
[0];
288 ret
= af9015_ctrl_msg(d
, &req
);
291 if (msg
[i
].len
> 21) {
295 if (msg
[i
].addr
== state
->af9013_config
[0].i2c_addr
)
296 req
.cmd
= WRITE_MEMORY
;
299 req
.i2c_addr
= msg
[i
].addr
;
302 req
.addr_len
= addr_len
;
303 req
.data_len
= msg
[i
].len
-addr_len
;
304 req
.data
= &msg
[i
].buf
[addr_len
];
305 ret
= af9015_ctrl_msg(d
, &req
);
315 mutex_unlock(&d
->i2c_mutex
);
320 static u32
af9015_i2c_func(struct i2c_adapter
*adapter
)
325 static struct i2c_algorithm af9015_i2c_algo
= {
326 .master_xfer
= af9015_i2c_xfer
,
327 .functionality
= af9015_i2c_func
,
330 static int af9015_identify_state(struct dvb_usb_device
*d
, const char **name
)
334 struct req_t req
= {GET_CONFIG
, 0, 0, 0, 0, 1, &reply
};
336 ret
= af9015_ctrl_msg(d
, &req
);
340 dev_dbg(&d
->udev
->dev
, "%s: reply=%02x\n", __func__
, reply
);
350 static int af9015_download_firmware(struct dvb_usb_device
*d
,
351 const struct firmware
*fw
)
353 struct af9015_state
*state
= d_to_priv(d
);
354 int i
, len
, remaining
, ret
;
355 struct req_t req
= {DOWNLOAD_FIRMWARE
, 0, 0, 0, 0, 0, NULL
};
357 dev_dbg(&d
->udev
->dev
, "%s:\n", __func__
);
360 for (i
= 0; i
< fw
->size
; i
++)
361 checksum
+= fw
->data
[i
];
363 state
->firmware_size
= fw
->size
;
364 state
->firmware_checksum
= checksum
;
366 #define FW_ADDR 0x5100 /* firmware start address */
367 #define LEN_MAX 55 /* max packet size */
368 for (remaining
= fw
->size
; remaining
> 0; remaining
-= LEN_MAX
) {
374 req
.data
= (u8
*) &fw
->data
[fw
->size
- remaining
];
375 req
.addr
= FW_ADDR
+ fw
->size
- remaining
;
377 ret
= af9015_ctrl_msg(d
, &req
);
379 dev_err(&d
->udev
->dev
,
380 "%s: firmware download failed=%d\n",
381 KBUILD_MODNAME
, ret
);
386 /* firmware loaded, request boot */
389 ret
= af9015_ctrl_msg(d
, &req
);
391 dev_err(&d
->udev
->dev
, "%s: firmware boot failed=%d\n",
392 KBUILD_MODNAME
, ret
);
400 /* hash (and dump) eeprom */
401 static int af9015_eeprom_hash(struct dvb_usb_device
*d
)
403 struct af9015_state
*state
= d_to_priv(d
);
405 static const unsigned int AF9015_EEPROM_SIZE
= 256;
406 u8 buf
[AF9015_EEPROM_SIZE
];
407 struct req_t req
= {READ_I2C
, AF9015_I2C_EEPROM
, 0, 0, 1, 1, NULL
};
410 for (i
= 0; i
< AF9015_EEPROM_SIZE
; i
++) {
413 ret
= af9015_ctrl_msg(d
, &req
);
418 /* calculate checksum */
419 for (i
= 0; i
< AF9015_EEPROM_SIZE
/ sizeof(u32
); i
++) {
420 state
->eeprom_sum
*= GOLDEN_RATIO_PRIME_32
;
421 state
->eeprom_sum
+= le32_to_cpu(((u32
*)buf
)[i
]);
424 for (i
= 0; i
< AF9015_EEPROM_SIZE
; i
+= 16)
425 dev_dbg(&d
->udev
->dev
, "%s: %*ph\n", __func__
, 16, buf
+ i
);
427 dev_dbg(&d
->udev
->dev
, "%s: eeprom sum=%.8x\n",
428 __func__
, state
->eeprom_sum
);
431 dev_err(&d
->udev
->dev
, "%s: eeprom failed=%d\n", KBUILD_MODNAME
, ret
);
435 static int af9015_read_config(struct dvb_usb_device
*d
)
437 struct af9015_state
*state
= d_to_priv(d
);
439 u8 val
, i
, offset
= 0;
440 struct req_t req
= {READ_I2C
, AF9015_I2C_EEPROM
, 0, 0, 1, 1, &val
};
442 dev_dbg(&d
->udev
->dev
, "%s:\n", __func__
);
444 /* IR remote controller */
445 req
.addr
= AF9015_EEPROM_IR_MODE
;
446 /* first message will timeout often due to possible hw bug */
447 for (i
= 0; i
< 4; i
++) {
448 ret
= af9015_ctrl_msg(d
, &req
);
455 ret
= af9015_eeprom_hash(d
);
459 state
->ir_mode
= val
;
460 dev_dbg(&d
->udev
->dev
, "%s: IR mode=%d\n", __func__
, val
);
462 /* TS mode - one or two receivers */
463 req
.addr
= AF9015_EEPROM_TS_MODE
;
464 ret
= af9015_ctrl_msg(d
, &req
);
468 state
->dual_mode
= val
;
469 dev_dbg(&d
->udev
->dev
, "%s: TS mode=%d\n", __func__
, state
->dual_mode
);
471 /* disable 2nd adapter because we don't have PID-filters */
472 if (d
->udev
->speed
== USB_SPEED_FULL
)
473 state
->dual_mode
= 0;
475 if (state
->dual_mode
) {
476 /* read 2nd demodulator I2C address */
477 req
.addr
= AF9015_EEPROM_DEMOD2_I2C
;
478 ret
= af9015_ctrl_msg(d
, &req
);
482 state
->af9013_config
[1].i2c_addr
= val
;
485 for (i
= 0; i
< state
->dual_mode
+ 1; i
++) {
487 offset
= AF9015_EEPROM_OFFSET
;
489 req
.addr
= AF9015_EEPROM_XTAL_TYPE1
+ offset
;
490 ret
= af9015_ctrl_msg(d
, &req
);
495 state
->af9013_config
[i
].clock
= 28800000;
498 state
->af9013_config
[i
].clock
= 20480000;
501 state
->af9013_config
[i
].clock
= 28000000;
504 state
->af9013_config
[i
].clock
= 25000000;
507 dev_dbg(&d
->udev
->dev
, "%s: [%d] xtal=%d set clock=%d\n",
509 state
->af9013_config
[i
].clock
);
512 req
.addr
= AF9015_EEPROM_IF1H
+ offset
;
513 ret
= af9015_ctrl_msg(d
, &req
);
517 state
->af9013_config
[i
].if_frequency
= val
<< 8;
519 req
.addr
= AF9015_EEPROM_IF1L
+ offset
;
520 ret
= af9015_ctrl_msg(d
, &req
);
524 state
->af9013_config
[i
].if_frequency
+= val
;
525 state
->af9013_config
[i
].if_frequency
*= 1000;
526 dev_dbg(&d
->udev
->dev
, "%s: [%d] IF frequency=%d\n", __func__
,
527 i
, state
->af9013_config
[i
].if_frequency
);
530 req
.addr
= AF9015_EEPROM_MT2060_IF1H
+ offset
;
531 ret
= af9015_ctrl_msg(d
, &req
);
534 state
->mt2060_if1
[i
] = val
<< 8;
535 req
.addr
= AF9015_EEPROM_MT2060_IF1L
+ offset
;
536 ret
= af9015_ctrl_msg(d
, &req
);
539 state
->mt2060_if1
[i
] += val
;
540 dev_dbg(&d
->udev
->dev
, "%s: [%d] MT2060 IF1=%d\n", __func__
, i
,
541 state
->mt2060_if1
[i
]);
544 req
.addr
= AF9015_EEPROM_TUNER_ID1
+ offset
;
545 ret
= af9015_ctrl_msg(d
, &req
);
549 case AF9013_TUNER_ENV77H11D5
:
550 case AF9013_TUNER_MT2060
:
551 case AF9013_TUNER_QT1010
:
552 case AF9013_TUNER_UNKNOWN
:
553 case AF9013_TUNER_MT2060_2
:
554 case AF9013_TUNER_TDA18271
:
555 case AF9013_TUNER_QT1010A
:
556 case AF9013_TUNER_TDA18218
:
557 state
->af9013_config
[i
].spec_inv
= 1;
559 case AF9013_TUNER_MXL5003D
:
560 case AF9013_TUNER_MXL5005D
:
561 case AF9013_TUNER_MXL5005R
:
562 case AF9013_TUNER_MXL5007T
:
563 state
->af9013_config
[i
].spec_inv
= 0;
565 case AF9013_TUNER_MC44S803
:
566 state
->af9013_config
[i
].gpio
[1] = AF9013_GPIO_LO
;
567 state
->af9013_config
[i
].spec_inv
= 1;
570 dev_err(&d
->udev
->dev
, "%s: tuner id=%d not " \
571 "supported, please report!\n",
572 KBUILD_MODNAME
, val
);
576 state
->af9013_config
[i
].tuner
= val
;
577 dev_dbg(&d
->udev
->dev
, "%s: [%d] tuner id=%d\n",
583 dev_err(&d
->udev
->dev
, "%s: eeprom read failed=%d\n",
584 KBUILD_MODNAME
, ret
);
586 /* AverMedia AVerTV Volar Black HD (A850) device have bad EEPROM
587 content :-( Override some wrong values here. Ditto for the
588 AVerTV Red HD+ (A850T) device. */
589 if (le16_to_cpu(d
->udev
->descriptor
.idVendor
) == USB_VID_AVERMEDIA
&&
590 ((le16_to_cpu(d
->udev
->descriptor
.idProduct
) ==
591 USB_PID_AVERMEDIA_A850
) ||
592 (le16_to_cpu(d
->udev
->descriptor
.idProduct
) ==
593 USB_PID_AVERMEDIA_A850T
))) {
594 dev_dbg(&d
->udev
->dev
,
595 "%s: AverMedia A850: overriding config\n",
597 /* disable dual mode */
598 state
->dual_mode
= 0;
601 state
->af9013_config
[0].if_frequency
= 4570000;
607 static int af9015_get_stream_config(struct dvb_frontend
*fe
, u8
*ts_type
,
608 struct usb_data_stream_properties
*stream
)
610 struct dvb_usb_device
*d
= fe_to_d(fe
);
611 dev_dbg(&d
->udev
->dev
, "%s: adap=%d\n", __func__
, fe_to_adap(fe
)->id
);
613 if (d
->udev
->speed
== USB_SPEED_FULL
)
614 stream
->u
.bulk
.buffersize
= TS_USB11_FRAME_SIZE
;
619 static int af9015_get_adapter_count(struct dvb_usb_device
*d
)
621 struct af9015_state
*state
= d_to_priv(d
);
622 return state
->dual_mode
+ 1;
625 /* override demod callbacks for resource locking */
626 static int af9015_af9013_set_frontend(struct dvb_frontend
*fe
)
629 struct af9015_state
*state
= fe_to_priv(fe
);
631 if (mutex_lock_interruptible(&state
->fe_mutex
))
634 ret
= state
->set_frontend
[fe_to_adap(fe
)->id
](fe
);
636 mutex_unlock(&state
->fe_mutex
);
641 /* override demod callbacks for resource locking */
642 static int af9015_af9013_read_status(struct dvb_frontend
*fe
,
646 struct af9015_state
*state
= fe_to_priv(fe
);
648 if (mutex_lock_interruptible(&state
->fe_mutex
))
651 ret
= state
->read_status
[fe_to_adap(fe
)->id
](fe
, status
);
653 mutex_unlock(&state
->fe_mutex
);
658 /* override demod callbacks for resource locking */
659 static int af9015_af9013_init(struct dvb_frontend
*fe
)
662 struct af9015_state
*state
= fe_to_priv(fe
);
664 if (mutex_lock_interruptible(&state
->fe_mutex
))
667 ret
= state
->init
[fe_to_adap(fe
)->id
](fe
);
669 mutex_unlock(&state
->fe_mutex
);
674 /* override demod callbacks for resource locking */
675 static int af9015_af9013_sleep(struct dvb_frontend
*fe
)
678 struct af9015_state
*state
= fe_to_priv(fe
);
680 if (mutex_lock_interruptible(&state
->fe_mutex
))
683 ret
= state
->sleep
[fe_to_adap(fe
)->id
](fe
);
685 mutex_unlock(&state
->fe_mutex
);
690 /* override tuner callbacks for resource locking */
691 static int af9015_tuner_init(struct dvb_frontend
*fe
)
694 struct af9015_state
*state
= fe_to_priv(fe
);
696 if (mutex_lock_interruptible(&state
->fe_mutex
))
699 ret
= state
->tuner_init
[fe_to_adap(fe
)->id
](fe
);
701 mutex_unlock(&state
->fe_mutex
);
706 /* override tuner callbacks for resource locking */
707 static int af9015_tuner_sleep(struct dvb_frontend
*fe
)
710 struct af9015_state
*state
= fe_to_priv(fe
);
712 if (mutex_lock_interruptible(&state
->fe_mutex
))
715 ret
= state
->tuner_sleep
[fe_to_adap(fe
)->id
](fe
);
717 mutex_unlock(&state
->fe_mutex
);
722 static int af9015_copy_firmware(struct dvb_usb_device
*d
)
724 struct af9015_state
*state
= d_to_priv(d
);
728 struct req_t req
= {COPY_FIRMWARE
, 0, 0x5100, 0, 0, sizeof(fw_params
),
730 dev_dbg(&d
->udev
->dev
, "%s:\n", __func__
);
732 fw_params
[0] = state
->firmware_size
>> 8;
733 fw_params
[1] = state
->firmware_size
& 0xff;
734 fw_params
[2] = state
->firmware_checksum
>> 8;
735 fw_params
[3] = state
->firmware_checksum
& 0xff;
737 /* wait 2nd demodulator ready */
740 ret
= af9015_read_reg_i2c(d
, state
->af9013_config
[1].i2c_addr
,
745 dev_dbg(&d
->udev
->dev
, "%s: firmware status=%02x\n",
748 if (val
== 0x0c) /* fw is running, no need for download */
751 /* set I2C master clock to fast (to speed up firmware copy) */
752 ret
= af9015_write_reg(d
, 0xd416, 0x04); /* 0x04 * 400ns */
759 ret
= af9015_ctrl_msg(d
, &req
);
761 dev_err(&d
->udev
->dev
, "%s: firmware copy cmd failed=%d\n",
762 KBUILD_MODNAME
, ret
);
764 dev_dbg(&d
->udev
->dev
, "%s: firmware copy done\n", __func__
);
766 /* set I2C master clock back to normal */
767 ret
= af9015_write_reg(d
, 0xd416, 0x14); /* 0x14 * 400ns */
771 /* request boot firmware */
772 ret
= af9015_write_reg_i2c(d
, state
->af9013_config
[1].i2c_addr
,
774 dev_dbg(&d
->udev
->dev
, "%s: firmware boot cmd status=%d\n",
779 for (i
= 0; i
< 15; i
++) {
782 /* check firmware status */
783 ret
= af9015_read_reg_i2c(d
, state
->af9013_config
[1].i2c_addr
,
785 dev_dbg(&d
->udev
->dev
, "%s: firmware status cmd status=%d " \
786 "firmware status=%02x\n", __func__
, ret
, val
);
790 if (val
== 0x0c || val
== 0x04) /* success or fail */
795 dev_err(&d
->udev
->dev
, "%s: firmware did not run\n",
798 } else if (val
!= 0x0c) {
799 dev_err(&d
->udev
->dev
, "%s: firmware boot timeout\n",
809 static int af9015_af9013_frontend_attach(struct dvb_usb_adapter
*adap
)
812 struct af9015_state
*state
= adap_to_priv(adap
);
815 state
->af9013_config
[0].ts_mode
= AF9013_TS_USB
;
816 memcpy(state
->af9013_config
[0].api_version
, "\x0\x1\x9\x0", 4);
817 state
->af9013_config
[0].gpio
[0] = AF9013_GPIO_HI
;
818 state
->af9013_config
[0].gpio
[3] = AF9013_GPIO_TUNER_ON
;
819 } else if (adap
->id
== 1) {
820 state
->af9013_config
[1].ts_mode
= AF9013_TS_SERIAL
;
821 memcpy(state
->af9013_config
[1].api_version
, "\x0\x1\x9\x0", 4);
822 state
->af9013_config
[1].gpio
[0] = AF9013_GPIO_TUNER_ON
;
823 state
->af9013_config
[1].gpio
[1] = AF9013_GPIO_LO
;
825 /* copy firmware to 2nd demodulator */
826 if (state
->dual_mode
) {
827 ret
= af9015_copy_firmware(adap_to_d(adap
));
829 dev_err(&adap_to_d(adap
)->udev
->dev
,
830 "%s: firmware copy to 2nd " \
831 "frontend failed, will " \
832 "disable it\n", KBUILD_MODNAME
);
833 state
->dual_mode
= 0;
841 /* attach demodulator */
842 adap
->fe
[0] = dvb_attach(af9013_attach
,
843 &state
->af9013_config
[adap
->id
], &adap_to_d(adap
)->i2c_adap
);
846 * AF9015 firmware does not like if it gets interrupted by I2C adapter
847 * request on some critical phases. During normal operation I2C adapter
848 * is used only 2nd demodulator and tuner on dual tuner devices.
849 * Override demodulator callbacks and use mutex for limit access to
850 * those "critical" paths to keep AF9015 happy.
853 state
->set_frontend
[adap
->id
] =
854 adap
->fe
[0]->ops
.set_frontend
;
855 adap
->fe
[0]->ops
.set_frontend
=
856 af9015_af9013_set_frontend
;
858 state
->read_status
[adap
->id
] =
859 adap
->fe
[0]->ops
.read_status
;
860 adap
->fe
[0]->ops
.read_status
=
861 af9015_af9013_read_status
;
863 state
->init
[adap
->id
] = adap
->fe
[0]->ops
.init
;
864 adap
->fe
[0]->ops
.init
= af9015_af9013_init
;
866 state
->sleep
[adap
->id
] = adap
->fe
[0]->ops
.sleep
;
867 adap
->fe
[0]->ops
.sleep
= af9015_af9013_sleep
;
870 return adap
->fe
[0] == NULL
? -ENODEV
: 0;
873 static struct mt2060_config af9015_mt2060_config
= {
878 static struct qt1010_config af9015_qt1010_config
= {
882 static struct tda18271_config af9015_tda18271_config
= {
883 .gate
= TDA18271_GATE_DIGITAL
,
884 .small_i2c
= TDA18271_16_BYTE_CHUNK_INIT
,
887 static struct mxl5005s_config af9015_mxl5003_config
= {
889 .if_freq
= IF_FREQ_4570000HZ
,
890 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
891 .agc_mode
= MXL_SINGLE_AGC
,
892 .tracking_filter
= MXL_TF_DEFAULT
,
893 .rssi_enable
= MXL_RSSI_ENABLE
,
894 .cap_select
= MXL_CAP_SEL_ENABLE
,
895 .div_out
= MXL_DIV_OUT_4
,
896 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
897 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
898 .top
= MXL5005S_TOP_25P2
,
899 .mod_mode
= MXL_DIGITAL_MODE
,
900 .if_mode
= MXL_ZERO_IF
,
901 .AgcMasterByte
= 0x00,
904 static struct mxl5005s_config af9015_mxl5005_config
= {
906 .if_freq
= IF_FREQ_4570000HZ
,
907 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
908 .agc_mode
= MXL_SINGLE_AGC
,
909 .tracking_filter
= MXL_TF_OFF
,
910 .rssi_enable
= MXL_RSSI_ENABLE
,
911 .cap_select
= MXL_CAP_SEL_ENABLE
,
912 .div_out
= MXL_DIV_OUT_4
,
913 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
914 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
915 .top
= MXL5005S_TOP_25P2
,
916 .mod_mode
= MXL_DIGITAL_MODE
,
917 .if_mode
= MXL_ZERO_IF
,
918 .AgcMasterByte
= 0x00,
921 static struct mc44s803_config af9015_mc44s803_config
= {
926 static struct tda18218_config af9015_tda18218_config
= {
928 .i2c_wr_max
= 21, /* max wr bytes AF9015 I2C adap can handle at once */
931 static struct mxl5007t_config af9015_mxl5007t_config
= {
932 .xtal_freq_hz
= MxL_XTAL_24_MHZ
,
933 .if_freq_hz
= MxL_IF_4_57_MHZ
,
936 static int af9015_tuner_attach(struct dvb_usb_adapter
*adap
)
938 struct dvb_usb_device
*d
= adap_to_d(adap
);
939 struct af9015_state
*state
= d_to_priv(d
);
941 dev_dbg(&d
->udev
->dev
, "%s:\n", __func__
);
943 switch (state
->af9013_config
[adap
->id
].tuner
) {
944 case AF9013_TUNER_MT2060
:
945 case AF9013_TUNER_MT2060_2
:
946 ret
= dvb_attach(mt2060_attach
, adap
->fe
[0],
947 &adap_to_d(adap
)->i2c_adap
, &af9015_mt2060_config
,
948 state
->mt2060_if1
[adap
->id
])
949 == NULL
? -ENODEV
: 0;
951 case AF9013_TUNER_QT1010
:
952 case AF9013_TUNER_QT1010A
:
953 ret
= dvb_attach(qt1010_attach
, adap
->fe
[0],
954 &adap_to_d(adap
)->i2c_adap
,
955 &af9015_qt1010_config
) == NULL
? -ENODEV
: 0;
957 case AF9013_TUNER_TDA18271
:
958 ret
= dvb_attach(tda18271_attach
, adap
->fe
[0], 0xc0,
959 &adap_to_d(adap
)->i2c_adap
,
960 &af9015_tda18271_config
) == NULL
? -ENODEV
: 0;
962 case AF9013_TUNER_TDA18218
:
963 ret
= dvb_attach(tda18218_attach
, adap
->fe
[0],
964 &adap_to_d(adap
)->i2c_adap
,
965 &af9015_tda18218_config
) == NULL
? -ENODEV
: 0;
967 case AF9013_TUNER_MXL5003D
:
968 ret
= dvb_attach(mxl5005s_attach
, adap
->fe
[0],
969 &adap_to_d(adap
)->i2c_adap
,
970 &af9015_mxl5003_config
) == NULL
? -ENODEV
: 0;
972 case AF9013_TUNER_MXL5005D
:
973 case AF9013_TUNER_MXL5005R
:
974 ret
= dvb_attach(mxl5005s_attach
, adap
->fe
[0],
975 &adap_to_d(adap
)->i2c_adap
,
976 &af9015_mxl5005_config
) == NULL
? -ENODEV
: 0;
978 case AF9013_TUNER_ENV77H11D5
:
979 ret
= dvb_attach(dvb_pll_attach
, adap
->fe
[0], 0xc0,
980 &adap_to_d(adap
)->i2c_adap
,
981 DVB_PLL_TDA665X
) == NULL
? -ENODEV
: 0;
983 case AF9013_TUNER_MC44S803
:
984 ret
= dvb_attach(mc44s803_attach
, adap
->fe
[0],
985 &adap_to_d(adap
)->i2c_adap
,
986 &af9015_mc44s803_config
) == NULL
? -ENODEV
: 0;
988 case AF9013_TUNER_MXL5007T
:
989 ret
= dvb_attach(mxl5007t_attach
, adap
->fe
[0],
990 &adap_to_d(adap
)->i2c_adap
,
991 0xc0, &af9015_mxl5007t_config
) == NULL
? -ENODEV
: 0;
993 case AF9013_TUNER_UNKNOWN
:
995 dev_err(&d
->udev
->dev
, "%s: unknown tuner id=%d\n",
997 state
->af9013_config
[adap
->id
].tuner
);
1001 if (adap
->fe
[0]->ops
.tuner_ops
.init
) {
1002 state
->tuner_init
[adap
->id
] =
1003 adap
->fe
[0]->ops
.tuner_ops
.init
;
1004 adap
->fe
[0]->ops
.tuner_ops
.init
= af9015_tuner_init
;
1007 if (adap
->fe
[0]->ops
.tuner_ops
.sleep
) {
1008 state
->tuner_sleep
[adap
->id
] =
1009 adap
->fe
[0]->ops
.tuner_ops
.sleep
;
1010 adap
->fe
[0]->ops
.tuner_ops
.sleep
= af9015_tuner_sleep
;
1016 static int af9015_pid_filter_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
1018 struct dvb_usb_device
*d
= adap_to_d(adap
);
1020 dev_dbg(&d
->udev
->dev
, "%s: onoff=%d\n", __func__
, onoff
);
1023 ret
= af9015_set_reg_bit(d
, 0xd503, 0);
1025 ret
= af9015_clear_reg_bit(d
, 0xd503, 0);
1030 static int af9015_pid_filter(struct dvb_usb_adapter
*adap
, int index
, u16 pid
,
1033 struct dvb_usb_device
*d
= adap_to_d(adap
);
1036 dev_dbg(&d
->udev
->dev
, "%s: index=%d pid=%04x onoff=%d\n",
1037 __func__
, index
, pid
, onoff
);
1039 ret
= af9015_write_reg(d
, 0xd505, (pid
& 0xff));
1043 ret
= af9015_write_reg(d
, 0xd506, (pid
>> 8));
1047 idx
= ((index
& 0x1f) | (1 << 5));
1048 ret
= af9015_write_reg(d
, 0xd504, idx
);
1054 static int af9015_init_endpoint(struct dvb_usb_device
*d
)
1056 struct af9015_state
*state
= d_to_priv(d
);
1060 dev_dbg(&d
->udev
->dev
, "%s: USB speed=%d\n", __func__
, d
->udev
->speed
);
1062 if (d
->udev
->speed
== USB_SPEED_FULL
) {
1063 frame_size
= TS_USB11_FRAME_SIZE
/4;
1064 packet_size
= TS_USB11_MAX_PACKET_SIZE
/4;
1066 frame_size
= TS_USB20_FRAME_SIZE
/4;
1067 packet_size
= TS_USB20_MAX_PACKET_SIZE
/4;
1070 ret
= af9015_set_reg_bit(d
, 0xd507, 2); /* assert EP4 reset */
1073 ret
= af9015_set_reg_bit(d
, 0xd50b, 1); /* assert EP5 reset */
1076 ret
= af9015_clear_reg_bit(d
, 0xdd11, 5); /* disable EP4 */
1079 ret
= af9015_clear_reg_bit(d
, 0xdd11, 6); /* disable EP5 */
1082 ret
= af9015_set_reg_bit(d
, 0xdd11, 5); /* enable EP4 */
1085 if (state
->dual_mode
) {
1086 ret
= af9015_set_reg_bit(d
, 0xdd11, 6); /* enable EP5 */
1090 ret
= af9015_clear_reg_bit(d
, 0xdd13, 5); /* disable EP4 NAK */
1093 if (state
->dual_mode
) {
1094 ret
= af9015_clear_reg_bit(d
, 0xdd13, 6); /* disable EP5 NAK */
1098 /* EP4 xfer length */
1099 ret
= af9015_write_reg(d
, 0xdd88, frame_size
& 0xff);
1102 ret
= af9015_write_reg(d
, 0xdd89, frame_size
>> 8);
1105 /* EP5 xfer length */
1106 ret
= af9015_write_reg(d
, 0xdd8a, frame_size
& 0xff);
1109 ret
= af9015_write_reg(d
, 0xdd8b, frame_size
>> 8);
1112 ret
= af9015_write_reg(d
, 0xdd0c, packet_size
); /* EP4 packet size */
1115 ret
= af9015_write_reg(d
, 0xdd0d, packet_size
); /* EP5 packet size */
1118 ret
= af9015_clear_reg_bit(d
, 0xd507, 2); /* negate EP4 reset */
1121 if (state
->dual_mode
) {
1122 ret
= af9015_clear_reg_bit(d
, 0xd50b, 1); /* negate EP5 reset */
1127 /* enable / disable mp2if2 */
1128 if (state
->dual_mode
)
1129 ret
= af9015_set_reg_bit(d
, 0xd50b, 0);
1131 ret
= af9015_clear_reg_bit(d
, 0xd50b, 0);
1135 dev_err(&d
->udev
->dev
, "%s: endpoint init failed=%d\n",
1136 KBUILD_MODNAME
, ret
);
1141 static int af9015_init(struct dvb_usb_device
*d
)
1143 struct af9015_state
*state
= d_to_priv(d
);
1145 dev_dbg(&d
->udev
->dev
, "%s:\n", __func__
);
1147 mutex_init(&state
->fe_mutex
);
1149 /* init RC canary */
1150 ret
= af9015_write_reg(d
, 0x98e9, 0xff);
1154 ret
= af9015_init_endpoint(d
);
1162 #if IS_ENABLED(CONFIG_RC_CORE)
1163 struct af9015_rc_setup
{
1168 static char *af9015_rc_setup_match(unsigned int id
,
1169 const struct af9015_rc_setup
*table
)
1171 for (; table
->rc_codes
; table
++)
1172 if (table
->id
== id
)
1173 return table
->rc_codes
;
1177 static const struct af9015_rc_setup af9015_rc_setup_modparam
[] = {
1178 { AF9015_REMOTE_A_LINK_DTU_M
, RC_MAP_ALINK_DTU_M
},
1179 { AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3
, RC_MAP_MSI_DIGIVOX_II
},
1180 { AF9015_REMOTE_MYGICTV_U718
, RC_MAP_TOTAL_MEDIA_IN_HAND
},
1181 { AF9015_REMOTE_DIGITTRADE_DVB_T
, RC_MAP_DIGITTRADE
},
1182 { AF9015_REMOTE_AVERMEDIA_KS
, RC_MAP_AVERMEDIA_RM_KS
},
1186 static const struct af9015_rc_setup af9015_rc_setup_hashes
[] = {
1187 { 0xb8feb708, RC_MAP_MSI_DIGIVOX_II
},
1188 { 0xa3703d00, RC_MAP_ALINK_DTU_M
},
1189 { 0x9b7dc64e, RC_MAP_TOTAL_MEDIA_IN_HAND
}, /* MYGICTV U718 */
1190 { 0x5d49e3db, RC_MAP_DIGITTRADE
}, /* LC-Power LC-USB-DVBT */
1194 static int af9015_rc_query(struct dvb_usb_device
*d
)
1196 struct af9015_state
*state
= d_to_priv(d
);
1200 /* read registers needed to detect remote controller code */
1201 ret
= af9015_read_regs(d
, 0x98d9, buf
, sizeof(buf
));
1205 /* If any of these are non-zero, assume invalid data */
1206 if (buf
[1] || buf
[2] || buf
[3]) {
1207 dev_dbg(&d
->udev
->dev
, "%s: invalid data\n", __func__
);
1211 /* Check for repeat of previous code */
1212 if ((state
->rc_repeat
!= buf
[6] || buf
[0]) &&
1213 !memcmp(&buf
[12], state
->rc_last
, 4)) {
1214 dev_dbg(&d
->udev
->dev
, "%s: key repeated\n", __func__
);
1215 rc_keydown(d
->rc_dev
, state
->rc_keycode
, 0);
1216 state
->rc_repeat
= buf
[6];
1220 /* Only process key if canary killed */
1221 if (buf
[16] != 0xff && buf
[0] != 0x01) {
1222 dev_dbg(&d
->udev
->dev
, "%s: key pressed %*ph\n",
1223 __func__
, 4, buf
+ 12);
1225 /* Reset the canary */
1226 ret
= af9015_write_reg(d
, 0x98e9, 0xff);
1230 /* Remember this key */
1231 memcpy(state
->rc_last
, &buf
[12], 4);
1232 if (buf
[14] == (u8
) ~buf
[15]) {
1233 if (buf
[12] == (u8
) ~buf
[13]) {
1235 state
->rc_keycode
= buf
[12] << 8 | buf
[14];
1238 state
->rc_keycode
= buf
[12] << 16 |
1239 buf
[13] << 8 | buf
[14];
1243 state
->rc_keycode
= buf
[12] << 24 | buf
[13] << 16 |
1244 buf
[14] << 8 | buf
[15];
1246 rc_keydown(d
->rc_dev
, state
->rc_keycode
, 0);
1248 dev_dbg(&d
->udev
->dev
, "%s: no key press\n", __func__
);
1249 /* Invalidate last keypress */
1250 /* Not really needed, but helps with debug */
1251 state
->rc_last
[2] = state
->rc_last
[3];
1254 state
->rc_repeat
= buf
[6];
1255 state
->rc_failed
= false;
1259 dev_warn(&d
->udev
->dev
, "%s: rc query failed=%d\n",
1260 KBUILD_MODNAME
, ret
);
1262 /* allow random errors as dvb-usb will stop polling on error */
1263 if (!state
->rc_failed
)
1266 state
->rc_failed
= true;
1272 static int af9015_get_rc_config(struct dvb_usb_device
*d
, struct dvb_usb_rc
*rc
)
1274 struct af9015_state
*state
= d_to_priv(d
);
1275 u16 vid
= le16_to_cpu(d
->udev
->descriptor
.idVendor
);
1277 if (state
->ir_mode
== AF9015_IR_MODE_DISABLED
)
1280 /* try to load remote based module param */
1282 rc
->map_name
= af9015_rc_setup_match(dvb_usb_af9015_remote
,
1283 af9015_rc_setup_modparam
);
1285 /* try to load remote based eeprom hash */
1287 rc
->map_name
= af9015_rc_setup_match(state
->eeprom_sum
,
1288 af9015_rc_setup_hashes
);
1290 /* try to load remote based USB iManufacturer string */
1291 if (!rc
->map_name
&& vid
== USB_VID_AFATECH
) {
1292 /* Check USB manufacturer and product strings and try
1293 to determine correct remote in case of chip vendor
1294 reference IDs are used.
1295 DO NOT ADD ANYTHING NEW HERE. Use hashes instead. */
1296 char manufacturer
[10];
1297 memset(manufacturer
, 0, sizeof(manufacturer
));
1298 usb_string(d
->udev
, d
->udev
->descriptor
.iManufacturer
,
1299 manufacturer
, sizeof(manufacturer
));
1300 if (!strcmp("MSI", manufacturer
)) {
1301 /* iManufacturer 1 MSI
1302 iProduct 2 MSI K-VOX */
1303 rc
->map_name
= af9015_rc_setup_match(
1304 AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3
,
1305 af9015_rc_setup_modparam
);
1309 /* load empty to enable rc */
1311 rc
->map_name
= RC_MAP_EMPTY
;
1313 rc
->allowed_protos
= RC_BIT_NEC
;
1314 rc
->query
= af9015_rc_query
;
1320 #define af9015_get_rc_config NULL
1323 static int af9015_probe(struct usb_interface
*intf
,
1324 const struct usb_device_id
*id
)
1326 struct usb_device
*udev
= interface_to_usbdev(intf
);
1327 char manufacturer
[sizeof("ITE Technologies, Inc.")];
1329 memset(manufacturer
, 0, sizeof(manufacturer
));
1330 usb_string(udev
, udev
->descriptor
.iManufacturer
,
1331 manufacturer
, sizeof(manufacturer
));
1333 * There is two devices having same ID but different chipset. One uses
1334 * AF9015 and the other IT9135 chipset. Only difference seen on lsusb
1335 * is iManufacturer string.
1337 * idVendor 0x0ccd TerraTec Electronic GmbH
1340 * iManufacturer 1 Afatech
1341 * iProduct 2 DVB-T 2
1343 * idVendor 0x0ccd TerraTec Electronic GmbH
1346 * iManufacturer 1 ITE Technologies, Inc.
1347 * iProduct 2 DVB-T TV Stick
1349 if ((le16_to_cpu(udev
->descriptor
.idVendor
) == USB_VID_TERRATEC
) &&
1350 (le16_to_cpu(udev
->descriptor
.idProduct
) == 0x0099)) {
1351 if (!strcmp("ITE Technologies, Inc.", manufacturer
)) {
1352 dev_dbg(&udev
->dev
, "%s: rejecting device\n", __func__
);
1357 return dvb_usbv2_probe(intf
, id
);
1360 /* interface 0 is used by DVB-T receiver and
1361 interface 1 is for remote controller (HID) */
1362 static struct dvb_usb_device_properties af9015_props
= {
1363 .driver_name
= KBUILD_MODNAME
,
1364 .owner
= THIS_MODULE
,
1365 .adapter_nr
= adapter_nr
,
1366 .size_of_priv
= sizeof(struct af9015_state
),
1368 .generic_bulk_ctrl_endpoint
= 0x02,
1369 .generic_bulk_ctrl_endpoint_response
= 0x81,
1371 .identify_state
= af9015_identify_state
,
1372 .firmware
= AF9015_FIRMWARE
,
1373 .download_firmware
= af9015_download_firmware
,
1375 .i2c_algo
= &af9015_i2c_algo
,
1376 .read_config
= af9015_read_config
,
1377 .frontend_attach
= af9015_af9013_frontend_attach
,
1378 .tuner_attach
= af9015_tuner_attach
,
1379 .init
= af9015_init
,
1380 .get_rc_config
= af9015_get_rc_config
,
1381 .get_stream_config
= af9015_get_stream_config
,
1383 .get_adapter_count
= af9015_get_adapter_count
,
1386 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
1387 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
1388 .pid_filter_count
= 32,
1389 .pid_filter
= af9015_pid_filter
,
1390 .pid_filter_ctrl
= af9015_pid_filter_ctrl
,
1392 .stream
= DVB_USB_STREAM_BULK(0x84, 8, TS_USB20_FRAME_SIZE
),
1394 .stream
= DVB_USB_STREAM_BULK(0x85, 8, TS_USB20_FRAME_SIZE
),
1399 static const struct usb_device_id af9015_id_table
[] = {
1400 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9015_9015
,
1401 &af9015_props
, "Afatech AF9015 reference design", NULL
) },
1402 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_AFATECH_AF9015_9016
,
1403 &af9015_props
, "Afatech AF9015 reference design", NULL
) },
1404 { DVB_USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV_DONGLE_GOLD
,
1405 &af9015_props
, "Leadtek WinFast DTV Dongle Gold", RC_MAP_LEADTEK_Y04G0051
) },
1406 { DVB_USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV71E
,
1407 &af9015_props
, "Pinnacle PCTV 71e", NULL
) },
1408 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_399U
,
1409 &af9015_props
, "KWorld PlusTV Dual DVB-T Stick (DVB-T 399U)", NULL
) },
1410 { DVB_USB_DEVICE(USB_VID_VISIONPLUS
, USB_PID_TINYTWIN
,
1411 &af9015_props
, "DigitalNow TinyTwin", RC_MAP_AZUREWAVE_AD_TU700
) },
1412 { DVB_USB_DEVICE(USB_VID_VISIONPLUS
, USB_PID_AZUREWAVE_AD_TU700
,
1413 &af9015_props
, "TwinHan AzureWave AD-TU700(704J)", RC_MAP_AZUREWAVE_AD_TU700
) },
1414 { DVB_USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_USB_XE_REV2
,
1415 &af9015_props
, "TerraTec Cinergy T USB XE", NULL
) },
1416 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_PC160_2T
,
1417 &af9015_props
, "KWorld PlusTV Dual DVB-T PCI (DVB-T PC160-2T)", NULL
) },
1418 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR_X
,
1419 &af9015_props
, "AVerMedia AVerTV DVB-T Volar X", RC_MAP_AVERMEDIA_M135A
) },
1420 { DVB_USB_DEVICE(USB_VID_XTENSIONS
, USB_PID_XTENSIONS_XD_380
,
1421 &af9015_props
, "Xtensions XD-380", NULL
) },
1422 { DVB_USB_DEVICE(USB_VID_MSI_2
, USB_PID_MSI_DIGIVOX_DUO
,
1423 &af9015_props
, "MSI DIGIVOX Duo", RC_MAP_MSI_DIGIVOX_III
) },
1424 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR_X_2
,
1425 &af9015_props
, "Fujitsu-Siemens Slim Mobile USB DVB-T", NULL
) },
1426 { DVB_USB_DEVICE(USB_VID_TELESTAR
, USB_PID_TELESTAR_STARSTICK_2
,
1427 &af9015_props
, "Telestar Starstick 2", NULL
) },
1428 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A309
,
1429 &af9015_props
, "AVerMedia A309", NULL
) },
1430 { DVB_USB_DEVICE(USB_VID_MSI_2
, USB_PID_MSI_DIGI_VOX_MINI_III
,
1431 &af9015_props
, "MSI Digi VOX mini III", RC_MAP_MSI_DIGIVOX_III
) },
1432 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_395U
,
1433 &af9015_props
, "KWorld USB DVB-T TV Stick II (VS-DVB-T 395U)", NULL
) },
1434 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_395U_2
,
1435 &af9015_props
, "KWorld USB DVB-T TV Stick II (VS-DVB-T 395U)", NULL
) },
1436 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_395U_3
,
1437 &af9015_props
, "KWorld USB DVB-T TV Stick II (VS-DVB-T 395U)", NULL
) },
1438 { DVB_USB_DEVICE(USB_VID_AFATECH
, USB_PID_TREKSTOR_DVBT
,
1439 &af9015_props
, "TrekStor DVB-T USB Stick", RC_MAP_TREKSTOR
) },
1440 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A850
,
1441 &af9015_props
, "AverMedia AVerTV Volar Black HD (A850)", NULL
) },
1442 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A805
,
1443 &af9015_props
, "AverMedia AVerTV Volar GPS 805 (A805)", NULL
) },
1444 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_CONCEPTRONIC_CTVDIGRCU
,
1445 &af9015_props
, "Conceptronic USB2.0 DVB-T CTVDIGRCU V3.0", NULL
) },
1446 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_MC810
,
1447 &af9015_props
, "KWorld Digial MC-810", NULL
) },
1448 { DVB_USB_DEVICE(USB_VID_KYE
, USB_PID_GENIUS_TVGO_DVB_T03
,
1449 &af9015_props
, "Genius TVGo DVB-T03", NULL
) },
1450 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_399U_2
,
1451 &af9015_props
, "KWorld PlusTV Dual DVB-T Stick (DVB-T 399U)", NULL
) },
1452 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_PC160_T
,
1453 &af9015_props
, "KWorld PlusTV DVB-T PCI Pro Card (DVB-T PC160-T)", NULL
) },
1454 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_SVEON_STV20
,
1455 &af9015_props
, "Sveon STV20 Tuner USB DVB-T HDTV", NULL
) },
1456 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_TINYTWIN_2
,
1457 &af9015_props
, "DigitalNow TinyTwin v2", RC_MAP_DIGITALNOW_TINYTWIN
) },
1458 { DVB_USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV2000DS
,
1459 &af9015_props
, "Leadtek WinFast DTV2000DS", RC_MAP_LEADTEK_Y04G0051
) },
1460 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_UB383_T
,
1461 &af9015_props
, "KWorld USB DVB-T Stick Mobile (UB383-T)", NULL
) },
1462 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_KWORLD_395U_4
,
1463 &af9015_props
, "KWorld USB DVB-T TV Stick II (VS-DVB-T 395U)", NULL
) },
1464 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A815M
,
1465 &af9015_props
, "AverMedia AVerTV Volar M (A815Mac)", NULL
) },
1466 { DVB_USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_STICK_RC
,
1467 &af9015_props
, "TerraTec Cinergy T Stick RC", RC_MAP_TERRATEC_SLIM_2
) },
1468 /* XXX: that same ID [0ccd:0099] is used by af9035 driver too */
1469 { DVB_USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_STICK_DUAL_RC
,
1470 &af9015_props
, "TerraTec Cinergy T Stick Dual RC", RC_MAP_TERRATEC_SLIM
) },
1471 { DVB_USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_A850T
,
1472 &af9015_props
, "AverMedia AVerTV Red HD+ (A850T)", NULL
) },
1473 { DVB_USB_DEVICE(USB_VID_GTEK
, USB_PID_TINYTWIN_3
,
1474 &af9015_props
, "DigitalNow TinyTwin v3", RC_MAP_DIGITALNOW_TINYTWIN
) },
1475 { DVB_USB_DEVICE(USB_VID_KWORLD_2
, USB_PID_SVEON_STV22
,
1476 &af9015_props
, "Sveon STV22 Dual USB DVB-T Tuner HDTV", RC_MAP_MSI_DIGIVOX_III
) },
1479 MODULE_DEVICE_TABLE(usb
, af9015_id_table
);
1481 /* usb specific object needed to register this driver with the usb subsystem */
1482 static struct usb_driver af9015_usb_driver
= {
1483 .name
= KBUILD_MODNAME
,
1484 .id_table
= af9015_id_table
,
1485 .probe
= af9015_probe
,
1486 .disconnect
= dvb_usbv2_disconnect
,
1487 .suspend
= dvb_usbv2_suspend
,
1488 .resume
= dvb_usbv2_resume
,
1489 .reset_resume
= dvb_usbv2_reset_resume
,
1494 module_usb_driver(af9015_usb_driver
);
1496 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
1497 MODULE_DESCRIPTION("Afatech AF9015 driver");
1498 MODULE_LICENSE("GPL");
1499 MODULE_FIRMWARE(AF9015_FIRMWARE
);