aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:50:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:50:49 -0500
commit3e7468313758913c5e4d372f35b271b96bad1298 (patch)
treeeb612d252a9e2349a1173451cd779beebd18a33e /drivers/media/dvb/dvb-usb
parent6825fbc4cb219f2c98bb7d157915d797cf5cb823 (diff)
parente97f4677961f68e29bd906022ebf60a6df7f530a (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (345 commits) V4L/DVB (13542): ir-keytable: Allow dynamic table change V4L/DVB (13541): atbm8830: replace 64-bit division and floating point usage V4L/DVB (13540): ir-common: Cleanup get key evdev code V4L/DVB (13539): ir-common: add __func__ for debug messages V4L/DVB (13538): ir-common: Use a dynamic keycode table V4L/DVB (13537): ir: Prepare the code for dynamic keycode table allocation V4L/DVB (13536): em28xx: Use the full RC5 code on HVR-950 Remote Controller V4L/DVB (13535): ir-common: Add a hauppauge new table with the complete RC5 code V4L/DVB (13534): ir-common: Remove some unused fields/structs V4L/DVB (13533): ir: use dynamic tables, instead of static ones V4L/DVB (13532): ir-common: Add infrastructure to use a dynamic keycode table V4L/DVB (13531): ir-common: rename the debug routine to allow exporting it V4L/DVB (13458): go7007: subdev conversion V4L/DVB (13457): s2250: subdev conversion V4L/DVB (13456): s2250: Change module structure V4L/DVB (13528): em28xx: add support for em2800 VC211A card em28xx: don't reduce scale to half size for em2800 em28xx: don't load audio modules when AC97 is mis-detected em28xx: em2800 chips support max width of 640 V4L/DVB (13523): dvb-bt8xx: fix compile warning ... Fix up trivial conflicts due to spelling fixes from the trivial tree in Documentation/video4linux/gspca.txt drivers/media/video/cx18/cx18-mailbox.h
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig8
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile3
-rw-r--r--drivers/media/dvb/dvb-usb/af9015.c33
-rw-r--r--drivers/media/dvb/dvb-usb/af9015.h215
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c117
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c182
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-dvb.c1
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h11
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb.h3
-rw-r--r--drivers/media/dvb/dvb-usb/ec168.c440
-rw-r--r--drivers/media/dvb/dvb-usb/ec168.h73
-rw-r--r--drivers/media/dvb/dvb-usb/friio-fe.c59
12 files changed, 1025 insertions, 120 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 0e4b97fba384..2dee1bf73577 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -322,3 +322,11 @@ config DVB_USB_FRIIO
322 depends on DVB_USB 322 depends on DVB_USB
323 help 323 help
324 Say Y here to support the Japanese DTV receiver Friio. 324 Say Y here to support the Japanese DTV receiver Friio.
325
326config DVB_USB_EC168
327 tristate "E3C EC168 DVB-T USB2.0 support"
328 depends on DVB_USB && EXPERIMENTAL
329 select DVB_EC100
330 select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE
331 help
332 Say Y here to support the E3C EC168 DVB-T USB2.0 receiver.
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 85b83a43d55d..72c92cb69a22 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -82,6 +82,9 @@ obj-$(CONFIG_DVB_USB_CE6230) += dvb-usb-ce6230.o
82dvb-usb-friio-objs = friio.o friio-fe.o 82dvb-usb-friio-objs = friio.o friio-fe.o
83obj-$(CONFIG_DVB_USB_FRIIO) += dvb-usb-friio.o 83obj-$(CONFIG_DVB_USB_FRIIO) += dvb-usb-friio.o
84 84
85dvb-usb-ec168-objs = ec168.o
86obj-$(CONFIG_DVB_USB_EC168) += dvb-usb-ec168.o
87
85EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ 88EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
86# due to tuner-xc3028 89# due to tuner-xc3028
87EXTRA_CFLAGS += -Idrivers/media/common/tuners 90EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c
index cf042b309b46..8b60a601fb82 100644
--- a/drivers/media/dvb/dvb-usb/af9015.c
+++ b/drivers/media/dvb/dvb-usb/af9015.c
@@ -730,7 +730,7 @@ static int af9015_read_config(struct usb_device *udev)
730 goto error; 730 goto error;
731 deb_info("%s: IR mode:%d\n", __func__, val); 731 deb_info("%s: IR mode:%d\n", __func__, val);
732 for (i = 0; i < af9015_properties_count; i++) { 732 for (i = 0; i < af9015_properties_count; i++) {
733 if (val == AF9015_IR_MODE_DISABLED || val == 0x04) { 733 if (val == AF9015_IR_MODE_DISABLED) {
734 af9015_properties[i].rc_key_map = NULL; 734 af9015_properties[i].rc_key_map = NULL;
735 af9015_properties[i].rc_key_map_size = 0; 735 af9015_properties[i].rc_key_map_size = 0;
736 } else if (dvb_usb_af9015_remote) { 736 } else if (dvb_usb_af9015_remote) {
@@ -868,6 +868,16 @@ static int af9015_read_config(struct usb_device *udev)
868 af9015_config.ir_table_size = 868 af9015_config.ir_table_size =
869 ARRAY_SIZE(af9015_ir_table_avermedia); 869 ARRAY_SIZE(af9015_ir_table_avermedia);
870 break; 870 break;
871 case USB_VID_MSI_2:
872 af9015_properties[i].rc_key_map =
873 af9015_rc_keys_msi_digivox_iii;
874 af9015_properties[i].rc_key_map_size =
875 ARRAY_SIZE(af9015_rc_keys_msi_digivox_iii);
876 af9015_config.ir_table =
877 af9015_ir_table_msi_digivox_iii;
878 af9015_config.ir_table_size =
879 ARRAY_SIZE(af9015_ir_table_msi_digivox_iii);
880 break;
871 } 881 }
872 } 882 }
873 } 883 }
@@ -1283,6 +1293,8 @@ static struct usb_device_id af9015_usb_table[] = {
1283 {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_MC810)}, 1293 {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_MC810)},
1284 {USB_DEVICE(USB_VID_KYE, USB_PID_GENIUS_TVGO_DVB_T03)}, 1294 {USB_DEVICE(USB_VID_KYE, USB_PID_GENIUS_TVGO_DVB_T03)},
1285/* 25 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_399U_2)}, 1295/* 25 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_399U_2)},
1296 {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_PC160_T)},
1297 {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV20)},
1286 {0}, 1298 {0},
1287}; 1299};
1288MODULE_DEVICE_TABLE(usb, af9015_usb_table); 1300MODULE_DEVICE_TABLE(usb, af9015_usb_table);
@@ -1296,7 +1308,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
1296 .firmware = "dvb-usb-af9015.fw", 1308 .firmware = "dvb-usb-af9015.fw",
1297 .no_reconnect = 1, 1309 .no_reconnect = 1,
1298 1310
1299 .size_of_priv = sizeof(struct af9015_state), \ 1311 .size_of_priv = sizeof(struct af9015_state),
1300 1312
1301 .num_adapters = 2, 1313 .num_adapters = 2,
1302 .adapter = { 1314 .adapter = {
@@ -1402,7 +1414,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
1402 .firmware = "dvb-usb-af9015.fw", 1414 .firmware = "dvb-usb-af9015.fw",
1403 .no_reconnect = 1, 1415 .no_reconnect = 1,
1404 1416
1405 .size_of_priv = sizeof(struct af9015_state), \ 1417 .size_of_priv = sizeof(struct af9015_state),
1406 1418
1407 .num_adapters = 2, 1419 .num_adapters = 2,
1408 .adapter = { 1420 .adapter = {
@@ -1508,7 +1520,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
1508 .firmware = "dvb-usb-af9015.fw", 1520 .firmware = "dvb-usb-af9015.fw",
1509 .no_reconnect = 1, 1521 .no_reconnect = 1,
1510 1522
1511 .size_of_priv = sizeof(struct af9015_state), \ 1523 .size_of_priv = sizeof(struct af9015_state),
1512 1524
1513 .num_adapters = 2, 1525 .num_adapters = 2,
1514 .adapter = { 1526 .adapter = {
@@ -1554,7 +1566,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
1554 1566
1555 .i2c_algo = &af9015_i2c_algo, 1567 .i2c_algo = &af9015_i2c_algo,
1556 1568
1557 .num_device_descs = 4, /* max 9 */ 1569 .num_device_descs = 6, /* max 9 */
1558 .devices = { 1570 .devices = {
1559 { 1571 {
1560 .name = "AverMedia AVerTV Volar GPS 805 (A805)", 1572 .name = "AverMedia AVerTV Volar GPS 805 (A805)",
@@ -1577,6 +1589,17 @@ static struct dvb_usb_device_properties af9015_properties[] = {
1577 .cold_ids = {&af9015_usb_table[24], NULL}, 1589 .cold_ids = {&af9015_usb_table[24], NULL},
1578 .warm_ids = {NULL}, 1590 .warm_ids = {NULL},
1579 }, 1591 },
1592 {
1593 .name = "KWorld PlusTV DVB-T PCI Pro Card " \
1594 "(DVB-T PC160-T)",
1595 .cold_ids = {&af9015_usb_table[26], NULL},
1596 .warm_ids = {NULL},
1597 },
1598 {
1599 .name = "Sveon STV20 Tuner USB DVB-T HDTV",
1600 .cold_ids = {&af9015_usb_table[27], NULL},
1601 .warm_ids = {NULL},
1602 },
1580 } 1603 }
1581 }, 1604 },
1582}; 1605};
diff --git a/drivers/media/dvb/dvb-usb/af9015.h b/drivers/media/dvb/dvb-usb/af9015.h
index c41f30e4a1b8..931c8515830d 100644
--- a/drivers/media/dvb/dvb-usb/af9015.h
+++ b/drivers/media/dvb/dvb-usb/af9015.h
@@ -95,6 +95,7 @@ enum af9015_ir_mode {
95 AF9015_IR_MODE_HID, 95 AF9015_IR_MODE_HID,
96 AF9015_IR_MODE_RLC, 96 AF9015_IR_MODE_RLC,
97 AF9015_IR_MODE_RC6, 97 AF9015_IR_MODE_RC6,
98 AF9015_IR_MODE_POLLING, /* just guess */
98}; 99};
99 100
100struct af9015_state { 101struct af9015_state {
@@ -119,6 +120,7 @@ enum af9015_remote {
119/* 5 */ AF9015_REMOTE_AVERMEDIA_KS, 120/* 5 */ AF9015_REMOTE_AVERMEDIA_KS,
120}; 121};
121 122
123/* LeadTek - Y04G0051 */
122/* Leadtek WinFast DTV Dongle Gold */ 124/* Leadtek WinFast DTV Dongle Gold */
123static struct dvb_usb_rc_key af9015_rc_keys_leadtek[] = { 125static struct dvb_usb_rc_key af9015_rc_keys_leadtek[] = {
124 { 0x001e, KEY_1 }, 126 { 0x001e, KEY_1 },
@@ -131,64 +133,96 @@ static struct dvb_usb_rc_key af9015_rc_keys_leadtek[] = {
131 { 0x0025, KEY_8 }, 133 { 0x0025, KEY_8 },
132 { 0x0026, KEY_9 }, 134 { 0x0026, KEY_9 },
133 { 0x0027, KEY_0 }, 135 { 0x0027, KEY_0 },
134 { 0x0028, KEY_ENTER }, 136 { 0x0028, KEY_OK },
135 { 0x004f, KEY_VOLUMEUP }, 137 { 0x004f, KEY_RIGHT },
136 { 0x0050, KEY_VOLUMEDOWN }, 138 { 0x0050, KEY_LEFT },
137 { 0x0051, KEY_CHANNELDOWN }, 139 { 0x0051, KEY_DOWN },
138 { 0x0052, KEY_CHANNELUP }, 140 { 0x0052, KEY_UP },
141 { 0x011a, KEY_POWER2 },
142 { 0x04b4, KEY_TV },
143 { 0x04b3, KEY_RED },
144 { 0x04b2, KEY_GREEN },
145 { 0x04b1, KEY_YELLOW },
146 { 0x04b0, KEY_BLUE },
147 { 0x003d, KEY_TEXT },
148 { 0x0113, KEY_SLEEP },
149 { 0x0010, KEY_MUTE },
150 { 0x0105, KEY_ESC },
151 { 0x0009, KEY_SCREEN },
152 { 0x010f, KEY_MENU },
153 { 0x003f, KEY_CHANNEL },
154 { 0x0013, KEY_REWIND },
155 { 0x0012, KEY_PLAY },
156 { 0x0011, KEY_FASTFORWARD },
157 { 0x0005, KEY_PREVIOUS },
158 { 0x0029, KEY_STOP },
159 { 0x002b, KEY_NEXT },
160 { 0x0041, KEY_EPG },
161 { 0x0019, KEY_VIDEO },
162 { 0x0016, KEY_AUDIO },
163 { 0x0037, KEY_DOT },
164 { 0x002a, KEY_AGAIN },
165 { 0x002c, KEY_CAMERA },
166 { 0x003c, KEY_NEW },
167 { 0x0115, KEY_RECORD },
168 { 0x010b, KEY_TIME },
169 { 0x0043, KEY_VOLUMEUP },
170 { 0x0042, KEY_VOLUMEDOWN },
171 { 0x004b, KEY_CHANNELUP },
172 { 0x004e, KEY_CHANNELDOWN },
139}; 173};
140 174
141static u8 af9015_ir_table_leadtek[] = { 175static u8 af9015_ir_table_leadtek[] = {
142 0x03, 0xfc, 0x00, 0xff, 0x1a, 0x01, 0x00, 176 0x03, 0xfc, 0x00, 0xff, 0x1a, 0x01, 0x00, /* KEY_POWER2 */
143 0x03, 0xfc, 0x56, 0xa9, 0x00, 0x00, 0x00, 177 0x03, 0xfc, 0x56, 0xa9, 0xb4, 0x04, 0x00, /* KEY_TV */
144 0x03, 0xfc, 0x4b, 0xb4, 0x00, 0x00, 0x00, 178 0x03, 0xfc, 0x4b, 0xb4, 0xb3, 0x04, 0x00, /* KEY_RED */
145 0x03, 0xfc, 0x4c, 0xb3, 0xb2, 0x04, 0x00, 179 0x03, 0xfc, 0x4c, 0xb3, 0xb2, 0x04, 0x00, /* KEY_GREEN */
146 0x03, 0xfc, 0x4d, 0xb2, 0x00, 0x00, 0x00, 180 0x03, 0xfc, 0x4d, 0xb2, 0xb1, 0x04, 0x00, /* KEY_YELLOW */
147 0x03, 0xfc, 0x4e, 0xb1, 0x00, 0x00, 0x00, 181 0x03, 0xfc, 0x4e, 0xb1, 0xb0, 0x04, 0x00, /* KEY_BLUE */
148 0x03, 0xfc, 0x1f, 0xe0, 0x3d, 0x00, 0x00, 182 0x03, 0xfc, 0x1f, 0xe0, 0x3d, 0x00, 0x00, /* KEY_TEXT */
149 0x03, 0xfc, 0x40, 0xbf, 0x13, 0x01, 0x00, 183 0x03, 0xfc, 0x40, 0xbf, 0x13, 0x01, 0x00, /* KEY_SLEEP */
150 0x03, 0xfc, 0x14, 0xeb, 0x10, 0x00, 0x00, 184 0x03, 0xfc, 0x14, 0xeb, 0x10, 0x00, 0x00, /* KEY_MUTE */
151 0x03, 0xfc, 0x49, 0xb6, 0x05, 0x01, 0x00, 185 0x03, 0xfc, 0x49, 0xb6, 0x05, 0x01, 0x00, /* KEY_ESC */
152 0x03, 0xfc, 0x50, 0xaf, 0x29, 0x00, 0x00, 186 0x03, 0xfc, 0x50, 0xaf, 0x29, 0x00, 0x00, /* KEY_STOP (1)*/
153 0x03, 0xfc, 0x0c, 0xf3, 0x52, 0x00, 0x00, 187 0x03, 0xfc, 0x0c, 0xf3, 0x52, 0x00, 0x00, /* KEY_UP */
154 0x03, 0xfc, 0x03, 0xfc, 0x09, 0x00, 0x00, 188 0x03, 0xfc, 0x03, 0xfc, 0x09, 0x00, 0x00, /* KEY_SCREEN */
155 0x03, 0xfc, 0x08, 0xf7, 0x50, 0x00, 0x00, 189 0x03, 0xfc, 0x08, 0xf7, 0x50, 0x00, 0x00, /* KEY_LEFT */
156 0x03, 0xfc, 0x13, 0xec, 0x28, 0x00, 0x00, 190 0x03, 0xfc, 0x13, 0xec, 0x28, 0x00, 0x00, /* KEY_OK (1) */
157 0x03, 0xfc, 0x04, 0xfb, 0x4f, 0x00, 0x00, 191 0x03, 0xfc, 0x04, 0xfb, 0x4f, 0x00, 0x00, /* KEY_RIGHT */
158 0x03, 0xfc, 0x4f, 0xb0, 0x0f, 0x01, 0x00, 192 0x03, 0xfc, 0x4f, 0xb0, 0x0f, 0x01, 0x00, /* KEY_MENU */
159 0x03, 0xfc, 0x10, 0xef, 0x51, 0x00, 0x00, 193 0x03, 0xfc, 0x10, 0xef, 0x51, 0x00, 0x00, /* KEY_DOWN */
160 0x03, 0xfc, 0x51, 0xae, 0x3f, 0x00, 0x00, 194 0x03, 0xfc, 0x51, 0xae, 0x3f, 0x00, 0x00, /* KEY_CHANNEL */
161 0x03, 0xfc, 0x42, 0xbd, 0x13, 0x00, 0x00, 195 0x03, 0xfc, 0x42, 0xbd, 0x13, 0x00, 0x00, /* KEY_REWIND */
162 0x03, 0xfc, 0x43, 0xbc, 0x00, 0x00, 0x00, 196 0x03, 0xfc, 0x43, 0xbc, 0x12, 0x00, 0x00, /* KEY_PLAY */
163 0x03, 0xfc, 0x44, 0xbb, 0x11, 0x00, 0x00, 197 0x03, 0xfc, 0x44, 0xbb, 0x11, 0x00, 0x00, /* KEY_FASTFORWARD */
164 0x03, 0xfc, 0x52, 0xad, 0x19, 0x00, 0x00, 198 0x03, 0xfc, 0x52, 0xad, 0x19, 0x00, 0x00, /* KEY_VIDEO (1) */
165 0x03, 0xfc, 0x54, 0xab, 0x05, 0x00, 0x00, 199 0x03, 0xfc, 0x54, 0xab, 0x05, 0x00, 0x00, /* KEY_PREVIOUS */
166 0x03, 0xfc, 0x46, 0xb9, 0x29, 0x00, 0x00, 200 0x03, 0xfc, 0x46, 0xb9, 0x29, 0x00, 0x00, /* KEY_STOP (2) */
167 0x03, 0xfc, 0x55, 0xaa, 0x2b, 0x00, 0x00, 201 0x03, 0xfc, 0x55, 0xaa, 0x2b, 0x00, 0x00, /* KEY_NEXT */
168 0x03, 0xfc, 0x53, 0xac, 0x41, 0x00, 0x00, 202 0x03, 0xfc, 0x53, 0xac, 0x41, 0x00, 0x00, /* KEY_EPG */
169 0x03, 0xfc, 0x05, 0xfa, 0x1e, 0x00, 0x00, 203 0x03, 0xfc, 0x05, 0xfa, 0x1e, 0x00, 0x00, /* KEY_1 */
170 0x03, 0xfc, 0x06, 0xf9, 0x1f, 0x00, 0x00, 204 0x03, 0xfc, 0x06, 0xf9, 0x1f, 0x00, 0x00, /* KEY_2 */
171 0x03, 0xfc, 0x07, 0xf8, 0x20, 0x00, 0x00, 205 0x03, 0xfc, 0x07, 0xf8, 0x20, 0x00, 0x00, /* KEY_3 */
172 0x03, 0xfc, 0x1e, 0xe1, 0x19, 0x00, 0x00, 206 0x03, 0xfc, 0x1e, 0xe1, 0x19, 0x00, 0x00, /* KEY_VIDEO (2) */
173 0x03, 0xfc, 0x09, 0xf6, 0x21, 0x00, 0x00, 207 0x03, 0xfc, 0x09, 0xf6, 0x21, 0x00, 0x00, /* KEY_4 */
174 0x03, 0xfc, 0x0a, 0xf5, 0x22, 0x00, 0x00, 208 0x03, 0xfc, 0x0a, 0xf5, 0x22, 0x00, 0x00, /* KEY_5 */
175 0x03, 0xfc, 0x0b, 0xf4, 0x23, 0x00, 0x00, 209 0x03, 0xfc, 0x0b, 0xf4, 0x23, 0x00, 0x00, /* KEY_6 */
176 0x03, 0xfc, 0x1b, 0xe4, 0x16, 0x00, 0x00, 210 0x03, 0xfc, 0x1b, 0xe4, 0x16, 0x00, 0x00, /* KEY_AUDIO */
177 0x03, 0xfc, 0x0d, 0xf2, 0x24, 0x00, 0x00, 211 0x03, 0xfc, 0x0d, 0xf2, 0x24, 0x00, 0x00, /* KEY_7 */
178 0x03, 0xfc, 0x0e, 0xf1, 0x25, 0x00, 0x00, 212 0x03, 0xfc, 0x0e, 0xf1, 0x25, 0x00, 0x00, /* KEY_8 */
179 0x03, 0xfc, 0x0f, 0xf0, 0x26, 0x00, 0x00, 213 0x03, 0xfc, 0x0f, 0xf0, 0x26, 0x00, 0x00, /* KEY_9 */
180 0x03, 0xfc, 0x16, 0xe9, 0x28, 0x00, 0x00, 214 0x03, 0xfc, 0x16, 0xe9, 0x28, 0x00, 0x00, /* KEY_OK (2) */
181 0x03, 0xfc, 0x41, 0xbe, 0x37, 0x00, 0x00, 215 0x03, 0xfc, 0x41, 0xbe, 0x37, 0x00, 0x00, /* KEY_DOT */
182 0x03, 0xfc, 0x12, 0xed, 0x27, 0x00, 0x00, 216 0x03, 0xfc, 0x12, 0xed, 0x27, 0x00, 0x00, /* KEY_0 */
183 0x03, 0xfc, 0x11, 0xee, 0x2a, 0x00, 0x00, 217 0x03, 0xfc, 0x11, 0xee, 0x2a, 0x00, 0x00, /* KEY_AGAIN */
184 0x03, 0xfc, 0x48, 0xb7, 0x2c, 0x00, 0x00, 218 0x03, 0xfc, 0x48, 0xb7, 0x2c, 0x00, 0x00, /* KEY_CAMERA */
185 0x03, 0xfc, 0x4a, 0xb5, 0x3c, 0x00, 0x00, 219 0x03, 0xfc, 0x4a, 0xb5, 0x3c, 0x00, 0x00, /* KEY_NEW */
186 0x03, 0xfc, 0x47, 0xb8, 0x15, 0x01, 0x00, 220 0x03, 0xfc, 0x47, 0xb8, 0x15, 0x01, 0x00, /* KEY_RECORD */
187 0x03, 0xfc, 0x45, 0xba, 0x0b, 0x01, 0x00, 221 0x03, 0xfc, 0x45, 0xba, 0x0b, 0x01, 0x00, /* KEY_TIME */
188 0x03, 0xfc, 0x5e, 0xa1, 0x43, 0x00, 0x00, 222 0x03, 0xfc, 0x5e, 0xa1, 0x43, 0x00, 0x00, /* KEY_VOLUMEUP */
189 0x03, 0xfc, 0x5a, 0xa5, 0x42, 0x00, 0x00, 223 0x03, 0xfc, 0x5a, 0xa5, 0x42, 0x00, 0x00, /* KEY_VOLUMEDOWN */
190 0x03, 0xfc, 0x5b, 0xa4, 0x4b, 0x00, 0x00, 224 0x03, 0xfc, 0x5b, 0xa4, 0x4b, 0x00, 0x00, /* KEY_CHANNELUP */
191 0x03, 0xfc, 0x5f, 0xa0, 0x4e, 0x00, 0x00, 225 0x03, 0xfc, 0x5f, 0xa0, 0x4e, 0x00, 0x00, /* KEY_CHANNELDOWN */
192}; 226};
193 227
194/* TwinHan AzureWave AD-TU700(704J) */ 228/* TwinHan AzureWave AD-TU700(704J) */
@@ -746,4 +780,75 @@ static u8 af9015_ir_table_trekstor[] = {
746 0x00, 0xff, 0x84, 0x7b, 0x27, 0x07, 0x00, 780 0x00, 0xff, 0x84, 0x7b, 0x27, 0x07, 0x00,
747}; 781};
748 782
783/* MSI DIGIVOX mini III */
784static struct dvb_usb_rc_key af9015_rc_keys_msi_digivox_iii[] = {
785 { 0x0713, KEY_POWER }, /* [red power button] */
786 { 0x073b, KEY_VIDEO }, /* Source */
787 { 0x073e, KEY_ZOOM }, /* Zoom */
788 { 0x070b, KEY_POWER2 }, /* ShutDown */
789 { 0x071e, KEY_1 },
790 { 0x071f, KEY_2 },
791 { 0x0720, KEY_3 },
792 { 0x0721, KEY_4 },
793 { 0x0722, KEY_5 },
794 { 0x0723, KEY_6 },
795 { 0x0724, KEY_7 },
796 { 0x0725, KEY_8 },
797 { 0x0726, KEY_9 },
798 { 0x0727, KEY_0 },
799 { 0x0752, KEY_CHANNELUP }, /* CH+ */
800 { 0x0751, KEY_CHANNELDOWN }, /* CH- */
801 { 0x0750, KEY_VOLUMEUP }, /* Vol+ */
802 { 0x074f, KEY_VOLUMEDOWN }, /* Vol- */
803 { 0x0705, KEY_ESC }, /* [back up arrow] */
804 { 0x0708, KEY_OK }, /* [enter arrow] */
805 { 0x073f, KEY_RECORD }, /* Rec */
806 { 0x0716, KEY_STOP }, /* Stop */
807 { 0x072a, KEY_PLAY }, /* Play */
808 { 0x073c, KEY_MUTE }, /* Mute */
809 { 0x0718, KEY_UP },
810 { 0x0707, KEY_DOWN },
811 { 0x070f, KEY_LEFT },
812 { 0x0715, KEY_RIGHT },
813 { 0x0736, KEY_RED },
814 { 0x0737, KEY_GREEN },
815 { 0x072d, KEY_YELLOW },
816 { 0x072e, KEY_BLUE },
817};
818
819static u8 af9015_ir_table_msi_digivox_iii[] = {
820 0x61, 0xd6, 0x43, 0xbc, 0x13, 0x07, 0x00, /* KEY_POWER */
821 0x61, 0xd6, 0x01, 0xfe, 0x3b, 0x07, 0x00, /* KEY_VIDEO */
822 0x61, 0xd6, 0x0b, 0xf4, 0x3e, 0x07, 0x00, /* KEY_ZOOM */
823 0x61, 0xd6, 0x03, 0xfc, 0x0b, 0x07, 0x00, /* KEY_POWER2 */
824 0x61, 0xd6, 0x04, 0xfb, 0x1e, 0x07, 0x00, /* KEY_1 */
825 0x61, 0xd6, 0x08, 0xf7, 0x1f, 0x07, 0x00, /* KEY_2 */
826 0x61, 0xd6, 0x02, 0xfd, 0x20, 0x07, 0x00, /* KEY_3 */
827 0x61, 0xd6, 0x0f, 0xf0, 0x21, 0x07, 0x00, /* KEY_4 */
828 0x61, 0xd6, 0x05, 0xfa, 0x22, 0x07, 0x00, /* KEY_5 */
829 0x61, 0xd6, 0x06, 0xf9, 0x23, 0x07, 0x00, /* KEY_6 */
830 0x61, 0xd6, 0x0c, 0xf3, 0x24, 0x07, 0x00, /* KEY_7 */
831 0x61, 0xd6, 0x0d, 0xf2, 0x25, 0x07, 0x00, /* KEY_8 */
832 0x61, 0xd6, 0x0a, 0xf5, 0x26, 0x07, 0x00, /* KEY_9 */
833 0x61, 0xd6, 0x11, 0xee, 0x27, 0x07, 0x00, /* KEY_0 */
834 0x61, 0xd6, 0x09, 0xf6, 0x52, 0x07, 0x00, /* KEY_CHANNELUP */
835 0x61, 0xd6, 0x07, 0xf8, 0x51, 0x07, 0x00, /* KEY_CHANNELDOWN */
836 0x61, 0xd6, 0x0e, 0xf1, 0x50, 0x07, 0x00, /* KEY_VOLUMEUP */
837 0x61, 0xd6, 0x13, 0xec, 0x4f, 0x07, 0x00, /* KEY_VOLUMEDOWN */
838 0x61, 0xd6, 0x10, 0xef, 0x05, 0x07, 0x00, /* KEY_ESC */
839 0x61, 0xd6, 0x12, 0xed, 0x08, 0x07, 0x00, /* KEY_OK */
840 0x61, 0xd6, 0x14, 0xeb, 0x3f, 0x07, 0x00, /* KEY_RECORD */
841 0x61, 0xd6, 0x15, 0xea, 0x16, 0x07, 0x00, /* KEY_STOP */
842 0x61, 0xd6, 0x16, 0xe9, 0x2a, 0x07, 0x00, /* KEY_PLAY */
843 0x61, 0xd6, 0x17, 0xe8, 0x3c, 0x07, 0x00, /* KEY_MUTE */
844 0x61, 0xd6, 0x18, 0xe7, 0x18, 0x07, 0x00, /* KEY_UP */
845 0x61, 0xd6, 0x19, 0xe6, 0x07, 0x07, 0x00, /* KEY_DOWN */
846 0x61, 0xd6, 0x1a, 0xe5, 0x0f, 0x07, 0x00, /* KEY_LEFT */
847 0x61, 0xd6, 0x1b, 0xe4, 0x15, 0x07, 0x00, /* KEY_RIGHT */
848 0x61, 0xd6, 0x1c, 0xe3, 0x36, 0x07, 0x00, /* KEY_RED */
849 0x61, 0xd6, 0x1d, 0xe2, 0x37, 0x07, 0x00, /* KEY_GREEN */
850 0x61, 0xd6, 0x1e, 0xe1, 0x2d, 0x07, 0x00, /* KEY_YELLOW */
851 0x61, 0xd6, 0x1f, 0xe0, 0x2e, 0x07, 0x00, /* KEY_BLUE */
852};
853
749#endif 854#endif
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 2a53dd096eef..05fb28e9c69e 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -36,9 +36,11 @@
36#include "tuner-xc2028.h" 36#include "tuner-xc2028.h"
37#include "tuner-simple.h" 37#include "tuner-simple.h"
38#include "mxl5005s.h" 38#include "mxl5005s.h"
39#include "max2165.h"
39#include "dib7000p.h" 40#include "dib7000p.h"
40#include "dib0070.h" 41#include "dib0070.h"
41#include "lgs8gxx.h" 42#include "lgs8gxx.h"
43#include "atbm8830.h"
42 44
43/* debug */ 45/* debug */
44static int dvb_usb_cxusb_debug; 46static int dvb_usb_cxusb_debug;
@@ -714,6 +716,11 @@ static struct mxl5005s_config d680_dmb_tuner = {
714 .AgcMasterByte = 0x00, 716 .AgcMasterByte = 0x00,
715}; 717};
716 718
719static struct max2165_config mygica_d689_max2165_cfg = {
720 .i2c_address = 0x60,
721 .osc_clk = 20
722};
723
717/* Callbacks for DVB USB */ 724/* Callbacks for DVB USB */
718static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) 725static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
719{ 726{
@@ -813,6 +820,14 @@ static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap)
813 return (fe == NULL) ? -EIO : 0; 820 return (fe == NULL) ? -EIO : 0;
814} 821}
815 822
823static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap)
824{
825 struct dvb_frontend *fe;
826 fe = dvb_attach(max2165_attach, adap->fe,
827 &adap->dev->i2c_adap, &mygica_d689_max2165_cfg);
828 return (fe == NULL) ? -EIO : 0;
829}
830
816static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) 831static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
817{ 832{
818 u8 b; 833 u8 b;
@@ -1160,6 +1175,55 @@ static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap)
1160 return 0; 1175 return 0;
1161} 1176}
1162 1177
1178static struct atbm8830_config mygica_d689_atbm8830_cfg = {
1179 .prod = ATBM8830_PROD_8830,
1180 .demod_address = 0x40,
1181 .serial_ts = 0,
1182 .ts_sampling_edge = 1,
1183 .ts_clk_gated = 0,
1184 .osc_clk_freq = 30400, /* in kHz */
1185 .if_freq = 0, /* zero IF */
1186 .zif_swap_iq = 1,
1187};
1188
1189static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)
1190{
1191 struct dvb_usb_device *d = adap->dev;
1192
1193 /* Select required USB configuration */
1194 if (usb_set_interface(d->udev, 0, 0) < 0)
1195 err("set interface failed");
1196
1197 /* Unblock all USB pipes */
1198 usb_clear_halt(d->udev,
1199 usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1200 usb_clear_halt(d->udev,
1201 usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1202 usb_clear_halt(d->udev,
1203 usb_rcvbulkpipe(d->udev, d->props.adapter[0].stream.endpoint));
1204
1205
1206 /* Reset the tuner */
1207 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
1208 err("clear tuner gpio failed");
1209 return -EIO;
1210 }
1211 msleep(100);
1212 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
1213 err("set tuner gpio failed");
1214 return -EIO;
1215 }
1216 msleep(100);
1217
1218 /* Attach frontend */
1219 adap->fe = dvb_attach(atbm8830_attach, &mygica_d689_atbm8830_cfg,
1220 &d->i2c_adap);
1221 if (adap->fe == NULL)
1222 return -EIO;
1223
1224 return 0;
1225}
1226
1163/* 1227/*
1164 * DViCO has shipped two devices with the same USB ID, but only one of them 1228 * DViCO has shipped two devices with the same USB ID, but only one of them
1165 * needs a firmware download. Check the device class details to see if they 1229 * needs a firmware download. Check the device class details to see if they
@@ -1240,6 +1304,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
1240static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; 1304static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
1241static struct dvb_usb_device_properties cxusb_aver_a868r_properties; 1305static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
1242static struct dvb_usb_device_properties cxusb_d680_dmb_properties; 1306static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
1307static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
1243 1308
1244static int cxusb_probe(struct usb_interface *intf, 1309static int cxusb_probe(struct usb_interface *intf,
1245 const struct usb_device_id *id) 1310 const struct usb_device_id *id)
@@ -1268,6 +1333,8 @@ static int cxusb_probe(struct usb_interface *intf,
1268 THIS_MODULE, NULL, adapter_nr) || 1333 THIS_MODULE, NULL, adapter_nr) ||
1269 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, 1334 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties,
1270 THIS_MODULE, NULL, adapter_nr) || 1335 THIS_MODULE, NULL, adapter_nr) ||
1336 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
1337 THIS_MODULE, NULL, adapter_nr) ||
1271 0) 1338 0)
1272 return 0; 1339 return 0;
1273 1340
@@ -1294,6 +1361,7 @@ static struct usb_device_id cxusb_table [] = {
1294 { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) }, 1361 { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) },
1295 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) }, 1362 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) },
1296 { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) }, 1363 { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) },
1364 { USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) },
1297 {} /* Terminating entry */ 1365 {} /* Terminating entry */
1298}; 1366};
1299MODULE_DEVICE_TABLE (usb, cxusb_table); 1367MODULE_DEVICE_TABLE (usb, cxusb_table);
@@ -1837,6 +1905,55 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = {
1837 } 1905 }
1838}; 1906};
1839 1907
1908static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
1909 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1910
1911 .usb_ctrl = CYPRESS_FX2,
1912
1913 .size_of_priv = sizeof(struct cxusb_state),
1914
1915 .num_adapters = 1,
1916 .adapter = {
1917 {
1918 .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
1919 .frontend_attach = cxusb_mygica_d689_frontend_attach,
1920 .tuner_attach = cxusb_mygica_d689_tuner_attach,
1921
1922 /* parameter for the MPEG2-data transfer */
1923 .stream = {
1924 .type = USB_BULK,
1925 .count = 5,
1926 .endpoint = 0x02,
1927 .u = {
1928 .bulk = {
1929 .buffersize = 8192,
1930 }
1931 }
1932 },
1933 },
1934 },
1935
1936 .power_ctrl = cxusb_d680_dmb_power_ctrl,
1937
1938 .i2c_algo = &cxusb_i2c_algo,
1939
1940 .generic_bulk_ctrl_endpoint = 0x01,
1941
1942 .rc_interval = 100,
1943 .rc_key_map = d680_dmb_rc_keys,
1944 .rc_key_map_size = ARRAY_SIZE(d680_dmb_rc_keys),
1945 .rc_query = cxusb_d680_dmb_rc_query,
1946
1947 .num_device_descs = 1,
1948 .devices = {
1949 {
1950 "Mygica D689 DMB-TH",
1951 { NULL },
1952 { &cxusb_table[19], NULL },
1953 },
1954 }
1955};
1956
1840static struct usb_driver cxusb_driver = { 1957static struct usb_driver cxusb_driver = {
1841 .name = "dvb_usb_cxusb", 1958 .name = "dvb_usb_cxusb",
1842 .probe = cxusb_probe, 1959 .probe = cxusb_probe,
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 6bd8951ea02b..684146f98eb7 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -558,8 +558,7 @@ static int dib0700_rc_query_legacy(struct dvb_usb_device *d, u32 *event,
558struct dib0700_rc_response { 558struct dib0700_rc_response {
559 u8 report_id; 559 u8 report_id;
560 u8 data_state; 560 u8 data_state;
561 u8 system_msb; 561 u16 system;
562 u8 system_lsb;
563 u8 data; 562 u8 data;
564 u8 not_data; 563 u8 not_data;
565}; 564};
@@ -589,37 +588,50 @@ static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event,
589 return 0; 588 return 0;
590 } 589 }
591 590
592 if (actlen != sizeof(buf)) {
593 /* We didn't get back the 6 byte message we expected */
594 err("Unexpected RC response size [%d]", actlen);
595 return -1;
596 }
597 591
598 poll_reply.report_id = buf[0]; 592 switch (dvb_usb_dib0700_ir_proto) {
599 poll_reply.data_state = buf[1]; 593 case 0:
600 poll_reply.system_msb = buf[2]; 594 poll_reply.report_id = 0;
601 poll_reply.system_lsb = buf[3]; 595 poll_reply.data_state = 1;
602 poll_reply.data = buf[4]; 596 poll_reply.system = buf[2];
603 poll_reply.not_data = buf[5]; 597 poll_reply.data = buf[4];
598 poll_reply.not_data = buf[5];
599
600 /* NEC protocol sends repeat code as 0 0 0 FF */
601 if ((poll_reply.system == 0x00) && (poll_reply.data == 0x00)
602 && (poll_reply.not_data == 0xff)) {
603 poll_reply.data_state = 2;
604 break;
605 }
606 break;
607 default:
608 if (actlen != sizeof(buf)) {
609 /* We didn't get back the 6 byte message we expected */
610 err("Unexpected RC response size [%d]", actlen);
611 return -1;
612 }
613
614 poll_reply.report_id = buf[0];
615 poll_reply.data_state = buf[1];
616 poll_reply.system = (buf[2] << 8) | buf[3];
617 poll_reply.data = buf[4];
618 poll_reply.not_data = buf[5];
604 619
605 /* 620 break;
606 info("rid=%02x ds=%02x sm=%02x sl=%02x d=%02x nd=%02x\n", 621 }
607 poll_reply.report_id, poll_reply.data_state,
608 poll_reply.system_msb, poll_reply.system_lsb,
609 poll_reply.data, poll_reply.not_data);
610 */
611 622
612 if ((poll_reply.data + poll_reply.not_data) != 0xff) { 623 if ((poll_reply.data + poll_reply.not_data) != 0xff) {
613 /* Key failed integrity check */ 624 /* Key failed integrity check */
614 err("key failed integrity check: %02x %02x %02x %02x", 625 err("key failed integrity check: %04x %02x %02x",
615 poll_reply.system_msb, poll_reply.system_lsb, 626 poll_reply.system,
616 poll_reply.data, poll_reply.not_data); 627 poll_reply.data, poll_reply.not_data);
617 return -1; 628 return -1;
618 } 629 }
619 630
631
620 /* Find the key in the map */ 632 /* Find the key in the map */
621 for (i = 0; i < d->props.rc_key_map_size; i++) { 633 for (i = 0; i < d->props.rc_key_map_size; i++) {
622 if (rc5_custom(&keymap[i]) == poll_reply.system_lsb && 634 if (rc5_custom(&keymap[i]) == (poll_reply.system & 0xff) &&
623 rc5_data(&keymap[i]) == poll_reply.data) { 635 rc5_data(&keymap[i]) == poll_reply.data) {
624 *event = keymap[i].event; 636 *event = keymap[i].event;
625 found = 1; 637 found = 1;
@@ -628,8 +640,8 @@ static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event,
628 } 640 }
629 641
630 if (found == 0) { 642 if (found == 0) {
631 err("Unknown remote controller key: %02x %02x %02x %02x", 643 err("Unknown remote controller key: %04x %02x %02x",
632 poll_reply.system_msb, poll_reply.system_lsb, 644 poll_reply.system,
633 poll_reply.data, poll_reply.not_data); 645 poll_reply.data, poll_reply.not_data);
634 d->last_event = 0; 646 d->last_event = 0;
635 return 0; 647 return 0;
@@ -874,6 +886,49 @@ static struct dvb_usb_rc_key dib0700_rc_keys[] = {
874 { 0x1d37, KEY_RECORD }, 886 { 0x1d37, KEY_RECORD },
875 { 0x1d3b, KEY_GOTO }, 887 { 0x1d3b, KEY_GOTO },
876 { 0x1d3d, KEY_POWER }, 888 { 0x1d3d, KEY_POWER },
889
890 /* Key codes for the Pixelview SBTVD remote (proto NEC) */
891 { 0x8613, KEY_MUTE },
892 { 0x8612, KEY_POWER },
893 { 0x8601, KEY_1 },
894 { 0x8602, KEY_2 },
895 { 0x8603, KEY_3 },
896 { 0x8604, KEY_4 },
897 { 0x8605, KEY_5 },
898 { 0x8606, KEY_6 },
899 { 0x8607, KEY_7 },
900 { 0x8608, KEY_8 },
901 { 0x8609, KEY_9 },
902 { 0x8600, KEY_0 },
903 { 0x860d, KEY_CHANNELUP },
904 { 0x8619, KEY_CHANNELDOWN },
905 { 0x8610, KEY_VOLUMEUP },
906 { 0x860c, KEY_VOLUMEDOWN },
907
908 { 0x860a, KEY_CAMERA },
909 { 0x860b, KEY_ZOOM },
910 { 0x861b, KEY_BACKSPACE },
911 { 0x8615, KEY_ENTER },
912
913 { 0x861d, KEY_UP },
914 { 0x861e, KEY_DOWN },
915 { 0x860e, KEY_LEFT },
916 { 0x860f, KEY_RIGHT },
917
918 { 0x8618, KEY_RECORD },
919 { 0x861a, KEY_STOP },
920
921 /* Key codes for the EvolutePC TVWay+ remote (proto NEC) */
922 { 0x7a00, KEY_MENU },
923 { 0x7a01, KEY_RECORD },
924 { 0x7a02, KEY_PLAY },
925 { 0x7a03, KEY_STOP },
926 { 0x7a10, KEY_CHANNELUP },
927 { 0x7a11, KEY_CHANNELDOWN },
928 { 0x7a12, KEY_VOLUMEUP },
929 { 0x7a13, KEY_VOLUMEDOWN },
930 { 0x7a40, KEY_POWER },
931 { 0x7a41, KEY_MUTE },
877}; 932};
878 933
879/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */ 934/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
@@ -1133,6 +1188,7 @@ static struct dib0070_config dib7770p_dib0070_config = {
1133 .clock_khz = 12000, 1188 .clock_khz = 12000,
1134 .clock_pad_drive = 0, 1189 .clock_pad_drive = 0,
1135 .flip_chip = 1, 1190 .flip_chip = 1,
1191 .charge_pump = 2,
1136}; 1192};
1137 1193
1138static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) 1194static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
@@ -1209,6 +1265,16 @@ static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
1209 return 0; 1265 return 0;
1210} 1266}
1211 1267
1268static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1269{
1270 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
1271}
1272
1273static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1274{
1275 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
1276}
1277
1212static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { 1278static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1213 60000, 15000, // internal, sampling 1279 60000, 15000, // internal, sampling
1214 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass 1280 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
@@ -1500,6 +1566,15 @@ static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1500 return 0; 1566 return 0;
1501} 1567}
1502 1568
1569static int stk807x_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1570{
1571 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
1572}
1573
1574static int stk807x_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1575{
1576 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
1577}
1503 1578
1504/* STK807x */ 1579/* STK807x */
1505static int stk807x_frontend_attach(struct dvb_usb_adapter *adap) 1580static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
@@ -1861,6 +1936,7 @@ struct usb_device_id dib0700_usb_id_table[] = {
1861 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) }, 1936 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
1862 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) }, 1937 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
1863 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) }, 1938 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) },
1939 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
1864 { 0 } /* Terminating entry */ 1940 { 0 } /* Terminating entry */
1865}; 1941};
1866MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); 1942MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
@@ -1895,6 +1971,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
1895 .num_adapters = 1, 1971 .num_adapters = 1,
1896 .adapter = { 1972 .adapter = {
1897 { 1973 {
1974 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1975 .pid_filter_count = 32,
1976 .pid_filter = stk70x0p_pid_filter,
1977 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
1898 .frontend_attach = stk7700p_frontend_attach, 1978 .frontend_attach = stk7700p_frontend_attach,
1899 .tuner_attach = stk7700p_tuner_attach, 1979 .tuner_attach = stk7700p_tuner_attach,
1900 1980
@@ -1976,11 +2056,19 @@ struct dvb_usb_device_properties dib0700_devices[] = {
1976 .num_adapters = 2, 2056 .num_adapters = 2,
1977 .adapter = { 2057 .adapter = {
1978 { 2058 {
2059 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2060 .pid_filter_count = 32,
2061 .pid_filter = stk70x0p_pid_filter,
2062 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
1979 .frontend_attach = stk7700d_frontend_attach, 2063 .frontend_attach = stk7700d_frontend_attach,
1980 .tuner_attach = stk7700d_tuner_attach, 2064 .tuner_attach = stk7700d_tuner_attach,
1981 2065
1982 DIB0700_DEFAULT_STREAMING_CONFIG(0x02), 2066 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1983 }, { 2067 }, {
2068 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2069 .pid_filter_count = 32,
2070 .pid_filter = stk70x0p_pid_filter,
2071 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
1984 .frontend_attach = stk7700d_frontend_attach, 2072 .frontend_attach = stk7700d_frontend_attach,
1985 .tuner_attach = stk7700d_tuner_attach, 2073 .tuner_attach = stk7700d_tuner_attach,
1986 2074
@@ -2023,6 +2111,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2023 .num_adapters = 1, 2111 .num_adapters = 1,
2024 .adapter = { 2112 .adapter = {
2025 { 2113 {
2114 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2115 .pid_filter_count = 32,
2116 .pid_filter = stk70x0p_pid_filter,
2117 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2026 .frontend_attach = stk7700P2_frontend_attach, 2118 .frontend_attach = stk7700P2_frontend_attach,
2027 .tuner_attach = stk7700d_tuner_attach, 2119 .tuner_attach = stk7700d_tuner_attach,
2028 2120
@@ -2055,6 +2147,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2055 .num_adapters = 1, 2147 .num_adapters = 1,
2056 .adapter = { 2148 .adapter = {
2057 { 2149 {
2150 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2151 .pid_filter_count = 32,
2152 .pid_filter = stk70x0p_pid_filter,
2153 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2058 .frontend_attach = stk7070p_frontend_attach, 2154 .frontend_attach = stk7070p_frontend_attach,
2059 .tuner_attach = dib7070p_tuner_attach, 2155 .tuner_attach = dib7070p_tuner_attach,
2060 2156
@@ -2122,6 +2218,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2122 .num_adapters = 1, 2218 .num_adapters = 1,
2123 .adapter = { 2219 .adapter = {
2124 { 2220 {
2221 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2222 .pid_filter_count = 32,
2223 .pid_filter = stk70x0p_pid_filter,
2224 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2125 .frontend_attach = stk7070p_frontend_attach, 2225 .frontend_attach = stk7070p_frontend_attach,
2126 .tuner_attach = dib7070p_tuner_attach, 2226 .tuner_attach = dib7070p_tuner_attach,
2127 2227
@@ -2157,6 +2257,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2157 .num_adapters = 2, 2257 .num_adapters = 2,
2158 .adapter = { 2258 .adapter = {
2159 { 2259 {
2260 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2261 .pid_filter_count = 32,
2262 .pid_filter = stk70x0p_pid_filter,
2263 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2160 .frontend_attach = stk7070pd_frontend_attach0, 2264 .frontend_attach = stk7070pd_frontend_attach0,
2161 .tuner_attach = dib7070p_tuner_attach, 2265 .tuner_attach = dib7070p_tuner_attach,
2162 2266
@@ -2164,6 +2268,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2164 2268
2165 .size_of_priv = sizeof(struct dib0700_adapter_state), 2269 .size_of_priv = sizeof(struct dib0700_adapter_state),
2166 }, { 2270 }, {
2271 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2272 .pid_filter_count = 32,
2273 .pid_filter = stk70x0p_pid_filter,
2274 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2167 .frontend_attach = stk7070pd_frontend_attach1, 2275 .frontend_attach = stk7070pd_frontend_attach1,
2168 .tuner_attach = dib7070p_tuner_attach, 2276 .tuner_attach = dib7070p_tuner_attach,
2169 2277
@@ -2210,6 +2318,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2210 .num_adapters = 1, 2318 .num_adapters = 1,
2211 .adapter = { 2319 .adapter = {
2212 { 2320 {
2321 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2322 .pid_filter_count = 32,
2323 .pid_filter = stk70x0p_pid_filter,
2324 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2213 .frontend_attach = stk7700ph_frontend_attach, 2325 .frontend_attach = stk7700ph_frontend_attach,
2214 .tuner_attach = stk7700ph_tuner_attach, 2326 .tuner_attach = stk7700ph_tuner_attach,
2215 2327
@@ -2322,6 +2434,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2322 .num_adapters = 1, 2434 .num_adapters = 1,
2323 .adapter = { 2435 .adapter = {
2324 { 2436 {
2437 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2438 .pid_filter_count = 32,
2439 .pid_filter = stk70x0p_pid_filter,
2440 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2325 .frontend_attach = stk7070p_frontend_attach, 2441 .frontend_attach = stk7070p_frontend_attach,
2326 .tuner_attach = dib7770p_tuner_attach, 2442 .tuner_attach = dib7770p_tuner_attach,
2327 2443
@@ -2353,6 +2469,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2353 .num_adapters = 1, 2469 .num_adapters = 1,
2354 .adapter = { 2470 .adapter = {
2355 { 2471 {
2472 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2473 .pid_filter_count = 32,
2474 .pid_filter = stk807x_pid_filter,
2475 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
2356 .frontend_attach = stk807x_frontend_attach, 2476 .frontend_attach = stk807x_frontend_attach,
2357 .tuner_attach = dib807x_tuner_attach, 2477 .tuner_attach = dib807x_tuner_attach,
2358 2478
@@ -2363,7 +2483,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2363 }, 2483 },
2364 }, 2484 },
2365 2485
2366 .num_device_descs = 2, 2486 .num_device_descs = 3,
2367 .devices = { 2487 .devices = {
2368 { "DiBcom STK807xP reference design", 2488 { "DiBcom STK807xP reference design",
2369 { &dib0700_usb_id_table[62], NULL }, 2489 { &dib0700_usb_id_table[62], NULL },
@@ -2373,6 +2493,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2373 { &dib0700_usb_id_table[63], NULL }, 2493 { &dib0700_usb_id_table[63], NULL },
2374 { NULL }, 2494 { NULL },
2375 }, 2495 },
2496 { "EvolutePC TVWay+",
2497 { &dib0700_usb_id_table[64], NULL },
2498 { NULL },
2499 },
2376 }, 2500 },
2377 2501
2378 .rc_interval = DEFAULT_RC_INTERVAL, 2502 .rc_interval = DEFAULT_RC_INTERVAL,
@@ -2384,6 +2508,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2384 .num_adapters = 2, 2508 .num_adapters = 2,
2385 .adapter = { 2509 .adapter = {
2386 { 2510 {
2511 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2512 .pid_filter_count = 32,
2513 .pid_filter = stk807x_pid_filter,
2514 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
2387 .frontend_attach = stk807xpvr_frontend_attach0, 2515 .frontend_attach = stk807xpvr_frontend_attach0,
2388 .tuner_attach = dib807x_tuner_attach, 2516 .tuner_attach = dib807x_tuner_attach,
2389 2517
@@ -2393,6 +2521,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2393 sizeof(struct dib0700_adapter_state), 2521 sizeof(struct dib0700_adapter_state),
2394 }, 2522 },
2395 { 2523 {
2524 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2525 .pid_filter_count = 32,
2526 .pid_filter = stk807x_pid_filter,
2527 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
2396 .frontend_attach = stk807xpvr_frontend_attach1, 2528 .frontend_attach = stk807xpvr_frontend_attach1,
2397 .tuner_attach = dib807x_tuner_attach, 2529 .tuner_attach = dib807x_tuner_attach,
2398 2530
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
index 8a7d87bcd1d9..df1ec3e69f4a 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
@@ -88,6 +88,7 @@ int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums)
88 goto err; 88 goto err;
89 } 89 }
90 adap->dvb_adap.priv = adap; 90 adap->dvb_adap.priv = adap;
91 adap->dvb_adap.fe_ioctl_override = adap->props.fe_ioctl_override;
91 92
92 if (adap->dev->props.read_mac_address) { 93 if (adap->dev->props.read_mac_address) {
93 if (adap->dev->props.read_mac_address(adap->dev,adap->dvb_adap.proposed_mac) == 0) 94 if (adap->dev->props.read_mac_address(adap->dev,adap->dvb_adap.proposed_mac) == 0)
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index a548c14c1944..f1602d4ace6d 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -27,6 +27,7 @@
27#define USB_VID_DIBCOM 0x10b8 27#define USB_VID_DIBCOM 0x10b8
28#define USB_VID_DPOSH 0x1498 28#define USB_VID_DPOSH 0x1498
29#define USB_VID_DVICO 0x0fe9 29#define USB_VID_DVICO 0x0fe9
30#define USB_VID_E3C 0x18b4
30#define USB_VID_ELGATO 0x0fd9 31#define USB_VID_ELGATO 0x0fd9
31#define USB_VID_EMPIA 0xeb1a 32#define USB_VID_EMPIA 0xeb1a
32#define USB_VID_GENPIX 0x09c0 33#define USB_VID_GENPIX 0x09c0
@@ -61,6 +62,7 @@
61#define USB_VID_XTENSIONS 0x1ae7 62#define USB_VID_XTENSIONS 0x1ae7
62#define USB_VID_HUMAX_COEX 0x10b9 63#define USB_VID_HUMAX_COEX 0x10b9
63#define USB_VID_774 0x7a69 64#define USB_VID_774 0x7a69
65#define USB_VID_EVOLUTEPC 0x1e59
64 66
65/* Product IDs */ 67/* Product IDs */
66#define USB_PID_ADSTECH_USB2_COLD 0xa333 68#define USB_PID_ADSTECH_USB2_COLD 0xa333
@@ -103,6 +105,11 @@
103#define USB_PID_DIBCOM_STK7770P 0x1e80 105#define USB_PID_DIBCOM_STK7770P 0x1e80
104#define USB_PID_DPOSH_M9206_COLD 0x9206 106#define USB_PID_DPOSH_M9206_COLD 0x9206
105#define USB_PID_DPOSH_M9206_WARM 0xa090 107#define USB_PID_DPOSH_M9206_WARM 0xa090
108#define USB_PID_E3C_EC168 0x1689
109#define USB_PID_E3C_EC168_2 0xfffa
110#define USB_PID_E3C_EC168_3 0xfffb
111#define USB_PID_E3C_EC168_4 0x1001
112#define USB_PID_E3C_EC168_5 0x1002
106#define USB_PID_UNIWILL_STK7700P 0x6003 113#define USB_PID_UNIWILL_STK7700P 0x6003
107#define USB_PID_GENIUS_TVGO_DVB_T03 0x4012 114#define USB_PID_GENIUS_TVGO_DVB_T03 0x4012
108#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 115#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0
@@ -115,6 +122,7 @@
115#define USB_PID_KWORLD_395U_3 0xe395 122#define USB_PID_KWORLD_395U_3 0xe395
116#define USB_PID_KWORLD_MC810 0xc810 123#define USB_PID_KWORLD_MC810 0xc810
117#define USB_PID_KWORLD_PC160_2T 0xc160 124#define USB_PID_KWORLD_PC160_2T 0xc160
125#define USB_PID_KWORLD_PC160_T 0xc161
118#define USB_PID_KWORLD_VSTREAM_COLD 0x17de 126#define USB_PID_KWORLD_VSTREAM_COLD 0x17de
119#define USB_PID_KWORLD_VSTREAM_WARM 0x17df 127#define USB_PID_KWORLD_VSTREAM_WARM 0x17df
120#define USB_PID_TERRATEC_CINERGY_T_USB_XE 0x0055 128#define USB_PID_TERRATEC_CINERGY_T_USB_XE 0x0055
@@ -271,10 +279,13 @@
271#define USB_PID_TELESTAR_STARSTICK_2 0x8000 279#define USB_PID_TELESTAR_STARSTICK_2 0x8000
272#define USB_PID_MSI_DIGI_VOX_MINI_III 0x8807 280#define USB_PID_MSI_DIGI_VOX_MINI_III 0x8807
273#define USB_PID_SONY_PLAYTV 0x0003 281#define USB_PID_SONY_PLAYTV 0x0003
282#define USB_PID_MYGICA_D689 0xd811
274#define USB_PID_ELGATO_EYETV_DTT 0x0021 283#define USB_PID_ELGATO_EYETV_DTT 0x0021
275#define USB_PID_ELGATO_EYETV_DTT_Dlx 0x0020 284#define USB_PID_ELGATO_EYETV_DTT_Dlx 0x0020
276#define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD 0x5000 285#define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD 0x5000
277#define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_WARM 0x5001 286#define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_WARM 0x5001
278#define USB_PID_FRIIO_WHITE 0x0001 287#define USB_PID_FRIIO_WHITE 0x0001
288#define USB_PID_TVWAY_PLUS 0x0002
289#define USB_PID_SVEON_STV20 0xe39d
279 290
280#endif 291#endif
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h
index fe2b87efb3f1..0143aef19ecd 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -162,6 +162,9 @@ struct dvb_usb_adapter_properties {
162 struct usb_data_stream_properties stream; 162 struct usb_data_stream_properties stream;
163 163
164 int size_of_priv; 164 int size_of_priv;
165
166 int (*fe_ioctl_override) (struct dvb_frontend *,
167 unsigned int, void *, unsigned int);
165}; 168};
166 169
167/** 170/**
diff --git a/drivers/media/dvb/dvb-usb/ec168.c b/drivers/media/dvb/dvb-usb/ec168.c
new file mode 100644
index 000000000000..52f5d4f0f230
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/ec168.c
@@ -0,0 +1,440 @@
1/*
2 * E3C EC168 DVB USB driver
3 *
4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */
21
22#include "ec168.h"
23#include "ec100.h"
24#include "mxl5005s.h"
25
26/* debug */
27static int dvb_usb_ec168_debug;
28module_param_named(debug, dvb_usb_ec168_debug, int, 0644);
29MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
30DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
31
32static struct ec100_config ec168_ec100_config;
33
34static int ec168_rw_udev(struct usb_device *udev, struct ec168_req *req)
35{
36 int ret;
37 unsigned int pipe;
38 u8 request, requesttype;
39 u8 buf[req->size];
40
41 switch (req->cmd) {
42 case DOWNLOAD_FIRMWARE:
43 case GPIO:
44 case WRITE_I2C:
45 case STREAMING_CTRL:
46 requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT);
47 request = req->cmd;
48 break;
49 case READ_I2C:
50 requesttype = (USB_TYPE_VENDOR | USB_DIR_IN);
51 request = req->cmd;
52 break;
53 case GET_CONFIG:
54 requesttype = (USB_TYPE_VENDOR | USB_DIR_IN);
55 request = CONFIG;
56 break;
57 case SET_CONFIG:
58 requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT);
59 request = CONFIG;
60 break;
61 case WRITE_DEMOD:
62 requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT);
63 request = DEMOD_RW;
64 break;
65 case READ_DEMOD:
66 requesttype = (USB_TYPE_VENDOR | USB_DIR_IN);
67 request = DEMOD_RW;
68 break;
69 default:
70 err("unknown command:%02x", req->cmd);
71 ret = -EPERM;
72 goto error;
73 }
74
75 if (requesttype == (USB_TYPE_VENDOR | USB_DIR_OUT)) {
76 /* write */
77 memcpy(buf, req->data, req->size);
78 pipe = usb_sndctrlpipe(udev, 0);
79 } else {
80 /* read */
81 pipe = usb_rcvctrlpipe(udev, 0);
82 }
83
84 msleep(1); /* avoid I2C errors */
85
86 ret = usb_control_msg(udev, pipe, request, requesttype, req->value,
87 req->index, buf, sizeof(buf), EC168_USB_TIMEOUT);
88
89 ec168_debug_dump(request, requesttype, req->value, req->index, buf,
90 req->size, deb_xfer);
91
92 if (ret < 0)
93 goto error;
94 else
95 ret = 0;
96
97 /* read request, copy returned data to return buf */
98 if (!ret && requesttype == (USB_TYPE_VENDOR | USB_DIR_IN))
99 memcpy(req->data, buf, req->size);
100
101 return ret;
102error:
103 deb_info("%s: failed:%d\n", __func__, ret);
104 return ret;
105}
106
107static int ec168_ctrl_msg(struct dvb_usb_device *d, struct ec168_req *req)
108{
109 return ec168_rw_udev(d->udev, req);
110}
111
112/* I2C */
113static int ec168_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
114 int num)
115{
116 struct dvb_usb_device *d = i2c_get_adapdata(adap);
117 struct ec168_req req;
118 int i = 0;
119 int ret;
120
121 if (num > 2)
122 return -EINVAL;
123
124 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
125 return -EAGAIN;
126
127 while (i < num) {
128 if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) {
129 if (msg[i].addr == ec168_ec100_config.demod_address) {
130 req.cmd = READ_DEMOD;
131 req.value = 0;
132 req.index = 0xff00 + msg[i].buf[0]; /* reg */
133 req.size = msg[i+1].len; /* bytes to read */
134 req.data = &msg[i+1].buf[0];
135 ret = ec168_ctrl_msg(d, &req);
136 i += 2;
137 } else {
138 err("I2C read not implemented");
139 ret = -ENOSYS;
140 i += 2;
141 }
142 } else {
143 if (msg[i].addr == ec168_ec100_config.demod_address) {
144 req.cmd = WRITE_DEMOD;
145 req.value = msg[i].buf[1]; /* val */
146 req.index = 0xff00 + msg[i].buf[0]; /* reg */
147 req.size = 0;
148 req.data = NULL;
149 ret = ec168_ctrl_msg(d, &req);
150 i += 1;
151 } else {
152 req.cmd = WRITE_I2C;
153 req.value = msg[i].buf[0]; /* val */
154 req.index = 0x0100 + msg[i].addr; /* I2C addr */
155 req.size = msg[i].len-1;
156 req.data = &msg[i].buf[1];
157 ret = ec168_ctrl_msg(d, &req);
158 i += 1;
159 }
160 }
161 if (ret)
162 goto error;
163
164 }
165 ret = i;
166
167error:
168 mutex_unlock(&d->i2c_mutex);
169 return i;
170}
171
172
173static u32 ec168_i2c_func(struct i2c_adapter *adapter)
174{
175 return I2C_FUNC_I2C;
176}
177
178static struct i2c_algorithm ec168_i2c_algo = {
179 .master_xfer = ec168_i2c_xfer,
180 .functionality = ec168_i2c_func,
181};
182
183/* Callbacks for DVB USB */
184static struct ec100_config ec168_ec100_config = {
185 .demod_address = 0xff, /* not real address, demod is integrated */
186};
187
188static int ec168_ec100_frontend_attach(struct dvb_usb_adapter *adap)
189{
190 deb_info("%s:\n", __func__);
191 adap->fe = dvb_attach(ec100_attach, &ec168_ec100_config,
192 &adap->dev->i2c_adap);
193 if (adap->fe == NULL)
194 return -ENODEV;
195
196 return 0;
197}
198
199static struct mxl5005s_config ec168_mxl5003s_config = {
200 .i2c_address = 0xc6,
201 .if_freq = IF_FREQ_4570000HZ,
202 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
203 .agc_mode = MXL_SINGLE_AGC,
204 .tracking_filter = MXL_TF_OFF,
205 .rssi_enable = MXL_RSSI_ENABLE,
206 .cap_select = MXL_CAP_SEL_ENABLE,
207 .div_out = MXL_DIV_OUT_4,
208 .clock_out = MXL_CLOCK_OUT_DISABLE,
209 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
210 .top = MXL5005S_TOP_25P2,
211 .mod_mode = MXL_DIGITAL_MODE,
212 .if_mode = MXL_ZERO_IF,
213 .AgcMasterByte = 0x00,
214};
215
216static int ec168_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
217{
218 deb_info("%s:\n", __func__);
219 return dvb_attach(mxl5005s_attach, adap->fe, &adap->dev->i2c_adap,
220 &ec168_mxl5003s_config) == NULL ? -ENODEV : 0;
221}
222
223static int ec168_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
224{
225 struct ec168_req req = {STREAMING_CTRL, 0x7f01, 0x0202, 0, NULL};
226 deb_info("%s: onoff:%d\n", __func__, onoff);
227 if (onoff)
228 req.index = 0x0102;
229 return ec168_ctrl_msg(adap->dev, &req);
230}
231
232static int ec168_download_firmware(struct usb_device *udev,
233 const struct firmware *fw)
234{
235 int i, len, packets, remainder, ret;
236 u16 addr = 0x0000; /* firmware start address */
237 struct ec168_req req = {DOWNLOAD_FIRMWARE, 0, 0, 0, NULL};
238 deb_info("%s:\n", __func__);
239
240 #define FW_PACKET_MAX_DATA 2048
241 packets = fw->size / FW_PACKET_MAX_DATA;
242 remainder = fw->size % FW_PACKET_MAX_DATA;
243 len = FW_PACKET_MAX_DATA;
244 for (i = 0; i <= packets; i++) {
245 if (i == packets) /* set size of the last packet */
246 len = remainder;
247
248 req.size = len;
249 req.data = (u8 *)(fw->data + i * FW_PACKET_MAX_DATA);
250 req.index = addr;
251 addr += FW_PACKET_MAX_DATA;
252
253 ret = ec168_rw_udev(udev, &req);
254 if (ret) {
255 err("firmware download failed:%d packet:%d", ret, i);
256 goto error;
257 }
258 }
259 req.size = 0;
260
261 /* set "warm"? */
262 req.cmd = SET_CONFIG;
263 req.value = 0;
264 req.index = 0x0001;
265 ret = ec168_rw_udev(udev, &req);
266 if (ret)
267 goto error;
268
269 /* really needed - no idea what does */
270 req.cmd = GPIO;
271 req.value = 0;
272 req.index = 0x0206;
273 ret = ec168_rw_udev(udev, &req);
274 if (ret)
275 goto error;
276
277 /* activate tuner I2C? */
278 req.cmd = WRITE_I2C;
279 req.value = 0;
280 req.index = 0x00c6;
281 ret = ec168_rw_udev(udev, &req);
282 if (ret)
283 goto error;
284
285 return ret;
286error:
287 deb_info("%s: failed:%d\n", __func__, ret);
288 return ret;
289}
290
291static int ec168_identify_state(struct usb_device *udev,
292 struct dvb_usb_device_properties *props,
293 struct dvb_usb_device_description **desc, int *cold)
294{
295 int ret;
296 u8 reply;
297 struct ec168_req req = {GET_CONFIG, 0, 1, sizeof(reply), &reply};
298 deb_info("%s:\n", __func__);
299
300 ret = ec168_rw_udev(udev, &req);
301 if (ret)
302 goto error;
303
304 deb_info("%s: reply:%02x\n", __func__, reply);
305
306 if (reply == 0x01)
307 *cold = 0;
308 else
309 *cold = 1;
310
311 return ret;
312error:
313 deb_info("%s: failed:%d\n", __func__, ret);
314 return ret;
315}
316
317/* DVB USB Driver stuff */
318static struct dvb_usb_device_properties ec168_properties;
319
320static int ec168_probe(struct usb_interface *intf,
321 const struct usb_device_id *id)
322{
323 int ret;
324 deb_info("%s: interface:%d\n", __func__,
325 intf->cur_altsetting->desc.bInterfaceNumber);
326
327 ret = dvb_usb_device_init(intf, &ec168_properties, THIS_MODULE, NULL,
328 adapter_nr);
329 if (ret)
330 goto error;
331
332 return ret;
333error:
334 deb_info("%s: failed:%d\n", __func__, ret);
335 return ret;
336}
337
338#define E3C_EC168_1689 0
339#define E3C_EC168_FFFA 1
340#define E3C_EC168_FFFB 2
341#define E3C_EC168_1001 3
342#define E3C_EC168_1002 4
343
344static struct usb_device_id ec168_id[] = {
345 [E3C_EC168_1689] =
346 {USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168)},
347 [E3C_EC168_FFFA] =
348 {USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_2)},
349 [E3C_EC168_FFFB] =
350 {USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_3)},
351 [E3C_EC168_1001] =
352 {USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_4)},
353 [E3C_EC168_1002] =
354 {USB_DEVICE(USB_VID_E3C, USB_PID_E3C_EC168_5)},
355 {} /* terminating entry */
356};
357
358MODULE_DEVICE_TABLE(usb, ec168_id);
359
360static struct dvb_usb_device_properties ec168_properties = {
361 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
362
363 .usb_ctrl = DEVICE_SPECIFIC,
364 .download_firmware = ec168_download_firmware,
365 .firmware = "dvb-usb-ec168.fw",
366 .no_reconnect = 1,
367
368 .size_of_priv = 0,
369
370 .num_adapters = 1,
371 .adapter = {
372 {
373 .streaming_ctrl = ec168_streaming_ctrl,
374 .frontend_attach = ec168_ec100_frontend_attach,
375 .tuner_attach = ec168_mxl5003s_tuner_attach,
376 .stream = {
377 .type = USB_BULK,
378 .count = 6,
379 .endpoint = 0x82,
380 .u = {
381 .bulk = {
382 .buffersize = (32*512),
383 }
384 }
385 },
386 }
387 },
388
389 .identify_state = ec168_identify_state,
390
391 .i2c_algo = &ec168_i2c_algo,
392
393 .num_device_descs = 1,
394 .devices = {
395 {
396 .name = "E3C EC168 DVB-T USB2.0 reference design",
397 .cold_ids = {
398 &ec168_id[E3C_EC168_1689],
399 &ec168_id[E3C_EC168_FFFA],
400 &ec168_id[E3C_EC168_FFFB],
401 &ec168_id[E3C_EC168_1001],
402 &ec168_id[E3C_EC168_1002],
403 NULL},
404 .warm_ids = {NULL},
405 },
406 }
407};
408
409static struct usb_driver ec168_driver = {
410 .name = "dvb_usb_ec168",
411 .probe = ec168_probe,
412 .disconnect = dvb_usb_device_exit,
413 .id_table = ec168_id,
414};
415
416/* module stuff */
417static int __init ec168_module_init(void)
418{
419 int ret;
420 deb_info("%s:\n", __func__);
421 ret = usb_register(&ec168_driver);
422 if (ret)
423 err("module init failed:%d", ret);
424
425 return ret;
426}
427
428static void __exit ec168_module_exit(void)
429{
430 deb_info("%s:\n", __func__);
431 /* deregister this driver from the USB subsystem */
432 usb_deregister(&ec168_driver);
433}
434
435module_init(ec168_module_init);
436module_exit(ec168_module_exit);
437
438MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
439MODULE_DESCRIPTION("E3C EC168 DVB-T USB2.0 driver");
440MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/ec168.h b/drivers/media/dvb/dvb-usb/ec168.h
new file mode 100644
index 000000000000..e7e0b831314e
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/ec168.h
@@ -0,0 +1,73 @@
1/*
2 * E3C EC168 DVB USB driver
3 *
4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */
21
22#ifndef EC168_H
23#define EC168_H
24
25#define DVB_USB_LOG_PREFIX "ec168"
26#include "dvb-usb.h"
27
28#define deb_info(args...) dprintk(dvb_usb_ec168_debug, 0x01, args)
29#define deb_rc(args...) dprintk(dvb_usb_ec168_debug, 0x02, args)
30#define deb_xfer(args...) dprintk(dvb_usb_ec168_debug, 0x04, args)
31#define deb_reg(args...) dprintk(dvb_usb_ec168_debug, 0x08, args)
32#define deb_i2c(args...) dprintk(dvb_usb_ec168_debug, 0x10, args)
33#define deb_fw(args...) dprintk(dvb_usb_ec168_debug, 0x20, args)
34
35#define ec168_debug_dump(r, t, v, i, b, l, func) { \
36 int loop_; \
37 func("%02x %02x %02x %02x %02x %02x %02x %02x", \
38 t, r, v & 0xff, v >> 8, i & 0xff, i >> 8, l & 0xff, l >> 8); \
39 if (t == (USB_TYPE_VENDOR | USB_DIR_OUT)) \
40 func(" >>> "); \
41 else \
42 func(" <<< "); \
43 for (loop_ = 0; loop_ < l; loop_++) \
44 func("%02x ", b[loop_]); \
45 func("\n");\
46}
47
48#define EC168_USB_TIMEOUT 1000
49
50struct ec168_req {
51 u8 cmd; /* [1] */
52 u16 value; /* [2|3] */
53 u16 index; /* [4|5] */
54 u16 size; /* [6|7] */
55 u8 *data;
56};
57
58enum ec168_cmd {
59 DOWNLOAD_FIRMWARE = 0x00,
60 CONFIG = 0x01,
61 DEMOD_RW = 0x03,
62 GPIO = 0x04,
63 STREAMING_CTRL = 0x10,
64 READ_I2C = 0x20,
65 WRITE_I2C = 0x21,
66 HID_DOWNLOAD = 0x30,
67 GET_CONFIG,
68 SET_CONFIG,
69 READ_DEMOD,
70 WRITE_DEMOD,
71};
72
73#endif
diff --git a/drivers/media/dvb/dvb-usb/friio-fe.c b/drivers/media/dvb/dvb-usb/friio-fe.c
index c4dfe25cf60d..9cbbe42ca44b 100644
--- a/drivers/media/dvb/dvb-usb/friio-fe.c
+++ b/drivers/media/dvb/dvb-usb/friio-fe.c
@@ -232,12 +232,6 @@ static int jdvbt90502_read_status(struct dvb_frontend *fe, fe_status_t *state)
232 return 0; 232 return 0;
233} 233}
234 234
235static int jdvbt90502_read_ber(struct dvb_frontend *fe, u32 *ber)
236{
237 *ber = 0;
238 return 0;
239}
240
241static int jdvbt90502_read_signal_strength(struct dvb_frontend *fe, 235static int jdvbt90502_read_signal_strength(struct dvb_frontend *fe,
242 u16 *strength) 236 u16 *strength)
243{ 237{
@@ -264,26 +258,26 @@ static int jdvbt90502_read_signal_strength(struct dvb_frontend *fe,
264 return 0; 258 return 0;
265} 259}
266 260
267static int jdvbt90502_read_snr(struct dvb_frontend *fe, u16 *snr)
268{
269 *snr = 0x0101;
270 return 0;
271}
272
273static int jdvbt90502_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
274{
275 *ucblocks = 0;
276 return 0;
277}
278 261
279static int jdvbt90502_get_tune_settings(struct dvb_frontend *fe, 262/* filter out un-supported properties to notify users */
280 struct dvb_frontend_tune_settings *fs) 263static int jdvbt90502_set_property(struct dvb_frontend *fe,
264 struct dtv_property *tvp)
281{ 265{
282 fs->min_delay_ms = 500; 266 int r = 0;
283 fs->step_size = 0; 267
284 fs->max_drift = 0; 268 switch (tvp->cmd) {
285 269 case DTV_DELIVERY_SYSTEM:
286 return 0; 270 if (tvp->u.data != SYS_ISDBT)
271 r = -EINVAL;
272 break;
273 case DTV_CLEAR:
274 case DTV_TUNE:
275 case DTV_FREQUENCY:
276 break;
277 default:
278 r = -EINVAL;
279 }
280 return r;
287} 281}
288 282
289static int jdvbt90502_get_frontend(struct dvb_frontend *fe, 283static int jdvbt90502_get_frontend(struct dvb_frontend *fe,
@@ -314,6 +308,9 @@ static int jdvbt90502_set_frontend(struct dvb_frontend *fe,
314 308
315 deb_fe("%s: Freq:%d\n", __func__, p->frequency); 309 deb_fe("%s: Freq:%d\n", __func__, p->frequency);
316 310
311 /* for recovery from DTV_CLEAN */
312 fe->dtv_property_cache.delivery_system = SYS_ISDBT;
313
317 ret = jdvbt90502_pll_set_freq(state, p->frequency); 314 ret = jdvbt90502_pll_set_freq(state, p->frequency);
318 if (ret) { 315 if (ret) {
319 deb_fe("%s:ret == %d\n", __func__, ret); 316 deb_fe("%s:ret == %d\n", __func__, ret);
@@ -323,12 +320,6 @@ static int jdvbt90502_set_frontend(struct dvb_frontend *fe,
323 return 0; 320 return 0;
324} 321}
325 322
326static int jdvbt90502_sleep(struct dvb_frontend *fe)
327{
328 deb_fe("%s called.\n", __func__);
329 return 0;
330}
331
332 323
333/** 324/**
334 * (reg, val) commad list to initialize this module. 325 * (reg, val) commad list to initialize this module.
@@ -394,6 +385,7 @@ static int jdvbt90502_init(struct dvb_frontend *fe)
394 if (ret != 1) 385 if (ret != 1)
395 goto error; 386 goto error;
396 } 387 }
388 fe->dtv_property_cache.delivery_system = SYS_ISDBT;
397 msleep(100); 389 msleep(100);
398 390
399 return 0; 391 return 0;
@@ -468,16 +460,13 @@ static struct dvb_frontend_ops jdvbt90502_ops = {
468 .release = jdvbt90502_release, 460 .release = jdvbt90502_release,
469 461
470 .init = jdvbt90502_init, 462 .init = jdvbt90502_init,
471 .sleep = jdvbt90502_sleep,
472 .write = _jdvbt90502_write, 463 .write = _jdvbt90502_write,
473 464
465 .set_property = jdvbt90502_set_property,
466
474 .set_frontend = jdvbt90502_set_frontend, 467 .set_frontend = jdvbt90502_set_frontend,
475 .get_frontend = jdvbt90502_get_frontend, 468 .get_frontend = jdvbt90502_get_frontend,
476 .get_tune_settings = jdvbt90502_get_tune_settings,
477 469
478 .read_status = jdvbt90502_read_status, 470 .read_status = jdvbt90502_read_status,
479 .read_ber = jdvbt90502_read_ber,
480 .read_signal_strength = jdvbt90502_read_signal_strength, 471 .read_signal_strength = jdvbt90502_read_signal_strength,
481 .read_snr = jdvbt90502_read_snr,
482 .read_ucblocks = jdvbt90502_read_ucblocks,
483}; 472};