2 * Copyright (C) 2010-2014 Michael Krufky (mkrufky@linuxtv.org)
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/media/dvb-drivers/dvb-usb.rst for more information
11 #include <linux/vmalloc.h>
12 #include <linux/i2c.h>
13 #include <media/tuner.h>
16 #include "mxl111sf-reg.h"
17 #include "mxl111sf-phy.h"
18 #include "mxl111sf-i2c.h"
19 #include "mxl111sf-gpio.h"
21 #include "mxl111sf-demod.h"
22 #include "mxl111sf-tuner.h"
27 int dvb_usb_mxl111sf_debug;
28 module_param_named(debug, dvb_usb_mxl111sf_debug, int, 0644);
29 MODULE_PARM_DESC(debug, "set debugging level (1=info, 2=xfer, 4=i2c, 8=reg, 16=adv (or-able)).");
31 static 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 static 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 static 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 int mxl111sf_ctrl_msg(struct mxl111sf_state *state,
56 u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
58 struct dvb_usb_device *d = state->d;
59 int wo = (rbuf == NULL || rlen == 0); /* write-only */
62 if (1 + wlen > MXL_MAX_XFER_SIZE) {
63 pr_warn("%s: len=%d is too big!\n", __func__, wlen);
67 pr_debug("%s(wlen = %d, rlen = %d)\n", __func__, wlen, rlen);
69 mutex_lock(&state->msg_lock);
70 memset(state->sndbuf, 0, 1+wlen);
71 memset(state->rcvbuf, 0, rlen);
73 state->sndbuf[0] = cmd;
74 memcpy(&state->sndbuf[1], wbuf, wlen);
76 ret = (wo) ? dvb_usbv2_generic_write(d, state->sndbuf, 1+wlen) :
77 dvb_usbv2_generic_rw(d, state->sndbuf, 1+wlen, state->rcvbuf,
81 memcpy(rbuf, state->rcvbuf, rlen);
83 mutex_unlock(&state->msg_lock);
90 /* ------------------------------------------------------------------------ */
92 #define MXL_CMD_REG_READ 0xaa
93 #define MXL_CMD_REG_WRITE 0x55
95 int mxl111sf_read_reg(struct mxl111sf_state *state, u8 addr, u8 *data)
100 ret = mxl111sf_ctrl_msg(state, MXL_CMD_REG_READ, &addr, 1, buf, 2);
102 mxl_debug("error reading reg: 0x%02x", addr);
109 pr_err("invalid response reading reg: 0x%02x != 0x%02x, 0x%02x",
110 addr, buf[0], buf[1]);
114 pr_debug("R: (0x%02x, 0x%02x)\n", addr, buf[1]);
119 int mxl111sf_write_reg(struct mxl111sf_state *state, u8 addr, u8 data)
121 u8 buf[] = { addr, data };
124 pr_debug("W: (0x%02x, 0x%02x)\n", addr, data);
126 ret = mxl111sf_ctrl_msg(state, MXL_CMD_REG_WRITE, buf, 2, NULL, 0);
128 pr_err("error writing reg: 0x%02x, val: 0x%02x", addr, data);
132 /* ------------------------------------------------------------------------ */
134 int mxl111sf_write_reg_mask(struct mxl111sf_state *state,
135 u8 addr, u8 mask, u8 data)
141 ret = mxl111sf_read_reg(state, addr, &val);
143 /* dont know why this usually errors out on the first try */
145 pr_err("error writing addr: 0x%02x, mask: 0x%02x, data: 0x%02x, retrying...",
148 ret = mxl111sf_read_reg(state, addr, &val);
156 ret = mxl111sf_write_reg(state, addr, val);
162 /* ------------------------------------------------------------------------ */
164 int mxl111sf_ctrl_program_regs(struct mxl111sf_state *state,
165 struct mxl111sf_reg_ctrl_info *ctrl_reg_info)
169 for (i = 0; ctrl_reg_info[i].addr |
170 ctrl_reg_info[i].mask |
171 ctrl_reg_info[i].data; i++) {
173 ret = mxl111sf_write_reg_mask(state,
174 ctrl_reg_info[i].addr,
175 ctrl_reg_info[i].mask,
176 ctrl_reg_info[i].data);
178 pr_err("failed on reg #%d (0x%02x)", i,
179 ctrl_reg_info[i].addr);
186 /* ------------------------------------------------------------------------ */
188 static int mxl1x1sf_get_chip_info(struct mxl111sf_state *state)
192 char *mxl_chip, *mxl_rev;
194 if ((state->chip_id) && (state->chip_ver))
197 ret = mxl111sf_read_reg(state, CHIP_ID_REG, &id);
202 ret = mxl111sf_read_reg(state, TOP_CHIP_REV_ID_REG, &ver);
205 state->chip_ver = ver;
209 mxl_chip = "MxL101SF";
212 mxl_chip = "MxL111SF";
215 mxl_chip = "UNKNOWN MxL1X1";
220 state->chip_rev = MXL111SF_V6;
224 state->chip_rev = MXL111SF_V8_100;
228 state->chip_rev = MXL111SF_V8_200;
233 mxl_rev = "UNKNOWN REVISION";
236 pr_info("%s detected, %s (0x%x)", mxl_chip, mxl_rev, ver);
241 #define get_chip_info(state) \
244 ___ret = mxl1x1sf_get_chip_info(state); \
245 if (mxl_fail(___ret)) { \
246 mxl_debug("failed to get chip info" \
247 " on first probe attempt"); \
248 ___ret = mxl1x1sf_get_chip_info(state); \
249 if (mxl_fail(___ret)) \
250 pr_err("failed to get chip info during probe"); \
252 mxl_debug("probe needed a retry " \
253 "in order to succeed."); \
258 /* ------------------------------------------------------------------------ */
260 static int mxl111sf_power_ctrl(struct dvb_usb_device *d, int onoff)
262 /* power control depends on which adapter is being woken:
263 * save this for init, instead, via mxl111sf_adap_fe_init */
268 static int mxl111sf_adap_fe_init(struct dvb_frontend *fe)
270 struct dvb_usb_device *d = fe_to_d(fe);
271 struct mxl111sf_state *state = fe_to_priv(fe);
272 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id];
275 /* exit if we didn't initialize the driver yet */
276 if (!state->chip_id) {
277 mxl_debug("driver not yet initialized, exit.");
281 pr_debug("%s()\n", __func__);
283 mutex_lock(&state->fe_lock);
285 state->alt_mode = adap_state->alt_mode;
287 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0)
288 pr_err("set interface failed");
290 err = mxl1x1sf_soft_reset(state);
292 err = mxl111sf_init_tuner_demod(state);
294 err = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
297 err = mxl111sf_enable_usb_output(state);
299 err = mxl1x1sf_top_master_ctrl(state, 1);
302 if ((MXL111SF_GPIO_MOD_DVBT != adap_state->gpio_mode) &&
303 (state->chip_rev > MXL111SF_V6)) {
304 mxl111sf_config_pin_mux_modes(state,
305 PIN_MUX_TS_SPI_IN_MODE_1);
308 err = mxl111sf_init_port_expander(state);
309 if (!mxl_fail(err)) {
310 state->gpio_mode = adap_state->gpio_mode;
311 err = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
314 err = fe->ops.init(fe);
316 msleep(100); /* add short delay after enabling
317 * the demod before touching it */
320 return (adap_state->fe_init) ? adap_state->fe_init(fe) : 0;
325 static int mxl111sf_adap_fe_sleep(struct dvb_frontend *fe)
327 struct mxl111sf_state *state = fe_to_priv(fe);
328 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id];
331 /* exit if we didn't initialize the driver yet */
332 if (!state->chip_id) {
333 mxl_debug("driver not yet initialized, exit.");
337 pr_debug("%s()\n", __func__);
339 err = (adap_state->fe_sleep) ? adap_state->fe_sleep(fe) : 0;
341 mutex_unlock(&state->fe_lock);
349 static int mxl111sf_ep6_streaming_ctrl(struct dvb_frontend *fe, int onoff)
351 struct mxl111sf_state *state = fe_to_priv(fe);
352 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id];
355 pr_debug("%s(%d)\n", __func__, onoff);
358 ret = mxl111sf_enable_usb_output(state);
360 ret = mxl111sf_config_mpeg_in(state, 1, 1,
361 adap_state->ep6_clockphase,
366 ret = mxl111sf_disable_656_port(state);
374 static int mxl111sf_ep5_streaming_ctrl(struct dvb_frontend *fe, int onoff)
376 struct mxl111sf_state *state = fe_to_priv(fe);
379 pr_debug("%s(%d)\n", __func__, onoff);
382 ret = mxl111sf_enable_usb_output(state);
385 ret = mxl111sf_init_i2s_port(state, 200);
387 ret = mxl111sf_config_i2s(state, 0, 15);
390 ret = mxl111sf_disable_i2s_port(state);
393 if (state->chip_rev > MXL111SF_V6)
394 ret = mxl111sf_config_spi(state, onoff);
400 static int mxl111sf_ep4_streaming_ctrl(struct dvb_frontend *fe, int onoff)
402 struct mxl111sf_state *state = fe_to_priv(fe);
405 pr_debug("%s(%d)\n", __func__, onoff);
408 ret = mxl111sf_enable_usb_output(state);
415 /* ------------------------------------------------------------------------ */
417 static struct lgdt3305_config hauppauge_lgdt3305_config = {
418 .i2c_addr = 0xb2 >> 1,
419 .mpeg_mode = LGDT3305_MPEG_SERIAL,
420 .tpclk_edge = LGDT3305_TPCLK_RISING_EDGE,
421 .tpvalid_polarity = LGDT3305_TP_VALID_HIGH,
423 .spectral_inversion = 0,
428 static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id)
430 struct dvb_usb_device *d = adap_to_d(adap);
431 struct mxl111sf_state *state = d_to_priv(d);
432 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id];
435 pr_debug("%s()\n", __func__);
437 /* save a pointer to the dvb_usb_device in device state */
439 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
440 state->alt_mode = adap_state->alt_mode;
442 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0)
443 pr_err("set interface failed");
445 state->gpio_mode = MXL111SF_GPIO_MOD_ATSC;
446 adap_state->gpio_mode = state->gpio_mode;
447 adap_state->device_mode = MXL_TUNER_MODE;
448 adap_state->ep6_clockphase = 1;
450 ret = mxl1x1sf_soft_reset(state);
453 ret = mxl111sf_init_tuner_demod(state);
457 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
461 ret = mxl111sf_enable_usb_output(state);
464 ret = mxl1x1sf_top_master_ctrl(state, 1);
468 ret = mxl111sf_init_port_expander(state);
471 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
475 adap->fe[fe_id] = dvb_attach(lgdt3305_attach,
476 &hauppauge_lgdt3305_config,
478 if (adap->fe[fe_id]) {
479 state->num_frontends++;
480 adap_state->fe_init = adap->fe[fe_id]->ops.init;
481 adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init;
482 adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep;
483 adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep;
491 static struct lg2160_config hauppauge_lg2160_config = {
493 .i2c_addr = 0x1c >> 1,
495 .spectral_inversion = 0,
499 static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id)
501 struct dvb_usb_device *d = adap_to_d(adap);
502 struct mxl111sf_state *state = d_to_priv(d);
503 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id];
506 pr_debug("%s()\n", __func__);
508 /* save a pointer to the dvb_usb_device in device state */
510 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
511 state->alt_mode = adap_state->alt_mode;
513 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0)
514 pr_err("set interface failed");
516 state->gpio_mode = MXL111SF_GPIO_MOD_MH;
517 adap_state->gpio_mode = state->gpio_mode;
518 adap_state->device_mode = MXL_TUNER_MODE;
519 adap_state->ep6_clockphase = 1;
521 ret = mxl1x1sf_soft_reset(state);
524 ret = mxl111sf_init_tuner_demod(state);
528 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
532 ret = mxl111sf_enable_usb_output(state);
535 ret = mxl1x1sf_top_master_ctrl(state, 1);
539 ret = mxl111sf_init_port_expander(state);
542 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
546 ret = get_chip_info(state);
550 adap->fe[fe_id] = dvb_attach(lg2160_attach,
551 &hauppauge_lg2160_config,
553 if (adap->fe[fe_id]) {
554 state->num_frontends++;
555 adap_state->fe_init = adap->fe[fe_id]->ops.init;
556 adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init;
557 adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep;
558 adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep;
566 static struct lg2160_config hauppauge_lg2161_1019_config = {
567 .lg_chip = LG2161_1019,
568 .i2c_addr = 0x1c >> 1,
570 .spectral_inversion = 0,
572 .output_if = 2, /* LG2161_OIF_SPI_MAS */
575 static struct lg2160_config hauppauge_lg2161_1040_config = {
576 .lg_chip = LG2161_1040,
577 .i2c_addr = 0x1c >> 1,
579 .spectral_inversion = 0,
581 .output_if = 4, /* LG2161_OIF_SPI_MAS */
584 static int mxl111sf_lg2161_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id)
586 struct dvb_usb_device *d = adap_to_d(adap);
587 struct mxl111sf_state *state = d_to_priv(d);
588 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id];
591 pr_debug("%s()\n", __func__);
593 /* save a pointer to the dvb_usb_device in device state */
595 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
596 state->alt_mode = adap_state->alt_mode;
598 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0)
599 pr_err("set interface failed");
601 state->gpio_mode = MXL111SF_GPIO_MOD_MH;
602 adap_state->gpio_mode = state->gpio_mode;
603 adap_state->device_mode = MXL_TUNER_MODE;
604 adap_state->ep6_clockphase = 1;
606 ret = mxl1x1sf_soft_reset(state);
609 ret = mxl111sf_init_tuner_demod(state);
613 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
617 ret = mxl111sf_enable_usb_output(state);
620 ret = mxl1x1sf_top_master_ctrl(state, 1);
624 ret = mxl111sf_init_port_expander(state);
627 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
631 ret = get_chip_info(state);
635 adap->fe[fe_id] = dvb_attach(lg2160_attach,
636 (MXL111SF_V8_200 == state->chip_rev) ?
637 &hauppauge_lg2161_1040_config :
638 &hauppauge_lg2161_1019_config,
640 if (adap->fe[fe_id]) {
641 state->num_frontends++;
642 adap_state->fe_init = adap->fe[fe_id]->ops.init;
643 adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init;
644 adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep;
645 adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep;
653 static struct lg2160_config hauppauge_lg2161_1019_ep6_config = {
654 .lg_chip = LG2161_1019,
655 .i2c_addr = 0x1c >> 1,
657 .spectral_inversion = 0,
659 .output_if = 1, /* LG2161_OIF_SERIAL_TS */
662 static struct lg2160_config hauppauge_lg2161_1040_ep6_config = {
663 .lg_chip = LG2161_1040,
664 .i2c_addr = 0x1c >> 1,
666 .spectral_inversion = 0,
668 .output_if = 7, /* LG2161_OIF_SERIAL_TS */
671 static int mxl111sf_lg2161_ep6_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id)
673 struct dvb_usb_device *d = adap_to_d(adap);
674 struct mxl111sf_state *state = d_to_priv(d);
675 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id];
678 pr_debug("%s()\n", __func__);
680 /* save a pointer to the dvb_usb_device in device state */
682 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
683 state->alt_mode = adap_state->alt_mode;
685 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0)
686 pr_err("set interface failed");
688 state->gpio_mode = MXL111SF_GPIO_MOD_MH;
689 adap_state->gpio_mode = state->gpio_mode;
690 adap_state->device_mode = MXL_TUNER_MODE;
691 adap_state->ep6_clockphase = 0;
693 ret = mxl1x1sf_soft_reset(state);
696 ret = mxl111sf_init_tuner_demod(state);
700 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
704 ret = mxl111sf_enable_usb_output(state);
707 ret = mxl1x1sf_top_master_ctrl(state, 1);
711 ret = mxl111sf_init_port_expander(state);
714 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
718 ret = get_chip_info(state);
722 adap->fe[fe_id] = dvb_attach(lg2160_attach,
723 (MXL111SF_V8_200 == state->chip_rev) ?
724 &hauppauge_lg2161_1040_ep6_config :
725 &hauppauge_lg2161_1019_ep6_config,
727 if (adap->fe[fe_id]) {
728 state->num_frontends++;
729 adap_state->fe_init = adap->fe[fe_id]->ops.init;
730 adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init;
731 adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep;
732 adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep;
740 static const struct mxl111sf_demod_config mxl_demod_config = {
741 .read_reg = mxl111sf_read_reg,
742 .write_reg = mxl111sf_write_reg,
743 .program_regs = mxl111sf_ctrl_program_regs,
746 static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap, u8 fe_id)
748 struct dvb_usb_device *d = adap_to_d(adap);
749 struct mxl111sf_state *state = d_to_priv(d);
750 struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id];
753 pr_debug("%s()\n", __func__);
755 /* save a pointer to the dvb_usb_device in device state */
757 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 1 : 2;
758 state->alt_mode = adap_state->alt_mode;
760 if (usb_set_interface(d->udev, 0, state->alt_mode) < 0)
761 pr_err("set interface failed");
763 state->gpio_mode = MXL111SF_GPIO_MOD_DVBT;
764 adap_state->gpio_mode = state->gpio_mode;
765 adap_state->device_mode = MXL_SOC_MODE;
766 adap_state->ep6_clockphase = 1;
768 ret = mxl1x1sf_soft_reset(state);
771 ret = mxl111sf_init_tuner_demod(state);
775 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
779 ret = mxl111sf_enable_usb_output(state);
782 ret = mxl1x1sf_top_master_ctrl(state, 1);
786 /* dont care if this fails */
787 mxl111sf_init_port_expander(state);
789 adap->fe[fe_id] = dvb_attach(mxl111sf_demod_attach, state,
791 if (adap->fe[fe_id]) {
792 state->num_frontends++;
793 adap_state->fe_init = adap->fe[fe_id]->ops.init;
794 adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init;
795 adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep;
796 adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep;
804 static inline int mxl111sf_set_ant_path(struct mxl111sf_state *state,
807 return mxl111sf_idac_config(state, 1, 1,
808 (antpath == ANT_PATH_INTERNAL) ?
812 #define DbgAntHunt(x, pwr0, pwr1, pwr2, pwr3) \
813 pr_err("%s(%d) FINAL input set to %s rxPwr:%d|%d|%d|%d\n", \
814 __func__, __LINE__, \
815 (ANT_PATH_EXTERNAL == x) ? "EXTERNAL" : "INTERNAL", \
816 pwr0, pwr1, pwr2, pwr3)
818 #define ANT_HUNT_SLEEP 90
819 #define ANT_EXT_TWEAK 0
821 static int mxl111sf_ant_hunt(struct dvb_frontend *fe)
823 struct mxl111sf_state *state = fe_to_priv(fe);
824 int antctrl = dvb_usb_mxl111sf_rfswitch;
826 u16 rxPwrA, rxPwr0, rxPwr1, rxPwr2;
828 /* FIXME: must force EXTERNAL for QAM - done elsewhere */
829 mxl111sf_set_ant_path(state, antctrl == ANT_PATH_AUTO ?
830 ANT_PATH_EXTERNAL : antctrl);
832 if (antctrl == ANT_PATH_AUTO) {
834 msleep(ANT_HUNT_SLEEP);
836 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwrA);
838 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
839 msleep(ANT_HUNT_SLEEP);
840 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr0);
842 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
843 msleep(ANT_HUNT_SLEEP);
844 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr1);
846 mxl111sf_set_ant_path(state, ANT_PATH_INTERNAL);
847 msleep(ANT_HUNT_SLEEP);
848 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr2);
850 if (rxPwr1+ANT_EXT_TWEAK >= rxPwr2) {
851 /* return with EXTERNAL enabled */
852 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
853 DbgAntHunt(ANT_PATH_EXTERNAL, rxPwrA,
854 rxPwr0, rxPwr1, rxPwr2);
856 /* return with INTERNAL enabled */
857 DbgAntHunt(ANT_PATH_INTERNAL, rxPwrA,
858 rxPwr0, rxPwr1, rxPwr2);
864 static const struct mxl111sf_tuner_config mxl_tuner_config = {
865 .if_freq = MXL_IF_6_0, /* applies to external IF output, only */
866 .invert_spectrum = 0,
867 .read_reg = mxl111sf_read_reg,
868 .write_reg = mxl111sf_write_reg,
869 .program_regs = mxl111sf_ctrl_program_regs,
870 .top_master_ctrl = mxl1x1sf_top_master_ctrl,
871 .ant_hunt = mxl111sf_ant_hunt,
874 static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap)
876 struct mxl111sf_state *state = adap_to_priv(adap);
877 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
878 struct media_device *mdev = dvb_get_media_controller(&adap->dvb_adap);
883 pr_debug("%s()\n", __func__);
885 for (i = 0; i < state->num_frontends; i++) {
886 if (dvb_attach(mxl111sf_tuner_attach, adap->fe[i], state,
887 &mxl_tuner_config) == NULL)
889 adap->fe[i]->ops.read_signal_strength = adap->fe[i]->ops.tuner_ops.get_rf_strength;
892 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
893 state->tuner.function = MEDIA_ENT_F_TUNER;
894 state->tuner.name = "mxl111sf tuner";
895 state->tuner_pads[MXL111SF_PAD_RF_INPUT].flags = MEDIA_PAD_FL_SINK;
896 state->tuner_pads[MXL111SF_PAD_RF_INPUT].sig_type = PAD_SIGNAL_ANALOG;
897 state->tuner_pads[MXL111SF_PAD_OUTPUT].flags = MEDIA_PAD_FL_SOURCE;
898 state->tuner_pads[MXL111SF_PAD_OUTPUT].sig_type = PAD_SIGNAL_ANALOG;
900 ret = media_entity_pads_init(&state->tuner,
901 MXL111SF_NUM_PADS, state->tuner_pads);
905 ret = media_device_register_entity(mdev, &state->tuner);
912 static u32 mxl111sf_i2c_func(struct i2c_adapter *adapter)
917 static struct i2c_algorithm mxl111sf_i2c_algo = {
918 .master_xfer = mxl111sf_i2c_xfer,
919 .functionality = mxl111sf_i2c_func,
920 #ifdef NEED_ALGO_CONTROL
921 .algo_control = dummy_algo_control,
925 static int mxl111sf_init(struct dvb_usb_device *d)
927 struct mxl111sf_state *state = d_to_priv(d);
929 static u8 eeprom[256];
931 struct i2c_msg msg[2] = {
932 { .addr = 0xa0 >> 1, .len = 1, .buf = ® },
933 { .addr = 0xa0 >> 1, .flags = I2C_M_RD,
934 .len = sizeof(eeprom), .buf = eeprom },
937 mutex_init(&state->msg_lock);
939 ret = get_chip_info(state);
941 pr_err("failed to get chip info during probe");
943 mutex_init(&state->fe_lock);
945 if (state->chip_rev > MXL111SF_V6)
946 mxl111sf_config_pin_mux_modes(state, PIN_MUX_TS_SPI_IN_MODE_1);
948 ret = i2c_transfer(&d->i2c_adap, msg, 2);
951 tveeprom_hauppauge_analog(&state->tv, (0x84 == eeprom[0xa0]) ?
952 eeprom + 0xa0 : eeprom + 0x80);
954 switch (state->tv.model) {
960 printk(KERN_WARNING "%s: warning: unknown hauppauge model #%d\n",
961 __func__, state->tv.model);
967 static int mxl111sf_frontend_attach_dvbt(struct dvb_usb_adapter *adap)
969 return mxl111sf_attach_demod(adap, 0);
972 static int mxl111sf_frontend_attach_atsc(struct dvb_usb_adapter *adap)
974 return mxl111sf_lgdt3305_frontend_attach(adap, 0);
977 static int mxl111sf_frontend_attach_mh(struct dvb_usb_adapter *adap)
979 return mxl111sf_lg2160_frontend_attach(adap, 0);
982 static int mxl111sf_frontend_attach_atsc_mh(struct dvb_usb_adapter *adap)
985 pr_debug("%s\n", __func__);
987 ret = mxl111sf_lgdt3305_frontend_attach(adap, 0);
991 ret = mxl111sf_attach_demod(adap, 1);
995 ret = mxl111sf_lg2160_frontend_attach(adap, 2);
1002 static int mxl111sf_frontend_attach_mercury(struct dvb_usb_adapter *adap)
1005 pr_debug("%s\n", __func__);
1007 ret = mxl111sf_lgdt3305_frontend_attach(adap, 0);
1011 ret = mxl111sf_attach_demod(adap, 1);
1015 ret = mxl111sf_lg2161_ep6_frontend_attach(adap, 2);
1022 static int mxl111sf_frontend_attach_mercury_mh(struct dvb_usb_adapter *adap)
1025 pr_debug("%s\n", __func__);
1027 ret = mxl111sf_attach_demod(adap, 0);
1031 if (dvb_usb_mxl111sf_spi)
1032 ret = mxl111sf_lg2161_frontend_attach(adap, 1);
1034 ret = mxl111sf_lg2161_ep6_frontend_attach(adap, 1);
1039 static void mxl111sf_stream_config_bulk(struct usb_data_stream_properties *stream, u8 endpoint)
1041 pr_debug("%s: endpoint=%d size=8192\n", __func__, endpoint);
1042 stream->type = USB_BULK;
1044 stream->endpoint = endpoint;
1045 stream->u.bulk.buffersize = 8192;
1048 static void mxl111sf_stream_config_isoc(struct usb_data_stream_properties *stream,
1049 u8 endpoint, int framesperurb, int framesize)
1051 pr_debug("%s: endpoint=%d size=%d\n", __func__, endpoint,
1052 framesperurb * framesize);
1053 stream->type = USB_ISOC;
1055 stream->endpoint = endpoint;
1056 stream->u.isoc.framesperurb = framesperurb;
1057 stream->u.isoc.framesize = framesize;
1058 stream->u.isoc.interval = 1;
1061 /* DVB USB Driver stuff */
1064 * bulk EP4/BULK/5/8192
1065 * isoc EP4/ISOC/5/96/564
1067 static int mxl111sf_get_stream_config_dvbt(struct dvb_frontend *fe,
1068 u8 *ts_type, struct usb_data_stream_properties *stream)
1070 pr_debug("%s: fe=%d\n", __func__, fe->id);
1072 *ts_type = DVB_USB_FE_TS_TYPE_188;
1073 if (dvb_usb_mxl111sf_isoc)
1074 mxl111sf_stream_config_isoc(stream, 4, 96, 564);
1076 mxl111sf_stream_config_bulk(stream, 4);
1080 static struct dvb_usb_device_properties mxl111sf_props_dvbt = {
1081 .driver_name = KBUILD_MODNAME,
1082 .owner = THIS_MODULE,
1083 .adapter_nr = adapter_nr,
1084 .size_of_priv = sizeof(struct mxl111sf_state),
1086 .generic_bulk_ctrl_endpoint = 0x02,
1087 .generic_bulk_ctrl_endpoint_response = 0x81,
1089 .i2c_algo = &mxl111sf_i2c_algo,
1090 .frontend_attach = mxl111sf_frontend_attach_dvbt,
1091 .tuner_attach = mxl111sf_attach_tuner,
1092 .init = mxl111sf_init,
1093 .streaming_ctrl = mxl111sf_ep4_streaming_ctrl,
1094 .get_stream_config = mxl111sf_get_stream_config_dvbt,
1099 .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1),
1105 * bulk EP6/BULK/5/8192
1106 * isoc EP6/ISOC/5/24/3072
1108 static int mxl111sf_get_stream_config_atsc(struct dvb_frontend *fe,
1109 u8 *ts_type, struct usb_data_stream_properties *stream)
1111 pr_debug("%s: fe=%d\n", __func__, fe->id);
1113 *ts_type = DVB_USB_FE_TS_TYPE_188;
1114 if (dvb_usb_mxl111sf_isoc)
1115 mxl111sf_stream_config_isoc(stream, 6, 24, 3072);
1117 mxl111sf_stream_config_bulk(stream, 6);
1121 static struct dvb_usb_device_properties mxl111sf_props_atsc = {
1122 .driver_name = KBUILD_MODNAME,
1123 .owner = THIS_MODULE,
1124 .adapter_nr = adapter_nr,
1125 .size_of_priv = sizeof(struct mxl111sf_state),
1127 .generic_bulk_ctrl_endpoint = 0x02,
1128 .generic_bulk_ctrl_endpoint_response = 0x81,
1130 .i2c_algo = &mxl111sf_i2c_algo,
1131 .frontend_attach = mxl111sf_frontend_attach_atsc,
1132 .tuner_attach = mxl111sf_attach_tuner,
1133 .init = mxl111sf_init,
1134 .streaming_ctrl = mxl111sf_ep6_streaming_ctrl,
1135 .get_stream_config = mxl111sf_get_stream_config_atsc,
1140 .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1),
1146 * bulk EP5/BULK/5/8192/RAW
1147 * isoc EP5/ISOC/5/96/200/RAW
1149 static int mxl111sf_get_stream_config_mh(struct dvb_frontend *fe,
1150 u8 *ts_type, struct usb_data_stream_properties *stream)
1152 pr_debug("%s: fe=%d\n", __func__, fe->id);
1154 *ts_type = DVB_USB_FE_TS_TYPE_RAW;
1155 if (dvb_usb_mxl111sf_isoc)
1156 mxl111sf_stream_config_isoc(stream, 5, 96, 200);
1158 mxl111sf_stream_config_bulk(stream, 5);
1162 static struct dvb_usb_device_properties mxl111sf_props_mh = {
1163 .driver_name = KBUILD_MODNAME,
1164 .owner = THIS_MODULE,
1165 .adapter_nr = adapter_nr,
1166 .size_of_priv = sizeof(struct mxl111sf_state),
1168 .generic_bulk_ctrl_endpoint = 0x02,
1169 .generic_bulk_ctrl_endpoint_response = 0x81,
1171 .i2c_algo = &mxl111sf_i2c_algo,
1172 .frontend_attach = mxl111sf_frontend_attach_mh,
1173 .tuner_attach = mxl111sf_attach_tuner,
1174 .init = mxl111sf_init,
1175 .streaming_ctrl = mxl111sf_ep5_streaming_ctrl,
1176 .get_stream_config = mxl111sf_get_stream_config_mh,
1181 .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1),
1186 /* atsc mh lgdt3305 mxl111sf lg2160
1187 * bulk EP6/BULK/5/8192 EP4/BULK/5/8192 EP5/BULK/5/8192/RAW
1188 * isoc EP6/ISOC/5/24/3072 EP4/ISOC/5/96/564 EP5/ISOC/5/96/200/RAW
1190 static int mxl111sf_get_stream_config_atsc_mh(struct dvb_frontend *fe,
1191 u8 *ts_type, struct usb_data_stream_properties *stream)
1193 pr_debug("%s: fe=%d\n", __func__, fe->id);
1196 *ts_type = DVB_USB_FE_TS_TYPE_188;
1197 if (dvb_usb_mxl111sf_isoc)
1198 mxl111sf_stream_config_isoc(stream, 6, 24, 3072);
1200 mxl111sf_stream_config_bulk(stream, 6);
1201 } else if (fe->id == 1) {
1202 *ts_type = DVB_USB_FE_TS_TYPE_188;
1203 if (dvb_usb_mxl111sf_isoc)
1204 mxl111sf_stream_config_isoc(stream, 4, 96, 564);
1206 mxl111sf_stream_config_bulk(stream, 4);
1207 } else if (fe->id == 2) {
1208 *ts_type = DVB_USB_FE_TS_TYPE_RAW;
1209 if (dvb_usb_mxl111sf_isoc)
1210 mxl111sf_stream_config_isoc(stream, 5, 96, 200);
1212 mxl111sf_stream_config_bulk(stream, 5);
1217 static int mxl111sf_streaming_ctrl_atsc_mh(struct dvb_frontend *fe, int onoff)
1219 pr_debug("%s: fe=%d onoff=%d\n", __func__, fe->id, onoff);
1222 return mxl111sf_ep6_streaming_ctrl(fe, onoff);
1223 else if (fe->id == 1)
1224 return mxl111sf_ep4_streaming_ctrl(fe, onoff);
1225 else if (fe->id == 2)
1226 return mxl111sf_ep5_streaming_ctrl(fe, onoff);
1230 static struct dvb_usb_device_properties mxl111sf_props_atsc_mh = {
1231 .driver_name = KBUILD_MODNAME,
1232 .owner = THIS_MODULE,
1233 .adapter_nr = adapter_nr,
1234 .size_of_priv = sizeof(struct mxl111sf_state),
1236 .generic_bulk_ctrl_endpoint = 0x02,
1237 .generic_bulk_ctrl_endpoint_response = 0x81,
1239 .i2c_algo = &mxl111sf_i2c_algo,
1240 .frontend_attach = mxl111sf_frontend_attach_atsc_mh,
1241 .tuner_attach = mxl111sf_attach_tuner,
1242 .init = mxl111sf_init,
1243 .streaming_ctrl = mxl111sf_streaming_ctrl_atsc_mh,
1244 .get_stream_config = mxl111sf_get_stream_config_atsc_mh,
1249 .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1),
1254 /* mercury lgdt3305 mxl111sf lg2161
1255 * tp bulk EP6/BULK/5/8192 EP4/BULK/5/8192 EP6/BULK/5/8192/RAW
1256 * tp isoc EP6/ISOC/5/24/3072 EP4/ISOC/5/96/564 EP6/ISOC/5/24/3072/RAW
1257 * spi bulk EP6/BULK/5/8192 EP4/BULK/5/8192 EP5/BULK/5/8192/RAW
1258 * spi isoc EP6/ISOC/5/24/3072 EP4/ISOC/5/96/564 EP5/ISOC/5/96/200/RAW
1260 static int mxl111sf_get_stream_config_mercury(struct dvb_frontend *fe,
1261 u8 *ts_type, struct usb_data_stream_properties *stream)
1263 pr_debug("%s: fe=%d\n", __func__, fe->id);
1266 *ts_type = DVB_USB_FE_TS_TYPE_188;
1267 if (dvb_usb_mxl111sf_isoc)
1268 mxl111sf_stream_config_isoc(stream, 6, 24, 3072);
1270 mxl111sf_stream_config_bulk(stream, 6);
1271 } else if (fe->id == 1) {
1272 *ts_type = DVB_USB_FE_TS_TYPE_188;
1273 if (dvb_usb_mxl111sf_isoc)
1274 mxl111sf_stream_config_isoc(stream, 4, 96, 564);
1276 mxl111sf_stream_config_bulk(stream, 4);
1277 } else if (fe->id == 2 && dvb_usb_mxl111sf_spi) {
1278 *ts_type = DVB_USB_FE_TS_TYPE_RAW;
1279 if (dvb_usb_mxl111sf_isoc)
1280 mxl111sf_stream_config_isoc(stream, 5, 96, 200);
1282 mxl111sf_stream_config_bulk(stream, 5);
1283 } else if (fe->id == 2 && !dvb_usb_mxl111sf_spi) {
1284 *ts_type = DVB_USB_FE_TS_TYPE_RAW;
1285 if (dvb_usb_mxl111sf_isoc)
1286 mxl111sf_stream_config_isoc(stream, 6, 24, 3072);
1288 mxl111sf_stream_config_bulk(stream, 6);
1293 static int mxl111sf_streaming_ctrl_mercury(struct dvb_frontend *fe, int onoff)
1295 pr_debug("%s: fe=%d onoff=%d\n", __func__, fe->id, onoff);
1298 return mxl111sf_ep6_streaming_ctrl(fe, onoff);
1299 else if (fe->id == 1)
1300 return mxl111sf_ep4_streaming_ctrl(fe, onoff);
1301 else if (fe->id == 2 && dvb_usb_mxl111sf_spi)
1302 return mxl111sf_ep5_streaming_ctrl(fe, onoff);
1303 else if (fe->id == 2 && !dvb_usb_mxl111sf_spi)
1304 return mxl111sf_ep6_streaming_ctrl(fe, onoff);
1308 static struct dvb_usb_device_properties mxl111sf_props_mercury = {
1309 .driver_name = KBUILD_MODNAME,
1310 .owner = THIS_MODULE,
1311 .adapter_nr = adapter_nr,
1312 .size_of_priv = sizeof(struct mxl111sf_state),
1314 .generic_bulk_ctrl_endpoint = 0x02,
1315 .generic_bulk_ctrl_endpoint_response = 0x81,
1317 .i2c_algo = &mxl111sf_i2c_algo,
1318 .frontend_attach = mxl111sf_frontend_attach_mercury,
1319 .tuner_attach = mxl111sf_attach_tuner,
1320 .init = mxl111sf_init,
1321 .streaming_ctrl = mxl111sf_streaming_ctrl_mercury,
1322 .get_stream_config = mxl111sf_get_stream_config_mercury,
1327 .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1),
1332 /* mercury mh mxl111sf lg2161
1333 * tp bulk EP4/BULK/5/8192 EP6/BULK/5/8192/RAW
1334 * tp isoc EP4/ISOC/5/96/564 EP6/ISOC/5/24/3072/RAW
1335 * spi bulk EP4/BULK/5/8192 EP5/BULK/5/8192/RAW
1336 * spi isoc EP4/ISOC/5/96/564 EP5/ISOC/5/96/200/RAW
1338 static int mxl111sf_get_stream_config_mercury_mh(struct dvb_frontend *fe,
1339 u8 *ts_type, struct usb_data_stream_properties *stream)
1341 pr_debug("%s: fe=%d\n", __func__, fe->id);
1344 *ts_type = DVB_USB_FE_TS_TYPE_188;
1345 if (dvb_usb_mxl111sf_isoc)
1346 mxl111sf_stream_config_isoc(stream, 4, 96, 564);
1348 mxl111sf_stream_config_bulk(stream, 4);
1349 } else if (fe->id == 1 && dvb_usb_mxl111sf_spi) {
1350 *ts_type = DVB_USB_FE_TS_TYPE_RAW;
1351 if (dvb_usb_mxl111sf_isoc)
1352 mxl111sf_stream_config_isoc(stream, 5, 96, 200);
1354 mxl111sf_stream_config_bulk(stream, 5);
1355 } else if (fe->id == 1 && !dvb_usb_mxl111sf_spi) {
1356 *ts_type = DVB_USB_FE_TS_TYPE_RAW;
1357 if (dvb_usb_mxl111sf_isoc)
1358 mxl111sf_stream_config_isoc(stream, 6, 24, 3072);
1360 mxl111sf_stream_config_bulk(stream, 6);
1365 static int mxl111sf_streaming_ctrl_mercury_mh(struct dvb_frontend *fe, int onoff)
1367 pr_debug("%s: fe=%d onoff=%d\n", __func__, fe->id, onoff);
1370 return mxl111sf_ep4_streaming_ctrl(fe, onoff);
1371 else if (fe->id == 1 && dvb_usb_mxl111sf_spi)
1372 return mxl111sf_ep5_streaming_ctrl(fe, onoff);
1373 else if (fe->id == 1 && !dvb_usb_mxl111sf_spi)
1374 return mxl111sf_ep6_streaming_ctrl(fe, onoff);
1378 static struct dvb_usb_device_properties mxl111sf_props_mercury_mh = {
1379 .driver_name = KBUILD_MODNAME,
1380 .owner = THIS_MODULE,
1381 .adapter_nr = adapter_nr,
1382 .size_of_priv = sizeof(struct mxl111sf_state),
1384 .generic_bulk_ctrl_endpoint = 0x02,
1385 .generic_bulk_ctrl_endpoint_response = 0x81,
1387 .i2c_algo = &mxl111sf_i2c_algo,
1388 .frontend_attach = mxl111sf_frontend_attach_mercury_mh,
1389 .tuner_attach = mxl111sf_attach_tuner,
1390 .init = mxl111sf_init,
1391 .streaming_ctrl = mxl111sf_streaming_ctrl_mercury_mh,
1392 .get_stream_config = mxl111sf_get_stream_config_mercury_mh,
1397 .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1),
1402 static const struct usb_device_id mxl111sf_id_table[] = {
1403 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc600, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) },
1404 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc601, &mxl111sf_props_atsc, "Hauppauge 126xxx ATSC", NULL) },
1405 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc602, &mxl111sf_props_mh, "HCW 126xxx", NULL) },
1406 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc603, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) },
1407 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc604, &mxl111sf_props_dvbt, "Hauppauge 126xxx DVBT", NULL) },
1408 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc609, &mxl111sf_props_atsc, "Hauppauge 126xxx ATSC", NULL) },
1409 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60a, &mxl111sf_props_mh, "HCW 126xxx", NULL) },
1410 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60b, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) },
1411 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60c, &mxl111sf_props_dvbt, "Hauppauge 126xxx DVBT", NULL) },
1412 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc653, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) },
1413 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc65b, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) },
1414 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb700, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) },
1415 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb701, &mxl111sf_props_atsc, "Hauppauge 126xxx ATSC", NULL) },
1416 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb702, &mxl111sf_props_mh, "HCW 117xxx", NULL) },
1417 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb703, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) },
1418 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb704, &mxl111sf_props_dvbt, "Hauppauge 117xxx DVBT", NULL) },
1419 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb753, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) },
1420 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb763, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) },
1421 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb764, &mxl111sf_props_dvbt, "Hauppauge 117xxx DVBT", NULL) },
1422 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd853, &mxl111sf_props_mercury, "Hauppauge Mercury", NULL) },
1423 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd854, &mxl111sf_props_dvbt, "Hauppauge 138xxx DVBT", NULL) },
1424 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd863, &mxl111sf_props_mercury, "Hauppauge Mercury", NULL) },
1425 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd864, &mxl111sf_props_dvbt, "Hauppauge 138xxx DVBT", NULL) },
1426 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8d3, &mxl111sf_props_mercury, "Hauppauge Mercury", NULL) },
1427 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8d4, &mxl111sf_props_dvbt, "Hauppauge 138xxx DVBT", NULL) },
1428 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8e3, &mxl111sf_props_mercury, "Hauppauge Mercury", NULL) },
1429 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8e4, &mxl111sf_props_dvbt, "Hauppauge 138xxx DVBT", NULL) },
1430 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8ff, &mxl111sf_props_mercury, "Hauppauge Mercury", NULL) },
1431 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc612, &mxl111sf_props_mercury_mh, "Hauppauge 126xxx", NULL) },
1432 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc613, &mxl111sf_props_mercury, "Hauppauge WinTV-Aero-M", NULL) },
1433 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc61a, &mxl111sf_props_mercury_mh, "Hauppauge 126xxx", NULL) },
1434 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc61b, &mxl111sf_props_mercury, "Hauppauge WinTV-Aero-M", NULL) },
1435 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb757, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) },
1436 { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xb767, &mxl111sf_props_atsc_mh, "Hauppauge 117xxx ATSC+", NULL) },
1439 MODULE_DEVICE_TABLE(usb, mxl111sf_id_table);
1441 static struct usb_driver mxl111sf_usb_driver = {
1442 .name = KBUILD_MODNAME,
1443 .id_table = mxl111sf_id_table,
1444 .probe = dvb_usbv2_probe,
1445 .disconnect = dvb_usbv2_disconnect,
1446 .suspend = dvb_usbv2_suspend,
1447 .resume = dvb_usbv2_resume,
1452 module_usb_driver(mxl111sf_usb_driver);
1454 MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
1455 MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF");
1456 MODULE_VERSION("1.0");
1457 MODULE_LICENSE("GPL");