aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-21 00:14:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-21 00:14:42 -0400
commitf894d18380e7e7ff05f6622ccb75d2881922c6e9 (patch)
treee3c11b831b68096239a49dec539a49e49c1d90b7 /drivers/media/dvb/dvb-usb
parentd13ff0559fea73f237a01669887d2c10e11d7662 (diff)
parentd20b27478d6ccf7c4c8de4f09db2bdbaec82a6c0 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (277 commits) V4L/DVB (8415): gspca: Infinite loop in i2c_w() of etoms. V4L/DVB (8414): videodev/cx18: fix get_index bug and error-handling lock-ups V4L/DVB (8411): videobuf-dma-contig.c: fix 64-bit build for pre-2.6.24 kernels V4L/DVB (8410): sh_mobile_ceu_camera: fix 64-bit compiler warnings V4L/DVB (8397): video: convert select VIDEO_ZORAN_ZR36060 into depends on V4L/DVB (8396): video: Fix Kbuild dependency for VIDEO_IR_I2C V4L/DVB (8395): saa7134: Fix Kbuild dependency of ir-kbd-i2c V4L/DVB (8394): ir-common: CodingStyle fix: move EXPORT_SYMBOL_GPL to their proper places V4L/DVB (8393): media/video: Fix depencencies for VIDEOBUF V4L/DVB (8392): media/Kconfig: Convert V4L1_COMPAT select into "depends on" V4L/DVB (8390): videodev: add comment and remove magic number. V4L/DVB (8389): videodev: simplify get_index() V4L/DVB (8387): Some cosmetic changes V4L/DVB (8381): ov7670: fix compile warnings V4L/DVB (8380): saa7115: use saa7115_auto instead of saa711x as the autodetect driver name. V4L/DVB (8379): saa7127: Make device detection optional V4L/DVB (8378): cx18: move cx18_av_vbi_setup to av-core.c and rename to cx18_av_std_setup V4L/DVB (8377): ivtv/cx18: ensure the default control values are correct V4L/DVB (8376): cx25840: move cx25840_vbi_setup to core.c and rename to cx25840_std_setup V4L/DVB (8374): gspca: No conflict of 0c45:6011 with the sn9c102 driver. ...
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig15
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile3
-rw-r--r--drivers/media/dvb/dvb-usb/anysee.c553
-rw-r--r--drivers/media/dvb/dvb-usb/anysee.h304
-rw-r--r--drivers/media/dvb/dvb-usb/au6610.c83
-rw-r--r--drivers/media/dvb/dvb-usb/au6610.h22
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c146
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.h3
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c7
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-i2c.c4
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h8
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.c38
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.h2
13 files changed, 1116 insertions, 72 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index f00a0eb40420..a577c0f89f67 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -76,6 +76,7 @@ config DVB_USB_DIB0700
76 select DVB_DIB3000MC 76 select DVB_DIB3000MC
77 select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE 77 select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE
78 select MEDIA_TUNER_MT2266 if !DVB_FE_CUSTOMISE 78 select MEDIA_TUNER_MT2266 if !DVB_FE_CUSTOMISE
79 select MEDIA_TUNER_XC2028 if !DVB_FE_CUSTOMISE
79 select DVB_TUNER_DIB0070 80 select DVB_TUNER_DIB0070
80 help 81 help
81 Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. The 82 Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. The
@@ -107,6 +108,8 @@ config DVB_USB_CXUSB
107 select DVB_MT352 if !DVB_FE_CUSTOMISE 108 select DVB_MT352 if !DVB_FE_CUSTOMISE
108 select DVB_ZL10353 if !DVB_FE_CUSTOMISE 109 select DVB_ZL10353 if !DVB_FE_CUSTOMISE
109 select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE 110 select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE
111 select MEDIA_TUNER_XC2028 if !DVB_FE_CUSTOMISE
112 select MEDIA_TUNER_MXL5005S if !DVB_FE_CUSTOMISE
110 help 113 help
111 Say Y here to support the Conexant USB2.0 hybrid reference design. 114 Say Y here to support the Conexant USB2.0 hybrid reference design.
112 Currently, only DVB and ATSC modes are supported, analog mode 115 Currently, only DVB and ATSC modes are supported, analog mode
@@ -120,6 +123,8 @@ config DVB_USB_M920X
120 depends on DVB_USB 123 depends on DVB_USB
121 select DVB_MT352 if !DVB_FE_CUSTOMISE 124 select DVB_MT352 if !DVB_FE_CUSTOMISE
122 select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE 125 select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE
126 select MEDIA_TUNER_TDA827X if !DVB_FE_CUSTOMISE
127 select DVB_TDA1004X if !DVB_FE_CUSTOMISE
123 help 128 help
124 Say Y here to support the MSI Mega Sky 580 USB2.0 DVB-T receiver. 129 Say Y here to support the MSI Mega Sky 580 USB2.0 DVB-T receiver.
125 Currently, only devices with a product id of 130 Currently, only devices with a product id of
@@ -241,3 +246,13 @@ config DVB_USB_AF9005_REMOTE
241 Say Y here to support the default remote control decoding for the 246 Say Y here to support the default remote control decoding for the
242 Afatech AF9005 based receiver. 247 Afatech AF9005 based receiver.
243 248
249config DVB_USB_ANYSEE
250 tristate "Anysee DVB-T/C USB2.0 support"
251 depends on DVB_USB
252 select DVB_PLL if !DVB_FE_CUSTOMISE
253 select DVB_MT352 if !DVB_FE_CUSTOMISE
254 select DVB_ZL10353 if !DVB_FE_CUSTOMISE
255 select DVB_TDA10023 if !DVB_FE_CUSTOMISE
256 help
257 Say Y here to support the Anysee E30, Anysee E30 Plus or
258 Anysee E30 C Plus DVB USB2.0 receiver.
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index c6511a6c0ab8..44c11e45e564 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -61,6 +61,9 @@ obj-$(CONFIG_DVB_USB_AF9005) += dvb-usb-af9005.o
61dvb-usb-af9005-remote-objs = af9005-remote.o 61dvb-usb-af9005-remote-objs = af9005-remote.o
62obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o 62obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
63 63
64dvb-usb-anysee-objs = anysee.o
65obj-$(CONFIG_DVB_USB_ANYSEE) += dvb-usb-anysee.o
66
64EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ 67EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
65# due to tuner-xc3028 68# due to tuner-xc3028
66EXTRA_CFLAGS += -Idrivers/media/common/tuners 69EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c
new file mode 100644
index 000000000000..adfd4fc82efd
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/anysee.c
@@ -0,0 +1,553 @@
1/*
2 * DVB USB Linux driver for Anysee E30 DVB-C & DVB-T USB2.0 receiver
3 *
4 * Copyright (C) 2007 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 * TODO:
21 * - add smart card reader support for Conditional Access (CA)
22 *
23 * Card reader in Anysee is nothing more than ISO 7816 card reader.
24 * There is no hardware CAM in any Anysee device sold.
25 * In my understanding it should be implemented by making own module
26 * for ISO 7816 card reader, like dvb_ca_en50221 is implemented. This
27 * module registers serial interface that can be used to communicate
28 * with any ISO 7816 smart card.
29 *
30 * Any help according to implement serial smart card reader support
31 * is highly welcome!
32 */
33
34#include "anysee.h"
35#include "tda1002x.h"
36#include "mt352.h"
37#include "mt352_priv.h"
38#include "zl10353.h"
39
40/* debug */
41static int dvb_usb_anysee_debug;
42module_param_named(debug, dvb_usb_anysee_debug, int, 0644);
43MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
44DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
45
46struct mutex anysee_usb_mutex;
47
48static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen,
49 u8 *rbuf, u8 rlen)
50{
51 struct anysee_state *state = d->priv;
52 int act_len, ret;
53 u8 buf[64];
54
55 if (slen > sizeof(buf))
56 slen = sizeof(buf);
57 memcpy(&buf[0], sbuf, slen);
58 buf[60] = state->seq++;
59
60 if (mutex_lock_interruptible(&anysee_usb_mutex) < 0)
61 return -EAGAIN;
62
63 /* We need receive one message more after dvb_usb_generic_rw due
64 to weird transaction flow, which is 1 x send + 2 x receive. */
65 ret = dvb_usb_generic_rw(d, buf, sizeof(buf), buf, sizeof(buf), 0);
66
67 if (!ret) {
68 /* receive 2nd answer */
69 ret = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev,
70 d->props.generic_bulk_ctrl_endpoint), buf, sizeof(buf),
71 &act_len, 2000);
72 if (ret)
73 err("%s: recv bulk message failed: %d", __func__, ret);
74 else {
75 deb_xfer("<<< ");
76 debug_dump(buf, act_len, deb_xfer);
77 }
78 }
79
80 /* read request, copy returned data to return buf */
81 if (!ret && rbuf && rlen)
82 memcpy(rbuf, buf, rlen);
83
84 mutex_unlock(&anysee_usb_mutex);
85
86 return ret;
87}
88
89static int anysee_read_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
90{
91 u8 buf[] = {CMD_REG_READ, reg >> 8, reg & 0xff, 0x01};
92 int ret;
93 ret = anysee_ctrl_msg(d, buf, sizeof(buf), val, 1);
94 deb_info("%s: reg:%04x val:%02x\n", __func__, reg, *val);
95 return ret;
96}
97
98static int anysee_write_reg(struct dvb_usb_device *d, u16 reg, u8 val)
99{
100 u8 buf[] = {CMD_REG_WRITE, reg >> 8, reg & 0xff, 0x01, val};
101 deb_info("%s: reg:%04x val:%02x\n", __func__, reg, val);
102 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
103}
104
105static int anysee_get_hw_info(struct dvb_usb_device *d, u8 *id)
106{
107 u8 buf[] = {CMD_GET_HW_INFO};
108 return anysee_ctrl_msg(d, buf, sizeof(buf), id, 3);
109}
110
111static int anysee_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
112{
113 u8 buf[] = {CMD_STREAMING_CTRL, (u8)onoff, 0x00};
114 deb_info("%s: onoff:%02x\n", __func__, onoff);
115 return anysee_ctrl_msg(adap->dev, buf, sizeof(buf), NULL, 0);
116}
117
118static int anysee_led_ctrl(struct dvb_usb_device *d, u8 mode, u8 interval)
119{
120 u8 buf[] = {CMD_LED_AND_IR_CTRL, 0x01, mode, interval};
121 deb_info("%s: state:%02x interval:%02x\n", __func__, mode, interval);
122 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
123}
124
125static int anysee_ir_ctrl(struct dvb_usb_device *d, u8 onoff)
126{
127 u8 buf[] = {CMD_LED_AND_IR_CTRL, 0x02, onoff};
128 deb_info("%s: onoff:%02x\n", __func__, onoff);
129 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
130}
131
132static int anysee_init(struct dvb_usb_device *d)
133{
134 int ret;
135 /* LED light */
136 ret = anysee_led_ctrl(d, 0x01, 0x03);
137 if (ret)
138 return ret;
139
140 /* enable IR */
141 ret = anysee_ir_ctrl(d, 1);
142 if (ret)
143 return ret;
144
145 return 0;
146}
147
148/* I2C */
149static int anysee_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msg,
150 int num)
151{
152 struct dvb_usb_device *d = i2c_get_adapdata(adap);
153 int ret, inc, i = 0;
154
155 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
156 return -EAGAIN;
157
158 while (i < num) {
159 if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) {
160 u8 buf[6];
161 buf[0] = CMD_I2C_READ;
162 buf[1] = msg[i].addr + 1;
163 buf[2] = msg[i].buf[0];
164 buf[3] = 0x00;
165 buf[4] = 0x00;
166 buf[5] = 0x01;
167 ret = anysee_ctrl_msg(d, buf, sizeof(buf), msg[i+1].buf,
168 msg[i+1].len);
169 inc = 2;
170 } else {
171 u8 buf[4+msg[i].len];
172 buf[0] = CMD_I2C_WRITE;
173 buf[1] = msg[i].addr;
174 buf[2] = msg[i].len;
175 buf[3] = 0x01;
176 memcpy(&buf[4], msg[i].buf, msg[i].len);
177 ret = anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
178 inc = 1;
179 }
180 if (ret)
181 return ret;
182
183 i += inc;
184 }
185
186 mutex_unlock(&d->i2c_mutex);
187
188 return i;
189}
190
191static u32 anysee_i2c_func(struct i2c_adapter *adapter)
192{
193 return I2C_FUNC_I2C;
194}
195
196static struct i2c_algorithm anysee_i2c_algo = {
197 .master_xfer = anysee_master_xfer,
198 .functionality = anysee_i2c_func,
199};
200
201static int anysee_mt352_demod_init(struct dvb_frontend *fe)
202{
203 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 };
204 static u8 reset [] = { RESET, 0x80 };
205 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
206 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
207 static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
208 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
209
210 mt352_write(fe, clock_config, sizeof(clock_config));
211 udelay(200);
212 mt352_write(fe, reset, sizeof(reset));
213 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
214
215 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
216 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
217 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
218
219 return 0;
220}
221
222/* Callbacks for DVB USB */
223static struct tda10023_config anysee_tda10023_config = {
224 .demod_address = 0x1a,
225 .invert = 0,
226 .xtal = 16000000,
227 .pll_m = 11,
228 .pll_p = 3,
229 .pll_n = 1,
230 .output_mode = TDA10023_OUTPUT_MODE_PARALLEL_C,
231 .deltaf = 0xfeeb,
232};
233
234static struct mt352_config anysee_mt352_config = {
235 .demod_address = 0x1e,
236 .demod_init = anysee_mt352_demod_init,
237};
238
239static struct zl10353_config anysee_zl10353_config = {
240 .demod_address = 0x1e,
241 .parallel_ts = 1,
242};
243
244static int anysee_frontend_attach(struct dvb_usb_adapter *adap)
245{
246 int ret;
247 struct anysee_state *state = adap->dev->priv;
248 u8 hw_info[3];
249 u8 io_d; /* IO port D */
250
251 /* check which hardware we have
252 We must do this call two times to get reliable values (hw bug). */
253 ret = anysee_get_hw_info(adap->dev, hw_info);
254 if (ret)
255 return ret;
256 ret = anysee_get_hw_info(adap->dev, hw_info);
257 if (ret)
258 return ret;
259
260 /* Meaning of these info bytes are guessed. */
261 info("firmware version:%d.%d.%d hardware id:%d",
262 0, hw_info[1], hw_info[2], hw_info[0]);
263
264 ret = anysee_read_reg(adap->dev, 0xb0, &io_d); /* IO port D */
265 if (ret)
266 return ret;
267 deb_info("%s: IO port D:%02x\n", __func__, io_d);
268
269 /* Select demod using trial and error method. */
270
271 /* Try to attach demodulator in following order:
272 model demod hw firmware
273 1. E30 MT352 02 0.2.1
274 2. E30 ZL10353 02 0.2.1
275 3. E30 Plus ZL10353 06 0.1.0
276 4. E30C Plus TDA10023 0a 0.1.0 rev 0.2
277 4. E30C Plus TDA10023 0f 0.1.2 rev 0.4
278 */
279
280 /* Zarlink MT352 DVB-T demod inside of Samsung DNOS404ZH102A NIM */
281 adap->fe = dvb_attach(mt352_attach, &anysee_mt352_config,
282 &adap->dev->i2c_adap);
283 if (adap->fe != NULL) {
284 state->tuner = DVB_PLL_THOMSON_DTT7579;
285 return 0;
286 }
287
288 /* Zarlink ZL10353 DVB-T demod inside of Samsung DNOS404ZH103A NIM */
289 adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config,
290 &adap->dev->i2c_adap);
291 if (adap->fe != NULL) {
292 state->tuner = DVB_PLL_THOMSON_DTT7579;
293 return 0;
294 }
295
296 /* connect demod on IO port D for TDA10023 & ZL10353 */
297 ret = anysee_write_reg(adap->dev, 0xb0, 0x25);
298 if (ret)
299 return ret;
300
301 /* Zarlink ZL10353 DVB-T demod inside of Samsung DNOS404ZH103A NIM */
302 adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config,
303 &adap->dev->i2c_adap);
304 if (adap->fe != NULL) {
305 state->tuner = DVB_PLL_THOMSON_DTT7579;
306 return 0;
307 }
308
309 /* IO port E - E30C rev 0.4 board requires this */
310 ret = anysee_write_reg(adap->dev, 0xb1, 0xa7);
311 if (ret)
312 return ret;
313
314 /* Philips TDA10023 DVB-C demod */
315 adap->fe = dvb_attach(tda10023_attach, &anysee_tda10023_config,
316 &adap->dev->i2c_adap, 0x48);
317 if (adap->fe != NULL) {
318 state->tuner = DVB_PLL_SAMSUNG_DTOS403IH102A;
319 return 0;
320 }
321
322 /* return IO port D to init value for safe */
323 ret = anysee_write_reg(adap->dev, 0xb0, io_d);
324 if (ret)
325 return ret;
326
327 err("Unkown Anysee version: %02x %02x %02x. "\
328 "Please report the <linux-dvb@linuxtv.org>.",
329 hw_info[0], hw_info[1], hw_info[2]);
330
331 return -ENODEV;
332}
333
334static int anysee_tuner_attach(struct dvb_usb_adapter *adap)
335{
336 struct anysee_state *state = adap->dev->priv;
337 deb_info("%s: \n", __func__);
338
339 switch (state->tuner) {
340 case DVB_PLL_THOMSON_DTT7579:
341 /* Thomson dtt7579 (not sure) PLL inside of:
342 Samsung DNOS404ZH102A NIM
343 Samsung DNOS404ZH103A NIM */
344 dvb_attach(dvb_pll_attach, adap->fe, 0x61,
345 NULL, DVB_PLL_THOMSON_DTT7579);
346 break;
347 case DVB_PLL_SAMSUNG_DTOS403IH102A:
348 /* Unknown PLL inside of Samsung DTOS403IH102A tuner module */
349 dvb_attach(dvb_pll_attach, adap->fe, 0xc0,
350 &adap->dev->i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A);
351 break;
352 }
353
354 return 0;
355}
356
357static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
358{
359 u8 buf[] = {CMD_GET_IR_CODE};
360 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
361 u8 ircode[2];
362 int i, ret;
363
364 ret = anysee_ctrl_msg(d, buf, sizeof(buf), &ircode[0], 2);
365 if (ret)
366 return ret;
367
368 *event = 0;
369 *state = REMOTE_NO_KEY_PRESSED;
370
371 for (i = 0; i < d->props.rc_key_map_size; i++) {
372 if (keymap[i].custom == ircode[0] &&
373 keymap[i].data == ircode[1]) {
374 *event = keymap[i].event;
375 *state = REMOTE_KEY_PRESSED;
376 return 0;
377 }
378 }
379 return 0;
380}
381
382static struct dvb_usb_rc_key anysee_rc_keys[] = {
383 { 0x01, 0x00, KEY_0 },
384 { 0x01, 0x01, KEY_1 },
385 { 0x01, 0x02, KEY_2 },
386 { 0x01, 0x03, KEY_3 },
387 { 0x01, 0x04, KEY_4 },
388 { 0x01, 0x05, KEY_5 },
389 { 0x01, 0x06, KEY_6 },
390 { 0x01, 0x07, KEY_7 },
391 { 0x01, 0x08, KEY_8 },
392 { 0x01, 0x09, KEY_9 },
393 { 0x01, 0x0a, KEY_POWER },
394 { 0x01, 0x0b, KEY_DOCUMENTS }, /* * */
395 { 0x01, 0x19, KEY_FAVORITES },
396 { 0x01, 0x20, KEY_SLEEP },
397 { 0x01, 0x21, KEY_MODE }, /* 4:3 / 16:9 select */
398 { 0x01, 0x22, KEY_ZOOM },
399 { 0x01, 0x47, KEY_TEXT },
400 { 0x01, 0x16, KEY_TV }, /* TV / radio select */
401 { 0x01, 0x1e, KEY_LANGUAGE }, /* Second Audio Program */
402 { 0x01, 0x1a, KEY_SUBTITLE },
403 { 0x01, 0x1b, KEY_CAMERA }, /* screenshot */
404 { 0x01, 0x42, KEY_MUTE },
405 { 0x01, 0x0e, KEY_MENU },
406 { 0x01, 0x0f, KEY_EPG },
407 { 0x01, 0x17, KEY_INFO },
408 { 0x01, 0x10, KEY_EXIT },
409 { 0x01, 0x13, KEY_VOLUMEUP },
410 { 0x01, 0x12, KEY_VOLUMEDOWN },
411 { 0x01, 0x11, KEY_CHANNELUP },
412 { 0x01, 0x14, KEY_CHANNELDOWN },
413 { 0x01, 0x15, KEY_OK },
414 { 0x01, 0x1d, KEY_RED },
415 { 0x01, 0x1f, KEY_GREEN },
416 { 0x01, 0x1c, KEY_YELLOW },
417 { 0x01, 0x44, KEY_BLUE },
418 { 0x01, 0x0c, KEY_SHUFFLE }, /* snapshot */
419 { 0x01, 0x48, KEY_STOP },
420 { 0x01, 0x50, KEY_PLAY },
421 { 0x01, 0x51, KEY_PAUSE },
422 { 0x01, 0x49, KEY_RECORD },
423 { 0x01, 0x18, KEY_PREVIOUS }, /* |<< */
424 { 0x01, 0x0d, KEY_NEXT }, /* >>| */
425 { 0x01, 0x24, KEY_PROG1 }, /* F1 */
426 { 0x01, 0x25, KEY_PROG2 }, /* F2 */
427};
428
429/* DVB USB Driver stuff */
430static struct dvb_usb_device_properties anysee_properties;
431
432static int anysee_probe(struct usb_interface *intf,
433 const struct usb_device_id *id)
434{
435 struct dvb_usb_device *d;
436 struct usb_host_interface *alt;
437 int ret;
438
439 mutex_init(&anysee_usb_mutex);
440
441 /* There is one interface with two alternate settings.
442 Alternate setting 0 is for bulk transfer.
443 Alternate setting 1 is for isochronous transfer.
444 We use bulk transfer (alternate setting 0). */
445 if (intf->num_altsetting < 1)
446 return -ENODEV;
447
448 ret = dvb_usb_device_init(intf, &anysee_properties, THIS_MODULE, &d,
449 adapter_nr);
450 if (ret)
451 return ret;
452
453 alt = usb_altnum_to_altsetting(intf, 0);
454 if (alt == NULL) {
455 deb_info("%s: no alt found!\n", __func__);
456 return -ENODEV;
457 }
458
459 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
460 alt->desc.bAlternateSetting);
461 if (ret)
462 return ret;
463
464 if (d)
465 ret = anysee_init(d);
466
467 return ret;
468}
469
470static struct usb_device_id anysee_table [] = {
471 { USB_DEVICE(USB_VID_CYPRESS, USB_PID_ANYSEE) },
472 { USB_DEVICE(USB_VID_AMT, USB_PID_ANYSEE) },
473 { } /* Terminating entry */
474};
475MODULE_DEVICE_TABLE(usb, anysee_table);
476
477static struct dvb_usb_device_properties anysee_properties = {
478 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
479
480 .usb_ctrl = DEVICE_SPECIFIC,
481
482 .size_of_priv = sizeof(struct anysee_state),
483
484 .num_adapters = 1,
485 .adapter = {
486 {
487 .streaming_ctrl = anysee_streaming_ctrl,
488 .frontend_attach = anysee_frontend_attach,
489 .tuner_attach = anysee_tuner_attach,
490 .stream = {
491 .type = USB_BULK,
492 .count = 8,
493 .endpoint = 0x82,
494 .u = {
495 .bulk = {
496 .buffersize = 512,
497 }
498 }
499 },
500 }
501 },
502
503 .rc_key_map = anysee_rc_keys,
504 .rc_key_map_size = ARRAY_SIZE(anysee_rc_keys),
505 .rc_query = anysee_rc_query,
506 .rc_interval = 200, /* windows driver uses 500ms */
507
508 .i2c_algo = &anysee_i2c_algo,
509
510 .generic_bulk_ctrl_endpoint = 1,
511
512 .num_device_descs = 1,
513 .devices = {
514 {
515 .name = "Anysee DVB USB2.0",
516 .cold_ids = {NULL},
517 .warm_ids = {&anysee_table[0],
518 &anysee_table[1], NULL},
519 },
520 }
521};
522
523static struct usb_driver anysee_driver = {
524 .name = "dvb_usb_anysee",
525 .probe = anysee_probe,
526 .disconnect = dvb_usb_device_exit,
527 .id_table = anysee_table,
528};
529
530/* module stuff */
531static int __init anysee_module_init(void)
532{
533 int ret;
534
535 ret = usb_register(&anysee_driver);
536 if (ret)
537 err("%s: usb_register failed. Error number %d", __func__, ret);
538
539 return ret;
540}
541
542static void __exit anysee_module_exit(void)
543{
544 /* deregister this driver from the USB subsystem */
545 usb_deregister(&anysee_driver);
546}
547
548module_init(anysee_module_init);
549module_exit(anysee_module_exit);
550
551MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
552MODULE_DESCRIPTION("Driver Anysee E30 DVB-C & DVB-T USB2.0");
553MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/anysee.h b/drivers/media/dvb/dvb-usb/anysee.h
new file mode 100644
index 000000000000..7ca01ff6e13c
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/anysee.h
@@ -0,0 +1,304 @@
1/*
2 * DVB USB Linux driver for Anysee E30 DVB-C & DVB-T USB2.0 receiver
3 *
4 * Copyright (C) 2007 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 * TODO:
21 * - add smart card reader support for Conditional Access (CA)
22 *
23 * Card reader in Anysee is nothing more than ISO 7816 card reader.
24 * There is no hardware CAM in any Anysee device sold.
25 * In my understanding it should be implemented by making own module
26 * for ISO 7816 card reader, like dvb_ca_en50221 is implemented. This
27 * module registers serial interface that can be used to communicate
28 * with any ISO 7816 smart card.
29 *
30 * Any help according to implement serial smart card reader support
31 * is highly welcome!
32 */
33
34#ifndef _DVB_USB_ANYSEE_H_
35#define _DVB_USB_ANYSEE_H_
36
37#define DVB_USB_LOG_PREFIX "anysee"
38#include "dvb-usb.h"
39
40#define deb_info(args...) dprintk(dvb_usb_anysee_debug, 0x01, args)
41#define deb_xfer(args...) dprintk(dvb_usb_anysee_debug, 0x02, args)
42#define deb_rc(args...) dprintk(dvb_usb_anysee_debug, 0x04, args)
43#define deb_reg(args...) dprintk(dvb_usb_anysee_debug, 0x08, args)
44#define deb_i2c(args...) dprintk(dvb_usb_anysee_debug, 0x10, args)
45#define deb_fw(args...) dprintk(dvb_usb_anysee_debug, 0x20, args)
46
47enum cmd {
48 CMD_I2C_READ = 0x33,
49 CMD_I2C_WRITE = 0x31,
50 CMD_REG_READ = 0xb0,
51 CMD_REG_WRITE = 0xb1,
52 CMD_STREAMING_CTRL = 0x12,
53 CMD_LED_AND_IR_CTRL = 0x16,
54 CMD_GET_IR_CODE = 0x41,
55 CMD_GET_HW_INFO = 0x19,
56 CMD_SMARTCARD = 0x34,
57};
58
59struct anysee_state {
60 u8 tuner;
61 u8 seq;
62};
63
64#endif
65
66/***************************************************************************
67 * USB API description (reverse engineered)
68 ***************************************************************************
69
70Transaction flow:
71=================
72BULK[00001] >>> REQUEST PACKET 64 bytes
73BULK[00081] <<< REPLY PACKET #1 64 bytes (PREVIOUS TRANSACTION REPLY)
74BULK[00081] <<< REPLY PACKET #2 64 bytes (CURRENT TRANSACTION REPLY)
75
76General reply packet(s) are always used if not own reply defined.
77
78============================================================================
79| 00-63 | GENERAL REPLY PACKET #1 (PREVIOUS REPLY)
80============================================================================
81| 00 | reply data (if any) from previous transaction
82| | Just same reply packet as returned during previous transaction.
83| | Needed only if reply is missed in previous transaction.
84| | Just skip normally.
85----------------------------------------------------------------------------
86| 01-59 | don't care
87----------------------------------------------------------------------------
88| 60 | packet sequence number
89----------------------------------------------------------------------------
90| 61-63 | don't care
91----------------------------------------------------------------------------
92
93============================================================================
94| 00-63 | GENERAL REPLY PACKET #2 (CURRENT REPLY)
95============================================================================
96| 00 | reply data (if any)
97----------------------------------------------------------------------------
98| 01-59 | don't care
99----------------------------------------------------------------------------
100| 60 | packet sequence number
101----------------------------------------------------------------------------
102| 61-63 | don't care
103----------------------------------------------------------------------------
104
105============================================================================
106| 00-63 | I2C WRITE REQUEST PACKET
107============================================================================
108| 00 | 0x31 I2C write command
109----------------------------------------------------------------------------
110| 01 | i2c address
111----------------------------------------------------------------------------
112| 02 | data length
113| | 0x02 (for typical I2C reg / val pair)
114----------------------------------------------------------------------------
115| 03 | 0x01
116----------------------------------------------------------------------------
117| 04- | data
118----------------------------------------------------------------------------
119| -59 | don't care
120----------------------------------------------------------------------------
121| 60 | packet sequence number
122----------------------------------------------------------------------------
123| 61-63 | don't care
124----------------------------------------------------------------------------
125
126============================================================================
127| 00-63 | I2C READ REQUEST PACKET
128============================================================================
129| 00 | 0x33 I2C read command
130----------------------------------------------------------------------------
131| 01 | i2c address + 1
132----------------------------------------------------------------------------
133| 02 | register
134----------------------------------------------------------------------------
135| 03 | 0x00
136----------------------------------------------------------------------------
137| 04 | 0x00
138----------------------------------------------------------------------------
139| 05 | 0x01
140----------------------------------------------------------------------------
141| 06-59 | don't care
142----------------------------------------------------------------------------
143| 60 | packet sequence number
144----------------------------------------------------------------------------
145| 61-63 | don't care
146----------------------------------------------------------------------------
147
148============================================================================
149| 00-63 | USB CONTROLLER REGISTER WRITE REQUEST PACKET
150============================================================================
151| 00 | 0xb1 register write command
152----------------------------------------------------------------------------
153| 01-02 | register
154----------------------------------------------------------------------------
155| 03 | 0x01
156----------------------------------------------------------------------------
157| 04 | value
158----------------------------------------------------------------------------
159| 05-59 | don't care
160----------------------------------------------------------------------------
161| 60 | packet sequence number
162----------------------------------------------------------------------------
163| 61-63 | don't care
164----------------------------------------------------------------------------
165
166============================================================================
167| 00-63 | USB CONTROLLER REGISTER READ REQUEST PACKET
168============================================================================
169| 00 | 0xb0 register read command
170----------------------------------------------------------------------------
171| 01-02 | register
172----------------------------------------------------------------------------
173| 03 | 0x01
174----------------------------------------------------------------------------
175| 04-59 | don't care
176----------------------------------------------------------------------------
177| 60 | packet sequence number
178----------------------------------------------------------------------------
179| 61-63 | don't care
180----------------------------------------------------------------------------
181
182============================================================================
183| 00-63 | LED CONTROL REQUEST PACKET
184============================================================================
185| 00 | 0x16 LED and IR control command
186----------------------------------------------------------------------------
187| 01 | 0x01 (LED)
188----------------------------------------------------------------------------
189| 03 | 0x00 blink
190| | 0x01 lights continuously
191----------------------------------------------------------------------------
192| 04 | blink interval
193| | 0x00 fastest (looks like LED lights continuously)
194| | 0xff slowest
195----------------------------------------------------------------------------
196| 05-59 | don't care
197----------------------------------------------------------------------------
198| 60 | packet sequence number
199----------------------------------------------------------------------------
200| 61-63 | don't care
201----------------------------------------------------------------------------
202
203============================================================================
204| 00-63 | IR CONTROL REQUEST PACKET
205============================================================================
206| 00 | 0x16 LED and IR control command
207----------------------------------------------------------------------------
208| 01 | 0x02 (IR)
209----------------------------------------------------------------------------
210| 03 | 0x00 IR disabled
211| | 0x01 IR enabled
212----------------------------------------------------------------------------
213| 04-59 | don't care
214----------------------------------------------------------------------------
215| 60 | packet sequence number
216----------------------------------------------------------------------------
217| 61-63 | don't care
218----------------------------------------------------------------------------
219
220============================================================================
221| 00-63 | STREAMING CONTROL REQUEST PACKET
222============================================================================
223| 00 | 0x12 streaming control command
224----------------------------------------------------------------------------
225| 01 | 0x00 streaming disabled
226| | 0x01 streaming enabled
227----------------------------------------------------------------------------
228| 02 | 0x00
229----------------------------------------------------------------------------
230| 03-59 | don't care
231----------------------------------------------------------------------------
232| 60 | packet sequence number
233----------------------------------------------------------------------------
234| 61-63 | don't care
235----------------------------------------------------------------------------
236
237============================================================================
238| 00-63 | REMOTE CONTROL REQUEST PACKET
239============================================================================
240| 00 | 0x41 remote control command
241----------------------------------------------------------------------------
242| 01-59 | don't care
243----------------------------------------------------------------------------
244| 60 | packet sequence number
245----------------------------------------------------------------------------
246| 61-63 | don't care
247----------------------------------------------------------------------------
248
249============================================================================
250| 00-63 | REMOTE CONTROL REPLY PACKET
251============================================================================
252| 00 | 0x00 code not received
253| | 0x01 code received
254----------------------------------------------------------------------------
255| 01 | remote control code
256----------------------------------------------------------------------------
257| 02-59 | don't care
258----------------------------------------------------------------------------
259| 60 | packet sequence number
260----------------------------------------------------------------------------
261| 61-63 | don't care
262----------------------------------------------------------------------------
263
264============================================================================
265| 00-63 | GET HARDWARE INFO REQUEST PACKET
266============================================================================
267| 00 | 0x19 get hardware info command
268----------------------------------------------------------------------------
269| 01-59 | don't care
270----------------------------------------------------------------------------
271| 60 | packet sequence number
272----------------------------------------------------------------------------
273| 61-63 | don't care
274----------------------------------------------------------------------------
275
276============================================================================
277| 00-63 | GET HARDWARE INFO REPLY PACKET
278============================================================================
279| 00 | hardware id
280----------------------------------------------------------------------------
281| 01-02 | firmware version
282----------------------------------------------------------------------------
283| 03-59 | don't care
284----------------------------------------------------------------------------
285| 60 | packet sequence number
286----------------------------------------------------------------------------
287| 61-63 | don't care
288----------------------------------------------------------------------------
289
290============================================================================
291| 00-63 | SMART CARD READER PACKET
292============================================================================
293| 00 | 0x34 smart card reader command
294----------------------------------------------------------------------------
295| xx |
296----------------------------------------------------------------------------
297| xx-59 | don't care
298----------------------------------------------------------------------------
299| 60 | packet sequence number
300----------------------------------------------------------------------------
301| 61-63 | don't care
302----------------------------------------------------------------------------
303
304*/
diff --git a/drivers/media/dvb/dvb-usb/au6610.c b/drivers/media/dvb/dvb-usb/au6610.c
index 2ccb90fa60c8..eb34cc3894e0 100644
--- a/drivers/media/dvb/dvb-usb/au6610.c
+++ b/drivers/media/dvb/dvb-usb/au6610.c
@@ -1,24 +1,31 @@
1/* DVB USB compliant linux driver for Sigmatek DVB-110 DVB-T USB2.0 receiver 1/*
2 * DVB USB Linux driver for Alcor Micro AU6610 DVB-T USB2.0.
2 * 3 *
3 * Copyright (C) 2006 Antti Palosaari <crope@iki.fi> 4 * Copyright (C) 2006 Antti Palosaari <crope@iki.fi>
4 * 5 *
5 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify
6 * under the terms of the GNU General Public License as published by the Free 7 * it under the terms of the GNU General Public License as published by
7 * Software Foundation, version 2. 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
8 * 10 *
9 * see Documentation/dvb/README.dvb-usb for more information 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.
10 */ 19 */
11 20
12#include "au6610.h" 21#include "au6610.h"
13
14#include "zl10353.h" 22#include "zl10353.h"
15#include "qt1010.h" 23#include "qt1010.h"
16 24
17/* debug */ 25/* debug */
18static int dvb_usb_au6610_debug; 26static int dvb_usb_au6610_debug;
19module_param_named(debug, dvb_usb_au6610_debug, int, 0644); 27module_param_named(debug, dvb_usb_au6610_debug, int, 0644);
20MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); 28MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
21
22DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 29DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
23 30
24static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr, 31static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr,
@@ -42,9 +49,8 @@ static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr,
42 } 49 }
43 50
44 ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), operation, 51 ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), operation,
45 USB_TYPE_VENDOR|USB_DIR_IN, addr << 1, index, usb_buf, 52 USB_TYPE_VENDOR|USB_DIR_IN, addr << 1, index,
46 sizeof(usb_buf), AU6610_USB_TIMEOUT); 53 usb_buf, sizeof(usb_buf), AU6610_USB_TIMEOUT);
47
48 if (ret < 0) 54 if (ret < 0)
49 return ret; 55 return ret;
50 56
@@ -116,15 +122,6 @@ static struct i2c_algorithm au6610_i2c_algo = {
116}; 122};
117 123
118/* Callbacks for DVB USB */ 124/* Callbacks for DVB USB */
119static int au6610_identify_state(struct usb_device *udev,
120 struct dvb_usb_device_properties *props,
121 struct dvb_usb_device_description **desc,
122 int *cold)
123{
124 *cold = 0;
125 return 0;
126}
127
128static struct zl10353_config au6610_zl10353_config = { 125static struct zl10353_config au6610_zl10353_config = {
129 .demod_address = 0x0f, 126 .demod_address = 0x0f,
130 .no_tuner = 1, 127 .no_tuner = 1,
@@ -133,12 +130,12 @@ static struct zl10353_config au6610_zl10353_config = {
133 130
134static int au6610_zl10353_frontend_attach(struct dvb_usb_adapter *adap) 131static int au6610_zl10353_frontend_attach(struct dvb_usb_adapter *adap)
135{ 132{
136 if ((adap->fe = dvb_attach(zl10353_attach, &au6610_zl10353_config, 133 adap->fe = dvb_attach(zl10353_attach, &au6610_zl10353_config,
137 &adap->dev->i2c_adap)) != NULL) { 134 &adap->dev->i2c_adap);
138 return 0; 135 if (adap->fe == NULL)
139 } 136 return -ENODEV;
140 137
141 return -EIO; 138 return 0;
142} 139}
143 140
144static struct qt1010_config au6610_qt1010_config = { 141static struct qt1010_config au6610_qt1010_config = {
@@ -171,7 +168,7 @@ static int au6610_probe(struct usb_interface *intf,
171 alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING); 168 alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING);
172 169
173 if (alt == NULL) { 170 if (alt == NULL) {
174 deb_rc("no alt found!\n"); 171 deb_info("%s: no alt found!\n", __func__);
175 return -ENODEV; 172 return -ENODEV;
176 } 173 }
177 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber, 174 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
@@ -181,18 +178,19 @@ static int au6610_probe(struct usb_interface *intf,
181 return ret; 178 return ret;
182} 179}
183 180
184
185static struct usb_device_id au6610_table [] = { 181static struct usb_device_id au6610_table [] = {
186 { USB_DEVICE(USB_VID_ALCOR_MICRO, USB_PID_SIGMATEK_DVB_110) }, 182 { USB_DEVICE(USB_VID_ALCOR_MICRO, USB_PID_SIGMATEK_DVB_110) },
187 { } /* Terminating entry */ 183 { } /* Terminating entry */
188}; 184};
189MODULE_DEVICE_TABLE (usb, au6610_table); 185MODULE_DEVICE_TABLE(usb, au6610_table);
190 186
191static struct dvb_usb_device_properties au6610_properties = { 187static struct dvb_usb_device_properties au6610_properties = {
192 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 188 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
189
193 .usb_ctrl = DEVICE_SPECIFIC, 190 .usb_ctrl = DEVICE_SPECIFIC,
194 .size_of_priv = 0, 191
195 .identify_state = au6610_identify_state, 192 .size_of_priv = 0,
193
196 .num_adapters = 1, 194 .num_adapters = 1,
197 .adapter = { 195 .adapter = {
198 { 196 {
@@ -206,20 +204,22 @@ static struct dvb_usb_device_properties au6610_properties = {
206 .u = { 204 .u = {
207 .isoc = { 205 .isoc = {
208 .framesperurb = 40, 206 .framesperurb = 40,
209 .framesize = 942, /* maximum packet size */ 207 .framesize = 942,
210 .interval = 1.25, /* 125 us */ 208 .interval = 1,
211 } 209 }
212 } 210 }
213 }, 211 },
214 } 212 }
215 }, 213 },
214
216 .i2c_algo = &au6610_i2c_algo, 215 .i2c_algo = &au6610_i2c_algo,
216
217 .num_device_descs = 1, 217 .num_device_descs = 1,
218 .devices = { 218 .devices = {
219 { 219 {
220 "Sigmatek DVB-110 DVB-T USB2.0", 220 .name = "Sigmatek DVB-110 DVB-T USB2.0",
221 { &au6610_table[0], NULL }, 221 .cold_ids = {NULL},
222 { NULL }, 222 .warm_ids = {&au6610_table[0], NULL},
223 }, 223 },
224 } 224 }
225}; 225};
@@ -236,12 +236,11 @@ static int __init au6610_module_init(void)
236{ 236{
237 int ret; 237 int ret;
238 238
239 if ((ret = usb_register(&au6610_driver))) { 239 ret = usb_register(&au6610_driver);
240 if (ret)
240 err("usb_register failed. Error number %d", ret); 241 err("usb_register failed. Error number %d", ret);
241 return ret;
242 }
243 242
244 return 0; 243 return ret;
245} 244}
246 245
247static void __exit au6610_module_exit(void) 246static void __exit au6610_module_exit(void)
@@ -250,10 +249,10 @@ static void __exit au6610_module_exit(void)
250 usb_deregister(&au6610_driver); 249 usb_deregister(&au6610_driver);
251} 250}
252 251
253module_init (au6610_module_init); 252module_init(au6610_module_init);
254module_exit (au6610_module_exit); 253module_exit(au6610_module_exit);
255 254
256MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); 255MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
257MODULE_DESCRIPTION("Driver Sigmatek DVB-110 DVB-T USB2.0 / AU6610"); 256MODULE_DESCRIPTION("Driver for Alcor Micro AU6610 DVB-T USB2.0");
258MODULE_VERSION("0.1"); 257MODULE_VERSION("0.1");
259MODULE_LICENSE("GPL"); 258MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/au6610.h b/drivers/media/dvb/dvb-usb/au6610.h
index 4161b054c713..7849abe2c614 100644
--- a/drivers/media/dvb/dvb-usb/au6610.h
+++ b/drivers/media/dvb/dvb-usb/au6610.h
@@ -1,10 +1,30 @@
1/*
2 * DVB USB Linux driver for Alcor Micro AU6610 DVB-T USB2.0.
3 *
4 * Copyright (C) 2006 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
1#ifndef _DVB_USB_AU6610_H_ 21#ifndef _DVB_USB_AU6610_H_
2#define _DVB_USB_AU6610_H_ 22#define _DVB_USB_AU6610_H_
3 23
4#define DVB_USB_LOG_PREFIX "au6610" 24#define DVB_USB_LOG_PREFIX "au6610"
5#include "dvb-usb.h" 25#include "dvb-usb.h"
6 26
7#define deb_rc(args...) dprintk(dvb_usb_au6610_debug,0x01,args) 27#define deb_info(args...) dprintk(dvb_usb_au6610_debug, 0x01, args)
8 28
9#define AU6610_REQ_I2C_WRITE 0x14 29#define AU6610_REQ_I2C_WRITE 0x14
10#define AU6610_REQ_I2C_READ 0x13 30#define AU6610_REQ_I2C_READ 0x13
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 0286156704f2..578afce6884c 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -35,6 +35,7 @@
35#include "zl10353.h" 35#include "zl10353.h"
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 39
39/* debug */ 40/* debug */
40static int dvb_usb_cxusb_debug; 41static int dvb_usb_cxusb_debug;
@@ -43,9 +44,8 @@ MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_ST
43 44
44DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 45DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
45 46
46#define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) 47#define deb_info(args...) dprintk(dvb_usb_cxusb_debug, 0x03, args)
47#define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \ 48#define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args)
48 dprintk(dvb_usb_cxusb_debug,0x01,args)
49 49
50static int cxusb_ctrl_msg(struct dvb_usb_device *d, 50static int cxusb_ctrl_msg(struct dvb_usb_device *d,
51 u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) 51 u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
@@ -202,6 +202,46 @@ static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
202 return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); 202 return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0);
203} 203}
204 204
205static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff)
206{
207 int ret;
208 if (!onoff)
209 return cxusb_ctrl_msg(d, CMD_POWER_OFF, NULL, 0, NULL, 0);
210 if (d->state == DVB_USB_STATE_INIT &&
211 usb_set_interface(d->udev, 0, 0) < 0)
212 err("set interface failed");
213 do; while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) &&
214 !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) &&
215 !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0);
216 if (!ret) {
217 /* FIXME: We don't know why, but we need to configure the
218 * lgdt3303 with the register settings below on resume */
219 int i;
220 u8 buf, bufs[] = {
221 0x0e, 0x2, 0x00, 0x7f,
222 0x0e, 0x2, 0x02, 0xfe,
223 0x0e, 0x2, 0x02, 0x01,
224 0x0e, 0x2, 0x00, 0x03,
225 0x0e, 0x2, 0x0d, 0x40,
226 0x0e, 0x2, 0x0e, 0x87,
227 0x0e, 0x2, 0x0f, 0x8e,
228 0x0e, 0x2, 0x10, 0x01,
229 0x0e, 0x2, 0x14, 0xd7,
230 0x0e, 0x2, 0x47, 0x88,
231 };
232 msleep(20);
233 for (i = 0; i < sizeof(bufs)/sizeof(u8); i += 4/sizeof(u8)) {
234 ret = cxusb_ctrl_msg(d, CMD_I2C_WRITE,
235 bufs+i, 4, &buf, 1);
236 if (ret)
237 break;
238 if (buf != 0x8)
239 return -EREMOTEIO;
240 }
241 }
242 return ret;
243}
244
205static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff) 245static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
206{ 246{
207 u8 b = 0; 247 u8 b = 0;
@@ -233,6 +273,16 @@ static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
233 return 0; 273 return 0;
234} 274}
235 275
276static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
277{
278 if (onoff)
279 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_ON, NULL, 0, NULL, 0);
280 else
281 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_OFF,
282 NULL, 0, NULL, 0);
283 return 0;
284}
285
236static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) 286static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
237{ 287{
238 struct dvb_usb_rc_key *keymap = d->props.rc_key_map; 288 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
@@ -423,6 +473,12 @@ static struct lgdt330x_config cxusb_lgdt3303_config = {
423 .demod_chip = LGDT3303, 473 .demod_chip = LGDT3303,
424}; 474};
425 475
476static struct lgdt330x_config cxusb_aver_lgdt3303_config = {
477 .demod_address = 0x0e,
478 .demod_chip = LGDT3303,
479 .clock_polarity_flip = 2,
480};
481
426static struct mt352_config cxusb_dee1601_config = { 482static struct mt352_config cxusb_dee1601_config = {
427 .demod_address = 0x0f, 483 .demod_address = 0x0f,
428 .demod_init = cxusb_dee1601_demod_init, 484 .demod_init = cxusb_dee1601_demod_init,
@@ -453,6 +509,24 @@ static struct mt352_config cxusb_mt352_xc3028_config = {
453 .demod_init = cxusb_mt352_demod_init, 509 .demod_init = cxusb_mt352_demod_init,
454}; 510};
455 511
512/* FIXME: needs tweaking */
513static struct mxl5005s_config aver_a868r_tuner = {
514 .i2c_address = 0x63,
515 .if_freq = 6000000UL,
516 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
517 .agc_mode = MXL_SINGLE_AGC,
518 .tracking_filter = MXL_TF_C,
519 .rssi_enable = MXL_RSSI_ENABLE,
520 .cap_select = MXL_CAP_SEL_ENABLE,
521 .div_out = MXL_DIV_OUT_4,
522 .clock_out = MXL_CLOCK_OUT_DISABLE,
523 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
524 .top = MXL5005S_TOP_25P2,
525 .mod_mode = MXL_DIGITAL_MODE,
526 .if_mode = MXL_ZERO_IF,
527 .AgcMasterByte = 0x00,
528};
529
456/* Callbacks for DVB USB */ 530/* Callbacks for DVB USB */
457static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) 531static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
458{ 532{
@@ -533,6 +607,13 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
533 return 0; 607 return 0;
534} 608}
535 609
610static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
611{
612 dvb_attach(mxl5005s_attach, adap->fe,
613 &adap->dev->i2c_adap, &aver_a868r_tuner);
614 return 0;
615}
616
536static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) 617static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
537{ 618{
538 u8 b; 619 u8 b;
@@ -562,6 +643,16 @@ static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
562 return -EIO; 643 return -EIO;
563} 644}
564 645
646static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
647{
648 adap->fe = dvb_attach(lgdt330x_attach, &cxusb_aver_lgdt3303_config,
649 &adap->dev->i2c_adap);
650 if (adap->fe != NULL)
651 return 0;
652
653 return -EIO;
654}
655
565static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap) 656static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
566{ 657{
567 /* used in both lgz201 and th7579 */ 658 /* used in both lgz201 and th7579 */
@@ -736,6 +827,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
736static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties; 827static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties;
737static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties; 828static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
738static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; 829static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
830static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
739 831
740static int cxusb_probe(struct usb_interface *intf, 832static int cxusb_probe(struct usb_interface *intf,
741 const struct usb_device_id *id) 833 const struct usb_device_id *id)
@@ -756,7 +848,10 @@ static int cxusb_probe(struct usb_interface *intf,
756 THIS_MODULE, NULL, adapter_nr) || 848 THIS_MODULE, NULL, adapter_nr) ||
757 0 == dvb_usb_device_init(intf, 849 0 == dvb_usb_device_init(intf,
758 &cxusb_bluebird_nano2_needsfirmware_properties, 850 &cxusb_bluebird_nano2_needsfirmware_properties,
759 THIS_MODULE, NULL, adapter_nr)) 851 THIS_MODULE, NULL, adapter_nr) ||
852 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties,
853 THIS_MODULE, NULL, adapter_nr) ||
854 0)
760 return 0; 855 return 0;
761 856
762 return -EINVAL; 857 return -EINVAL;
@@ -779,6 +874,7 @@ static struct usb_device_id cxusb_table [] = {
779 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) }, 874 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) },
780 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) }, 875 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) },
781 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) }, 876 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) },
877 { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) },
782 {} /* Terminating entry */ 878 {} /* Terminating entry */
783}; 879};
784MODULE_DEVICE_TABLE (usb, cxusb_table); 880MODULE_DEVICE_TABLE (usb, cxusb_table);
@@ -1182,6 +1278,48 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
1182 } 1278 }
1183}; 1279};
1184 1280
1281static struct dvb_usb_device_properties cxusb_aver_a868r_properties = {
1282 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1283
1284 .usb_ctrl = CYPRESS_FX2,
1285
1286 .size_of_priv = sizeof(struct cxusb_state),
1287
1288 .num_adapters = 1,
1289 .adapter = {
1290 {
1291 .streaming_ctrl = cxusb_aver_streaming_ctrl,
1292 .frontend_attach = cxusb_aver_lgdt3303_frontend_attach,
1293 .tuner_attach = cxusb_mxl5003s_tuner_attach,
1294 /* parameter for the MPEG2-data transfer */
1295 .stream = {
1296 .type = USB_BULK,
1297 .count = 5,
1298 .endpoint = 0x04,
1299 .u = {
1300 .bulk = {
1301 .buffersize = 8192,
1302 }
1303 }
1304 },
1305
1306 },
1307 },
1308 .power_ctrl = cxusb_aver_power_ctrl,
1309
1310 .i2c_algo = &cxusb_i2c_algo,
1311
1312 .generic_bulk_ctrl_endpoint = 0x01,
1313
1314 .num_device_descs = 1,
1315 .devices = {
1316 { "AVerMedia AVerTVHD Volar (A868R)",
1317 { NULL },
1318 { &cxusb_table[16], NULL },
1319 },
1320 }
1321};
1322
1185static struct usb_driver cxusb_driver = { 1323static struct usb_driver cxusb_driver = {
1186 .name = "dvb_usb_cxusb", 1324 .name = "dvb_usb_cxusb",
1187 .probe = cxusb_probe, 1325 .probe = cxusb_probe,
diff --git a/drivers/media/dvb/dvb-usb/cxusb.h b/drivers/media/dvb/dvb-usb/cxusb.h
index 4768a2c35517..1a51eafd31b9 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.h
+++ b/drivers/media/dvb/dvb-usb/cxusb.h
@@ -20,6 +20,9 @@
20#define CMD_STREAMING_ON 0x36 20#define CMD_STREAMING_ON 0x36
21#define CMD_STREAMING_OFF 0x37 21#define CMD_STREAMING_OFF 0x37
22 22
23#define CMD_AVER_STREAM_ON 0x18
24#define CMD_AVER_STREAM_OFF 0x19
25
23#define CMD_GET_IR_CODE 0x47 26#define CMD_GET_IR_CODE 0x47
24 27
25#define CMD_ANALOG 0x50 28#define CMD_ANALOG 0x50
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index c4d40fe01d57..3dd20bfbed32 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -1117,6 +1117,7 @@ struct usb_device_id dib0700_usb_id_table[] = {
1117 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) }, 1117 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
1118 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) }, 1118 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
1119 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) }, 1119 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
1120 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
1120 { 0 } /* Terminating entry */ 1121 { 0 } /* Terminating entry */
1121}; 1122};
1122MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); 1123MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
@@ -1372,7 +1373,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
1372 } 1373 }
1373 }, 1374 },
1374 1375
1375 .num_device_descs = 2, 1376 .num_device_descs = 3,
1376 .devices = { 1377 .devices = {
1377 { "DiBcom STK7070PD reference design", 1378 { "DiBcom STK7070PD reference design",
1378 { &dib0700_usb_id_table[17], NULL }, 1379 { &dib0700_usb_id_table[17], NULL },
@@ -1381,6 +1382,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
1381 { "Pinnacle PCTV Dual DVB-T Diversity Stick", 1382 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
1382 { &dib0700_usb_id_table[18], NULL }, 1383 { &dib0700_usb_id_table[18], NULL },
1383 { NULL }, 1384 { NULL },
1385 },
1386 { "Hauppauge Nova-TD Stick (52009)",
1387 { &dib0700_usb_id_table[35], NULL },
1388 { NULL },
1384 } 1389 }
1385 } 1390 }
1386 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 1391 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
index 23428cd30756..326f7608954b 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
@@ -20,11 +20,7 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d)
20 } 20 }
21 21
22 strncpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name)); 22 strncpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name));
23#ifdef I2C_ADAP_CLASS_TV_DIGITAL
24 d->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL,
25#else
26 d->i2c_adap.class = I2C_CLASS_TV_DIGITAL, 23 d->i2c_adap.class = I2C_CLASS_TV_DIGITAL,
27#endif
28 d->i2c_adap.algo = d->props.i2c_algo; 24 d->i2c_adap.algo = d->props.i2c_algo;
29 d->i2c_adap.algo_data = NULL; 25 d->i2c_adap.algo_data = NULL;
30 d->i2c_adap.dev.parent = &d->udev->dev; 26 d->i2c_adap.dev.parent = &d->udev->dev;
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index 34245d1b7dd9..e5238b31e946 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -14,6 +14,7 @@
14#define USB_VID_AFATECH 0x15a4 14#define USB_VID_AFATECH 0x15a4
15#define USB_VID_ALCOR_MICRO 0x058f 15#define USB_VID_ALCOR_MICRO 0x058f
16#define USB_VID_ALINK 0x05e3 16#define USB_VID_ALINK 0x05e3
17#define USB_VID_AMT 0x1c73
17#define USB_VID_ANCHOR 0x0547 18#define USB_VID_ANCHOR 0x0547
18#define USB_VID_ANSONIC 0x10b9 19#define USB_VID_ANSONIC 0x10b9
19#define USB_VID_ANUBIS_ELECTRONIC 0x10fd 20#define USB_VID_ANUBIS_ELECTRONIC 0x10fd
@@ -57,6 +58,7 @@
57#define USB_PID_AFATECH_AF9005 0x9020 58#define USB_PID_AFATECH_AF9005 0x9020
58#define USB_VID_ALINK_DTU 0xf170 59#define USB_VID_ALINK_DTU 0xf170
59#define USB_PID_ANSONIC_DVBT_USB 0x6000 60#define USB_PID_ANSONIC_DVBT_USB 0x6000
61#define USB_PID_ANYSEE 0x861f
60#define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001 62#define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001
61#define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002 63#define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002
62#define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800 64#define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800
@@ -132,9 +134,15 @@
132#define USB_PID_HAUPPAUGE_NOVA_T_STICK_3 0x7070 134#define USB_PID_HAUPPAUGE_NOVA_T_STICK_3 0x7070
133#define USB_PID_HAUPPAUGE_MYTV_T 0x7080 135#define USB_PID_HAUPPAUGE_MYTV_T 0x7080
134#define USB_PID_HAUPPAUGE_NOVA_TD_STICK 0x9580 136#define USB_PID_HAUPPAUGE_NOVA_TD_STICK 0x9580
137#define USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009 0x5200
135#define USB_PID_AVERMEDIA_EXPRESS 0xb568 138#define USB_PID_AVERMEDIA_EXPRESS 0xb568
136#define USB_PID_AVERMEDIA_VOLAR 0xa807 139#define USB_PID_AVERMEDIA_VOLAR 0xa807
137#define USB_PID_AVERMEDIA_VOLAR_2 0xb808 140#define USB_PID_AVERMEDIA_VOLAR_2 0xb808
141#define USB_PID_AVERMEDIA_VOLAR_A868R 0xa868
142#define USB_PID_AVERMEDIA_MCE_USB_M038 0x1228
143#define USB_PID_AVERMEDIA_HYBRID_ULTRA_USB_M039R 0x0039
144#define USB_PID_AVERMEDIA_HYBRID_ULTRA_USB_M039R_ATSC 0x1039
145#define USB_PID_AVERMEDIA_HYBRID_ULTRA_USB_M039R_DVBT 0x2039
138#define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 146#define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006
139#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a 147#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a
140#define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058 148#define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c
index 037f7ffb47b2..6f596ed41761 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -1,8 +1,8 @@
1/* DVB USB compliant linux driver for GL861 USB2.0 devices. 1/* DVB USB compliant linux driver for GL861 USB2.0 devices.
2 * 2 *
3 * This program is free software; you can redistribute it and/or modify it 3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free 4 * under the terms of the GNU General Public License as published by the
5 * Software Foundation, version 2. 5 * Free Software Foundation, version 2.
6 * 6 *
7 * see Documentation/dvb/README.dvb-usb for more information 7 * see Documentation/dvb/README.dvb-usb for more information
8 */ 8 */
@@ -13,9 +13,9 @@
13 13
14/* debug */ 14/* debug */
15static int dvb_usb_gl861_debug; 15static int dvb_usb_gl861_debug;
16module_param_named(debug,dvb_usb_gl861_debug, int, 0644); 16module_param_named(debug, dvb_usb_gl861_debug, int, 0644);
17MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); 17MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))."
18 18 DVB_USB_DEBUG_STATUS);
19DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 19DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
20 20
21static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr, 21static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
@@ -70,7 +70,7 @@ static int gl861_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
70 /* write/read request */ 70 /* write/read request */
71 if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { 71 if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
72 if (gl861_i2c_msg(d, msg[i].addr, msg[i].buf, 72 if (gl861_i2c_msg(d, msg[i].addr, msg[i].buf,
73 msg[i].len, msg[i+1].buf, msg[i+1].len) < 0) 73 msg[i].len, msg[i+1].buf, msg[i+1].len) < 0)
74 break; 74 break;
75 i++; 75 i++;
76 } else 76 } else
@@ -102,12 +102,13 @@ static struct zl10353_config gl861_zl10353_config = {
102 102
103static int gl861_frontend_attach(struct dvb_usb_adapter *adap) 103static int gl861_frontend_attach(struct dvb_usb_adapter *adap)
104{ 104{
105 if ((adap->fe = dvb_attach(zl10353_attach, &gl861_zl10353_config,
106 &adap->dev->i2c_adap)) != NULL) {
107 return 0;
108 }
109 105
110 return -EIO; 106 adap->fe = dvb_attach(zl10353_attach, &gl861_zl10353_config,
107 &adap->dev->i2c_adap);
108 if (adap->fe == NULL)
109 return -EIO;
110
111 return 0;
111} 112}
112 113
113static struct qt1010_config gl861_qt1010_config = { 114static struct qt1010_config gl861_qt1010_config = {
@@ -156,7 +157,7 @@ static struct usb_device_id gl861_table [] = {
156 { USB_DEVICE(USB_VID_ALINK, USB_VID_ALINK_DTU) }, 157 { USB_DEVICE(USB_VID_ALINK, USB_VID_ALINK_DTU) },
157 { } /* Terminating entry */ 158 { } /* Terminating entry */
158}; 159};
159MODULE_DEVICE_TABLE (usb, gl861_table); 160MODULE_DEVICE_TABLE(usb, gl861_table);
160 161
161static struct dvb_usb_device_properties gl861_properties = { 162static struct dvb_usb_device_properties gl861_properties = {
162 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 163 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
@@ -180,7 +181,7 @@ static struct dvb_usb_device_properties gl861_properties = {
180 } 181 }
181 } 182 }
182 }, 183 },
183 }}, 184 } },
184 .i2c_algo = &gl861_i2c_algo, 185 .i2c_algo = &gl861_i2c_algo,
185 186
186 .num_device_descs = 2, 187 .num_device_descs = 2,
@@ -210,12 +211,11 @@ static int __init gl861_module_init(void)
210{ 211{
211 int ret; 212 int ret;
212 213
213 if ((ret = usb_register(&gl861_driver))) { 214 ret = usb_register(&gl861_driver);
215 if (ret)
214 err("usb_register failed. Error number %d", ret); 216 err("usb_register failed. Error number %d", ret);
215 return ret;
216 }
217 217
218 return 0; 218 return ret;
219} 219}
220 220
221static void __exit gl861_module_exit(void) 221static void __exit gl861_module_exit(void)
@@ -224,8 +224,8 @@ static void __exit gl861_module_exit(void)
224 usb_deregister(&gl861_driver); 224 usb_deregister(&gl861_driver);
225} 225}
226 226
227module_init (gl861_module_init); 227module_init(gl861_module_init);
228module_exit (gl861_module_exit); 228module_exit(gl861_module_exit);
229 229
230MODULE_AUTHOR("Carl Lundqvist <comabug@gmail.com>"); 230MODULE_AUTHOR("Carl Lundqvist <comabug@gmail.com>");
231MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / GL861"); 231MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / GL861");
diff --git a/drivers/media/dvb/dvb-usb/gl861.h b/drivers/media/dvb/dvb-usb/gl861.h
index 72a51afd5ee3..c54855e2c233 100644
--- a/drivers/media/dvb/dvb-usb/gl861.h
+++ b/drivers/media/dvb/dvb-usb/gl861.h
@@ -4,7 +4,7 @@
4#define DVB_USB_LOG_PREFIX "gl861" 4#define DVB_USB_LOG_PREFIX "gl861"
5#include "dvb-usb.h" 5#include "dvb-usb.h"
6 6
7#define deb_rc(args...) dprintk(dvb_usb_gl861_debug,0x01,args) 7#define deb_rc(args...) dprintk(dvb_usb_gl861_debug, 0x01, args)
8 8
9#define GL861_WRITE 0x40 9#define GL861_WRITE 0x40
10#define GL861_READ 0xc0 10#define GL861_READ 0xc0