1 /* DVB USB framework compliant Linux driver for the
2 * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
3 * TeVii S600, S630, S650,
5 * Geniatech SU3000 Cards
6 * Copyright (C) 2008,2009 Igor M. Liplianin (liplianin@me.by)
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, version 2.
12 * see Documentation/dvb/README.dvb-usb for more information
29 #include "stb6100_proc.h"
31 #ifndef USB_PID_DW2102
32 #define USB_PID_DW2102 0x2102
35 #ifndef USB_PID_DW2104
36 #define USB_PID_DW2104 0x2104
39 #ifndef USB_PID_DW3101
40 #define USB_PID_DW3101 0x3101
43 #ifndef USB_PID_CINERGY_S
44 #define USB_PID_CINERGY_S 0x0064
47 #ifndef USB_PID_TEVII_S630
48 #define USB_PID_TEVII_S630 0xd630
51 #ifndef USB_PID_TEVII_S650
52 #define USB_PID_TEVII_S650 0xd650
55 #ifndef USB_PID_TEVII_S660
56 #define USB_PID_TEVII_S660 0xd660
59 #ifndef USB_PID_PROF_1100
60 #define USB_PID_PROF_1100 0xb012
63 #define DW210X_READ_MSG 0
64 #define DW210X_WRITE_MSG 1
66 #define REG_1F_SYMBOLRATE_BYTE0 0x1f
67 #define REG_20_SYMBOLRATE_BYTE1 0x20
68 #define REG_21_SYMBOLRATE_BYTE2 0x21
70 #define DW2102_VOLTAGE_CTRL (0x1800)
71 #define SU3000_STREAM_CTRL (0x1900)
72 #define DW2102_RC_QUERY (0x1a00)
73 #define DW2102_LED_CTRL (0x1b00)
75 #define err_str "did not find the firmware file. (%s) " \
76 "Please see linux/Documentation/dvb/ for more details " \
77 "on firmware-problems."
79 struct rc_map_dvb_usb_table_table {
80 struct rc_map_table *rc_keys;
89 static int dvb_usb_dw2102_debug;
90 module_param_named(debug, dvb_usb_dw2102_debug, int, 0644);
91 MODULE_PARM_DESC(debug, "set debugging level (1=info 2=xfer 4=rc(or-able))."
92 DVB_USB_DEBUG_STATUS);
96 module_param_named(keymap, ir_keymap, int, 0644);
97 MODULE_PARM_DESC(keymap, "set keymap 0=default 1=dvbworld 2=tevii 3=tbs ..."
101 static int demod_probe = 1;
102 module_param_named(demod, demod_probe, int, 0644);
103 MODULE_PARM_DESC(demod, "demod to probe (1=cx24116 2=stv0903+stv6110 "
104 "4=stv0903+stb6100(or-able)).");
106 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
108 static int dw210x_op_rw(struct usb_device *dev, u8 request, u16 value,
109 u16 index, u8 * data, u16 len, int flags)
114 unsigned int pipe = (flags == DW210X_READ_MSG) ?
115 usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0);
116 u8 request_type = (flags == DW210X_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT;
118 if (flags == DW210X_WRITE_MSG)
119 memcpy(u8buf, data, len);
120 ret = usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR,
121 value, index , u8buf, len, 2000);
123 if (flags == DW210X_READ_MSG)
124 memcpy(data, u8buf, len);
129 static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
132 struct dvb_usb_device *d = i2c_get_adapdata(adap);
134 u8 buf6[] = {0x2c, 0x05, 0xc0, 0, 0, 0, 0};
139 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
144 /* read stv0299 register */
145 value = msg[0].buf[0];/* register */
146 for (i = 0; i < msg[1].len; i++) {
148 ret = dw210x_op_rw(d->udev, 0xb5, value, 0,
149 buf6, 2, DW210X_READ_MSG);
150 msg[1].buf[i] = buf6[0];
154 switch (msg[0].addr) {
156 /* write to stv0299 register */
158 buf6[1] = msg[0].buf[0];
159 buf6[2] = msg[0].buf[1];
160 ret = dw210x_op_rw(d->udev, 0xb2, 0, 0,
161 buf6, 3, DW210X_WRITE_MSG);
164 if (msg[0].flags == 0) {
165 /* write to tuner pll */
169 buf6[3] = msg[0].buf[0];
170 buf6[4] = msg[0].buf[1];
171 buf6[5] = msg[0].buf[2];
172 buf6[6] = msg[0].buf[3];
173 ret = dw210x_op_rw(d->udev, 0xb2, 0, 0,
174 buf6, 7, DW210X_WRITE_MSG);
176 /* read from tuner */
177 ret = dw210x_op_rw(d->udev, 0xb5, 0, 0,
178 buf6, 1, DW210X_READ_MSG);
179 msg[0].buf[0] = buf6[0];
182 case (DW2102_RC_QUERY):
183 ret = dw210x_op_rw(d->udev, 0xb8, 0, 0,
184 buf6, 2, DW210X_READ_MSG);
185 msg[0].buf[0] = buf6[0];
186 msg[0].buf[1] = buf6[1];
188 case (DW2102_VOLTAGE_CTRL):
190 buf6[1] = msg[0].buf[0];
191 ret = dw210x_op_rw(d->udev, 0xb2, 0, 0,
192 buf6, 2, DW210X_WRITE_MSG);
199 mutex_unlock(&d->i2c_mutex);
203 static int dw2102_serit_i2c_transfer(struct i2c_adapter *adap,
204 struct i2c_msg msg[], int num)
206 struct dvb_usb_device *d = i2c_get_adapdata(adap);
208 u8 buf6[] = {0, 0, 0, 0, 0, 0, 0};
212 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
217 /* read si2109 register by number */
218 buf6[0] = msg[0].addr << 1;
219 buf6[1] = msg[0].len;
220 buf6[2] = msg[0].buf[0];
221 ret = dw210x_op_rw(d->udev, 0xc2, 0, 0,
222 buf6, msg[0].len + 2, DW210X_WRITE_MSG);
223 /* read si2109 register */
224 ret = dw210x_op_rw(d->udev, 0xc3, 0xd0, 0,
225 buf6, msg[1].len + 2, DW210X_READ_MSG);
226 memcpy(msg[1].buf, buf6 + 2, msg[1].len);
230 switch (msg[0].addr) {
232 /* write to si2109 register */
233 buf6[0] = msg[0].addr << 1;
234 buf6[1] = msg[0].len;
235 memcpy(buf6 + 2, msg[0].buf, msg[0].len);
236 ret = dw210x_op_rw(d->udev, 0xc2, 0, 0, buf6,
237 msg[0].len + 2, DW210X_WRITE_MSG);
239 case(DW2102_RC_QUERY):
240 ret = dw210x_op_rw(d->udev, 0xb8, 0, 0,
241 buf6, 2, DW210X_READ_MSG);
242 msg[0].buf[0] = buf6[0];
243 msg[0].buf[1] = buf6[1];
245 case(DW2102_VOLTAGE_CTRL):
247 buf6[1] = msg[0].buf[0];
248 ret = dw210x_op_rw(d->udev, 0xb2, 0, 0,
249 buf6, 2, DW210X_WRITE_MSG);
255 mutex_unlock(&d->i2c_mutex);
259 static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
261 struct dvb_usb_device *d = i2c_get_adapdata(adap);
266 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
272 /* first write first register number */
273 u8 ibuf[msg[1].len + 2], obuf[3];
274 obuf[0] = msg[0].addr << 1;
275 obuf[1] = msg[0].len;
276 obuf[2] = msg[0].buf[0];
277 ret = dw210x_op_rw(d->udev, 0xc2, 0, 0,
278 obuf, msg[0].len + 2, DW210X_WRITE_MSG);
279 /* second read registers */
280 ret = dw210x_op_rw(d->udev, 0xc3, 0xd1 , 0,
281 ibuf, msg[1].len + 2, DW210X_READ_MSG);
282 memcpy(msg[1].buf, ibuf + 2, msg[1].len);
287 switch (msg[0].addr) {
289 /* write to register */
290 u8 obuf[msg[0].len + 2];
291 obuf[0] = msg[0].addr << 1;
292 obuf[1] = msg[0].len;
293 memcpy(obuf + 2, msg[0].buf, msg[0].len);
294 ret = dw210x_op_rw(d->udev, 0xc2, 0, 0,
295 obuf, msg[0].len + 2, DW210X_WRITE_MSG);
300 u8 obuf[msg[0].len + 2];
301 obuf[0] = msg[0].addr << 1;
302 obuf[1] = msg[0].len;
303 memcpy(obuf + 2, msg[0].buf, msg[0].len);
304 ret = dw210x_op_rw(d->udev, 0xc2, 0, 0,
305 obuf, msg[0].len + 2, DW210X_WRITE_MSG);
308 case(DW2102_RC_QUERY): {
310 ret = dw210x_op_rw(d->udev, 0xb8, 0, 0,
311 ibuf, 2, DW210X_READ_MSG);
312 memcpy(msg[0].buf, ibuf , 2);
315 case(DW2102_VOLTAGE_CTRL): {
318 obuf[1] = msg[0].buf[0];
319 ret = dw210x_op_rw(d->udev, 0xb2, 0, 0,
320 obuf, 2, DW210X_WRITE_MSG);
328 mutex_unlock(&d->i2c_mutex);
332 static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
334 struct dvb_usb_device *d = i2c_get_adapdata(adap);
340 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
343 for (j = 0; j < num; j++) {
344 switch (msg[j].addr) {
345 case(DW2102_RC_QUERY): {
347 ret = dw210x_op_rw(d->udev, 0xb8, 0, 0,
348 ibuf, 2, DW210X_READ_MSG);
349 memcpy(msg[j].buf, ibuf , 2);
352 case(DW2102_VOLTAGE_CTRL): {
355 obuf[1] = msg[j].buf[0];
356 ret = dw210x_op_rw(d->udev, 0xb2, 0, 0,
357 obuf, 2, DW210X_WRITE_MSG);
362 case 0x68: ds3000, stv0903
363 case 0x60: ts2020, stv6110, stb6100 */
365 if (msg[j].flags == I2C_M_RD) {
367 u8 ibuf[msg[j].len + 2];
368 ret = dw210x_op_rw(d->udev, 0xc3,
369 (msg[j].addr << 1) + 1, 0,
370 ibuf, msg[j].len + 2,
372 memcpy(msg[j].buf, ibuf + 2, msg[j].len);
374 } else if (((msg[j].buf[0] == 0xb0) &&
375 (msg[j].addr == 0x68)) ||
376 ((msg[j].buf[0] == 0xf7) &&
377 (msg[j].addr == 0x55))) {
380 obuf[0] = msg[j].addr << 1;
381 obuf[1] = (msg[j].len > 15 ? 17 : msg[j].len);
382 obuf[2] = msg[j].buf[0];
383 len = msg[j].len - 1;
386 memcpy(obuf + 3, msg[j].buf + i,
387 (len > 16 ? 16 : len));
388 ret = dw210x_op_rw(d->udev, 0xc2, 0, 0,
389 obuf, (len > 16 ? 16 : len) + 3,
395 /* write registers */
396 u8 obuf[msg[j].len + 2];
397 obuf[0] = msg[j].addr << 1;
398 obuf[1] = msg[j].len;
399 memcpy(obuf + 2, msg[j].buf, msg[j].len);
400 ret = dw210x_op_rw(d->udev, 0xc2, 0, 0,
401 obuf, msg[j].len + 2,
410 mutex_unlock(&d->i2c_mutex);
414 static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
417 struct dvb_usb_device *d = i2c_get_adapdata(adap);
422 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
428 /* first write first register number */
429 u8 ibuf[msg[1].len + 2], obuf[3];
430 obuf[0] = msg[0].addr << 1;
431 obuf[1] = msg[0].len;
432 obuf[2] = msg[0].buf[0];
433 ret = dw210x_op_rw(d->udev, 0xc2, 0, 0,
434 obuf, msg[0].len + 2, DW210X_WRITE_MSG);
435 /* second read registers */
436 ret = dw210x_op_rw(d->udev, 0xc3, 0x19 , 0,
437 ibuf, msg[1].len + 2, DW210X_READ_MSG);
438 memcpy(msg[1].buf, ibuf + 2, msg[1].len);
443 switch (msg[0].addr) {
446 /* write to register */
447 u8 obuf[msg[0].len + 2];
448 obuf[0] = msg[0].addr << 1;
449 obuf[1] = msg[0].len;
450 memcpy(obuf + 2, msg[0].buf, msg[0].len);
451 ret = dw210x_op_rw(d->udev, 0xc2, 0, 0,
452 obuf, msg[0].len + 2, DW210X_WRITE_MSG);
455 case(DW2102_RC_QUERY): {
457 ret = dw210x_op_rw(d->udev, 0xb8, 0, 0,
458 ibuf, 2, DW210X_READ_MSG);
459 memcpy(msg[0].buf, ibuf , 2);
467 for (i = 0; i < num; i++) {
468 deb_xfer("%02x:%02x: %s ", i, msg[i].addr,
469 msg[i].flags == 0 ? ">>>" : "<<<");
470 debug_dump(msg[i].buf, msg[i].len, deb_xfer);
473 mutex_unlock(&d->i2c_mutex);
477 static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
480 struct dvb_usb_device *d = i2c_get_adapdata(adap);
481 struct usb_device *udev;
488 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
491 for (j = 0; j < num; j++) {
492 switch (msg[j].addr) {
493 case (DW2102_RC_QUERY): {
495 ret = dw210x_op_rw(d->udev, 0xb8, 0, 0,
496 ibuf, 4, DW210X_READ_MSG);
497 memcpy(msg[j].buf, ibuf + 1, 2);
500 case (DW2102_VOLTAGE_CTRL): {
504 obuf[1] = msg[j].buf[1];/* off-on */
505 ret = dw210x_op_rw(d->udev, 0x8a, 0, 0,
506 obuf, 2, DW210X_WRITE_MSG);
508 obuf[1] = msg[j].buf[0];/* 13v-18v */
509 ret = dw210x_op_rw(d->udev, 0x8a, 0, 0,
510 obuf, 2, DW210X_WRITE_MSG);
513 case (DW2102_LED_CTRL): {
517 obuf[1] = msg[j].buf[0];
518 ret = dw210x_op_rw(d->udev, 0x8a, 0, 0,
519 obuf, 2, DW210X_WRITE_MSG);
524 case 0x68: ds3000, stv0903
525 case 0x60: ts2020, stv6110, stb6100
528 if (msg[j].flags == I2C_M_RD) {
531 ret = dw210x_op_rw(d->udev, 0x91, 0, 0,
534 memcpy(msg[j].buf, ibuf, msg[j].len);
536 } else if ((msg[j].buf[0] == 0xb0) &&
537 (msg[j].addr == 0x68)) {
540 obuf[0] = (msg[j].len > 16 ?
541 18 : msg[j].len + 1);
542 obuf[1] = msg[j].addr << 1;
543 obuf[2] = msg[j].buf[0];
544 len = msg[j].len - 1;
547 memcpy(obuf + 3, msg[j].buf + i,
548 (len > 16 ? 16 : len));
549 ret = dw210x_op_rw(d->udev, 0x80, 0, 0,
550 obuf, (len > 16 ? 16 : len) + 3,
555 } else if ((udev->descriptor.idProduct == 0x7500)
556 && (j < (num - 1))) {
557 /* write register addr before read */
558 u8 obuf[msg[j].len + 2];
559 obuf[0] = msg[j + 1].len;
560 obuf[1] = (msg[j].addr << 1);
561 memcpy(obuf + 2, msg[j].buf, msg[j].len);
562 ret = dw210x_op_rw(d->udev, 0x92, 0, 0,
563 obuf, msg[j].len + 2,
567 /* write registers */
568 u8 obuf[msg[j].len + 2];
569 obuf[0] = msg[j].len + 1;
570 obuf[1] = (msg[j].addr << 1);
571 memcpy(obuf + 2, msg[j].buf, msg[j].len);
572 ret = dw210x_op_rw(d->udev,
573 (num > 1 ? 0x90 : 0x80), 0, 0,
574 obuf, msg[j].len + 2,
585 mutex_unlock(&d->i2c_mutex);
589 static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
592 struct dvb_usb_device *d = i2c_get_adapdata(adap);
593 u8 obuf[0x40], ibuf[0x40];
597 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
602 switch (msg[0].addr) {
603 case SU3000_STREAM_CTRL:
604 obuf[0] = msg[0].buf[0] + 0x36;
607 if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 0, 0) < 0)
608 err("i2c transfer failed.");
610 case DW2102_RC_QUERY:
612 if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 2, 0) < 0)
613 err("i2c transfer failed.");
614 msg[0].buf[1] = ibuf[0];
615 msg[0].buf[0] = ibuf[1];
618 /* always i2c write*/
620 obuf[1] = msg[0].addr;
621 obuf[2] = msg[0].len;
623 memcpy(&obuf[3], msg[0].buf, msg[0].len);
625 if (dvb_usb_generic_rw(d, obuf, msg[0].len + 3,
627 err("i2c transfer failed.");
632 /* always i2c read */
634 obuf[1] = msg[0].len;
635 obuf[2] = msg[1].len;
636 obuf[3] = msg[0].addr;
637 memcpy(&obuf[4], msg[0].buf, msg[0].len);
639 if (dvb_usb_generic_rw(d, obuf, msg[0].len + 4,
640 ibuf, msg[1].len + 1, 0) < 0)
641 err("i2c transfer failed.");
643 memcpy(msg[1].buf, &ibuf[1], msg[1].len);
646 warn("more than 2 i2c messages at a time is not handled yet.");
649 mutex_unlock(&d->i2c_mutex);
653 static u32 dw210x_i2c_func(struct i2c_adapter *adapter)
658 static struct i2c_algorithm dw2102_i2c_algo = {
659 .master_xfer = dw2102_i2c_transfer,
660 .functionality = dw210x_i2c_func,
663 static struct i2c_algorithm dw2102_serit_i2c_algo = {
664 .master_xfer = dw2102_serit_i2c_transfer,
665 .functionality = dw210x_i2c_func,
668 static struct i2c_algorithm dw2102_earda_i2c_algo = {
669 .master_xfer = dw2102_earda_i2c_transfer,
670 .functionality = dw210x_i2c_func,
673 static struct i2c_algorithm dw2104_i2c_algo = {
674 .master_xfer = dw2104_i2c_transfer,
675 .functionality = dw210x_i2c_func,
678 static struct i2c_algorithm dw3101_i2c_algo = {
679 .master_xfer = dw3101_i2c_transfer,
680 .functionality = dw210x_i2c_func,
683 static struct i2c_algorithm s6x0_i2c_algo = {
684 .master_xfer = s6x0_i2c_transfer,
685 .functionality = dw210x_i2c_func,
688 static struct i2c_algorithm su3000_i2c_algo = {
689 .master_xfer = su3000_i2c_transfer,
690 .functionality = dw210x_i2c_func,
693 static int dw210x_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
697 u8 eeprom[256], eepromline[16];
699 for (i = 0; i < 256; i++) {
700 if (dw210x_op_rw(d->udev, 0xb6, 0xa0 , i, ibuf, 2, DW210X_READ_MSG) < 0) {
701 err("read eeprom failed.");
704 eepromline[i%16] = ibuf[0];
707 if ((i % 16) == 15) {
708 deb_xfer("%02x: ", i - 15);
709 debug_dump(eepromline, 16, deb_xfer);
713 memcpy(mac, eeprom + 8, 6);
717 static int s6x0_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
720 u8 ibuf[] = { 0 }, obuf[] = { 0 };
721 u8 eeprom[256], eepromline[16];
722 struct i2c_msg msg[] = {
736 for (i = 0; i < 256; i++) {
738 ret = s6x0_i2c_transfer(&d->i2c_adap, msg, 2);
740 err("read eeprom failed.");
743 eepromline[i % 16] = ibuf[0];
747 if ((i % 16) == 15) {
748 deb_xfer("%02x: ", i - 15);
749 debug_dump(eepromline, 16, deb_xfer);
753 memcpy(mac, eeprom + 16, 6);
757 static int su3000_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
759 static u8 command_start[] = {0x00};
760 static u8 command_stop[] = {0x01};
761 struct i2c_msg msg = {
762 .addr = SU3000_STREAM_CTRL,
764 .buf = onoff ? command_start : command_stop,
768 i2c_transfer(&adap->dev->i2c_adap, &msg, 1);
773 static int su3000_power_ctrl(struct dvb_usb_device *d, int i)
775 struct su3000_state *state = (struct su3000_state *)d->priv;
776 u8 obuf[] = {0xde, 0};
778 info("%s: %d, initialized %d\n", __func__, i, state->initialized);
780 if (i && !state->initialized) {
781 state->initialized = 1;
783 dvb_usb_generic_rw(d, obuf, 2, NULL, 0, 0);
789 static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
792 u8 obuf[] = { 0x1f, 0xf0 };
794 struct i2c_msg msg[] = {
809 for (i = 0; i < 6; i++) {
811 if (i2c_transfer(&d->i2c_adap, msg, 2) != 2)
816 debug_dump(mac, 6, printk);
822 static int su3000_identify_state(struct usb_device *udev,
823 struct dvb_usb_device_properties *props,
824 struct dvb_usb_device_description **desc,
827 info("%s\n", __func__);
833 static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
835 static u8 command_13v[] = {0x00, 0x01};
836 static u8 command_18v[] = {0x01, 0x01};
837 static u8 command_off[] = {0x00, 0x00};
838 struct i2c_msg msg = {
839 .addr = DW2102_VOLTAGE_CTRL,
845 struct dvb_usb_adapter *udev_adap =
846 (struct dvb_usb_adapter *)(fe->dvb->priv);
847 if (voltage == SEC_VOLTAGE_18)
848 msg.buf = command_18v;
849 else if (voltage == SEC_VOLTAGE_13)
850 msg.buf = command_13v;
852 i2c_transfer(&udev_adap->dev->i2c_adap, &msg, 1);
857 static void dw210x_led_ctrl(struct dvb_frontend *fe, int offon)
859 static u8 led_off[] = { 0 };
860 static u8 led_on[] = { 1 };
861 struct i2c_msg msg = {
862 .addr = DW2102_LED_CTRL,
867 struct dvb_usb_adapter *udev_adap =
868 (struct dvb_usb_adapter *)(fe->dvb->priv);
872 i2c_transfer(&udev_adap->dev->i2c_adap, &msg, 1);
875 static struct stv0299_config sharp_z0194a_config = {
876 .demod_address = 0x68,
877 .inittab = sharp_z0194a_inittab,
881 .lock_output = STV0299_LOCKOUTPUT_1,
882 .volt13_op0_op1 = STV0299_VOLT13_OP1,
884 .set_symbol_rate = sharp_z0194a_set_symbol_rate,
887 static struct cx24116_config dw2104_config = {
888 .demod_address = 0x55,
889 .mpg_clk_pos_pol = 0x01,
892 static struct si21xx_config serit_sp1511lhb_config = {
893 .demod_address = 0x68,
898 static struct tda10023_config dw3101_tda10023_config = {
899 .demod_address = 0x0c,
903 static struct mt312_config zl313_config = {
904 .demod_address = 0x0e,
907 static struct ds3000_config dw2104_ds3000_config = {
908 .demod_address = 0x68,
911 static struct stv0900_config dw2104a_stv0900_config = {
912 .demod_address = 0x6a,
915 .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */
916 .diseqc_mode = 2,/* 2/3 PWM */
917 .tun1_maddress = 0,/* 0x60 */
918 .tun1_adc = 0,/* 2 Vpp */
922 static struct stb6100_config dw2104a_stb6100_config = {
923 .tuner_address = 0x60,
924 .refclock = 27000000,
927 static struct stv0900_config dw2104_stv0900_config = {
928 .demod_address = 0x68,
934 .tun1_adc = 1,/* 1 Vpp */
938 static struct stv6110_config dw2104_stv6110_config = {
944 static struct stv0900_config prof_7500_stv0900_config = {
945 .demod_address = 0x6a,
948 .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */
949 .diseqc_mode = 2,/* 2/3 PWM */
950 .tun1_maddress = 0,/* 0x60 */
951 .tun1_adc = 0,/* 2 Vpp */
954 .set_lock_led = dw210x_led_ctrl,
957 static struct ds3000_config su3000_ds3000_config = {
958 .demod_address = 0x68,
962 static int dw2104_frontend_attach(struct dvb_usb_adapter *d)
964 struct dvb_tuner_ops *tuner_ops = NULL;
966 if (demod_probe & 4) {
967 d->fe = dvb_attach(stv0900_attach, &dw2104a_stv0900_config,
968 &d->dev->i2c_adap, 0);
970 if (dvb_attach(stb6100_attach, d->fe,
971 &dw2104a_stb6100_config,
972 &d->dev->i2c_adap)) {
973 tuner_ops = &d->fe->ops.tuner_ops;
974 tuner_ops->set_frequency = stb6100_set_freq;
975 tuner_ops->get_frequency = stb6100_get_freq;
976 tuner_ops->set_bandwidth = stb6100_set_bandw;
977 tuner_ops->get_bandwidth = stb6100_get_bandw;
978 d->fe->ops.set_voltage = dw210x_set_voltage;
979 info("Attached STV0900+STB6100!\n");
985 if (demod_probe & 2) {
986 d->fe = dvb_attach(stv0900_attach, &dw2104_stv0900_config,
987 &d->dev->i2c_adap, 0);
989 if (dvb_attach(stv6110_attach, d->fe,
990 &dw2104_stv6110_config,
991 &d->dev->i2c_adap)) {
992 d->fe->ops.set_voltage = dw210x_set_voltage;
993 info("Attached STV0900+STV6110A!\n");
999 if (demod_probe & 1) {
1000 d->fe = dvb_attach(cx24116_attach, &dw2104_config,
1002 if (d->fe != NULL) {
1003 d->fe->ops.set_voltage = dw210x_set_voltage;
1004 info("Attached cx24116!\n");
1009 d->fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config,
1011 if (d->fe != NULL) {
1012 d->fe->ops.set_voltage = dw210x_set_voltage;
1013 info("Attached DS3000!\n");
1020 static struct dvb_usb_device_properties dw2102_properties;
1021 static struct dvb_usb_device_properties dw2104_properties;
1022 static struct dvb_usb_device_properties s6x0_properties;
1024 static int dw2102_frontend_attach(struct dvb_usb_adapter *d)
1026 if (dw2102_properties.i2c_algo == &dw2102_serit_i2c_algo) {
1027 /*dw2102_properties.adapter->tuner_attach = NULL;*/
1028 d->fe = dvb_attach(si21xx_attach, &serit_sp1511lhb_config,
1030 if (d->fe != NULL) {
1031 d->fe->ops.set_voltage = dw210x_set_voltage;
1032 info("Attached si21xx!\n");
1037 if (dw2102_properties.i2c_algo == &dw2102_earda_i2c_algo) {
1038 d->fe = dvb_attach(stv0288_attach, &earda_config,
1040 if (d->fe != NULL) {
1041 if (dvb_attach(stb6000_attach, d->fe, 0x61,
1042 &d->dev->i2c_adap)) {
1043 d->fe->ops.set_voltage = dw210x_set_voltage;
1044 info("Attached stv0288!\n");
1050 if (dw2102_properties.i2c_algo == &dw2102_i2c_algo) {
1051 /*dw2102_properties.adapter->tuner_attach = dw2102_tuner_attach;*/
1052 d->fe = dvb_attach(stv0299_attach, &sharp_z0194a_config,
1054 if (d->fe != NULL) {
1055 d->fe->ops.set_voltage = dw210x_set_voltage;
1056 info("Attached stv0299!\n");
1063 static int dw3101_frontend_attach(struct dvb_usb_adapter *d)
1065 d->fe = dvb_attach(tda10023_attach, &dw3101_tda10023_config,
1066 &d->dev->i2c_adap, 0x48);
1067 if (d->fe != NULL) {
1068 info("Attached tda10023!\n");
1074 static int zl100313_frontend_attach(struct dvb_usb_adapter *d)
1076 d->fe = dvb_attach(mt312_attach, &zl313_config,
1078 if (d->fe != NULL) {
1079 if (dvb_attach(zl10039_attach, d->fe, 0x60,
1080 &d->dev->i2c_adap)) {
1081 d->fe->ops.set_voltage = dw210x_set_voltage;
1082 info("Attached zl100313+zl10039!\n");
1090 static int stv0288_frontend_attach(struct dvb_usb_adapter *d)
1092 d->fe = dvb_attach(stv0288_attach, &earda_config,
1094 if (d->fe != NULL) {
1095 if (dvb_attach(stb6000_attach, d->fe, 0x61,
1096 &d->dev->i2c_adap)) {
1097 d->fe->ops.set_voltage = dw210x_set_voltage;
1098 info("Attached stv0288+stb6000!\n");
1106 static int ds3000_frontend_attach(struct dvb_usb_adapter *d)
1108 d->fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config,
1110 if (d->fe != NULL) {
1111 d->fe->ops.set_voltage = dw210x_set_voltage;
1112 info("Attached ds3000+ds2020!\n");
1119 static int prof_7500_frontend_attach(struct dvb_usb_adapter *d)
1121 d->fe = dvb_attach(stv0900_attach, &prof_7500_stv0900_config,
1122 &d->dev->i2c_adap, 0);
1125 d->fe->ops.set_voltage = dw210x_set_voltage;
1127 info("Attached STV0900+STB6100A!\n");
1132 static int su3000_frontend_attach(struct dvb_usb_adapter *d)
1134 u8 obuf[3] = { 0xe, 0x80, 0 };
1137 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1138 err("command 0x0e transfer failed.");
1144 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1145 err("command 0x0e transfer failed.");
1151 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1152 err("command 0x0e transfer failed.");
1156 if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1157 err("command 0x51 transfer failed.");
1159 d->fe = dvb_attach(ds3000_attach, &su3000_ds3000_config,
1164 info("Attached DS3000!\n");
1169 static int dw2102_tuner_attach(struct dvb_usb_adapter *adap)
1171 dvb_attach(dvb_pll_attach, adap->fe, 0x60,
1172 &adap->dev->i2c_adap, DVB_PLL_OPERA1);
1176 static int dw3101_tuner_attach(struct dvb_usb_adapter *adap)
1178 dvb_attach(dvb_pll_attach, adap->fe, 0x60,
1179 &adap->dev->i2c_adap, DVB_PLL_TUA6034);
1184 static struct rc_map_table rc_map_dw210x_table[] = {
1185 { 0xf80a, KEY_Q }, /*power*/
1186 { 0xf80c, KEY_M }, /*mute*/
1197 { 0xf81c, KEY_PAGEUP }, /*ch+*/
1198 { 0xf80f, KEY_PAGEDOWN }, /*ch-*/
1199 { 0xf81a, KEY_O }, /*vol+*/
1200 { 0xf80e, KEY_Z }, /*vol-*/
1201 { 0xf804, KEY_R }, /*rec*/
1202 { 0xf809, KEY_D }, /*fav*/
1203 { 0xf808, KEY_BACKSPACE }, /*rewind*/
1204 { 0xf807, KEY_A }, /*fast*/
1205 { 0xf80b, KEY_P }, /*pause*/
1206 { 0xf802, KEY_ESC }, /*cancel*/
1207 { 0xf803, KEY_G }, /*tab*/
1208 { 0xf800, KEY_UP }, /*up*/
1209 { 0xf81f, KEY_ENTER }, /*ok*/
1210 { 0xf801, KEY_DOWN }, /*down*/
1211 { 0xf805, KEY_C }, /*cap*/
1212 { 0xf806, KEY_S }, /*stop*/
1213 { 0xf840, KEY_F }, /*full*/
1214 { 0xf81e, KEY_W }, /*tvmode*/
1215 { 0xf81b, KEY_B }, /*recall*/
1218 static struct rc_map_table rc_map_tevii_table[] = {
1219 { 0xf80a, KEY_POWER },
1220 { 0xf80c, KEY_MUTE },
1231 { 0xf81c, KEY_MENU },
1232 { 0xf80f, KEY_VOLUMEDOWN },
1233 { 0xf81a, KEY_LAST },
1234 { 0xf80e, KEY_OPEN },
1235 { 0xf804, KEY_RECORD },
1236 { 0xf809, KEY_VOLUMEUP },
1237 { 0xf808, KEY_CHANNELUP },
1238 { 0xf807, KEY_PVR },
1239 { 0xf80b, KEY_TIME },
1240 { 0xf802, KEY_RIGHT },
1241 { 0xf803, KEY_LEFT },
1244 { 0xf801, KEY_DOWN },
1245 { 0xf805, KEY_TUNER },
1246 { 0xf806, KEY_CHANNELDOWN },
1247 { 0xf840, KEY_PLAYPAUSE },
1248 { 0xf81e, KEY_REWIND },
1249 { 0xf81b, KEY_FAVORITES },
1250 { 0xf81d, KEY_BACK },
1251 { 0xf84d, KEY_FASTFORWARD },
1252 { 0xf844, KEY_EPG },
1253 { 0xf84c, KEY_INFO },
1255 { 0xf843, KEY_AUDIO },
1256 { 0xf845, KEY_SUBTITLE },
1257 { 0xf84a, KEY_LIST },
1264 { 0xf856, KEY_MODE },
1265 { 0xf858, KEY_SWITCHVIDEOMODE },
1268 static struct rc_map_table rc_map_tbs_table[] = {
1269 { 0xf884, KEY_POWER },
1270 { 0xf894, KEY_MUTE },
1281 { 0xf896, KEY_CHANNELUP },
1282 { 0xf891, KEY_CHANNELDOWN },
1283 { 0xf893, KEY_VOLUMEUP },
1284 { 0xf88c, KEY_VOLUMEDOWN },
1285 { 0xf883, KEY_RECORD },
1286 { 0xf898, KEY_PAUSE },
1288 { 0xf89a, KEY_SHUFFLE },
1290 { 0xf890, KEY_LEFT },
1291 { 0xf882, KEY_RIGHT },
1292 { 0xf888, KEY_DOWN },
1293 { 0xf895, KEY_FAVORITES },
1294 { 0xf897, KEY_SUBTITLE },
1295 { 0xf89d, KEY_ZOOM },
1296 { 0xf89f, KEY_EXIT },
1297 { 0xf89e, KEY_MENU },
1298 { 0xf89c, KEY_EPG },
1299 { 0xf880, KEY_PREVIOUS },
1300 { 0xf89b, KEY_MODE }
1303 static struct rc_map_table rc_map_su3000_table[] = {
1304 { 0x25, KEY_POWER }, /* right-bottom Red */
1305 { 0x0a, KEY_MUTE }, /* -/-- */
1316 { 0x20, KEY_UP }, /* CH+ */
1317 { 0x21, KEY_DOWN }, /* CH+ */
1318 { 0x12, KEY_VOLUMEUP }, /* Brightness Up */
1319 { 0x13, KEY_VOLUMEDOWN },/* Brightness Down */
1320 { 0x1f, KEY_RECORD },
1322 { 0x16, KEY_PAUSE },
1324 { 0x27, KEY_FASTFORWARD },/* >> */
1325 { 0x26, KEY_REWIND }, /* << */
1326 { 0x0d, KEY_OK }, /* Mute */
1327 { 0x11, KEY_LEFT }, /* VOL- */
1328 { 0x10, KEY_RIGHT }, /* VOL+ */
1329 { 0x29, KEY_BACK }, /* button under 9 */
1330 { 0x2c, KEY_MENU }, /* TTX */
1331 { 0x2b, KEY_EPG }, /* EPG */
1332 { 0x1e, KEY_RED }, /* OSD */
1333 { 0x0e, KEY_GREEN }, /* Window */
1334 { 0x2d, KEY_YELLOW }, /* button under << */
1335 { 0x0f, KEY_BLUE }, /* bottom yellow button */
1336 { 0x14, KEY_AUDIO }, /* Snapshot */
1337 { 0x38, KEY_TV }, /* TV/Radio */
1338 { 0x0c, KEY_ESC } /* upper Red buttton */
1341 static struct rc_map_dvb_usb_table_table keys_tables[] = {
1342 { rc_map_dw210x_table, ARRAY_SIZE(rc_map_dw210x_table) },
1343 { rc_map_tevii_table, ARRAY_SIZE(rc_map_tevii_table) },
1344 { rc_map_tbs_table, ARRAY_SIZE(rc_map_tbs_table) },
1345 { rc_map_su3000_table, ARRAY_SIZE(rc_map_su3000_table) },
1348 static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
1350 struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
1351 int keymap_size = d->props.rc.legacy.rc_map_size;
1353 struct i2c_msg msg = {
1354 .addr = DW2102_RC_QUERY,
1360 /* override keymap */
1361 if ((ir_keymap > 0) && (ir_keymap <= ARRAY_SIZE(keys_tables))) {
1362 keymap = keys_tables[ir_keymap - 1].rc_keys ;
1363 keymap_size = keys_tables[ir_keymap - 1].rc_keys_size;
1364 } else if (ir_keymap > ARRAY_SIZE(keys_tables))
1365 return 0; /* none */
1367 *state = REMOTE_NO_KEY_PRESSED;
1368 if (d->props.i2c_algo->master_xfer(&d->i2c_adap, &msg, 1) == 1) {
1369 for (i = 0; i < keymap_size ; i++) {
1370 if (rc5_data(&keymap[i]) == msg.buf[0]) {
1371 *state = REMOTE_KEY_PRESSED;
1372 *event = keymap[i].keycode;
1378 if ((*state) == REMOTE_KEY_PRESSED)
1379 deb_rc("%s: found rc key: %x, %x, event: %x\n",
1380 __func__, key[0], key[1], (*event));
1381 else if (key[0] != 0xff)
1382 deb_rc("%s: unknown rc key: %x, %x\n",
1383 __func__, key[0], key[1]);
1390 static struct usb_device_id dw2102_table[] = {
1391 {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)},
1392 {USB_DEVICE(USB_VID_CYPRESS, 0x2101)},
1393 {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2104)},
1394 {USB_DEVICE(0x9022, USB_PID_TEVII_S650)},
1395 {USB_DEVICE(USB_VID_TERRATEC, USB_PID_CINERGY_S)},
1396 {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW3101)},
1397 {USB_DEVICE(0x9022, USB_PID_TEVII_S630)},
1398 {USB_DEVICE(0x3011, USB_PID_PROF_1100)},
1399 {USB_DEVICE(0x9022, USB_PID_TEVII_S660)},
1400 {USB_DEVICE(0x3034, 0x7500)},
1401 {USB_DEVICE(0x1f4d, 0x3000)},
1402 {USB_DEVICE(USB_VID_TERRATEC, 0x00a8)},
1406 MODULE_DEVICE_TABLE(usb, dw2102_table);
1408 static int dw2102_load_firmware(struct usb_device *dev,
1409 const struct firmware *frmwr)
1414 u8 reset16[] = {0, 0, 0, 0, 0, 0, 0};
1415 const struct firmware *fw;
1416 const char *fw_2101 = "dvb-usb-dw2101.fw";
1418 switch (dev->descriptor.idProduct) {
1420 ret = request_firmware(&fw, fw_2101, &dev->dev);
1422 err(err_str, fw_2101);
1430 info("start downloading DW210X firmware");
1431 p = kmalloc(fw->size, GFP_KERNEL);
1434 dw210x_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1, DW210X_WRITE_MSG);
1435 dw210x_op_rw(dev, 0xa0, 0xe600, 0, &reset, 1, DW210X_WRITE_MSG);
1438 memcpy(p, fw->data, fw->size);
1439 for (i = 0; i < fw->size; i += 0x40) {
1441 if (dw210x_op_rw(dev, 0xa0, i, 0, b , 0x40,
1442 DW210X_WRITE_MSG) != 0x40) {
1443 err("error while transferring firmware");
1448 /* restart the CPU */
1450 if (ret || dw210x_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1,
1451 DW210X_WRITE_MSG) != 1) {
1452 err("could not restart the USB controller CPU.");
1455 if (ret || dw210x_op_rw(dev, 0xa0, 0xe600, 0, &reset, 1,
1456 DW210X_WRITE_MSG) != 1) {
1457 err("could not restart the USB controller CPU.");
1460 /* init registers */
1461 switch (dev->descriptor.idProduct) {
1462 case USB_PID_PROF_1100:
1463 s6x0_properties.rc.legacy.rc_map_table = rc_map_tbs_table;
1464 s6x0_properties.rc.legacy.rc_map_size =
1465 ARRAY_SIZE(rc_map_tbs_table);
1467 case USB_PID_TEVII_S650:
1468 dw2104_properties.rc.legacy.rc_map_table = rc_map_tevii_table;
1469 dw2104_properties.rc.legacy.rc_map_size =
1470 ARRAY_SIZE(rc_map_tevii_table);
1471 case USB_PID_DW2104:
1473 dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1,
1475 /* break omitted intentionally */
1476 case USB_PID_DW3101:
1478 dw210x_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0,
1481 case USB_PID_CINERGY_S:
1482 case USB_PID_DW2102:
1483 dw210x_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0,
1485 dw210x_op_rw(dev, 0xb9, 0x0000, 0, &reset16[0], 2,
1487 /* check STV0299 frontend */
1488 dw210x_op_rw(dev, 0xb5, 0, 0, &reset16[0], 2,
1490 if ((reset16[0] == 0xa1) || (reset16[0] == 0x80)) {
1491 dw2102_properties.i2c_algo = &dw2102_i2c_algo;
1492 dw2102_properties.adapter->tuner_attach = &dw2102_tuner_attach;
1495 /* check STV0288 frontend */
1499 dw210x_op_rw(dev, 0xc2, 0, 0, &reset16[0], 3,
1501 dw210x_op_rw(dev, 0xc3, 0xd1, 0, &reset16[0], 3,
1503 if (reset16[2] == 0x11) {
1504 dw2102_properties.i2c_algo = &dw2102_earda_i2c_algo;
1509 dw210x_op_rw(dev, 0xbc, 0x0030, 0, &reset16[0], 2,
1511 dw210x_op_rw(dev, 0xba, 0x0000, 0, &reset16[0], 7,
1513 dw210x_op_rw(dev, 0xba, 0x0000, 0, &reset16[0], 7,
1515 dw210x_op_rw(dev, 0xb9, 0x0000, 0, &reset16[0], 2,
1526 static struct dvb_usb_device_properties dw2102_properties = {
1527 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1528 .usb_ctrl = DEVICE_SPECIFIC,
1529 .firmware = "dvb-usb-dw2102.fw",
1532 .i2c_algo = &dw2102_serit_i2c_algo,
1535 .rc_map_table = rc_map_dw210x_table,
1536 .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table),
1538 .rc_query = dw2102_rc_query,
1541 .generic_bulk_ctrl_endpoint = 0x81,
1542 /* parameter for the MPEG2-data transfer */
1544 .download_firmware = dw2102_load_firmware,
1545 .read_mac_address = dw210x_read_mac_address,
1548 .frontend_attach = dw2102_frontend_attach,
1549 .streaming_ctrl = NULL,
1550 .tuner_attach = NULL,
1563 .num_device_descs = 3,
1565 {"DVBWorld DVB-S 2102 USB2.0",
1566 {&dw2102_table[0], NULL},
1569 {"DVBWorld DVB-S 2101 USB2.0",
1570 {&dw2102_table[1], NULL},
1573 {"TerraTec Cinergy S USB",
1574 {&dw2102_table[4], NULL},
1580 static struct dvb_usb_device_properties dw2104_properties = {
1581 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1582 .usb_ctrl = DEVICE_SPECIFIC,
1583 .firmware = "dvb-usb-dw2104.fw",
1586 .i2c_algo = &dw2104_i2c_algo,
1588 .rc_map_table = rc_map_dw210x_table,
1589 .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table),
1591 .rc_query = dw2102_rc_query,
1594 .generic_bulk_ctrl_endpoint = 0x81,
1595 /* parameter for the MPEG2-data transfer */
1597 .download_firmware = dw2102_load_firmware,
1598 .read_mac_address = dw210x_read_mac_address,
1601 .frontend_attach = dw2104_frontend_attach,
1602 .streaming_ctrl = NULL,
1603 /*.tuner_attach = dw2104_tuner_attach,*/
1616 .num_device_descs = 2,
1618 { "DVBWorld DW2104 USB2.0",
1619 {&dw2102_table[2], NULL},
1622 { "TeVii S650 USB2.0",
1623 {&dw2102_table[3], NULL},
1629 static struct dvb_usb_device_properties dw3101_properties = {
1630 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1631 .usb_ctrl = DEVICE_SPECIFIC,
1632 .firmware = "dvb-usb-dw3101.fw",
1635 .i2c_algo = &dw3101_i2c_algo,
1637 .rc_map_table = rc_map_dw210x_table,
1638 .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table),
1640 .rc_query = dw2102_rc_query,
1643 .generic_bulk_ctrl_endpoint = 0x81,
1644 /* parameter for the MPEG2-data transfer */
1646 .download_firmware = dw2102_load_firmware,
1647 .read_mac_address = dw210x_read_mac_address,
1650 .frontend_attach = dw3101_frontend_attach,
1651 .streaming_ctrl = NULL,
1652 .tuner_attach = dw3101_tuner_attach,
1665 .num_device_descs = 1,
1667 { "DVBWorld DVB-C 3101 USB2.0",
1668 {&dw2102_table[5], NULL},
1674 static struct dvb_usb_device_properties s6x0_properties = {
1675 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1676 .usb_ctrl = DEVICE_SPECIFIC,
1677 .firmware = "dvb-usb-s630.fw",
1680 .i2c_algo = &s6x0_i2c_algo,
1682 .rc_map_table = rc_map_tevii_table,
1683 .rc_map_size = ARRAY_SIZE(rc_map_tevii_table),
1685 .rc_query = dw2102_rc_query,
1688 .generic_bulk_ctrl_endpoint = 0x81,
1690 .download_firmware = dw2102_load_firmware,
1691 .read_mac_address = s6x0_read_mac_address,
1694 .frontend_attach = zl100313_frontend_attach,
1695 .streaming_ctrl = NULL,
1696 .tuner_attach = NULL,
1709 .num_device_descs = 1,
1712 {&dw2102_table[6], NULL},
1718 struct dvb_usb_device_properties *p1100;
1719 static struct dvb_usb_device_description d1100 = {
1721 {&dw2102_table[7], NULL},
1725 struct dvb_usb_device_properties *s660;
1726 static struct dvb_usb_device_description d660 = {
1728 {&dw2102_table[8], NULL},
1732 struct dvb_usb_device_properties *p7500;
1733 static struct dvb_usb_device_description d7500 = {
1734 "Prof 7500 USB DVB-S2",
1735 {&dw2102_table[9], NULL},
1739 static struct dvb_usb_device_properties su3000_properties = {
1740 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1741 .usb_ctrl = DEVICE_SPECIFIC,
1742 .size_of_priv = sizeof(struct su3000_state),
1743 .power_ctrl = su3000_power_ctrl,
1745 .identify_state = su3000_identify_state,
1746 .i2c_algo = &su3000_i2c_algo,
1749 .rc_map_table = rc_map_su3000_table,
1750 .rc_map_size = ARRAY_SIZE(rc_map_su3000_table),
1752 .rc_query = dw2102_rc_query,
1755 .read_mac_address = su3000_read_mac_address,
1757 .generic_bulk_ctrl_endpoint = 0x01,
1761 .streaming_ctrl = su3000_streaming_ctrl,
1762 .frontend_attach = su3000_frontend_attach,
1775 .num_device_descs = 2,
1777 { "SU3000HD DVB-S USB2.0",
1778 { &dw2102_table[10], NULL },
1781 { "Terratec Cinergy S2 USB HD",
1782 { &dw2102_table[11], NULL },
1788 static int dw2102_probe(struct usb_interface *intf,
1789 const struct usb_device_id *id)
1791 p1100 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
1794 /* copy default structure */
1795 memcpy(p1100, &s6x0_properties,
1796 sizeof(struct dvb_usb_device_properties));
1797 /* fill only different fields */
1798 p1100->firmware = "dvb-usb-p1100.fw";
1799 p1100->devices[0] = d1100;
1800 p1100->rc.legacy.rc_map_table = rc_map_tbs_table;
1801 p1100->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table);
1802 p1100->adapter->frontend_attach = stv0288_frontend_attach;
1804 s660 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
1809 memcpy(s660, &s6x0_properties,
1810 sizeof(struct dvb_usb_device_properties));
1811 s660->firmware = "dvb-usb-s660.fw";
1812 s660->devices[0] = d660;
1813 s660->adapter->frontend_attach = ds3000_frontend_attach;
1815 p7500 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
1821 memcpy(p7500, &s6x0_properties,
1822 sizeof(struct dvb_usb_device_properties));
1823 p7500->firmware = "dvb-usb-p7500.fw";
1824 p7500->devices[0] = d7500;
1825 p7500->rc.legacy.rc_map_table = rc_map_tbs_table;
1826 p7500->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table);
1827 p7500->adapter->frontend_attach = prof_7500_frontend_attach;
1829 if (0 == dvb_usb_device_init(intf, &dw2102_properties,
1830 THIS_MODULE, NULL, adapter_nr) ||
1831 0 == dvb_usb_device_init(intf, &dw2104_properties,
1832 THIS_MODULE, NULL, adapter_nr) ||
1833 0 == dvb_usb_device_init(intf, &dw3101_properties,
1834 THIS_MODULE, NULL, adapter_nr) ||
1835 0 == dvb_usb_device_init(intf, &s6x0_properties,
1836 THIS_MODULE, NULL, adapter_nr) ||
1837 0 == dvb_usb_device_init(intf, p1100,
1838 THIS_MODULE, NULL, adapter_nr) ||
1839 0 == dvb_usb_device_init(intf, s660,
1840 THIS_MODULE, NULL, adapter_nr) ||
1841 0 == dvb_usb_device_init(intf, p7500,
1842 THIS_MODULE, NULL, adapter_nr) ||
1843 0 == dvb_usb_device_init(intf, &su3000_properties,
1844 THIS_MODULE, NULL, adapter_nr))
1850 static struct usb_driver dw2102_driver = {
1852 .probe = dw2102_probe,
1853 .disconnect = dvb_usb_device_exit,
1854 .id_table = dw2102_table,
1857 static int __init dw2102_module_init(void)
1859 int ret = usb_register(&dw2102_driver);
1861 err("usb_register failed. Error number %d", ret);
1866 static void __exit dw2102_module_exit(void)
1868 usb_deregister(&dw2102_driver);
1871 module_init(dw2102_module_init);
1872 module_exit(dw2102_module_exit);
1874 MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by");
1875 MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104,"
1876 " DVB-C 3101 USB2.0,"
1877 " TeVii S600, S630, S650, S660 USB2.0,"
1878 " Prof 1100, 7500 USB2.0,"
1879 " Geniatech SU3000 devices");
1880 MODULE_VERSION("0.1");
1881 MODULE_LICENSE("GPL");