blob: a4a5361cf0665d35d6d8814a6272c5920e90e06a [file] [log] [blame]
Antti Palosaaria51e34d2008-05-17 23:05:48 -03001/*
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
Antti Palosaari9fdd9ca2008-06-11 11:43:19 -030026 * for ISO 7816 card reader, like dvb_ca_en50221 is implemented. This
27 * module registers serial interface that can be used to communicate
Antti Palosaaria51e34d2008-05-17 23:05:48 -030028 * 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"
Antti Palosaari72ffd2b2011-04-10 20:14:50 -030039#include "tda18212.h"
Antti Palosaarif0a53102011-04-27 21:11:59 -030040#include "cx24116.h"
Antti Palosaaribedbf3d2011-04-29 13:55:02 -030041#include "stv0900.h"
42#include "stv6110.h"
Antti Palosaarif0a53102011-04-27 21:11:59 -030043#include "isl6423.h"
Antti Palosaaria51e34d2008-05-17 23:05:48 -030044
45/* debug */
46static int dvb_usb_anysee_debug;
47module_param_named(debug, dvb_usb_anysee_debug, int, 0644);
48MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
Mauro Carvalho Chehabffbc5f82009-01-05 01:34:20 -030049static int dvb_usb_anysee_delsys;
Antti Palosaari0f77c3a2008-08-11 10:54:16 -030050module_param_named(delsys, dvb_usb_anysee_delsys, int, 0644);
51MODULE_PARM_DESC(delsys, "select delivery mode (0=DVB-C, 1=DVB-T)");
Antti Palosaaria51e34d2008-05-17 23:05:48 -030052DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
53
Akinobu Mitadec0c462008-10-29 21:16:04 -030054static DEFINE_MUTEX(anysee_usb_mutex);
Antti Palosaaria51e34d2008-05-17 23:05:48 -030055
56static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen,
57 u8 *rbuf, u8 rlen)
58{
59 struct anysee_state *state = d->priv;
60 int act_len, ret;
61 u8 buf[64];
62
Antti Palosaaria51e34d2008-05-17 23:05:48 -030063 memcpy(&buf[0], sbuf, slen);
64 buf[60] = state->seq++;
65
66 if (mutex_lock_interruptible(&anysee_usb_mutex) < 0)
67 return -EAGAIN;
68
69 /* We need receive one message more after dvb_usb_generic_rw due
70 to weird transaction flow, which is 1 x send + 2 x receive. */
71 ret = dvb_usb_generic_rw(d, buf, sizeof(buf), buf, sizeof(buf), 0);
72
73 if (!ret) {
74 /* receive 2nd answer */
75 ret = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev,
76 d->props.generic_bulk_ctrl_endpoint), buf, sizeof(buf),
77 &act_len, 2000);
78 if (ret)
79 err("%s: recv bulk message failed: %d", __func__, ret);
80 else {
81 deb_xfer("<<< ");
82 debug_dump(buf, act_len, deb_xfer);
83 }
84 }
85
86 /* read request, copy returned data to return buf */
87 if (!ret && rbuf && rlen)
88 memcpy(rbuf, buf, rlen);
89
90 mutex_unlock(&anysee_usb_mutex);
91
92 return ret;
93}
94
95static int anysee_read_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
96{
97 u8 buf[] = {CMD_REG_READ, reg >> 8, reg & 0xff, 0x01};
98 int ret;
99 ret = anysee_ctrl_msg(d, buf, sizeof(buf), val, 1);
100 deb_info("%s: reg:%04x val:%02x\n", __func__, reg, *val);
101 return ret;
102}
103
104static int anysee_write_reg(struct dvb_usb_device *d, u16 reg, u8 val)
105{
106 u8 buf[] = {CMD_REG_WRITE, reg >> 8, reg & 0xff, 0x01, val};
107 deb_info("%s: reg:%04x val:%02x\n", __func__, reg, val);
108 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
109}
110
Antti Palosaari41f81f62011-04-10 17:53:52 -0300111/* write single register with mask */
112static int anysee_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val,
113 u8 mask)
114{
115 int ret;
116 u8 tmp;
117
118 /* no need for read if whole reg is written */
119 if (mask != 0xff) {
120 ret = anysee_read_reg(d, reg, &tmp);
121 if (ret)
122 return ret;
123
124 val &= mask;
125 tmp &= ~mask;
126 val |= tmp;
127 }
128
129 return anysee_write_reg(d, reg, val);
130}
131
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300132static int anysee_get_hw_info(struct dvb_usb_device *d, u8 *id)
133{
134 u8 buf[] = {CMD_GET_HW_INFO};
135 return anysee_ctrl_msg(d, buf, sizeof(buf), id, 3);
136}
137
138static int anysee_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
139{
140 u8 buf[] = {CMD_STREAMING_CTRL, (u8)onoff, 0x00};
141 deb_info("%s: onoff:%02x\n", __func__, onoff);
142 return anysee_ctrl_msg(adap->dev, buf, sizeof(buf), NULL, 0);
143}
144
145static int anysee_led_ctrl(struct dvb_usb_device *d, u8 mode, u8 interval)
146{
147 u8 buf[] = {CMD_LED_AND_IR_CTRL, 0x01, mode, interval};
148 deb_info("%s: state:%02x interval:%02x\n", __func__, mode, interval);
149 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
150}
151
152static int anysee_ir_ctrl(struct dvb_usb_device *d, u8 onoff)
153{
154 u8 buf[] = {CMD_LED_AND_IR_CTRL, 0x02, onoff};
155 deb_info("%s: onoff:%02x\n", __func__, onoff);
156 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
157}
158
159static int anysee_init(struct dvb_usb_device *d)
160{
161 int ret;
162 /* LED light */
163 ret = anysee_led_ctrl(d, 0x01, 0x03);
164 if (ret)
165 return ret;
166
167 /* enable IR */
168 ret = anysee_ir_ctrl(d, 1);
169 if (ret)
170 return ret;
171
172 return 0;
173}
174
175/* I2C */
176static int anysee_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msg,
177 int num)
178{
179 struct dvb_usb_device *d = i2c_get_adapdata(adap);
Mauro Carvalho Chehab902571a2008-12-29 19:02:24 -0300180 int ret = 0, inc, i = 0;
Antti Palosaari21d2e932011-05-24 06:04:08 -0300181 u8 buf[52]; /* 4 + 48 (I2C WR USB command header + I2C WR max) */
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300182
183 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
184 return -EAGAIN;
185
186 while (i < num) {
187 if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) {
Antti Palosaari21d2e932011-05-24 06:04:08 -0300188 if (msg[i].len > 2 || msg[i+1].len > 60) {
189 ret = -EOPNOTSUPP;
190 break;
191 }
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300192 buf[0] = CMD_I2C_READ;
Antti Palosaari7ea03d22011-04-09 20:50:07 -0300193 buf[1] = (msg[i].addr << 1) | 0x01;
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300194 buf[2] = msg[i].buf[0];
Antti Palosaari882b82c2011-04-12 19:49:25 -0300195 buf[3] = msg[i].buf[1];
196 buf[4] = msg[i].len-1;
Antti Palosaarib3e6a5a2011-04-09 21:00:51 -0300197 buf[5] = msg[i+1].len;
Antti Palosaari21d2e932011-05-24 06:04:08 -0300198 ret = anysee_ctrl_msg(d, buf, 6, msg[i+1].buf,
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300199 msg[i+1].len);
200 inc = 2;
201 } else {
Antti Palosaari21d2e932011-05-24 06:04:08 -0300202 if (msg[i].len > 48) {
203 ret = -EOPNOTSUPP;
204 break;
205 }
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300206 buf[0] = CMD_I2C_WRITE;
Antti Palosaari7ea03d22011-04-09 20:50:07 -0300207 buf[1] = (msg[i].addr << 1);
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300208 buf[2] = msg[i].len;
209 buf[3] = 0x01;
210 memcpy(&buf[4], msg[i].buf, msg[i].len);
Antti Palosaari21d2e932011-05-24 06:04:08 -0300211 ret = anysee_ctrl_msg(d, buf, 4 + msg[i].len, NULL, 0);
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300212 inc = 1;
213 }
214 if (ret)
Antti Palosaarie613f8f2008-08-11 10:36:43 -0300215 break;
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300216
217 i += inc;
218 }
219
220 mutex_unlock(&d->i2c_mutex);
221
Antti Palosaarie613f8f2008-08-11 10:36:43 -0300222 return ret ? ret : i;
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300223}
224
225static u32 anysee_i2c_func(struct i2c_adapter *adapter)
226{
227 return I2C_FUNC_I2C;
228}
229
230static struct i2c_algorithm anysee_i2c_algo = {
231 .master_xfer = anysee_master_xfer,
232 .functionality = anysee_i2c_func,
233};
234
235static int anysee_mt352_demod_init(struct dvb_frontend *fe)
236{
Antti Palosaariae3745f2009-09-16 19:50:25 -0300237 static u8 clock_config[] = { CLOCK_CTL, 0x38, 0x28 };
238 static u8 reset[] = { RESET, 0x80 };
239 static u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 };
240 static u8 agc_cfg[] = { AGC_TARGET, 0x28, 0x20 };
241 static u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 };
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300242 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
243
244 mt352_write(fe, clock_config, sizeof(clock_config));
245 udelay(200);
246 mt352_write(fe, reset, sizeof(reset));
247 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
248
249 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
250 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
251 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
252
253 return 0;
254}
255
256/* Callbacks for DVB USB */
257static struct tda10023_config anysee_tda10023_config = {
Antti Palosaari7ea03d22011-04-09 20:50:07 -0300258 .demod_address = (0x1a >> 1),
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300259 .invert = 0,
260 .xtal = 16000000,
261 .pll_m = 11,
262 .pll_p = 3,
263 .pll_n = 1,
Antti Palosaari5ae2fca2008-06-09 22:58:22 -0300264 .output_mode = TDA10023_OUTPUT_MODE_PARALLEL_C,
265 .deltaf = 0xfeeb,
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300266};
267
268static struct mt352_config anysee_mt352_config = {
Antti Palosaari7ea03d22011-04-09 20:50:07 -0300269 .demod_address = (0x1e >> 1),
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300270 .demod_init = anysee_mt352_demod_init,
271};
272
273static struct zl10353_config anysee_zl10353_config = {
Antti Palosaari7ea03d22011-04-09 20:50:07 -0300274 .demod_address = (0x1e >> 1),
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300275 .parallel_ts = 1,
276};
277
Antti Palosaari1fd80702011-04-12 17:34:08 -0300278static struct zl10353_config anysee_zl10353_tda18212_config2 = {
279 .demod_address = (0x1e >> 1),
280 .parallel_ts = 1,
281 .disable_i2c_gate_ctrl = 1,
282 .no_tuner = 1,
283 .if2 = 41500,
284};
285
Antti Palosaari72ffd2b2011-04-10 20:14:50 -0300286static struct zl10353_config anysee_zl10353_tda18212_config = {
287 .demod_address = (0x18 >> 1),
288 .parallel_ts = 1,
289 .disable_i2c_gate_ctrl = 1,
290 .no_tuner = 1,
291 .if2 = 41500,
292};
293
294static struct tda10023_config anysee_tda10023_tda18212_config = {
295 .demod_address = (0x1a >> 1),
296 .xtal = 16000000,
297 .pll_m = 12,
298 .pll_p = 3,
299 .pll_n = 1,
300 .output_mode = TDA10023_OUTPUT_MODE_PARALLEL_C,
301 .deltaf = 0xba02,
302};
303
304static struct tda18212_config anysee_tda18212_config = {
305 .i2c_address = (0xc0 >> 1),
306 .if_dvbt_6 = 4150,
307 .if_dvbt_7 = 4150,
308 .if_dvbt_8 = 4150,
309 .if_dvbc = 5000,
310};
311
Antti Palosaarif0a53102011-04-27 21:11:59 -0300312static struct cx24116_config anysee_cx24116_config = {
313 .demod_address = (0xaa >> 1),
314 .mpg_clk_pos_pol = 0x00,
315 .i2c_wr_max = 48,
316};
317
Antti Palosaaribedbf3d2011-04-29 13:55:02 -0300318static struct stv0900_config anysee_stv0900_config = {
319 .demod_address = (0xd0 >> 1),
320 .demod_mode = 0,
321 .xtal = 8000000,
322 .clkmode = 3,
323 .diseqc_mode = 2,
324 .tun1_maddress = 0,
325 .tun1_adc = 1, /* 1 Vpp */
326 .path1_mode = 3,
327};
328
329static struct stv6110_config anysee_stv6110_config = {
330 .i2c_address = (0xc0 >> 1),
331 .mclk = 16000000,
332 .clk_div = 1,
333};
334
Antti Palosaarif0a53102011-04-27 21:11:59 -0300335static struct isl6423_config anysee_isl6423_config = {
336 .current_max = SEC_CURRENT_800m,
337 .curlim = SEC_CURRENT_LIM_OFF,
338 .mod_extern = 1,
339 .addr = (0x10 >> 1),
340};
341
Antti Palosaari41f81f62011-04-10 17:53:52 -0300342/*
343 * New USB device strings: Mfr=1, Product=2, SerialNumber=0
344 * Manufacturer: AMT.CO.KR
345 *
346 * E30 VID=04b4 PID=861f HW=2 FW=2.1 Product=????????
347 * PCB: ?
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300348 * parts: DNOS404ZH102A(MT352, DTT7579(?))
Antti Palosaari41f81f62011-04-10 17:53:52 -0300349 *
350 * E30 VID=04b4 PID=861f HW=2 FW=2.1 Product=????????
351 * PCB: ?
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300352 * parts: DNOS404ZH103A(ZL10353, DTT7579(?))
Antti Palosaari41f81f62011-04-10 17:53:52 -0300353 *
354 * E30 Plus VID=04b4 PID=861f HW=6 FW=1.0 "anysee"
355 * PCB: 507CD (rev1.1)
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300356 * parts: DNOS404ZH103A(ZL10353, DTT7579(?)), CST56I01
Antti Palosaari41f81f62011-04-10 17:53:52 -0300357 * OEA=80 OEB=00 OEC=00 OED=ff OEF=fe
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300358 * IOA=4f IOB=ff IOC=00 IOD=06 IOF=01
Antti Palosaari41f81f62011-04-10 17:53:52 -0300359 * IOD[0] ZL10353 1=enabled
360 * IOA[7] TS 0=enabled
361 * tuner is not behind ZL10353 I2C-gate (no care if gate disabled or not)
362 *
363 * E30 C Plus VID=04b4 PID=861f HW=10 FW=1.0 "anysee-DC(LP)"
364 * PCB: 507DC (rev0.2)
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300365 * parts: TDA10023, DTOS403IH102B TM, CST56I01
Antti Palosaari41f81f62011-04-10 17:53:52 -0300366 * OEA=80 OEB=00 OEC=00 OED=ff OEF=fe
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300367 * IOA=4f IOB=ff IOC=00 IOD=26 IOF=01
Antti Palosaari41f81f62011-04-10 17:53:52 -0300368 * IOD[0] TDA10023 1=enabled
369 *
Antti Palosaarif0a53102011-04-27 21:11:59 -0300370 * E30 S2 Plus VID=04b4 PID=861f HW=11 FW=0.1 "anysee-S2(LP)"
371 * PCB: 507SI (rev2.1)
372 * parts: BS2N10WCC01(CX24116, CX24118), ISL6423, TDA8024
373 * OEA=80 OEB=00 OEC=ff OED=ff OEF=fe
374 * IOA=4d IOB=ff IOC=00 IOD=26 IOF=01
375 * IOD[0] CX24116 1=enabled
376 *
Antti Palosaari41f81f62011-04-10 17:53:52 -0300377 * E30 C Plus VID=1c73 PID=861f HW=15 FW=1.2 "anysee-FA(LP)"
378 * PCB: 507FA (rev0.4)
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300379 * parts: TDA10023, DTOS403IH102B TM, TDA8024
Antti Palosaari41f81f62011-04-10 17:53:52 -0300380 * OEA=80 OEB=00 OEC=ff OED=ff OEF=ff
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300381 * IOA=4d IOB=ff IOC=00 IOD=00 IOF=c0
Antti Palosaari41f81f62011-04-10 17:53:52 -0300382 * IOD[5] TDA10023 1=enabled
383 * IOE[0] tuner 1=enabled
384 *
385 * E30 Combo Plus VID=1c73 PID=861f HW=15 FW=1.2 "anysee-FA(LP)"
386 * PCB: 507FA (rev1.1)
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300387 * parts: ZL10353, TDA10023, DTOS403IH102B TM, TDA8024
Antti Palosaari41f81f62011-04-10 17:53:52 -0300388 * OEA=80 OEB=00 OEC=ff OED=ff OEF=ff
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300389 * IOA=4d IOB=ff IOC=00 IOD=00 IOF=c0
Antti Palosaari41f81f62011-04-10 17:53:52 -0300390 * DVB-C:
391 * IOD[5] TDA10023 1=enabled
392 * IOE[0] tuner 1=enabled
393 * DVB-T:
394 * IOD[0] ZL10353 1=enabled
395 * IOE[0] tuner 0=enabled
396 * tuner is behind ZL10353 I2C-gate
Antti Palosaari70fc26f2011-04-12 20:17:11 -0300397 *
398 * E7 TC VID=1c73 PID=861f HW=18 FW=0.7 AMTCI=0.5 "anysee-E7TC(LP)"
399 * PCB: 508TC (rev0.6)
400 * parts: ZL10353, TDA10023, DNOD44CDH086A(TDA18212)
401 * OEA=80 OEB=00 OEC=03 OED=f7 OEF=ff
402 * IOA=4d IOB=00 IOC=cc IOD=48 IOF=e4
403 * IOA[7] TS 1=enabled
404 * IOE[4] TDA18212 1=enabled
405 * DVB-C:
406 * IOD[6] ZL10353 0=disabled
407 * IOD[5] TDA10023 1=enabled
408 * IOE[0] IF 1=enabled
409 * DVB-T:
410 * IOD[5] TDA10023 0=disabled
411 * IOD[6] ZL10353 1=enabled
412 * IOE[0] IF 0=enabled
Antti Palosaaribedbf3d2011-04-29 13:55:02 -0300413 *
414 * E7 S2 VID=1c73 PID=861f HW=19 FW=0.4 AMTCI=0.5 "anysee-E7S2(LP)"
415 * PCB: 508S2 (rev0.7)
416 * parts: DNBU10512IST(STV0903, STV6110), ISL6423
417 * OEA=80 OEB=00 OEC=03 OED=f7 OEF=ff
418 * IOA=4d IOB=00 IOC=c4 IOD=08 IOF=e4
419 * IOA[7] TS 1=enabled
420 * IOE[5] STV0903 1=enabled
421 *
Antti Palosaari8439e0d2011-05-24 07:57:34 -0300422 * E7 PTC VID=1c73 PID=861f HW=21 FW=0.1 AMTCI=?? "anysee-E7PTC(LP)"
423 * PCB: 508PTC (rev0.5)
424 * parts: ZL10353, TDA10023, DNOD44CDH086A(TDA18212)
425 * OEA=80 OEB=00 OEC=03 OED=f7 OEE=ff
426 * IOA=4d IOB=00 IOC=cc IOD=48 IOE=e4
427 * IOA[7] TS 1=enabled
428 * IOE[4] TDA18212 1=enabled
429 * DVB-C:
430 * IOD[6] ZL10353 0=disabled
431 * IOD[5] TDA10023 1=enabled
432 * IOE[0] IF 1=enabled
433 * DVB-T:
434 * IOD[5] TDA10023 0=disabled
435 * IOD[6] ZL10353 1=enabled
436 * IOE[0] IF 0=enabled
Antti Palosaarifea3c392011-05-25 18:21:43 -0300437 *
438 * E7 S2 VID=1c73 PID=861f HW=22 FW=0.1 AMTCI=?? "anysee-E7PS2(LP)"
439 * PCB: 508PS2 (rev0.4)
440 * parts: DNBU10512IST(STV0903, STV6110), ISL6423
441 * OEA=80 OEB=00 OEC=03 OED=f7 OEE=ff
442 * IOA=4d IOB=00 IOC=c4 IOD=08 IOE=e4
443 * IOA[7] TS 1=enabled
444 * IOE[5] STV0903 1=enabled
Antti Palosaari41f81f62011-04-10 17:53:52 -0300445 */
446
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300447static int anysee_frontend_attach(struct dvb_usb_adapter *adap)
448{
449 int ret;
450 struct anysee_state *state = adap->dev->priv;
451 u8 hw_info[3];
Antti Palosaari72ffd2b2011-04-10 20:14:50 -0300452 u8 tmp;
453 struct i2c_msg msg[2] = {
454 {
455 .addr = anysee_tda18212_config.i2c_address,
456 .flags = 0,
457 .len = 1,
458 .buf = "\x00",
459 }, {
460 .addr = anysee_tda18212_config.i2c_address,
461 .flags = I2C_M_RD,
462 .len = 1,
463 .buf = &tmp,
464 }
465 };
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300466
Antti Palosaari41f81f62011-04-10 17:53:52 -0300467 /* Check which hardware we have.
468 * We must do this call two times to get reliable values (hw bug).
469 */
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300470 ret = anysee_get_hw_info(adap->dev, hw_info);
471 if (ret)
Antti Palosaari41f81f62011-04-10 17:53:52 -0300472 goto error;
473
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300474 ret = anysee_get_hw_info(adap->dev, hw_info);
475 if (ret)
Antti Palosaari41f81f62011-04-10 17:53:52 -0300476 goto error;
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300477
478 /* Meaning of these info bytes are guessed. */
Antti Palosaari592d9e22011-04-09 21:13:33 -0300479 info("firmware version:%d.%d hardware id:%d",
480 hw_info[1], hw_info[2], hw_info[0]);
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300481
Antti Palosaari41f81f62011-04-10 17:53:52 -0300482 state->hw = hw_info[0];
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300483
Antti Palosaari41f81f62011-04-10 17:53:52 -0300484 switch (state->hw) {
485 case ANYSEE_HW_02: /* 2 */
486 /* E30 */
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300487
Antti Palosaari41f81f62011-04-10 17:53:52 -0300488 /* attach demod */
489 adap->fe = dvb_attach(mt352_attach, &anysee_mt352_config,
490 &adap->dev->i2c_adap);
491 if (adap->fe)
492 break;
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300493
Antti Palosaari41f81f62011-04-10 17:53:52 -0300494 /* attach demod */
Antti Palosaari0f77c3a2008-08-11 10:54:16 -0300495 adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config,
Antti Palosaari41f81f62011-04-10 17:53:52 -0300496 &adap->dev->i2c_adap);
Antti Palosaari41f81f62011-04-10 17:53:52 -0300497
498 break;
499 case ANYSEE_HW_507CD: /* 6 */
500 /* E30 Plus */
501
502 /* enable DVB-T demod on IOD[0] */
503 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0), 0x01);
504 if (ret)
505 goto error;
506
507 /* enable transport stream on IOA[7] */
508 ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (0 << 7), 0x80);
509 if (ret)
510 goto error;
511
512 /* attach demod */
513 adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config,
514 &adap->dev->i2c_adap);
Antti Palosaari41f81f62011-04-10 17:53:52 -0300515
516 break;
517 case ANYSEE_HW_507DC: /* 10 */
518 /* E30 C Plus */
519
520 /* enable DVB-C demod on IOD[0] */
521 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0), 0x01);
522 if (ret)
523 goto error;
524
525 /* attach demod */
526 adap->fe = dvb_attach(tda10023_attach, &anysee_tda10023_config,
527 &adap->dev->i2c_adap, 0x48);
Antti Palosaari41f81f62011-04-10 17:53:52 -0300528
529 break;
Antti Palosaarif0a53102011-04-27 21:11:59 -0300530 case ANYSEE_HW_507SI: /* 11 */
531 /* E30 S2 Plus */
532
533 /* enable DVB-S/S2 demod on IOD[0] */
534 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0), 0x01);
535 if (ret)
536 goto error;
537
538 /* attach demod */
539 adap->fe = dvb_attach(cx24116_attach, &anysee_cx24116_config,
540 &adap->dev->i2c_adap);
541
542 break;
Antti Palosaari41f81f62011-04-10 17:53:52 -0300543 case ANYSEE_HW_507FA: /* 15 */
544 /* E30 Combo Plus */
545 /* E30 C Plus */
546
Antti Palosaari72ffd2b2011-04-10 20:14:50 -0300547 /* enable tuner on IOE[4] */
548 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10);
549 if (ret)
550 goto error;
551
552 /* probe TDA18212 */
553 tmp = 0;
554 ret = i2c_transfer(&adap->dev->i2c_adap, msg, 2);
555 if (ret == 2 && tmp == 0xc7)
556 deb_info("%s: TDA18212 found\n", __func__);
557 else
558 tmp = 0;
559
560 /* disable tuner on IOE[4] */
561 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 4), 0x10);
562 if (ret)
563 goto error;
564
Antti Palosaari41f81f62011-04-10 17:53:52 -0300565 if (dvb_usb_anysee_delsys) {
566 /* disable DVB-C demod on IOD[5] */
567 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 5),
568 0x20);
569 if (ret)
570 goto error;
571
572 /* enable DVB-T demod on IOD[0] */
573 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0),
574 0x01);
575 if (ret)
576 goto error;
577
578 /* attach demod */
Antti Palosaari72ffd2b2011-04-10 20:14:50 -0300579 if (tmp == 0xc7) {
580 /* TDA18212 config */
581 adap->fe = dvb_attach(zl10353_attach,
Antti Palosaari1fd80702011-04-12 17:34:08 -0300582 &anysee_zl10353_tda18212_config2,
Antti Palosaari72ffd2b2011-04-10 20:14:50 -0300583 &adap->dev->i2c_adap);
584 } else {
585 /* PLL config */
586 adap->fe = dvb_attach(zl10353_attach,
587 &anysee_zl10353_config,
588 &adap->dev->i2c_adap);
589 }
Antti Palosaari41f81f62011-04-10 17:53:52 -0300590 } else {
591 /* disable DVB-T demod on IOD[0] */
592 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 0),
593 0x01);
594 if (ret)
595 goto error;
596
597 /* enable DVB-C demod on IOD[5] */
598 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 5),
599 0x20);
600 if (ret)
601 goto error;
602
603 /* attach demod */
Antti Palosaari72ffd2b2011-04-10 20:14:50 -0300604 if (tmp == 0xc7) {
605 /* TDA18212 config */
606 adap->fe = dvb_attach(tda10023_attach,
607 &anysee_tda10023_tda18212_config,
608 &adap->dev->i2c_adap, 0x48);
609 } else {
610 /* PLL config */
611 adap->fe = dvb_attach(tda10023_attach,
612 &anysee_tda10023_config,
613 &adap->dev->i2c_adap, 0x48);
614 }
Antti Palosaari0f77c3a2008-08-11 10:54:16 -0300615 }
Antti Palosaarie82eea72011-04-12 19:43:30 -0300616
Antti Palosaari41f81f62011-04-10 17:53:52 -0300617 break;
Antti Palosaaria43be982011-04-10 20:23:02 -0300618 case ANYSEE_HW_508TC: /* 18 */
Antti Palosaari8439e0d2011-05-24 07:57:34 -0300619 case ANYSEE_HW_508PTC: /* 21 */
Antti Palosaaria43be982011-04-10 20:23:02 -0300620 /* E7 TC */
Antti Palosaari8439e0d2011-05-24 07:57:34 -0300621 /* E7 PTC */
Antti Palosaaria43be982011-04-10 20:23:02 -0300622
623 /* enable transport stream on IOA[7] */
624 ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (1 << 7), 0x80);
625 if (ret)
626 goto error;
627
628 if (dvb_usb_anysee_delsys) {
629 /* disable DVB-C demod on IOD[5] */
630 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 5),
631 0x20);
632 if (ret)
633 goto error;
634
635 /* enable DVB-T demod on IOD[6] */
636 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 6),
637 0x40);
638 if (ret)
639 goto error;
640
641 /* enable IF route on IOE[0] */
642 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 0),
643 0x01);
644 if (ret)
645 goto error;
646
647 /* attach demod */
648 adap->fe = dvb_attach(zl10353_attach,
649 &anysee_zl10353_tda18212_config,
650 &adap->dev->i2c_adap);
Antti Palosaaria43be982011-04-10 20:23:02 -0300651 } else {
652 /* disable DVB-T demod on IOD[6] */
653 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 6),
654 0x40);
655 if (ret)
656 goto error;
657
658 /* enable DVB-C demod on IOD[5] */
659 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 5),
660 0x20);
661 if (ret)
662 goto error;
663
664 /* enable IF route on IOE[0] */
665 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 0),
666 0x01);
667 if (ret)
668 goto error;
669
670 /* attach demod */
671 adap->fe = dvb_attach(tda10023_attach,
672 &anysee_tda10023_tda18212_config,
673 &adap->dev->i2c_adap, 0x48);
Antti Palosaaria43be982011-04-10 20:23:02 -0300674 }
Antti Palosaarie82eea72011-04-12 19:43:30 -0300675
Antti Palosaaria43be982011-04-10 20:23:02 -0300676 break;
Antti Palosaaribedbf3d2011-04-29 13:55:02 -0300677 case ANYSEE_HW_508S2: /* 19 */
Antti Palosaarifea3c392011-05-25 18:21:43 -0300678 case ANYSEE_HW_508PS2: /* 22 */
Antti Palosaaribedbf3d2011-04-29 13:55:02 -0300679 /* E7 S2 */
Antti Palosaarifea3c392011-05-25 18:21:43 -0300680 /* E7 PS2 */
Antti Palosaaribedbf3d2011-04-29 13:55:02 -0300681
682 /* enable transport stream on IOA[7] */
683 ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (1 << 7), 0x80);
684 if (ret)
685 goto error;
686
687 /* enable DVB-S/S2 demod on IOE[5] */
688 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 5), 0x20);
689 if (ret)
690 goto error;
691
692 /* attach demod */
693 adap->fe = dvb_attach(stv0900_attach, &anysee_stv0900_config,
694 &adap->dev->i2c_adap, 0);
695
696 break;
Antti Palosaari0f77c3a2008-08-11 10:54:16 -0300697 }
698
Antti Palosaari41f81f62011-04-10 17:53:52 -0300699 if (!adap->fe) {
700 /* we have no frontend :-( */
701 ret = -ENODEV;
Antti Palosaarie82eea72011-04-12 19:43:30 -0300702 err("Unsupported Anysee version. " \
703 "Please report the <linux-media@vger.kernel.org>.");
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300704 }
Antti Palosaari41f81f62011-04-10 17:53:52 -0300705error:
706 return ret;
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300707}
708
709static int anysee_tuner_attach(struct dvb_usb_adapter *adap)
710{
711 struct anysee_state *state = adap->dev->priv;
Antti Palosaari72ffd2b2011-04-10 20:14:50 -0300712 struct dvb_frontend *fe;
Antti Palosaarie82eea72011-04-12 19:43:30 -0300713 int ret;
Antti Palosaaria8494682010-10-17 18:25:10 -0300714 deb_info("%s:\n", __func__);
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300715
Antti Palosaari41f81f62011-04-10 17:53:52 -0300716 switch (state->hw) {
717 case ANYSEE_HW_02: /* 2 */
718 /* E30 */
719
720 /* attach tuner */
Antti Palosaarie82eea72011-04-12 19:43:30 -0300721 fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc2 >> 1),
Antti Palosaari7ea03d22011-04-09 20:50:07 -0300722 NULL, DVB_PLL_THOMSON_DTT7579);
Antti Palosaarie82eea72011-04-12 19:43:30 -0300723
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300724 break;
Antti Palosaari41f81f62011-04-10 17:53:52 -0300725 case ANYSEE_HW_507CD: /* 6 */
726 /* E30 Plus */
727
728 /* attach tuner */
Antti Palosaarie82eea72011-04-12 19:43:30 -0300729 fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc2 >> 1),
Antti Palosaari41f81f62011-04-10 17:53:52 -0300730 &adap->dev->i2c_adap, DVB_PLL_THOMSON_DTT7579);
731
732 break;
733 case ANYSEE_HW_507DC: /* 10 */
734 /* E30 C Plus */
735
736 /* attach tuner */
Antti Palosaarie82eea72011-04-12 19:43:30 -0300737 fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc0 >> 1),
Antti Palosaari7ea03d22011-04-09 20:50:07 -0300738 &adap->dev->i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A);
Antti Palosaarie82eea72011-04-12 19:43:30 -0300739
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300740 break;
Antti Palosaarif0a53102011-04-27 21:11:59 -0300741 case ANYSEE_HW_507SI: /* 11 */
742 /* E30 S2 Plus */
743
744 /* attach LNB controller */
745 fe = dvb_attach(isl6423_attach, adap->fe, &adap->dev->i2c_adap,
746 &anysee_isl6423_config);
747
748 break;
Antti Palosaari41f81f62011-04-10 17:53:52 -0300749 case ANYSEE_HW_507FA: /* 15 */
750 /* E30 Combo Plus */
751 /* E30 C Plus */
752
Antti Palosaari59fb4142011-04-12 10:22:47 -0300753 if (dvb_usb_anysee_delsys) {
754 /* enable DVB-T tuner on IOE[0] */
755 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 0),
756 0x01);
757 if (ret)
758 goto error;
759 } else {
760 /* enable DVB-C tuner on IOE[0] */
761 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 0),
762 0x01);
763 if (ret)
764 goto error;
765 }
766
Antti Palosaari72ffd2b2011-04-10 20:14:50 -0300767 /* Try first attach TDA18212 silicon tuner on IOE[4], if that
768 * fails attach old simple PLL. */
769
770 /* enable tuner on IOE[4] */
771 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10);
772 if (ret)
773 goto error;
774
775 /* attach tuner */
776 fe = dvb_attach(tda18212_attach, adap->fe, &adap->dev->i2c_adap,
777 &anysee_tda18212_config);
778 if (fe)
779 break;
780
781 /* disable tuner on IOE[4] */
782 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 4), 0x10);
783 if (ret)
784 goto error;
785
Antti Palosaari41f81f62011-04-10 17:53:52 -0300786 /* attach tuner */
Antti Palosaarie82eea72011-04-12 19:43:30 -0300787 fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc0 >> 1),
Antti Palosaari41f81f62011-04-10 17:53:52 -0300788 &adap->dev->i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A);
789
790 break;
Antti Palosaaria43be982011-04-10 20:23:02 -0300791 case ANYSEE_HW_508TC: /* 18 */
Antti Palosaari8439e0d2011-05-24 07:57:34 -0300792 case ANYSEE_HW_508PTC: /* 21 */
Antti Palosaaria43be982011-04-10 20:23:02 -0300793 /* E7 TC */
Antti Palosaari8439e0d2011-05-24 07:57:34 -0300794 /* E7 PTC */
Antti Palosaaria43be982011-04-10 20:23:02 -0300795
796 /* enable tuner on IOE[4] */
797 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10);
798 if (ret)
799 goto error;
800
801 /* attach tuner */
802 fe = dvb_attach(tda18212_attach, adap->fe, &adap->dev->i2c_adap,
803 &anysee_tda18212_config);
Antti Palosaaria43be982011-04-10 20:23:02 -0300804
805 break;
Antti Palosaaribedbf3d2011-04-29 13:55:02 -0300806 case ANYSEE_HW_508S2: /* 19 */
Antti Palosaarifea3c392011-05-25 18:21:43 -0300807 case ANYSEE_HW_508PS2: /* 22 */
Antti Palosaaribedbf3d2011-04-29 13:55:02 -0300808 /* E7 S2 */
Antti Palosaarifea3c392011-05-25 18:21:43 -0300809 /* E7 PS2 */
Antti Palosaaribedbf3d2011-04-29 13:55:02 -0300810
811 /* attach tuner */
812 fe = dvb_attach(stv6110_attach, adap->fe,
813 &anysee_stv6110_config, &adap->dev->i2c_adap);
814
815 if (fe) {
816 /* attach LNB controller */
817 fe = dvb_attach(isl6423_attach, adap->fe,
818 &adap->dev->i2c_adap, &anysee_isl6423_config);
819 }
820
821 break;
Antti Palosaari41f81f62011-04-10 17:53:52 -0300822 default:
Antti Palosaarie82eea72011-04-12 19:43:30 -0300823 fe = NULL;
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300824 }
825
Antti Palosaarie82eea72011-04-12 19:43:30 -0300826 if (fe)
827 ret = 0;
828 else
829 ret = -ENODEV;
830
Antti Palosaari41f81f62011-04-10 17:53:52 -0300831error:
832 return ret;
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300833}
834
Antti Palosaaria8494682010-10-17 18:25:10 -0300835static int anysee_rc_query(struct dvb_usb_device *d)
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300836{
837 u8 buf[] = {CMD_GET_IR_CODE};
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300838 u8 ircode[2];
Antti Palosaaria8494682010-10-17 18:25:10 -0300839 int ret;
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300840
Antti Palosaaria8494682010-10-17 18:25:10 -0300841 /* Remote controller is basic NEC using address byte 0x08.
842 Anysee device RC query returns only two bytes, status and code,
843 address byte is dropped. Also it does not return any value for
844 NEC RCs having address byte other than 0x08. Due to that, we
845 cannot use that device as standard NEC receiver.
846 It could be possible make hack which reads whole code directly
847 from device memory... */
848
849 ret = anysee_ctrl_msg(d, buf, sizeof(buf), ircode, sizeof(ircode));
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300850 if (ret)
851 return ret;
852
Antti Palosaaria8494682010-10-17 18:25:10 -0300853 if (ircode[0]) {
854 deb_rc("%s: key pressed %02x\n", __func__, ircode[1]);
Mauro Carvalho Chehabca866742010-11-17 13:53:11 -0300855 rc_keydown(d->rc_dev, 0x08 << 8 | ircode[1], 0);
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300856 }
Antti Palosaaria8494682010-10-17 18:25:10 -0300857
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300858 return 0;
859}
860
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300861/* DVB USB Driver stuff */
862static struct dvb_usb_device_properties anysee_properties;
863
864static int anysee_probe(struct usb_interface *intf,
865 const struct usb_device_id *id)
866{
867 struct dvb_usb_device *d;
868 struct usb_host_interface *alt;
869 int ret;
870
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300871 /* There is one interface with two alternate settings.
872 Alternate setting 0 is for bulk transfer.
873 Alternate setting 1 is for isochronous transfer.
874 We use bulk transfer (alternate setting 0). */
875 if (intf->num_altsetting < 1)
876 return -ENODEV;
877
Dan Carpenter8b0d7042010-05-31 16:27:39 -0300878 /*
879 * Anysee is always warm (its USB-bridge, Cypress FX2, uploads
880 * firmware from eeprom). If dvb_usb_device_init() succeeds that
881 * means d is a valid pointer.
882 */
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300883 ret = dvb_usb_device_init(intf, &anysee_properties, THIS_MODULE, &d,
884 adapter_nr);
885 if (ret)
886 return ret;
887
888 alt = usb_altnum_to_altsetting(intf, 0);
889 if (alt == NULL) {
890 deb_info("%s: no alt found!\n", __func__);
891 return -ENODEV;
892 }
893
894 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
895 alt->desc.bAlternateSetting);
896 if (ret)
897 return ret;
898
Dan Carpenter8b0d7042010-05-31 16:27:39 -0300899 return anysee_init(d);
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300900}
901
Antti Palosaariae3745f2009-09-16 19:50:25 -0300902static struct usb_device_id anysee_table[] = {
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300903 { USB_DEVICE(USB_VID_CYPRESS, USB_PID_ANYSEE) },
904 { USB_DEVICE(USB_VID_AMT, USB_PID_ANYSEE) },
905 { } /* Terminating entry */
906};
907MODULE_DEVICE_TABLE(usb, anysee_table);
908
909static struct dvb_usb_device_properties anysee_properties = {
910 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
911
912 .usb_ctrl = DEVICE_SPECIFIC,
913
914 .size_of_priv = sizeof(struct anysee_state),
915
916 .num_adapters = 1,
917 .adapter = {
918 {
919 .streaming_ctrl = anysee_streaming_ctrl,
920 .frontend_attach = anysee_frontend_attach,
921 .tuner_attach = anysee_tuner_attach,
922 .stream = {
923 .type = USB_BULK,
924 .count = 8,
925 .endpoint = 0x82,
926 .u = {
927 .bulk = {
Antti Palosaariab693332009-09-16 19:47:01 -0300928 .buffersize = (16*512),
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300929 }
930 }
931 },
932 }
933 },
934
Antti Palosaaria8494682010-10-17 18:25:10 -0300935 .rc.core = {
936 .rc_codes = RC_MAP_ANYSEE,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -0300937 .protocol = RC_TYPE_OTHER,
Antti Palosaaria8494682010-10-17 18:25:10 -0300938 .module_name = "anysee",
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -0300939 .rc_query = anysee_rc_query,
Antti Palosaaria8494682010-10-17 18:25:10 -0300940 .rc_interval = 250, /* windows driver uses 500ms */
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -0300941 },
Antti Palosaaria51e34d2008-05-17 23:05:48 -0300942
943 .i2c_algo = &anysee_i2c_algo,
944
945 .generic_bulk_ctrl_endpoint = 1,
946
947 .num_device_descs = 1,
948 .devices = {
949 {
950 .name = "Anysee DVB USB2.0",
951 .cold_ids = {NULL},
952 .warm_ids = {&anysee_table[0],
953 &anysee_table[1], NULL},
954 },
955 }
956};
957
958static struct usb_driver anysee_driver = {
959 .name = "dvb_usb_anysee",
960 .probe = anysee_probe,
961 .disconnect = dvb_usb_device_exit,
962 .id_table = anysee_table,
963};
964
965/* module stuff */
966static int __init anysee_module_init(void)
967{
968 int ret;
969
970 ret = usb_register(&anysee_driver);
971 if (ret)
972 err("%s: usb_register failed. Error number %d", __func__, ret);
973
974 return ret;
975}
976
977static void __exit anysee_module_exit(void)
978{
979 /* deregister this driver from the USB subsystem */
980 usb_deregister(&anysee_driver);
981}
982
983module_init(anysee_module_init);
984module_exit(anysee_module_exit);
985
986MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
987MODULE_DESCRIPTION("Driver Anysee E30 DVB-C & DVB-T USB2.0");
988MODULE_LICENSE("GPL");