2 * DVB USB Linux driver for Anysee E30 DVB-C & DVB-T USB2.0 receiver
4 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
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.
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.
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.
21 * - add smart card reader support for Conditional Access (CA)
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.
30 * Any help according to implement serial smart card reader support
37 #include "mt352_priv.h"
46 static int dvb_usb_anysee_debug;
47 module_param_named(debug, dvb_usb_anysee_debug, int, 0644);
48 MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
49 static int dvb_usb_anysee_delsys;
50 module_param_named(delsys, dvb_usb_anysee_delsys, int, 0644);
51 MODULE_PARM_DESC(delsys, "select delivery mode (0=DVB-C, 1=DVB-T)");
52 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
54 static DEFINE_MUTEX(anysee_usb_mutex);
56 static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen,
59 struct anysee_state *state = d->priv;
63 if (slen > sizeof(buf))
65 memcpy(&buf[0], sbuf, slen);
66 buf[60] = state->seq++;
68 if (mutex_lock_interruptible(&anysee_usb_mutex) < 0)
71 /* We need receive one message more after dvb_usb_generic_rw due
72 to weird transaction flow, which is 1 x send + 2 x receive. */
73 ret = dvb_usb_generic_rw(d, buf, sizeof(buf), buf, sizeof(buf), 0);
76 /* receive 2nd answer */
77 ret = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev,
78 d->props.generic_bulk_ctrl_endpoint), buf, sizeof(buf),
81 err("%s: recv bulk message failed: %d", __func__, ret);
84 debug_dump(buf, act_len, deb_xfer);
88 /* read request, copy returned data to return buf */
89 if (!ret && rbuf && rlen)
90 memcpy(rbuf, buf, rlen);
92 mutex_unlock(&anysee_usb_mutex);
97 static int anysee_read_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
99 u8 buf[] = {CMD_REG_READ, reg >> 8, reg & 0xff, 0x01};
101 ret = anysee_ctrl_msg(d, buf, sizeof(buf), val, 1);
102 deb_info("%s: reg:%04x val:%02x\n", __func__, reg, *val);
106 static int anysee_write_reg(struct dvb_usb_device *d, u16 reg, u8 val)
108 u8 buf[] = {CMD_REG_WRITE, reg >> 8, reg & 0xff, 0x01, val};
109 deb_info("%s: reg:%04x val:%02x\n", __func__, reg, val);
110 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
113 /* write single register with mask */
114 static int anysee_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val,
120 /* no need for read if whole reg is written */
122 ret = anysee_read_reg(d, reg, &tmp);
131 return anysee_write_reg(d, reg, val);
134 static int anysee_get_hw_info(struct dvb_usb_device *d, u8 *id)
136 u8 buf[] = {CMD_GET_HW_INFO};
137 return anysee_ctrl_msg(d, buf, sizeof(buf), id, 3);
140 static int anysee_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
142 u8 buf[] = {CMD_STREAMING_CTRL, (u8)onoff, 0x00};
143 deb_info("%s: onoff:%02x\n", __func__, onoff);
144 return anysee_ctrl_msg(adap->dev, buf, sizeof(buf), NULL, 0);
147 static int anysee_led_ctrl(struct dvb_usb_device *d, u8 mode, u8 interval)
149 u8 buf[] = {CMD_LED_AND_IR_CTRL, 0x01, mode, interval};
150 deb_info("%s: state:%02x interval:%02x\n", __func__, mode, interval);
151 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
154 static int anysee_ir_ctrl(struct dvb_usb_device *d, u8 onoff)
156 u8 buf[] = {CMD_LED_AND_IR_CTRL, 0x02, onoff};
157 deb_info("%s: onoff:%02x\n", __func__, onoff);
158 return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
161 static int anysee_init(struct dvb_usb_device *d)
165 ret = anysee_led_ctrl(d, 0x01, 0x03);
170 ret = anysee_ir_ctrl(d, 1);
178 static int anysee_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msg,
181 struct dvb_usb_device *d = i2c_get_adapdata(adap);
182 int ret = 0, inc, i = 0;
184 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
188 if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) {
190 buf[0] = CMD_I2C_READ;
191 buf[1] = (msg[i].addr << 1) | 0x01;
192 buf[2] = msg[i].buf[0];
193 buf[3] = msg[i].buf[1];
194 buf[4] = msg[i].len-1;
195 buf[5] = msg[i+1].len;
196 ret = anysee_ctrl_msg(d, buf, sizeof(buf), msg[i+1].buf,
200 u8 buf[4+msg[i].len];
201 buf[0] = CMD_I2C_WRITE;
202 buf[1] = (msg[i].addr << 1);
205 memcpy(&buf[4], msg[i].buf, msg[i].len);
206 ret = anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
215 mutex_unlock(&d->i2c_mutex);
217 return ret ? ret : i;
220 static u32 anysee_i2c_func(struct i2c_adapter *adapter)
225 static struct i2c_algorithm anysee_i2c_algo = {
226 .master_xfer = anysee_master_xfer,
227 .functionality = anysee_i2c_func,
230 static int anysee_mt352_demod_init(struct dvb_frontend *fe)
232 static u8 clock_config[] = { CLOCK_CTL, 0x38, 0x28 };
233 static u8 reset[] = { RESET, 0x80 };
234 static u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 };
235 static u8 agc_cfg[] = { AGC_TARGET, 0x28, 0x20 };
236 static u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 };
237 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
239 mt352_write(fe, clock_config, sizeof(clock_config));
241 mt352_write(fe, reset, sizeof(reset));
242 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
244 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
245 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
246 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
251 /* Callbacks for DVB USB */
252 static struct tda10023_config anysee_tda10023_config = {
253 .demod_address = (0x1a >> 1),
259 .output_mode = TDA10023_OUTPUT_MODE_PARALLEL_C,
263 static struct mt352_config anysee_mt352_config = {
264 .demod_address = (0x1e >> 1),
265 .demod_init = anysee_mt352_demod_init,
268 static struct zl10353_config anysee_zl10353_config = {
269 .demod_address = (0x1e >> 1),
273 static struct zl10353_config anysee_zl10353_tda18212_config2 = {
274 .demod_address = (0x1e >> 1),
276 .disable_i2c_gate_ctrl = 1,
281 static struct zl10353_config anysee_zl10353_tda18212_config = {
282 .demod_address = (0x18 >> 1),
284 .disable_i2c_gate_ctrl = 1,
289 static struct tda10023_config anysee_tda10023_tda18212_config = {
290 .demod_address = (0x1a >> 1),
295 .output_mode = TDA10023_OUTPUT_MODE_PARALLEL_C,
299 static struct tda18212_config anysee_tda18212_config = {
300 .i2c_address = (0xc0 >> 1),
307 static struct cx24116_config anysee_cx24116_config = {
308 .demod_address = (0xaa >> 1),
309 .mpg_clk_pos_pol = 0x00,
313 static struct stv0900_config anysee_stv0900_config = {
314 .demod_address = (0xd0 >> 1),
320 .tun1_adc = 1, /* 1 Vpp */
324 static struct stv6110_config anysee_stv6110_config = {
325 .i2c_address = (0xc0 >> 1),
330 static struct isl6423_config anysee_isl6423_config = {
331 .current_max = SEC_CURRENT_800m,
332 .curlim = SEC_CURRENT_LIM_OFF,
338 * New USB device strings: Mfr=1, Product=2, SerialNumber=0
339 * Manufacturer: AMT.CO.KR
341 * E30 VID=04b4 PID=861f HW=2 FW=2.1 Product=????????
343 * parts: DNOS404ZH102A(MT352, DTT7579(?))
345 * E30 VID=04b4 PID=861f HW=2 FW=2.1 Product=????????
347 * parts: DNOS404ZH103A(ZL10353, DTT7579(?))
349 * E30 Plus VID=04b4 PID=861f HW=6 FW=1.0 "anysee"
350 * PCB: 507CD (rev1.1)
351 * parts: DNOS404ZH103A(ZL10353, DTT7579(?)), CST56I01
352 * OEA=80 OEB=00 OEC=00 OED=ff OEF=fe
353 * IOA=4f IOB=ff IOC=00 IOD=06 IOF=01
354 * IOD[0] ZL10353 1=enabled
355 * IOA[7] TS 0=enabled
356 * tuner is not behind ZL10353 I2C-gate (no care if gate disabled or not)
358 * E30 C Plus VID=04b4 PID=861f HW=10 FW=1.0 "anysee-DC(LP)"
359 * PCB: 507DC (rev0.2)
360 * parts: TDA10023, DTOS403IH102B TM, CST56I01
361 * OEA=80 OEB=00 OEC=00 OED=ff OEF=fe
362 * IOA=4f IOB=ff IOC=00 IOD=26 IOF=01
363 * IOD[0] TDA10023 1=enabled
365 * E30 S2 Plus VID=04b4 PID=861f HW=11 FW=0.1 "anysee-S2(LP)"
366 * PCB: 507SI (rev2.1)
367 * parts: BS2N10WCC01(CX24116, CX24118), ISL6423, TDA8024
368 * OEA=80 OEB=00 OEC=ff OED=ff OEF=fe
369 * IOA=4d IOB=ff IOC=00 IOD=26 IOF=01
370 * IOD[0] CX24116 1=enabled
372 * E30 C Plus VID=1c73 PID=861f HW=15 FW=1.2 "anysee-FA(LP)"
373 * PCB: 507FA (rev0.4)
374 * parts: TDA10023, DTOS403IH102B TM, TDA8024
375 * OEA=80 OEB=00 OEC=ff OED=ff OEF=ff
376 * IOA=4d IOB=ff IOC=00 IOD=00 IOF=c0
377 * IOD[5] TDA10023 1=enabled
378 * IOE[0] tuner 1=enabled
380 * E30 Combo Plus VID=1c73 PID=861f HW=15 FW=1.2 "anysee-FA(LP)"
381 * PCB: 507FA (rev1.1)
382 * parts: ZL10353, TDA10023, DTOS403IH102B TM, TDA8024
383 * OEA=80 OEB=00 OEC=ff OED=ff OEF=ff
384 * IOA=4d IOB=ff IOC=00 IOD=00 IOF=c0
386 * IOD[5] TDA10023 1=enabled
387 * IOE[0] tuner 1=enabled
389 * IOD[0] ZL10353 1=enabled
390 * IOE[0] tuner 0=enabled
391 * tuner is behind ZL10353 I2C-gate
393 * E7 TC VID=1c73 PID=861f HW=18 FW=0.7 AMTCI=0.5 "anysee-E7TC(LP)"
394 * PCB: 508TC (rev0.6)
395 * parts: ZL10353, TDA10023, DNOD44CDH086A(TDA18212)
396 * OEA=80 OEB=00 OEC=03 OED=f7 OEF=ff
397 * IOA=4d IOB=00 IOC=cc IOD=48 IOF=e4
398 * IOA[7] TS 1=enabled
399 * IOE[4] TDA18212 1=enabled
401 * IOD[6] ZL10353 0=disabled
402 * IOD[5] TDA10023 1=enabled
403 * IOE[0] IF 1=enabled
405 * IOD[5] TDA10023 0=disabled
406 * IOD[6] ZL10353 1=enabled
407 * IOE[0] IF 0=enabled
409 * E7 S2 VID=1c73 PID=861f HW=19 FW=0.4 AMTCI=0.5 "anysee-E7S2(LP)"
410 * PCB: 508S2 (rev0.7)
411 * parts: DNBU10512IST(STV0903, STV6110), ISL6423
412 * OEA=80 OEB=00 OEC=03 OED=f7 OEF=ff
413 * IOA=4d IOB=00 IOC=c4 IOD=08 IOF=e4
414 * IOA[7] TS 1=enabled
415 * IOE[5] STV0903 1=enabled
419 static int anysee_frontend_attach(struct dvb_usb_adapter *adap)
422 struct anysee_state *state = adap->dev->priv;
425 struct i2c_msg msg[2] = {
427 .addr = anysee_tda18212_config.i2c_address,
432 .addr = anysee_tda18212_config.i2c_address,
439 /* Check which hardware we have.
440 * We must do this call two times to get reliable values (hw bug).
442 ret = anysee_get_hw_info(adap->dev, hw_info);
446 ret = anysee_get_hw_info(adap->dev, hw_info);
450 /* Meaning of these info bytes are guessed. */
451 info("firmware version:%d.%d hardware id:%d",
452 hw_info[1], hw_info[2], hw_info[0]);
454 state->hw = hw_info[0];
457 case ANYSEE_HW_02: /* 2 */
461 adap->fe = dvb_attach(mt352_attach, &anysee_mt352_config,
462 &adap->dev->i2c_adap);
467 adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config,
468 &adap->dev->i2c_adap);
471 case ANYSEE_HW_507CD: /* 6 */
474 /* enable DVB-T demod on IOD[0] */
475 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0), 0x01);
479 /* enable transport stream on IOA[7] */
480 ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (0 << 7), 0x80);
485 adap->fe = dvb_attach(zl10353_attach, &anysee_zl10353_config,
486 &adap->dev->i2c_adap);
489 case ANYSEE_HW_507DC: /* 10 */
492 /* enable DVB-C demod on IOD[0] */
493 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0), 0x01);
498 adap->fe = dvb_attach(tda10023_attach, &anysee_tda10023_config,
499 &adap->dev->i2c_adap, 0x48);
502 case ANYSEE_HW_507SI: /* 11 */
505 /* enable DVB-S/S2 demod on IOD[0] */
506 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0), 0x01);
511 adap->fe = dvb_attach(cx24116_attach, &anysee_cx24116_config,
512 &adap->dev->i2c_adap);
515 case ANYSEE_HW_507FA: /* 15 */
519 /* enable tuner on IOE[4] */
520 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10);
526 ret = i2c_transfer(&adap->dev->i2c_adap, msg, 2);
527 if (ret == 2 && tmp == 0xc7)
528 deb_info("%s: TDA18212 found\n", __func__);
532 /* disable tuner on IOE[4] */
533 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 4), 0x10);
537 if (dvb_usb_anysee_delsys) {
538 /* disable DVB-C demod on IOD[5] */
539 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 5),
544 /* enable DVB-T demod on IOD[0] */
545 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 0),
552 /* TDA18212 config */
553 adap->fe = dvb_attach(zl10353_attach,
554 &anysee_zl10353_tda18212_config2,
555 &adap->dev->i2c_adap);
558 adap->fe = dvb_attach(zl10353_attach,
559 &anysee_zl10353_config,
560 &adap->dev->i2c_adap);
563 /* disable DVB-T demod on IOD[0] */
564 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 0),
569 /* enable DVB-C demod on IOD[5] */
570 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 5),
577 /* TDA18212 config */
578 adap->fe = dvb_attach(tda10023_attach,
579 &anysee_tda10023_tda18212_config,
580 &adap->dev->i2c_adap, 0x48);
583 adap->fe = dvb_attach(tda10023_attach,
584 &anysee_tda10023_config,
585 &adap->dev->i2c_adap, 0x48);
590 case ANYSEE_HW_508TC: /* 18 */
593 /* enable transport stream on IOA[7] */
594 ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (1 << 7), 0x80);
598 if (dvb_usb_anysee_delsys) {
599 /* disable DVB-C demod on IOD[5] */
600 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 5),
605 /* enable DVB-T demod on IOD[6] */
606 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 6),
611 /* enable IF route on IOE[0] */
612 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 0),
618 adap->fe = dvb_attach(zl10353_attach,
619 &anysee_zl10353_tda18212_config,
620 &adap->dev->i2c_adap);
622 /* disable DVB-T demod on IOD[6] */
623 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (0 << 6),
628 /* enable DVB-C demod on IOD[5] */
629 ret = anysee_wr_reg_mask(adap->dev, REG_IOD, (1 << 5),
634 /* enable IF route on IOE[0] */
635 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 0),
641 adap->fe = dvb_attach(tda10023_attach,
642 &anysee_tda10023_tda18212_config,
643 &adap->dev->i2c_adap, 0x48);
647 case ANYSEE_HW_508S2: /* 19 */
650 /* enable transport stream on IOA[7] */
651 ret = anysee_wr_reg_mask(adap->dev, REG_IOA, (1 << 7), 0x80);
655 /* enable DVB-S/S2 demod on IOE[5] */
656 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 5), 0x20);
661 adap->fe = dvb_attach(stv0900_attach, &anysee_stv0900_config,
662 &adap->dev->i2c_adap, 0);
668 /* we have no frontend :-( */
670 err("Unsupported Anysee version. " \
671 "Please report the <linux-media@vger.kernel.org>.");
677 static int anysee_tuner_attach(struct dvb_usb_adapter *adap)
679 struct anysee_state *state = adap->dev->priv;
680 struct dvb_frontend *fe;
682 deb_info("%s:\n", __func__);
685 case ANYSEE_HW_02: /* 2 */
689 fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc2 >> 1),
690 NULL, DVB_PLL_THOMSON_DTT7579);
693 case ANYSEE_HW_507CD: /* 6 */
697 fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc2 >> 1),
698 &adap->dev->i2c_adap, DVB_PLL_THOMSON_DTT7579);
701 case ANYSEE_HW_507DC: /* 10 */
705 fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc0 >> 1),
706 &adap->dev->i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A);
709 case ANYSEE_HW_507SI: /* 11 */
712 /* attach LNB controller */
713 fe = dvb_attach(isl6423_attach, adap->fe, &adap->dev->i2c_adap,
714 &anysee_isl6423_config);
717 case ANYSEE_HW_507FA: /* 15 */
721 if (dvb_usb_anysee_delsys) {
722 /* enable DVB-T tuner on IOE[0] */
723 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 0),
728 /* enable DVB-C tuner on IOE[0] */
729 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 0),
735 /* Try first attach TDA18212 silicon tuner on IOE[4], if that
736 * fails attach old simple PLL. */
738 /* enable tuner on IOE[4] */
739 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10);
744 fe = dvb_attach(tda18212_attach, adap->fe, &adap->dev->i2c_adap,
745 &anysee_tda18212_config);
749 /* disable tuner on IOE[4] */
750 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 4), 0x10);
755 fe = dvb_attach(dvb_pll_attach, adap->fe, (0xc0 >> 1),
756 &adap->dev->i2c_adap, DVB_PLL_SAMSUNG_DTOS403IH102A);
759 case ANYSEE_HW_508TC: /* 18 */
762 /* enable tuner on IOE[4] */
763 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10);
768 fe = dvb_attach(tda18212_attach, adap->fe, &adap->dev->i2c_adap,
769 &anysee_tda18212_config);
772 case ANYSEE_HW_508S2: /* 19 */
776 fe = dvb_attach(stv6110_attach, adap->fe,
777 &anysee_stv6110_config, &adap->dev->i2c_adap);
780 /* attach LNB controller */
781 fe = dvb_attach(isl6423_attach, adap->fe,
782 &adap->dev->i2c_adap, &anysee_isl6423_config);
799 static int anysee_rc_query(struct dvb_usb_device *d)
801 u8 buf[] = {CMD_GET_IR_CODE};
805 /* Remote controller is basic NEC using address byte 0x08.
806 Anysee device RC query returns only two bytes, status and code,
807 address byte is dropped. Also it does not return any value for
808 NEC RCs having address byte other than 0x08. Due to that, we
809 cannot use that device as standard NEC receiver.
810 It could be possible make hack which reads whole code directly
811 from device memory... */
813 ret = anysee_ctrl_msg(d, buf, sizeof(buf), ircode, sizeof(ircode));
818 deb_rc("%s: key pressed %02x\n", __func__, ircode[1]);
819 rc_keydown(d->rc_dev, 0x08 << 8 | ircode[1], 0);
825 /* DVB USB Driver stuff */
826 static struct dvb_usb_device_properties anysee_properties;
828 static int anysee_probe(struct usb_interface *intf,
829 const struct usb_device_id *id)
831 struct dvb_usb_device *d;
832 struct usb_host_interface *alt;
835 /* There is one interface with two alternate settings.
836 Alternate setting 0 is for bulk transfer.
837 Alternate setting 1 is for isochronous transfer.
838 We use bulk transfer (alternate setting 0). */
839 if (intf->num_altsetting < 1)
843 * Anysee is always warm (its USB-bridge, Cypress FX2, uploads
844 * firmware from eeprom). If dvb_usb_device_init() succeeds that
845 * means d is a valid pointer.
847 ret = dvb_usb_device_init(intf, &anysee_properties, THIS_MODULE, &d,
852 alt = usb_altnum_to_altsetting(intf, 0);
854 deb_info("%s: no alt found!\n", __func__);
858 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
859 alt->desc.bAlternateSetting);
863 return anysee_init(d);
866 static struct usb_device_id anysee_table[] = {
867 { USB_DEVICE(USB_VID_CYPRESS, USB_PID_ANYSEE) },
868 { USB_DEVICE(USB_VID_AMT, USB_PID_ANYSEE) },
869 { } /* Terminating entry */
871 MODULE_DEVICE_TABLE(usb, anysee_table);
873 static struct dvb_usb_device_properties anysee_properties = {
874 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
876 .usb_ctrl = DEVICE_SPECIFIC,
878 .size_of_priv = sizeof(struct anysee_state),
883 .streaming_ctrl = anysee_streaming_ctrl,
884 .frontend_attach = anysee_frontend_attach,
885 .tuner_attach = anysee_tuner_attach,
892 .buffersize = (16*512),
900 .rc_codes = RC_MAP_ANYSEE,
901 .protocol = RC_TYPE_OTHER,
902 .module_name = "anysee",
903 .rc_query = anysee_rc_query,
904 .rc_interval = 250, /* windows driver uses 500ms */
907 .i2c_algo = &anysee_i2c_algo,
909 .generic_bulk_ctrl_endpoint = 1,
911 .num_device_descs = 1,
914 .name = "Anysee DVB USB2.0",
916 .warm_ids = {&anysee_table[0],
917 &anysee_table[1], NULL},
922 static struct usb_driver anysee_driver = {
923 .name = "dvb_usb_anysee",
924 .probe = anysee_probe,
925 .disconnect = dvb_usb_device_exit,
926 .id_table = anysee_table,
930 static int __init anysee_module_init(void)
934 ret = usb_register(&anysee_driver);
936 err("%s: usb_register failed. Error number %d", __func__, ret);
941 static void __exit anysee_module_exit(void)
943 /* deregister this driver from the USB subsystem */
944 usb_deregister(&anysee_driver);
947 module_init(anysee_module_init);
948 module_exit(anysee_module_exit);
950 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
951 MODULE_DESCRIPTION("Driver Anysee E30 DVB-C & DVB-T USB2.0");
952 MODULE_LICENSE("GPL");