2 * Copyright (C) 2010 Michael Krufky (mkrufky@kernellabs.com)
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation, version 2.
8 * see Documentation/dvb/README.dvb-usb for more information
11 #include <linux/vmalloc.h>
12 #include <linux/i2c.h>
15 #include "mxl111sf-reg.h"
16 #include "mxl111sf-phy.h"
17 #include "mxl111sf-i2c.h"
18 #include "mxl111sf-gpio.h"
20 #include "mxl111sf-demod.h"
21 #include "mxl111sf-tuner.h"
26 int dvb_usb_mxl111sf_debug;
27 module_param_named(debug, dvb_usb_mxl111sf_debug, int, 0644);
28 MODULE_PARM_DESC(debug, "set debugging level "
29 "(1=info, 2=xfer, 4=i2c, 8=reg, 16=adv (or-able)).");
31 int dvb_usb_mxl111sf_isoc;
32 module_param_named(isoc, dvb_usb_mxl111sf_isoc, int, 0644);
33 MODULE_PARM_DESC(isoc, "enable usb isoc xfer (0=bulk, 1=isoc).");
35 int dvb_usb_mxl111sf_spi;
36 module_param_named(spi, dvb_usb_mxl111sf_spi, int, 0644);
37 MODULE_PARM_DESC(spi, "use spi rather than tp for data xfer (0=tp, 1=spi).");
39 #define ANT_PATH_AUTO 0
40 #define ANT_PATH_EXTERNAL 1
41 #define ANT_PATH_INTERNAL 2
43 int dvb_usb_mxl111sf_rfswitch =
50 module_param_named(rfswitch, dvb_usb_mxl111sf_rfswitch, int, 0644);
51 MODULE_PARM_DESC(rfswitch, "force rf switch position (0=auto, 1=ext, 2=int).");
53 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
55 #define deb_info(args...) dprintk(dvb_usb_mxl111sf_debug, 0x13, args)
56 #define deb_reg(args...) dprintk(dvb_usb_mxl111sf_debug, 0x08, args)
57 #define deb_adv(args...) dprintk(dvb_usb_mxl111sf_debug, MXL_ADV_DBG, args)
59 int mxl111sf_ctrl_msg(struct dvb_usb_device *d,
60 u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
62 int wo = (rbuf == NULL || rlen == 0); /* write-only */
66 deb_adv("%s(wlen = %d, rlen = %d)\n", __func__, wlen, rlen);
68 memset(sndbuf, 0, 1+wlen);
71 memcpy(&sndbuf[1], wbuf, wlen);
73 ret = (wo) ? dvb_usb_generic_write(d, sndbuf, 1+wlen) :
74 dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0);
80 /* ------------------------------------------------------------------------ */
82 #define MXL_CMD_REG_READ 0xaa
83 #define MXL_CMD_REG_WRITE 0x55
85 int mxl111sf_read_reg(struct mxl111sf_state *state, u8 addr, u8 *data)
90 ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_READ, &addr, 1, buf, 2);
92 mxl_debug("error reading reg: 0x%02x", addr);
99 err("invalid response reading reg: 0x%02x != 0x%02x, 0x%02x",
100 addr, buf[0], buf[1]);
104 deb_reg("R: (0x%02x, 0x%02x)\n", addr, *data);
109 int mxl111sf_write_reg(struct mxl111sf_state *state, u8 addr, u8 data)
111 u8 buf[] = { addr, data };
114 deb_reg("W: (0x%02x, 0x%02x)\n", addr, data);
116 ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_WRITE, buf, 2, NULL, 0);
118 err("error writing reg: 0x%02x, val: 0x%02x", addr, data);
122 /* ------------------------------------------------------------------------ */
124 int mxl111sf_write_reg_mask(struct mxl111sf_state *state,
125 u8 addr, u8 mask, u8 data)
131 ret = mxl111sf_read_reg(state, addr, &val);
133 /* dont know why this usually errors out on the first try */
135 err("error writing addr: 0x%02x, mask: 0x%02x, "
136 "data: 0x%02x, retrying...", addr, mask, data);
138 ret = mxl111sf_read_reg(state, addr, &val);
146 ret = mxl111sf_write_reg(state, addr, val);
152 /* ------------------------------------------------------------------------ */
154 int mxl111sf_ctrl_program_regs(struct mxl111sf_state *state,
155 struct mxl111sf_reg_ctrl_info *ctrl_reg_info)
159 for (i = 0; ctrl_reg_info[i].addr |
160 ctrl_reg_info[i].mask |
161 ctrl_reg_info[i].data; i++) {
163 ret = mxl111sf_write_reg_mask(state,
164 ctrl_reg_info[i].addr,
165 ctrl_reg_info[i].mask,
166 ctrl_reg_info[i].data);
168 err("failed on reg #%d (0x%02x)", i,
169 ctrl_reg_info[i].addr);
176 /* ------------------------------------------------------------------------ */
178 static int mxl1x1sf_get_chip_info(struct mxl111sf_state *state)
182 char *mxl_chip, *mxl_rev;
184 if ((state->chip_id) && (state->chip_ver))
187 ret = mxl111sf_read_reg(state, CHIP_ID_REG, &id);
192 ret = mxl111sf_read_reg(state, TOP_CHIP_REV_ID_REG, &ver);
195 state->chip_ver = ver;
199 mxl_chip = "MxL101SF";
202 mxl_chip = "MxL111SF";
205 mxl_chip = "UNKNOWN MxL1X1";
210 state->chip_rev = MXL111SF_V6;
214 state->chip_rev = MXL111SF_V8_100;
218 state->chip_rev = MXL111SF_V8_200;
223 mxl_rev = "UNKNOWN REVISION";
226 info("%s detected, %s (0x%x)", mxl_chip, mxl_rev, ver);
231 #define get_chip_info(state) \
234 ___ret = mxl1x1sf_get_chip_info(state); \
235 if (mxl_fail(___ret)) { \
236 mxl_debug("failed to get chip info" \
237 " on first probe attempt"); \
238 ___ret = mxl1x1sf_get_chip_info(state); \
239 if (mxl_fail(___ret)) \
240 err("failed to get chip info during probe"); \
242 mxl_debug("probe needed a retry " \
243 "in order to succeed."); \
248 /* ------------------------------------------------------------------------ */
250 static int mxl111sf_power_ctrl(struct dvb_usb_device *d, int onoff)
252 /* power control depends on which adapter is being woken:
253 * save this for init, instead, via mxl111sf_adap_fe_init */
257 static int mxl111sf_adap_fe_init(struct dvb_frontend *fe)
259 struct dvb_usb_adapter *adap = fe->dvb->priv;
260 struct dvb_usb_device *d = adap->dev;
261 struct mxl111sf_state *state = d->priv;
262 struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe->id].priv;
266 /* exit if we didnt initialize the driver yet */
267 if (!state->chip_id) {
268 mxl_debug("driver not yet initialized, exit.");
272 deb_info("%s()\n", __func__);
274 mutex_lock(&state->fe_lock);
276 state->alt_mode = adap_state->alt_mode;
278 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
279 err("set interface failed");
281 err = mxl1x1sf_soft_reset(state);
283 err = mxl111sf_init_tuner_demod(state);
285 err = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
288 mxl111sf_enable_usb_output(state);
290 mxl1x1sf_top_master_ctrl(state, 1);
293 if ((MXL111SF_GPIO_MOD_DVBT != adap_state->gpio_mode) &&
294 (state->chip_rev > MXL111SF_V6)) {
295 mxl111sf_config_pin_mux_modes(state,
296 PIN_MUX_TS_SPI_IN_MODE_1);
299 err = mxl111sf_init_port_expander(state);
300 if (!mxl_fail(err)) {
301 state->gpio_mode = adap_state->gpio_mode;
302 err = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
305 err = fe->ops.init(fe);
307 msleep(100); /* add short delay after enabling
308 * the demod before touching it */
311 return (adap_state->fe_init) ? adap_state->fe_init(fe) : 0;
316 static int mxl111sf_adap_fe_sleep(struct dvb_frontend *fe)
318 struct dvb_usb_adapter *adap = fe->dvb->priv;
319 struct dvb_usb_device *d = adap->dev;
320 struct mxl111sf_state *state = d->priv;
321 struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe->id].priv;
324 /* exit if we didnt initialize the driver yet */
325 if (!state->chip_id) {
326 mxl_debug("driver not yet initialized, exit.");
330 deb_info("%s()\n", __func__);
332 err = (adap_state->fe_sleep) ? adap_state->fe_sleep(fe) : 0;
334 mutex_unlock(&state->fe_lock);
342 static int mxl111sf_ep6_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
344 struct dvb_usb_device *d = adap->dev;
345 struct mxl111sf_state *state = d->priv;
346 struct mxl111sf_adap_state *adap_state = adap->fe_adap[adap->active_fe].priv;
349 deb_info("%s(%d)\n", __func__, onoff);
352 ret = mxl111sf_enable_usb_output(state);
354 ret = mxl111sf_config_mpeg_in(state, 1, 1,
355 adap_state->ep6_clockphase,
360 ret = mxl111sf_disable_656_port(state);
368 static int mxl111sf_ep5_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
370 struct dvb_usb_device *d = adap->dev;
371 struct mxl111sf_state *state = d->priv;
374 deb_info("%s(%d)\n", __func__, onoff);
377 ret = mxl111sf_enable_usb_output(state);
380 ret = mxl111sf_init_i2s_port(state, 200);
382 ret = mxl111sf_config_i2s(state, 0, 15);
385 ret = mxl111sf_disable_i2s_port(state);
388 if (state->chip_rev > MXL111SF_V6)
389 ret = mxl111sf_config_spi(state, onoff);
395 static int mxl111sf_ep4_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
397 struct dvb_usb_device *d = adap->dev;
398 struct mxl111sf_state *state = d->priv;
401 deb_info("%s(%d)\n", __func__, onoff);
404 ret = mxl111sf_enable_usb_output(state);
411 /* ------------------------------------------------------------------------ */
413 static struct lgdt3305_config hauppauge_lgdt3305_config = {
414 .i2c_addr = 0xb2 >> 1,
415 .mpeg_mode = LGDT3305_MPEG_SERIAL,
416 .tpclk_edge = LGDT3305_TPCLK_RISING_EDGE,
417 .tpvalid_polarity = LGDT3305_TP_VALID_HIGH,
419 .spectral_inversion = 0,
424 static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
426 struct dvb_usb_device *d = adap->dev;
427 struct mxl111sf_state *state = d->priv;
428 int fe_id = adap->num_frontends_initialized;
429 struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
432 deb_adv("%s()\n", __func__);
434 /* save a pointer to the dvb_usb_device in device state */
436 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
437 state->alt_mode = adap_state->alt_mode;
439 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
440 err("set interface failed");
442 state->gpio_mode = MXL111SF_GPIO_MOD_ATSC;
443 adap_state->gpio_mode = state->gpio_mode;
444 adap_state->device_mode = MXL_TUNER_MODE;
445 adap_state->ep6_clockphase = 1;
447 ret = mxl1x1sf_soft_reset(state);
450 ret = mxl111sf_init_tuner_demod(state);
454 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
458 ret = mxl111sf_enable_usb_output(state);
461 ret = mxl1x1sf_top_master_ctrl(state, 1);
465 ret = mxl111sf_init_port_expander(state);
468 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
472 adap->fe_adap[fe_id].fe = dvb_attach(lgdt3305_attach,
473 &hauppauge_lgdt3305_config,
474 &adap->dev->i2c_adap);
475 if (adap->fe_adap[fe_id].fe) {
476 adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
477 adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init;
478 adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep;
479 adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep;
487 static struct lg2160_config hauppauge_lg2160_config = {
489 .i2c_addr = 0x1c >> 1,
491 .spectral_inversion = 0,
495 static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap)
497 struct dvb_usb_device *d = adap->dev;
498 struct mxl111sf_state *state = d->priv;
499 int fe_id = adap->num_frontends_initialized;
500 struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
503 deb_adv("%s()\n", __func__);
505 /* save a pointer to the dvb_usb_device in device state */
507 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
508 state->alt_mode = adap_state->alt_mode;
510 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
511 err("set interface failed");
513 state->gpio_mode = MXL111SF_GPIO_MOD_MH;
514 adap_state->gpio_mode = state->gpio_mode;
515 adap_state->device_mode = MXL_TUNER_MODE;
516 adap_state->ep6_clockphase = 1;
518 ret = mxl1x1sf_soft_reset(state);
521 ret = mxl111sf_init_tuner_demod(state);
525 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
529 ret = mxl111sf_enable_usb_output(state);
532 ret = mxl1x1sf_top_master_ctrl(state, 1);
536 ret = mxl111sf_init_port_expander(state);
539 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
543 ret = get_chip_info(state);
547 adap->fe_adap[fe_id].fe = dvb_attach(lg2160_attach,
548 &hauppauge_lg2160_config,
549 &adap->dev->i2c_adap);
550 if (adap->fe_adap[fe_id].fe) {
551 adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
552 adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init;
553 adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep;
554 adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep;
562 static struct lg2160_config hauppauge_lg2161_1019_config = {
563 .lg_chip = LG2161_1019,
564 .i2c_addr = 0x1c >> 1,
566 .spectral_inversion = 0,
568 .output_if = 2, /* LG2161_OIF_SPI_MAS */
571 static struct lg2160_config hauppauge_lg2161_1040_config = {
572 .lg_chip = LG2161_1040,
573 .i2c_addr = 0x1c >> 1,
575 .spectral_inversion = 0,
577 .output_if = 4, /* LG2161_OIF_SPI_MAS */
580 static int mxl111sf_lg2161_frontend_attach(struct dvb_usb_adapter *adap)
582 struct dvb_usb_device *d = adap->dev;
583 struct mxl111sf_state *state = d->priv;
584 int fe_id = adap->num_frontends_initialized;
585 struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
588 deb_adv("%s()\n", __func__);
590 /* save a pointer to the dvb_usb_device in device state */
592 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
593 state->alt_mode = adap_state->alt_mode;
595 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
596 err("set interface failed");
598 state->gpio_mode = MXL111SF_GPIO_MOD_MH;
599 adap_state->gpio_mode = state->gpio_mode;
600 adap_state->device_mode = MXL_TUNER_MODE;
601 adap_state->ep6_clockphase = 1;
603 ret = mxl1x1sf_soft_reset(state);
606 ret = mxl111sf_init_tuner_demod(state);
610 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
614 ret = mxl111sf_enable_usb_output(state);
617 ret = mxl1x1sf_top_master_ctrl(state, 1);
621 ret = mxl111sf_init_port_expander(state);
624 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
628 ret = get_chip_info(state);
632 adap->fe_adap[fe_id].fe = dvb_attach(lg2160_attach,
633 (MXL111SF_V8_200 == state->chip_rev) ?
634 &hauppauge_lg2161_1040_config :
635 &hauppauge_lg2161_1019_config,
636 &adap->dev->i2c_adap);
637 if (adap->fe_adap[fe_id].fe) {
638 adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
639 adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init;
640 adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep;
641 adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep;
649 static struct lg2160_config hauppauge_lg2161_1019_ep6_config = {
650 .lg_chip = LG2161_1019,
651 .i2c_addr = 0x1c >> 1,
653 .spectral_inversion = 0,
655 .output_if = 1, /* LG2161_OIF_SERIAL_TS */
658 static struct lg2160_config hauppauge_lg2161_1040_ep6_config = {
659 .lg_chip = LG2161_1040,
660 .i2c_addr = 0x1c >> 1,
662 .spectral_inversion = 0,
664 .output_if = 7, /* LG2161_OIF_SERIAL_TS */
667 static int mxl111sf_lg2161_ep6_frontend_attach(struct dvb_usb_adapter *adap)
669 struct dvb_usb_device *d = adap->dev;
670 struct mxl111sf_state *state = d->priv;
671 int fe_id = adap->num_frontends_initialized;
672 struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
675 deb_adv("%s()\n", __func__);
677 /* save a pointer to the dvb_usb_device in device state */
679 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
680 state->alt_mode = adap_state->alt_mode;
682 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
683 err("set interface failed");
685 state->gpio_mode = MXL111SF_GPIO_MOD_MH;
686 adap_state->gpio_mode = state->gpio_mode;
687 adap_state->device_mode = MXL_TUNER_MODE;
688 adap_state->ep6_clockphase = 0;
690 ret = mxl1x1sf_soft_reset(state);
693 ret = mxl111sf_init_tuner_demod(state);
697 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
701 ret = mxl111sf_enable_usb_output(state);
704 ret = mxl1x1sf_top_master_ctrl(state, 1);
708 ret = mxl111sf_init_port_expander(state);
711 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
715 ret = get_chip_info(state);
719 adap->fe_adap[fe_id].fe = dvb_attach(lg2160_attach,
720 (MXL111SF_V8_200 == state->chip_rev) ?
721 &hauppauge_lg2161_1040_ep6_config :
722 &hauppauge_lg2161_1019_ep6_config,
723 &adap->dev->i2c_adap);
724 if (adap->fe_adap[fe_id].fe) {
725 adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
726 adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init;
727 adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep;
728 adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep;
736 static struct mxl111sf_demod_config mxl_demod_config = {
737 .read_reg = mxl111sf_read_reg,
738 .write_reg = mxl111sf_write_reg,
739 .program_regs = mxl111sf_ctrl_program_regs,
742 static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap)
744 struct dvb_usb_device *d = adap->dev;
745 struct mxl111sf_state *state = d->priv;
746 int fe_id = adap->num_frontends_initialized;
747 struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
750 deb_adv("%s()\n", __func__);
752 /* save a pointer to the dvb_usb_device in device state */
754 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 1 : 2;
755 state->alt_mode = adap_state->alt_mode;
757 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
758 err("set interface failed");
760 state->gpio_mode = MXL111SF_GPIO_MOD_DVBT;
761 adap_state->gpio_mode = state->gpio_mode;
762 adap_state->device_mode = MXL_SOC_MODE;
763 adap_state->ep6_clockphase = 1;
765 ret = mxl1x1sf_soft_reset(state);
768 ret = mxl111sf_init_tuner_demod(state);
772 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
776 ret = mxl111sf_enable_usb_output(state);
779 ret = mxl1x1sf_top_master_ctrl(state, 1);
783 /* dont care if this fails */
784 mxl111sf_init_port_expander(state);
786 adap->fe_adap[fe_id].fe = dvb_attach(mxl111sf_demod_attach, state,
788 if (adap->fe_adap[fe_id].fe) {
789 adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
790 adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init;
791 adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep;
792 adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep;
800 static inline int mxl111sf_set_ant_path(struct mxl111sf_state *state,
803 return mxl111sf_idac_config(state, 1, 1,
804 (antpath == ANT_PATH_INTERNAL) ?
808 #define DbgAntHunt(x, pwr0, pwr1, pwr2, pwr3) \
809 err("%s(%d) FINAL input set to %s rxPwr:%d|%d|%d|%d\n", \
810 __func__, __LINE__, \
811 (ANT_PATH_EXTERNAL == x) ? "EXTERNAL" : "INTERNAL", \
812 pwr0, pwr1, pwr2, pwr3)
814 #define ANT_HUNT_SLEEP 90
815 #define ANT_EXT_TWEAK 0
817 static int mxl111sf_ant_hunt(struct dvb_frontend *fe)
819 struct dvb_usb_adapter *adap = fe->dvb->priv;
820 struct dvb_usb_device *d = adap->dev;
821 struct mxl111sf_state *state = d->priv;
823 int antctrl = dvb_usb_mxl111sf_rfswitch;
825 u16 rxPwrA, rxPwr0, rxPwr1, rxPwr2;
827 /* FIXME: must force EXTERNAL for QAM - done elsewhere */
828 mxl111sf_set_ant_path(state, antctrl == ANT_PATH_AUTO ?
829 ANT_PATH_EXTERNAL : antctrl);
831 if (antctrl == ANT_PATH_AUTO) {
833 msleep(ANT_HUNT_SLEEP);
835 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwrA);
837 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
838 msleep(ANT_HUNT_SLEEP);
839 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr0);
841 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
842 msleep(ANT_HUNT_SLEEP);
843 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr1);
845 mxl111sf_set_ant_path(state, ANT_PATH_INTERNAL);
846 msleep(ANT_HUNT_SLEEP);
847 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr2);
849 if (rxPwr1+ANT_EXT_TWEAK >= rxPwr2) {
850 /* return with EXTERNAL enabled */
851 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
852 DbgAntHunt(ANT_PATH_EXTERNAL, rxPwrA,
853 rxPwr0, rxPwr1, rxPwr2);
855 /* return with INTERNAL enabled */
856 DbgAntHunt(ANT_PATH_INTERNAL, rxPwrA,
857 rxPwr0, rxPwr1, rxPwr2);
863 static struct mxl111sf_tuner_config mxl_tuner_config = {
864 .if_freq = MXL_IF_6_0, /* applies to external IF output, only */
865 .invert_spectrum = 0,
866 .read_reg = mxl111sf_read_reg,
867 .write_reg = mxl111sf_write_reg,
868 .program_regs = mxl111sf_ctrl_program_regs,
869 .top_master_ctrl = mxl1x1sf_top_master_ctrl,
870 .ant_hunt = mxl111sf_ant_hunt,
873 static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap)
875 struct dvb_usb_device *d = adap->dev;
876 struct mxl111sf_state *state = d->priv;
877 int fe_id = adap->num_frontends_initialized;
879 deb_adv("%s()\n", __func__);
881 if (NULL != dvb_attach(mxl111sf_tuner_attach,
882 adap->fe_adap[fe_id].fe, state,
889 static int mxl111sf_fe_ioctl_override(struct dvb_frontend *fe,
890 unsigned int cmd, void *parg,
896 case DVB_FE_IOCTL_PRE:
899 case FE_READ_SIGNAL_STRENGTH:
900 err = fe->ops.tuner_ops.get_rf_strength(fe, parg);
901 /* If no error occurs, prevent dvb-core from handling
902 * this IOCTL, otherwise return the error */
909 case DVB_FE_IOCTL_POST:
910 /* no post-ioctl handling required */
916 static u32 mxl111sf_i2c_func(struct i2c_adapter *adapter)
921 struct i2c_algorithm mxl111sf_i2c_algo = {
922 .master_xfer = mxl111sf_i2c_xfer,
923 .functionality = mxl111sf_i2c_func,
924 #ifdef NEED_ALGO_CONTROL
925 .algo_control = dummy_algo_control,
929 static struct dvb_usb_device_properties mxl111sf_dvbt_bulk_properties;
930 static struct dvb_usb_device_properties mxl111sf_dvbt_isoc_properties;
931 static struct dvb_usb_device_properties mxl111sf_atsc_bulk_properties;
932 static struct dvb_usb_device_properties mxl111sf_atsc_isoc_properties;
933 static struct dvb_usb_device_properties mxl111sf_atsc_mh_bulk_properties;
934 static struct dvb_usb_device_properties mxl111sf_atsc_mh_isoc_properties;
935 static struct dvb_usb_device_properties mxl111sf_mh_bulk_properties;
936 static struct dvb_usb_device_properties mxl111sf_mh_isoc_properties;
937 static struct dvb_usb_device_properties mxl111sf_mercury_spi_bulk_properties;
938 static struct dvb_usb_device_properties mxl111sf_mercury_spi_isoc_properties;
939 static struct dvb_usb_device_properties mxl111sf_mercury_tp_bulk_properties;
940 static struct dvb_usb_device_properties mxl111sf_mercury_tp_isoc_properties;
941 static struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_bulk_properties;
942 static struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_isoc_properties;
943 static struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_bulk_properties;
944 static struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_isoc_properties;
946 static int mxl111sf_probe(struct usb_interface *intf,
947 const struct usb_device_id *id)
949 struct dvb_usb_device *d = NULL;
951 deb_adv("%s()\n", __func__);
953 if (((dvb_usb_mxl111sf_isoc) &&
954 (0 == dvb_usb_device_init(intf,
955 &mxl111sf_dvbt_isoc_properties,
956 THIS_MODULE, &d, adapter_nr) ||
957 0 == dvb_usb_device_init(intf,
958 &mxl111sf_atsc_isoc_properties,
959 THIS_MODULE, &d, adapter_nr) ||
960 0 == dvb_usb_device_init(intf,
961 &mxl111sf_atsc_mh_isoc_properties,
962 THIS_MODULE, &d, adapter_nr) ||
963 0 == dvb_usb_device_init(intf,
964 &mxl111sf_mh_isoc_properties,
965 THIS_MODULE, &d, adapter_nr) ||
966 ((dvb_usb_mxl111sf_spi) &&
967 (0 == dvb_usb_device_init(intf,
968 &mxl111sf_mercury_spi_isoc_properties,
969 THIS_MODULE, &d, adapter_nr) ||
970 0 == dvb_usb_device_init(intf,
971 &mxl111sf_mercury_mh_spi_isoc_properties,
972 THIS_MODULE, &d, adapter_nr))) ||
973 0 == dvb_usb_device_init(intf,
974 &mxl111sf_mercury_tp_isoc_properties,
975 THIS_MODULE, &d, adapter_nr) ||
976 0 == dvb_usb_device_init(intf,
977 &mxl111sf_mercury_mh_tp_isoc_properties,
978 THIS_MODULE, &d, adapter_nr))) ||
979 0 == dvb_usb_device_init(intf,
980 &mxl111sf_dvbt_bulk_properties,
981 THIS_MODULE, &d, adapter_nr) ||
982 0 == dvb_usb_device_init(intf,
983 &mxl111sf_atsc_bulk_properties,
984 THIS_MODULE, &d, adapter_nr) ||
985 0 == dvb_usb_device_init(intf,
986 &mxl111sf_atsc_mh_bulk_properties,
987 THIS_MODULE, &d, adapter_nr) ||
988 0 == dvb_usb_device_init(intf,
989 &mxl111sf_mh_bulk_properties,
990 THIS_MODULE, &d, adapter_nr) ||
991 ((dvb_usb_mxl111sf_spi) &&
992 (0 == dvb_usb_device_init(intf,
993 &mxl111sf_mercury_spi_bulk_properties,
994 THIS_MODULE, &d, adapter_nr) ||
995 0 == dvb_usb_device_init(intf,
996 &mxl111sf_mercury_mh_spi_bulk_properties,
997 THIS_MODULE, &d, adapter_nr))) ||
998 0 == dvb_usb_device_init(intf,
999 &mxl111sf_mercury_tp_bulk_properties,
1000 THIS_MODULE, &d, adapter_nr) ||
1001 0 == dvb_usb_device_init(intf,
1002 &mxl111sf_mercury_mh_tp_bulk_properties,
1003 THIS_MODULE, &d, adapter_nr) || 0) {
1005 struct mxl111sf_state *state = d->priv;
1006 static u8 eeprom[256];
1007 struct i2c_client c;
1010 ret = get_chip_info(state);
1012 err("failed to get chip info during probe");
1014 mutex_init(&state->fe_lock);
1016 if (state->chip_rev > MXL111SF_V6)
1017 mxl111sf_config_pin_mux_modes(state,
1018 PIN_MUX_TS_SPI_IN_MODE_1);
1020 c.adapter = &d->i2c_adap;
1023 ret = tveeprom_read(&c, eeprom, sizeof(eeprom));
1026 tveeprom_hauppauge_analog(&c, &state->tv,
1027 (0x84 == eeprom[0xa0]) ?
1028 eeprom + 0xa0 : eeprom + 0x80);
1030 switch (state->tv.model) {
1036 printk(KERN_WARNING "%s: warning: "
1037 "unknown hauppauge model #%d\n",
1038 __func__, state->tv.model);
1043 err("Your device is not yet supported by this driver. "
1044 "See kernellabs.com for more info");
1048 static struct usb_device_id mxl111sf_table[] = {
1049 /* 0 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc600) }, /* ATSC+ IR */
1050 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc601) }, /* ATSC */
1051 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc602) }, /* + */
1052 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc603) }, /* ATSC+ */
1053 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc604) }, /* DVBT */
1054 /* 5 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc609) }, /* ATSC IR */
1055 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60a) }, /* + IR */
1056 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60b) }, /* ATSC+ IR */
1057 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60c) }, /* DVBT IR */
1058 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc653) }, /* ATSC+ */
1059 /*10 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc65b) }, /* ATSC+ IR */
1060 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb700) }, /* ATSC+ sw */
1061 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb701) }, /* ATSC sw */
1062 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb702) }, /* + sw */
1063 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb703) }, /* ATSC+ sw */
1064 /*15 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb704) }, /* DVBT sw */
1065 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb753) }, /* ATSC+ sw */
1066 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb763) }, /* ATSC+ no */
1067 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb764) }, /* DVBT no */
1068 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd853) }, /* ATSC+ sw */
1069 /*20 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd854) }, /* DVBT sw */
1070 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd863) }, /* ATSC+ no */
1071 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd864) }, /* DVBT no */
1072 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8d3) }, /* ATSC+ sw */
1073 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8d4) }, /* DVBT sw */
1074 /*25 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8e3) }, /* ATSC+ no */
1075 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8e4) }, /* DVBT no */
1076 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8ff) }, /* ATSC+ */
1077 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc612) }, /* + */
1078 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc613) }, /* ATSC+ */
1079 /*30 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc61a) }, /* + IR */
1080 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc61b) }, /* ATSC+ IR */
1081 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb757) }, /* ATSC+DVBT sw */
1082 { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb767) }, /* ATSC+DVBT no */
1083 {} /* Terminating entry */
1085 MODULE_DEVICE_TABLE(usb, mxl111sf_table);
1088 #define MXL111SF_EP4_BULK_STREAMING_CONFIG \
1089 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
1090 .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, \
1097 .buffersize = 8192, \
1102 /* FIXME: works for v6 but not v8 silicon */
1103 #define MXL111SF_EP4_ISOC_STREAMING_CONFIG \
1104 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
1105 .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, \
1112 .framesperurb = 96, \
1113 /* FIXME: v6 SILICON: */ \
1120 #define MXL111SF_EP5_BULK_STREAMING_CONFIG \
1121 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
1122 .streaming_ctrl = mxl111sf_ep5_streaming_ctrl, \
1129 .buffersize = 8192, \
1134 #define MXL111SF_EP5_ISOC_STREAMING_CONFIG \
1135 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
1136 .streaming_ctrl = mxl111sf_ep5_streaming_ctrl, \
1143 .framesperurb = 96, \
1150 #define MXL111SF_EP6_BULK_STREAMING_CONFIG \
1151 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
1152 .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, \
1159 .buffersize = 8192, \
1165 #define MXL111SF_EP6_ISOC_STREAMING_CONFIG \
1166 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
1167 .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, \
1174 .framesperurb = 24, \
1175 .framesize = 3072, \
1181 #define MXL111SF_DEFAULT_DEVICE_PROPERTIES \
1182 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
1183 .usb_ctrl = DEVICE_SPECIFIC, \
1184 /* use usb alt setting 1 for EP4 ISOC transfer (dvb-t), \
1185 EP6 BULK transfer (atsc/qam), \
1186 use usb alt setting 2 for EP4 BULK transfer (dvb-t), \
1187 EP6 ISOC transfer (atsc/qam), \
1189 .power_ctrl = mxl111sf_power_ctrl, \
1190 .i2c_algo = &mxl111sf_i2c_algo, \
1191 .generic_bulk_ctrl_endpoint = MXL_EP2_REG_WRITE, \
1192 .generic_bulk_ctrl_endpoint_response = MXL_EP1_REG_READ, \
1193 .size_of_priv = sizeof(struct mxl111sf_state)
1195 static struct dvb_usb_device_properties mxl111sf_dvbt_bulk_properties = {
1196 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1201 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1204 .frontend_attach = mxl111sf_attach_demod,
1205 .tuner_attach = mxl111sf_attach_tuner,
1207 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1211 .num_device_descs = 3,
1213 { "Hauppauge 126xxx DVBT (bulk)",
1215 { &mxl111sf_table[4], &mxl111sf_table[8],
1218 { "Hauppauge 117xxx DVBT (bulk)",
1220 { &mxl111sf_table[15], &mxl111sf_table[18],
1223 { "Hauppauge 138xxx DVBT (bulk)",
1225 { &mxl111sf_table[20], &mxl111sf_table[22],
1226 &mxl111sf_table[24], &mxl111sf_table[26],
1232 static struct dvb_usb_device_properties mxl111sf_dvbt_isoc_properties = {
1233 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1238 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1241 .frontend_attach = mxl111sf_attach_demod,
1242 .tuner_attach = mxl111sf_attach_tuner,
1244 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1248 .num_device_descs = 3,
1250 { "Hauppauge 126xxx DVBT (isoc)",
1252 { &mxl111sf_table[4], &mxl111sf_table[8],
1255 { "Hauppauge 117xxx DVBT (isoc)",
1257 { &mxl111sf_table[15], &mxl111sf_table[18],
1260 { "Hauppauge 138xxx DVBT (isoc)",
1262 { &mxl111sf_table[20], &mxl111sf_table[22],
1263 &mxl111sf_table[24], &mxl111sf_table[26],
1269 static struct dvb_usb_device_properties mxl111sf_atsc_bulk_properties = {
1270 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1275 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1278 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1279 .tuner_attach = mxl111sf_attach_tuner,
1281 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1285 .num_device_descs = 2,
1287 { "Hauppauge 126xxx ATSC (bulk)",
1289 { &mxl111sf_table[1], &mxl111sf_table[5],
1292 { "Hauppauge 117xxx ATSC (bulk)",
1294 { &mxl111sf_table[12],
1300 static struct dvb_usb_device_properties mxl111sf_atsc_isoc_properties = {
1301 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1306 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1309 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1310 .tuner_attach = mxl111sf_attach_tuner,
1312 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
1316 .num_device_descs = 2,
1318 { "Hauppauge 126xxx ATSC (isoc)",
1320 { &mxl111sf_table[1], &mxl111sf_table[5],
1323 { "Hauppauge 117xxx ATSC (isoc)",
1325 { &mxl111sf_table[12],
1331 static struct dvb_usb_device_properties mxl111sf_mh_bulk_properties = {
1332 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1337 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1340 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1342 .frontend_attach = mxl111sf_lg2160_frontend_attach,
1343 .tuner_attach = mxl111sf_attach_tuner,
1345 MXL111SF_EP5_BULK_STREAMING_CONFIG,
1349 .num_device_descs = 2,
1351 { "HCW 126xxx (bulk)",
1353 { &mxl111sf_table[2], &mxl111sf_table[6],
1356 { "HCW 117xxx (bulk)",
1358 { &mxl111sf_table[13],
1364 static struct dvb_usb_device_properties mxl111sf_mh_isoc_properties = {
1365 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1370 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1373 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1375 .frontend_attach = mxl111sf_lg2160_frontend_attach,
1376 .tuner_attach = mxl111sf_attach_tuner,
1378 MXL111SF_EP5_ISOC_STREAMING_CONFIG,
1382 .num_device_descs = 2,
1384 { "HCW 126xxx (isoc)",
1386 { &mxl111sf_table[2], &mxl111sf_table[6],
1389 { "HCW 117xxx (isoc)",
1391 { &mxl111sf_table[13],
1397 static struct dvb_usb_device_properties mxl111sf_atsc_mh_bulk_properties = {
1398 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1403 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1406 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1407 .tuner_attach = mxl111sf_attach_tuner,
1409 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1412 .frontend_attach = mxl111sf_attach_demod,
1413 .tuner_attach = mxl111sf_attach_tuner,
1415 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1418 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1420 .frontend_attach = mxl111sf_lg2160_frontend_attach,
1421 .tuner_attach = mxl111sf_attach_tuner,
1423 MXL111SF_EP5_BULK_STREAMING_CONFIG,
1427 .num_device_descs = 2,
1429 { "Hauppauge 126xxx ATSC+ (bulk)",
1431 { &mxl111sf_table[0], &mxl111sf_table[3],
1432 &mxl111sf_table[7], &mxl111sf_table[9],
1433 &mxl111sf_table[10], NULL },
1435 { "Hauppauge 117xxx ATSC+ (bulk)",
1437 { &mxl111sf_table[11], &mxl111sf_table[14],
1438 &mxl111sf_table[16], &mxl111sf_table[17],
1439 &mxl111sf_table[32], &mxl111sf_table[33],
1445 static struct dvb_usb_device_properties mxl111sf_atsc_mh_isoc_properties = {
1446 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1451 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1454 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1455 .tuner_attach = mxl111sf_attach_tuner,
1457 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
1460 .frontend_attach = mxl111sf_attach_demod,
1461 .tuner_attach = mxl111sf_attach_tuner,
1463 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1466 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1468 .frontend_attach = mxl111sf_lg2160_frontend_attach,
1469 .tuner_attach = mxl111sf_attach_tuner,
1471 MXL111SF_EP5_ISOC_STREAMING_CONFIG,
1475 .num_device_descs = 2,
1477 { "Hauppauge 126xxx ATSC+ (isoc)",
1479 { &mxl111sf_table[0], &mxl111sf_table[3],
1480 &mxl111sf_table[7], &mxl111sf_table[9],
1481 &mxl111sf_table[10], NULL },
1483 { "Hauppauge 117xxx ATSC+ (isoc)",
1485 { &mxl111sf_table[11], &mxl111sf_table[14],
1486 &mxl111sf_table[16], &mxl111sf_table[17],
1487 &mxl111sf_table[32], &mxl111sf_table[33],
1493 static struct dvb_usb_device_properties mxl111sf_mercury_spi_bulk_properties = {
1494 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1499 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1502 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1503 .tuner_attach = mxl111sf_attach_tuner,
1505 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1508 .frontend_attach = mxl111sf_attach_demod,
1509 .tuner_attach = mxl111sf_attach_tuner,
1511 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1514 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1516 .frontend_attach = mxl111sf_lg2161_frontend_attach,
1517 .tuner_attach = mxl111sf_attach_tuner,
1519 MXL111SF_EP5_BULK_STREAMING_CONFIG,
1523 .num_device_descs = 2,
1525 { "Hauppauge Mercury (spi-bulk)",
1527 { &mxl111sf_table[19], &mxl111sf_table[21],
1528 &mxl111sf_table[23], &mxl111sf_table[25],
1531 { "Hauppauge WinTV-Aero-M (spi-bulk)",
1533 { &mxl111sf_table[29], &mxl111sf_table[31],
1539 static struct dvb_usb_device_properties mxl111sf_mercury_spi_isoc_properties = {
1540 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1545 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1548 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1549 .tuner_attach = mxl111sf_attach_tuner,
1551 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
1554 .frontend_attach = mxl111sf_attach_demod,
1555 .tuner_attach = mxl111sf_attach_tuner,
1557 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1560 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1562 .frontend_attach = mxl111sf_lg2161_frontend_attach,
1563 .tuner_attach = mxl111sf_attach_tuner,
1565 MXL111SF_EP5_ISOC_STREAMING_CONFIG,
1569 .num_device_descs = 2,
1571 { "Hauppauge Mercury (spi-isoc)",
1573 { &mxl111sf_table[19], &mxl111sf_table[21],
1574 &mxl111sf_table[23], &mxl111sf_table[25],
1577 { "Hauppauge WinTV-Aero-M (spi-isoc)",
1579 { &mxl111sf_table[29], &mxl111sf_table[31],
1585 static struct dvb_usb_device_properties mxl111sf_mercury_tp_bulk_properties = {
1586 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1591 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1594 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1595 .tuner_attach = mxl111sf_attach_tuner,
1597 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1600 .frontend_attach = mxl111sf_attach_demod,
1601 .tuner_attach = mxl111sf_attach_tuner,
1603 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1606 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1608 .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
1609 .tuner_attach = mxl111sf_attach_tuner,
1611 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1615 .num_device_descs = 2,
1617 { "Hauppauge Mercury (tp-bulk)",
1619 { &mxl111sf_table[19], &mxl111sf_table[21],
1620 &mxl111sf_table[23], &mxl111sf_table[25],
1621 &mxl111sf_table[27], NULL },
1623 { "Hauppauge WinTV-Aero-M",
1625 { &mxl111sf_table[29], &mxl111sf_table[31],
1631 static struct dvb_usb_device_properties mxl111sf_mercury_tp_isoc_properties = {
1632 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1637 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1640 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1641 .tuner_attach = mxl111sf_attach_tuner,
1643 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
1646 .frontend_attach = mxl111sf_attach_demod,
1647 .tuner_attach = mxl111sf_attach_tuner,
1649 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1652 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1654 .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
1655 .tuner_attach = mxl111sf_attach_tuner,
1657 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
1661 .num_device_descs = 2,
1663 { "Hauppauge Mercury (tp-isoc)",
1665 { &mxl111sf_table[19], &mxl111sf_table[21],
1666 &mxl111sf_table[23], &mxl111sf_table[25],
1667 &mxl111sf_table[27], NULL },
1669 { "Hauppauge WinTV-Aero-M (tp-isoc)",
1671 { &mxl111sf_table[29], &mxl111sf_table[31],
1678 struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_bulk_properties = {
1679 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1684 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1687 .frontend_attach = mxl111sf_attach_demod,
1688 .tuner_attach = mxl111sf_attach_tuner,
1690 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1693 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1695 .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
1696 .tuner_attach = mxl111sf_attach_tuner,
1698 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1702 .num_device_descs = 1,
1704 { "Hauppauge 126xxx (tp-bulk)",
1706 { &mxl111sf_table[28], &mxl111sf_table[30],
1713 struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_isoc_properties = {
1714 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1719 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1722 .frontend_attach = mxl111sf_attach_demod,
1723 .tuner_attach = mxl111sf_attach_tuner,
1725 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1728 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1730 .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
1731 .tuner_attach = mxl111sf_attach_tuner,
1733 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
1737 .num_device_descs = 1,
1739 { "Hauppauge 126xxx (tp-isoc)",
1741 { &mxl111sf_table[28], &mxl111sf_table[30],
1748 struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_bulk_properties = {
1749 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1754 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1757 .frontend_attach = mxl111sf_attach_demod,
1758 .tuner_attach = mxl111sf_attach_tuner,
1760 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1763 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1765 .frontend_attach = mxl111sf_lg2161_frontend_attach,
1766 .tuner_attach = mxl111sf_attach_tuner,
1768 MXL111SF_EP5_BULK_STREAMING_CONFIG,
1772 .num_device_descs = 1,
1774 { "Hauppauge 126xxx (spi-bulk)",
1776 { &mxl111sf_table[28], &mxl111sf_table[30],
1783 struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_isoc_properties = {
1784 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1789 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1792 .frontend_attach = mxl111sf_attach_demod,
1793 .tuner_attach = mxl111sf_attach_tuner,
1795 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1798 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1800 .frontend_attach = mxl111sf_lg2161_frontend_attach,
1801 .tuner_attach = mxl111sf_attach_tuner,
1803 MXL111SF_EP5_ISOC_STREAMING_CONFIG,
1807 .num_device_descs = 1,
1809 { "Hauppauge 126xxx (spi-isoc)",
1811 { &mxl111sf_table[28], &mxl111sf_table[30],
1817 static struct usb_driver mxl111sf_driver = {
1818 .name = "dvb_usb_mxl111sf",
1819 .probe = mxl111sf_probe,
1820 .disconnect = dvb_usb_device_exit,
1821 .id_table = mxl111sf_table,
1824 module_usb_driver(mxl111sf_driver);
1826 MODULE_AUTHOR("Michael Krufky <mkrufky@kernellabs.com>");
1827 MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF");
1828 MODULE_VERSION("1.0");
1829 MODULE_LICENSE("GPL");