blob: cd842798f5afefebd51114b2382242e882b63481 [file] [log] [blame]
Michael Krufky4c66c922011-08-29 00:05:35 -03001/*
2 * Copyright (C) 2010 Michael Krufky (mkrufky@kernellabs.com)
3 *
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.
7 *
8 * see Documentation/dvb/README.dvb-usb for more information
9 */
10
11#include <linux/vmalloc.h>
12#include <linux/i2c.h>
13
14#include "mxl111sf.h"
15#include "mxl111sf-reg.h"
16#include "mxl111sf-phy.h"
17#include "mxl111sf-i2c.h"
18#include "mxl111sf-gpio.h"
19
Michael Krufky4f984802011-10-15 23:10:15 +010020#include "mxl111sf-demod.h"
Michael Krufky4c66c922011-08-29 00:05:35 -030021#include "mxl111sf-tuner.h"
22
23#include "lgdt3305.h"
Michael Krufky31136212012-01-29 15:53:55 -030024#include "lg2160.h"
Michael Krufky4c66c922011-08-29 00:05:35 -030025
26int dvb_usb_mxl111sf_debug;
27module_param_named(debug, dvb_usb_mxl111sf_debug, int, 0644);
28MODULE_PARM_DESC(debug, "set debugging level "
29 "(1=info, 2=xfer, 4=i2c, 8=reg, 16=adv (or-able)).");
30
31int dvb_usb_mxl111sf_isoc;
32module_param_named(isoc, dvb_usb_mxl111sf_isoc, int, 0644);
33MODULE_PARM_DESC(isoc, "enable usb isoc xfer (0=bulk, 1=isoc).");
34
Michael Krufky31136212012-01-29 15:53:55 -030035int dvb_usb_mxl111sf_spi;
36module_param_named(spi, dvb_usb_mxl111sf_spi, int, 0644);
37MODULE_PARM_DESC(spi, "use spi rather than tp for data xfer (0=tp, 1=spi).");
38
Michael Krufky4c66c922011-08-29 00:05:35 -030039#define ANT_PATH_AUTO 0
40#define ANT_PATH_EXTERNAL 1
41#define ANT_PATH_INTERNAL 2
42
43int dvb_usb_mxl111sf_rfswitch =
44#if 0
45 ANT_PATH_AUTO;
46#else
47 ANT_PATH_EXTERNAL;
48#endif
49
50module_param_named(rfswitch, dvb_usb_mxl111sf_rfswitch, int, 0644);
51MODULE_PARM_DESC(rfswitch, "force rf switch position (0=auto, 1=ext, 2=int).");
52
53DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
54
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)
58
59int mxl111sf_ctrl_msg(struct dvb_usb_device *d,
60 u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
61{
62 int wo = (rbuf == NULL || rlen == 0); /* write-only */
63 int ret;
64 u8 sndbuf[1+wlen];
65
66 deb_adv("%s(wlen = %d, rlen = %d)\n", __func__, wlen, rlen);
67
68 memset(sndbuf, 0, 1+wlen);
69
70 sndbuf[0] = cmd;
71 memcpy(&sndbuf[1], wbuf, wlen);
72
73 ret = (wo) ? dvb_usb_generic_write(d, sndbuf, 1+wlen) :
74 dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0);
75 mxl_fail(ret);
76
77 return ret;
78}
79
80/* ------------------------------------------------------------------------ */
81
82#define MXL_CMD_REG_READ 0xaa
83#define MXL_CMD_REG_WRITE 0x55
84
85int mxl111sf_read_reg(struct mxl111sf_state *state, u8 addr, u8 *data)
86{
87 u8 buf[2];
88 int ret;
89
90 ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_READ, &addr, 1, buf, 2);
91 if (mxl_fail(ret)) {
92 mxl_debug("error reading reg: 0x%02x", addr);
93 goto fail;
94 }
95
96 if (buf[0] == addr)
97 *data = buf[1];
98 else {
99 err("invalid response reading reg: 0x%02x != 0x%02x, 0x%02x",
100 addr, buf[0], buf[1]);
101 ret = -EINVAL;
102 }
103
104 deb_reg("R: (0x%02x, 0x%02x)\n", addr, *data);
105fail:
106 return ret;
107}
108
109int mxl111sf_write_reg(struct mxl111sf_state *state, u8 addr, u8 data)
110{
111 u8 buf[] = { addr, data };
112 int ret;
113
114 deb_reg("W: (0x%02x, 0x%02x)\n", addr, data);
115
116 ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_WRITE, buf, 2, NULL, 0);
117 if (mxl_fail(ret))
118 err("error writing reg: 0x%02x, val: 0x%02x", addr, data);
119 return ret;
120}
121
122/* ------------------------------------------------------------------------ */
123
124int mxl111sf_write_reg_mask(struct mxl111sf_state *state,
125 u8 addr, u8 mask, u8 data)
126{
127 int ret;
128 u8 val;
129
130 if (mask != 0xff) {
131 ret = mxl111sf_read_reg(state, addr, &val);
132#if 1
133 /* dont know why this usually errors out on the first try */
134 if (mxl_fail(ret))
135 err("error writing addr: 0x%02x, mask: 0x%02x, "
136 "data: 0x%02x, retrying...", addr, mask, data);
137
138 ret = mxl111sf_read_reg(state, addr, &val);
139#endif
140 if (mxl_fail(ret))
141 goto fail;
142 }
143 val &= ~mask;
144 val |= data;
145
146 ret = mxl111sf_write_reg(state, addr, val);
147 mxl_fail(ret);
148fail:
149 return ret;
150}
151
152/* ------------------------------------------------------------------------ */
153
154int mxl111sf_ctrl_program_regs(struct mxl111sf_state *state,
155 struct mxl111sf_reg_ctrl_info *ctrl_reg_info)
156{
157 int i, ret = 0;
158
159 for (i = 0; ctrl_reg_info[i].addr |
160 ctrl_reg_info[i].mask |
161 ctrl_reg_info[i].data; i++) {
162
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);
167 if (mxl_fail(ret)) {
168 err("failed on reg #%d (0x%02x)", i,
169 ctrl_reg_info[i].addr);
170 break;
171 }
172 }
173 return ret;
174}
175
176/* ------------------------------------------------------------------------ */
177
178static int mxl1x1sf_get_chip_info(struct mxl111sf_state *state)
179{
180 int ret;
181 u8 id, ver;
182 char *mxl_chip, *mxl_rev;
183
184 if ((state->chip_id) && (state->chip_ver))
185 return 0;
186
187 ret = mxl111sf_read_reg(state, CHIP_ID_REG, &id);
188 if (mxl_fail(ret))
189 goto fail;
190 state->chip_id = id;
191
192 ret = mxl111sf_read_reg(state, TOP_CHIP_REV_ID_REG, &ver);
193 if (mxl_fail(ret))
194 goto fail;
195 state->chip_ver = ver;
196
197 switch (id) {
198 case 0x61:
199 mxl_chip = "MxL101SF";
200 break;
201 case 0x63:
202 mxl_chip = "MxL111SF";
203 break;
204 default:
205 mxl_chip = "UNKNOWN MxL1X1";
206 break;
207 }
208 switch (ver) {
209 case 0x36:
210 state->chip_rev = MXL111SF_V6;
211 mxl_rev = "v6";
212 break;
213 case 0x08:
214 state->chip_rev = MXL111SF_V8_100;
215 mxl_rev = "v8_100";
216 break;
217 case 0x18:
218 state->chip_rev = MXL111SF_V8_200;
219 mxl_rev = "v8_200";
220 break;
221 default:
222 state->chip_rev = 0;
223 mxl_rev = "UNKNOWN REVISION";
224 break;
225 }
226 info("%s detected, %s (0x%x)", mxl_chip, mxl_rev, ver);
227fail:
228 return ret;
229}
230
231#define get_chip_info(state) \
232({ \
233 int ___ret; \
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"); \
241 else \
242 mxl_debug("probe needed a retry " \
243 "in order to succeed."); \
244 } \
245 ___ret; \
246})
247
248/* ------------------------------------------------------------------------ */
249
250static int mxl111sf_power_ctrl(struct dvb_usb_device *d, int onoff)
251{
252 /* power control depends on which adapter is being woken:
253 * save this for init, instead, via mxl111sf_adap_fe_init */
254 return 0;
255}
256
257static int mxl111sf_adap_fe_init(struct dvb_frontend *fe)
258{
259 struct dvb_usb_adapter *adap = fe->dvb->priv;
260 struct dvb_usb_device *d = adap->dev;
261 struct mxl111sf_state *state = d->priv;
Michael Krufky77eed212011-09-06 09:31:57 -0300262 struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe->id].priv;
263
Michael Krufky4c66c922011-08-29 00:05:35 -0300264 int err;
265
266 /* exit if we didnt initialize the driver yet */
267 if (!state->chip_id) {
268 mxl_debug("driver not yet initialized, exit.");
269 goto fail;
270 }
271
272 deb_info("%s()\n", __func__);
273
274 mutex_lock(&state->fe_lock);
275
276 state->alt_mode = adap_state->alt_mode;
277
278 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
279 err("set interface failed");
280
281 err = mxl1x1sf_soft_reset(state);
282 mxl_fail(err);
283 err = mxl111sf_init_tuner_demod(state);
284 mxl_fail(err);
285 err = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
286
287 mxl_fail(err);
288 mxl111sf_enable_usb_output(state);
289 mxl_fail(err);
290 mxl1x1sf_top_master_ctrl(state, 1);
291 mxl_fail(err);
292
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);
297 mxl_fail(err);
298 }
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);
303 mxl_fail(err);
304#if 0
305 err = fe->ops.init(fe);
306#endif
307 msleep(100); /* add short delay after enabling
308 * the demod before touching it */
309 }
310
311 return (adap_state->fe_init) ? adap_state->fe_init(fe) : 0;
312fail:
313 return -ENODEV;
314}
315
316static int mxl111sf_adap_fe_sleep(struct dvb_frontend *fe)
317{
318 struct dvb_usb_adapter *adap = fe->dvb->priv;
319 struct dvb_usb_device *d = adap->dev;
320 struct mxl111sf_state *state = d->priv;
Michael Krufky77eed212011-09-06 09:31:57 -0300321 struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe->id].priv;
Michael Krufky4c66c922011-08-29 00:05:35 -0300322 int err;
323
324 /* exit if we didnt initialize the driver yet */
325 if (!state->chip_id) {
326 mxl_debug("driver not yet initialized, exit.");
327 goto fail;
328 }
329
330 deb_info("%s()\n", __func__);
331
332 err = (adap_state->fe_sleep) ? adap_state->fe_sleep(fe) : 0;
333
334 mutex_unlock(&state->fe_lock);
335
336 return err;
337fail:
338 return -ENODEV;
339}
340
341
342static int mxl111sf_ep6_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
343{
344 struct dvb_usb_device *d = adap->dev;
345 struct mxl111sf_state *state = d->priv;
Michael Krufky77eed212011-09-06 09:31:57 -0300346 struct mxl111sf_adap_state *adap_state = adap->fe_adap[adap->active_fe].priv;
Michael Krufky4c66c922011-08-29 00:05:35 -0300347 int ret = 0;
Michael Krufky4c66c922011-08-29 00:05:35 -0300348
349 deb_info("%s(%d)\n", __func__, onoff);
350
351 if (onoff) {
352 ret = mxl111sf_enable_usb_output(state);
353 mxl_fail(ret);
354 ret = mxl111sf_config_mpeg_in(state, 1, 1,
355 adap_state->ep6_clockphase,
356 0, 0);
357 mxl_fail(ret);
Michael Krufky3be5bb72012-03-18 14:35:57 -0300358#if 0
Michael Krufky4c66c922011-08-29 00:05:35 -0300359 } else {
360 ret = mxl111sf_disable_656_port(state);
361 mxl_fail(ret);
Michael Krufky3be5bb72012-03-18 14:35:57 -0300362#endif
Michael Krufky4c66c922011-08-29 00:05:35 -0300363 }
364
Michael Krufky4c66c922011-08-29 00:05:35 -0300365 return ret;
366}
367
Michael Krufky31136212012-01-29 15:53:55 -0300368static int mxl111sf_ep5_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
369{
370 struct dvb_usb_device *d = adap->dev;
371 struct mxl111sf_state *state = d->priv;
372 int ret = 0;
373
374 deb_info("%s(%d)\n", __func__, onoff);
375
376 if (onoff) {
377 ret = mxl111sf_enable_usb_output(state);
378 mxl_fail(ret);
379
380 ret = mxl111sf_init_i2s_port(state, 200);
381 mxl_fail(ret);
382 ret = mxl111sf_config_i2s(state, 0, 15);
383 mxl_fail(ret);
384 } else {
385 ret = mxl111sf_disable_i2s_port(state);
386 mxl_fail(ret);
387 }
388 if (state->chip_rev > MXL111SF_V6)
389 ret = mxl111sf_config_spi(state, onoff);
390 mxl_fail(ret);
391
392 return ret;
393}
394
Michael Krufky4f984802011-10-15 23:10:15 +0100395static int mxl111sf_ep4_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
396{
397 struct dvb_usb_device *d = adap->dev;
398 struct mxl111sf_state *state = d->priv;
399 int ret = 0;
400
401 deb_info("%s(%d)\n", __func__, onoff);
402
403 if (onoff) {
404 ret = mxl111sf_enable_usb_output(state);
405 mxl_fail(ret);
406 }
407
408 return ret;
409}
410
Michael Krufky4c66c922011-08-29 00:05:35 -0300411/* ------------------------------------------------------------------------ */
412
413static 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,
418 .deny_i2c_rptr = 1,
419 .spectral_inversion = 0,
420 .qam_if_khz = 6000,
421 .vsb_if_khz = 6000,
422};
423
424static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
425{
426 struct dvb_usb_device *d = adap->dev;
427 struct mxl111sf_state *state = d->priv;
Michael Krufky12513122011-09-08 04:12:57 -0300428 int fe_id = adap->num_frontends_initialized;
429 struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
Michael Krufky4c66c922011-08-29 00:05:35 -0300430 int ret;
431
432 deb_adv("%s()\n", __func__);
433
434 /* save a pointer to the dvb_usb_device in device state */
435 state->d = d;
436 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
437 state->alt_mode = adap_state->alt_mode;
438
439 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
440 err("set interface failed");
441
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;
446
447 ret = mxl1x1sf_soft_reset(state);
448 if (mxl_fail(ret))
449 goto fail;
450 ret = mxl111sf_init_tuner_demod(state);
451 if (mxl_fail(ret))
452 goto fail;
453
454 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
455 if (mxl_fail(ret))
456 goto fail;
457
458 ret = mxl111sf_enable_usb_output(state);
459 if (mxl_fail(ret))
460 goto fail;
461 ret = mxl1x1sf_top_master_ctrl(state, 1);
462 if (mxl_fail(ret))
463 goto fail;
464
465 ret = mxl111sf_init_port_expander(state);
466 if (mxl_fail(ret))
467 goto fail;
468 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
469 if (mxl_fail(ret))
470 goto fail;
471
Michael Krufky12513122011-09-08 04:12:57 -0300472 adap->fe_adap[fe_id].fe = dvb_attach(lgdt3305_attach,
Michael Krufky4c66c922011-08-29 00:05:35 -0300473 &hauppauge_lgdt3305_config,
474 &adap->dev->i2c_adap);
Michael Krufky12513122011-09-08 04:12:57 -0300475 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;
Michael Krufky4c66c922011-08-29 00:05:35 -0300480 return 0;
481 }
482 ret = -EIO;
483fail:
484 return ret;
485}
486
Michael Krufky31136212012-01-29 15:53:55 -0300487static struct lg2160_config hauppauge_lg2160_config = {
488 .lg_chip = LG2160,
489 .i2c_addr = 0x1c >> 1,
490 .deny_i2c_rptr = 1,
491 .spectral_inversion = 0,
492 .if_khz = 6000,
493};
494
495static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap)
496{
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;
501 int ret;
502
503 deb_adv("%s()\n", __func__);
504
505 /* save a pointer to the dvb_usb_device in device state */
506 state->d = d;
507 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
508 state->alt_mode = adap_state->alt_mode;
509
510 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
511 err("set interface failed");
512
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;
517
518 ret = mxl1x1sf_soft_reset(state);
519 if (mxl_fail(ret))
520 goto fail;
521 ret = mxl111sf_init_tuner_demod(state);
522 if (mxl_fail(ret))
523 goto fail;
524
525 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
526 if (mxl_fail(ret))
527 goto fail;
528
529 ret = mxl111sf_enable_usb_output(state);
530 if (mxl_fail(ret))
531 goto fail;
532 ret = mxl1x1sf_top_master_ctrl(state, 1);
533 if (mxl_fail(ret))
534 goto fail;
535
536 ret = mxl111sf_init_port_expander(state);
537 if (mxl_fail(ret))
538 goto fail;
539 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
540 if (mxl_fail(ret))
541 goto fail;
542
543 ret = get_chip_info(state);
544 if (mxl_fail(ret))
545 goto fail;
546
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;
555 return 0;
556 }
557 ret = -EIO;
558fail:
559 return ret;
560}
561
562static struct lg2160_config hauppauge_lg2161_1019_config = {
563 .lg_chip = LG2161_1019,
564 .i2c_addr = 0x1c >> 1,
565 .deny_i2c_rptr = 1,
566 .spectral_inversion = 0,
567 .if_khz = 6000,
568 .output_if = 2, /* LG2161_OIF_SPI_MAS */
569};
570
571static struct lg2160_config hauppauge_lg2161_1040_config = {
572 .lg_chip = LG2161_1040,
573 .i2c_addr = 0x1c >> 1,
574 .deny_i2c_rptr = 1,
575 .spectral_inversion = 0,
576 .if_khz = 6000,
577 .output_if = 4, /* LG2161_OIF_SPI_MAS */
578};
579
580static int mxl111sf_lg2161_frontend_attach(struct dvb_usb_adapter *adap)
581{
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;
586 int ret;
587
588 deb_adv("%s()\n", __func__);
589
590 /* save a pointer to the dvb_usb_device in device state */
591 state->d = d;
592 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
593 state->alt_mode = adap_state->alt_mode;
594
595 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
596 err("set interface failed");
597
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;
602
603 ret = mxl1x1sf_soft_reset(state);
604 if (mxl_fail(ret))
605 goto fail;
606 ret = mxl111sf_init_tuner_demod(state);
607 if (mxl_fail(ret))
608 goto fail;
609
610 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
611 if (mxl_fail(ret))
612 goto fail;
613
614 ret = mxl111sf_enable_usb_output(state);
615 if (mxl_fail(ret))
616 goto fail;
617 ret = mxl1x1sf_top_master_ctrl(state, 1);
618 if (mxl_fail(ret))
619 goto fail;
620
621 ret = mxl111sf_init_port_expander(state);
622 if (mxl_fail(ret))
623 goto fail;
624 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
625 if (mxl_fail(ret))
626 goto fail;
627
628 ret = get_chip_info(state);
629 if (mxl_fail(ret))
630 goto fail;
631
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;
642 return 0;
643 }
644 ret = -EIO;
645fail:
646 return ret;
647}
648
649static struct lg2160_config hauppauge_lg2161_1019_ep6_config = {
650 .lg_chip = LG2161_1019,
651 .i2c_addr = 0x1c >> 1,
652 .deny_i2c_rptr = 1,
653 .spectral_inversion = 0,
654 .if_khz = 6000,
655 .output_if = 1, /* LG2161_OIF_SERIAL_TS */
656};
657
658static struct lg2160_config hauppauge_lg2161_1040_ep6_config = {
659 .lg_chip = LG2161_1040,
660 .i2c_addr = 0x1c >> 1,
661 .deny_i2c_rptr = 1,
662 .spectral_inversion = 0,
663 .if_khz = 6000,
664 .output_if = 7, /* LG2161_OIF_SERIAL_TS */
665};
666
667static int mxl111sf_lg2161_ep6_frontend_attach(struct dvb_usb_adapter *adap)
668{
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;
673 int ret;
674
675 deb_adv("%s()\n", __func__);
676
677 /* save a pointer to the dvb_usb_device in device state */
678 state->d = d;
679 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
680 state->alt_mode = adap_state->alt_mode;
681
682 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
683 err("set interface failed");
684
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;
689
690 ret = mxl1x1sf_soft_reset(state);
691 if (mxl_fail(ret))
692 goto fail;
693 ret = mxl111sf_init_tuner_demod(state);
694 if (mxl_fail(ret))
695 goto fail;
696
697 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
698 if (mxl_fail(ret))
699 goto fail;
700
701 ret = mxl111sf_enable_usb_output(state);
702 if (mxl_fail(ret))
703 goto fail;
704 ret = mxl1x1sf_top_master_ctrl(state, 1);
705 if (mxl_fail(ret))
706 goto fail;
707
708 ret = mxl111sf_init_port_expander(state);
709 if (mxl_fail(ret))
710 goto fail;
711 ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
712 if (mxl_fail(ret))
713 goto fail;
714
715 ret = get_chip_info(state);
716 if (mxl_fail(ret))
717 goto fail;
718
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;
729 return 0;
730 }
731 ret = -EIO;
732fail:
733 return ret;
734}
735
Michael Krufky4f984802011-10-15 23:10:15 +0100736static 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,
740};
741
742static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap)
743{
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;
748 int ret;
749
750 deb_adv("%s()\n", __func__);
751
752 /* save a pointer to the dvb_usb_device in device state */
753 state->d = d;
754 adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 1 : 2;
755 state->alt_mode = adap_state->alt_mode;
756
757 if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
758 err("set interface failed");
759
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;
764
765 ret = mxl1x1sf_soft_reset(state);
766 if (mxl_fail(ret))
767 goto fail;
768 ret = mxl111sf_init_tuner_demod(state);
769 if (mxl_fail(ret))
770 goto fail;
771
772 ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
773 if (mxl_fail(ret))
774 goto fail;
775
776 ret = mxl111sf_enable_usb_output(state);
777 if (mxl_fail(ret))
778 goto fail;
779 ret = mxl1x1sf_top_master_ctrl(state, 1);
780 if (mxl_fail(ret))
781 goto fail;
782
783 /* dont care if this fails */
784 mxl111sf_init_port_expander(state);
785
786 adap->fe_adap[fe_id].fe = dvb_attach(mxl111sf_demod_attach, state,
787 &mxl_demod_config);
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;
793 return 0;
794 }
795 ret = -EIO;
796fail:
797 return ret;
798}
799
Michael Krufky4c66c922011-08-29 00:05:35 -0300800static inline int mxl111sf_set_ant_path(struct mxl111sf_state *state,
801 int antpath)
802{
803 return mxl111sf_idac_config(state, 1, 1,
804 (antpath == ANT_PATH_INTERNAL) ?
805 0x3f : 0x00, 0);
806}
807
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)
813
814#define ANT_HUNT_SLEEP 90
815#define ANT_EXT_TWEAK 0
816
817static int mxl111sf_ant_hunt(struct dvb_frontend *fe)
818{
819 struct dvb_usb_adapter *adap = fe->dvb->priv;
820 struct dvb_usb_device *d = adap->dev;
821 struct mxl111sf_state *state = d->priv;
822
823 int antctrl = dvb_usb_mxl111sf_rfswitch;
824
825 u16 rxPwrA, rxPwr0, rxPwr1, rxPwr2;
826
827 /* FIXME: must force EXTERNAL for QAM - done elsewhere */
828 mxl111sf_set_ant_path(state, antctrl == ANT_PATH_AUTO ?
829 ANT_PATH_EXTERNAL : antctrl);
830
831 if (antctrl == ANT_PATH_AUTO) {
832#if 0
833 msleep(ANT_HUNT_SLEEP);
834#endif
835 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwrA);
836
837 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
838 msleep(ANT_HUNT_SLEEP);
839 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr0);
840
841 mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL);
842 msleep(ANT_HUNT_SLEEP);
843 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr1);
844
845 mxl111sf_set_ant_path(state, ANT_PATH_INTERNAL);
846 msleep(ANT_HUNT_SLEEP);
847 fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr2);
848
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);
854 } else {
855 /* return with INTERNAL enabled */
856 DbgAntHunt(ANT_PATH_INTERNAL, rxPwrA,
857 rxPwr0, rxPwr1, rxPwr2);
858 }
859 }
860 return 0;
861}
862
863static 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,
871};
872
873static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap)
874{
875 struct dvb_usb_device *d = adap->dev;
876 struct mxl111sf_state *state = d->priv;
Michael Krufky12513122011-09-08 04:12:57 -0300877 int fe_id = adap->num_frontends_initialized;
Michael Krufky4c66c922011-08-29 00:05:35 -0300878
879 deb_adv("%s()\n", __func__);
880
Michael Krufky12513122011-09-08 04:12:57 -0300881 if (NULL != dvb_attach(mxl111sf_tuner_attach,
882 adap->fe_adap[fe_id].fe, state,
Michael Krufky4c66c922011-08-29 00:05:35 -0300883 &mxl_tuner_config))
884 return 0;
885
886 return -EIO;
887}
888
889static int mxl111sf_fe_ioctl_override(struct dvb_frontend *fe,
890 unsigned int cmd, void *parg,
891 unsigned int stage)
892{
893 int err = 0;
894
895 switch (stage) {
896 case DVB_FE_IOCTL_PRE:
897
898 switch (cmd) {
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 */
903 if (0 == err)
904 err = 1;
905 break;
906 }
907 break;
908
909 case DVB_FE_IOCTL_POST:
910 /* no post-ioctl handling required */
911 break;
912 }
913 return err;
914};
915
916static u32 mxl111sf_i2c_func(struct i2c_adapter *adapter)
917{
918 return I2C_FUNC_I2C;
919}
920
921struct 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,
926#endif
927};
928
Michael Krufky4f984802011-10-15 23:10:15 +0100929static struct dvb_usb_device_properties mxl111sf_dvbt_bulk_properties;
930static struct dvb_usb_device_properties mxl111sf_dvbt_isoc_properties;
Michael Krufky4c66c922011-08-29 00:05:35 -0300931static struct dvb_usb_device_properties mxl111sf_atsc_bulk_properties;
932static struct dvb_usb_device_properties mxl111sf_atsc_isoc_properties;
Michael Krufky31136212012-01-29 15:53:55 -0300933static struct dvb_usb_device_properties mxl111sf_atsc_mh_bulk_properties;
934static struct dvb_usb_device_properties mxl111sf_atsc_mh_isoc_properties;
935static struct dvb_usb_device_properties mxl111sf_mh_bulk_properties;
936static struct dvb_usb_device_properties mxl111sf_mh_isoc_properties;
937static struct dvb_usb_device_properties mxl111sf_mercury_spi_bulk_properties;
938static struct dvb_usb_device_properties mxl111sf_mercury_spi_isoc_properties;
939static struct dvb_usb_device_properties mxl111sf_mercury_tp_bulk_properties;
940static struct dvb_usb_device_properties mxl111sf_mercury_tp_isoc_properties;
941static struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_bulk_properties;
942static struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_isoc_properties;
943static struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_bulk_properties;
944static struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_isoc_properties;
Michael Krufky4c66c922011-08-29 00:05:35 -0300945
946static int mxl111sf_probe(struct usb_interface *intf,
947 const struct usb_device_id *id)
948{
949 struct dvb_usb_device *d = NULL;
950
951 deb_adv("%s()\n", __func__);
952
953 if (((dvb_usb_mxl111sf_isoc) &&
954 (0 == dvb_usb_device_init(intf,
Michael Krufky4f984802011-10-15 23:10:15 +0100955 &mxl111sf_dvbt_isoc_properties,
956 THIS_MODULE, &d, adapter_nr) ||
957 0 == dvb_usb_device_init(intf,
Michael Krufky4c66c922011-08-29 00:05:35 -0300958 &mxl111sf_atsc_isoc_properties,
Michael Krufky31136212012-01-29 15:53:55 -0300959 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,
Michael Krufky4c66c922011-08-29 00:05:35 -0300978 THIS_MODULE, &d, adapter_nr))) ||
979 0 == dvb_usb_device_init(intf,
Michael Krufky4f984802011-10-15 23:10:15 +0100980 &mxl111sf_dvbt_bulk_properties,
981 THIS_MODULE, &d, adapter_nr) ||
982 0 == dvb_usb_device_init(intf,
Michael Krufky4c66c922011-08-29 00:05:35 -0300983 &mxl111sf_atsc_bulk_properties,
Michael Krufky31136212012-01-29 15:53:55 -0300984 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,
Michael Krufky4c66c922011-08-29 00:05:35 -03001003 THIS_MODULE, &d, adapter_nr) || 0) {
1004
1005 struct mxl111sf_state *state = d->priv;
1006 static u8 eeprom[256];
1007 struct i2c_client c;
1008 int ret;
1009
1010 ret = get_chip_info(state);
1011 if (mxl_fail(ret))
1012 err("failed to get chip info during probe");
1013
1014 mutex_init(&state->fe_lock);
1015
1016 if (state->chip_rev > MXL111SF_V6)
1017 mxl111sf_config_pin_mux_modes(state,
1018 PIN_MUX_TS_SPI_IN_MODE_1);
1019
1020 c.adapter = &d->i2c_adap;
1021 c.addr = 0xa0 >> 1;
1022
1023 ret = tveeprom_read(&c, eeprom, sizeof(eeprom));
1024 if (mxl_fail(ret))
1025 return 0;
1026 tveeprom_hauppauge_analog(&c, &state->tv,
1027 (0x84 == eeprom[0xa0]) ?
1028 eeprom + 0xa0 : eeprom + 0x80);
1029#if 0
1030 switch (state->tv.model) {
1031 case 117001:
1032 case 126001:
1033 case 138001:
1034 break;
1035 default:
1036 printk(KERN_WARNING "%s: warning: "
1037 "unknown hauppauge model #%d\n",
1038 __func__, state->tv.model);
1039 }
1040#endif
1041 return 0;
1042 }
1043 err("Your device is not yet supported by this driver. "
1044 "See kernellabs.com for more info");
1045 return -EINVAL;
1046}
1047
1048static 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 */
1084};
1085MODULE_DEVICE_TABLE(usb, mxl111sf_table);
1086
1087
Michael Krufky4f984802011-10-15 23:10:15 +01001088#define MXL111SF_EP4_BULK_STREAMING_CONFIG \
Michael Krufky0d6ac1f2011-12-11 18:51:01 -03001089 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
Michael Krufky4f984802011-10-15 23:10:15 +01001090 .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, \
1091 .stream = { \
1092 .type = USB_BULK, \
1093 .count = 5, \
1094 .endpoint = 0x04, \
1095 .u = { \
1096 .bulk = { \
1097 .buffersize = 8192, \
1098 } \
1099 } \
1100 }
1101
1102/* FIXME: works for v6 but not v8 silicon */
1103#define MXL111SF_EP4_ISOC_STREAMING_CONFIG \
Michael Krufky0d6ac1f2011-12-11 18:51:01 -03001104 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
Michael Krufky4f984802011-10-15 23:10:15 +01001105 .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, \
1106 .stream = { \
1107 .type = USB_ISOC, \
1108 .count = 5, \
1109 .endpoint = 0x04, \
1110 .u = { \
1111 .isoc = { \
1112 .framesperurb = 96, \
1113 /* FIXME: v6 SILICON: */ \
1114 .framesize = 564, \
1115 .interval = 1, \
1116 } \
1117 } \
1118 }
1119
Michael Krufky31136212012-01-29 15:53:55 -03001120#define MXL111SF_EP5_BULK_STREAMING_CONFIG \
1121 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
1122 .streaming_ctrl = mxl111sf_ep5_streaming_ctrl, \
1123 .stream = { \
1124 .type = USB_BULK, \
1125 .count = 5, \
1126 .endpoint = 0x05, \
1127 .u = { \
1128 .bulk = { \
1129 .buffersize = 8192, \
1130 } \
1131 } \
1132 }
1133
1134#define MXL111SF_EP5_ISOC_STREAMING_CONFIG \
1135 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
1136 .streaming_ctrl = mxl111sf_ep5_streaming_ctrl, \
1137 .stream = { \
1138 .type = USB_ISOC, \
1139 .count = 5, \
1140 .endpoint = 0x05, \
1141 .u = { \
1142 .isoc = { \
1143 .framesperurb = 96, \
1144 .framesize = 200, \
1145 .interval = 1, \
1146 } \
1147 } \
1148 }
1149
Michael Krufky4c66c922011-08-29 00:05:35 -03001150#define MXL111SF_EP6_BULK_STREAMING_CONFIG \
Michael Krufky0d6ac1f2011-12-11 18:51:01 -03001151 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
Michael Krufky4c66c922011-08-29 00:05:35 -03001152 .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, \
1153 .stream = { \
1154 .type = USB_BULK, \
1155 .count = 5, \
1156 .endpoint = 0x06, \
1157 .u = { \
1158 .bulk = { \
1159 .buffersize = 8192, \
1160 } \
1161 } \
1162 }
1163
1164/* FIXME */
1165#define MXL111SF_EP6_ISOC_STREAMING_CONFIG \
Michael Krufky0d6ac1f2011-12-11 18:51:01 -03001166 .size_of_priv = sizeof(struct mxl111sf_adap_state), \
Michael Krufky4c66c922011-08-29 00:05:35 -03001167 .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, \
1168 .stream = { \
1169 .type = USB_ISOC, \
1170 .count = 5, \
1171 .endpoint = 0x06, \
1172 .u = { \
1173 .isoc = { \
1174 .framesperurb = 24, \
1175 .framesize = 3072, \
1176 .interval = 1, \
1177 } \
1178 } \
1179 }
1180
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), \
1188 */ \
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)
1194
Michael Krufky4f984802011-10-15 23:10:15 +01001195static struct dvb_usb_device_properties mxl111sf_dvbt_bulk_properties = {
Michael Krufky4c66c922011-08-29 00:05:35 -03001196 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1197
1198 .num_adapters = 1,
1199 .adapter = {
1200 {
Michael Krufky77eed212011-09-06 09:31:57 -03001201 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1202 .num_frontends = 1,
1203 .fe = {{
Michael Krufky4f984802011-10-15 23:10:15 +01001204 .frontend_attach = mxl111sf_attach_demod,
1205 .tuner_attach = mxl111sf_attach_tuner,
1206
1207 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1208 } },
1209 },
1210 },
Michael Krufky31136212012-01-29 15:53:55 -03001211 .num_device_descs = 3,
Michael Krufky4f984802011-10-15 23:10:15 +01001212 .devices = {
1213 { "Hauppauge 126xxx DVBT (bulk)",
1214 { NULL },
1215 { &mxl111sf_table[4], &mxl111sf_table[8],
1216 NULL },
1217 },
1218 { "Hauppauge 117xxx DVBT (bulk)",
1219 { NULL },
1220 { &mxl111sf_table[15], &mxl111sf_table[18],
1221 NULL },
1222 },
1223 { "Hauppauge 138xxx DVBT (bulk)",
1224 { NULL },
1225 { &mxl111sf_table[20], &mxl111sf_table[22],
1226 &mxl111sf_table[24], &mxl111sf_table[26],
1227 NULL },
1228 },
Michael Krufky4f984802011-10-15 23:10:15 +01001229 }
1230};
1231
1232static struct dvb_usb_device_properties mxl111sf_dvbt_isoc_properties = {
1233 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1234
1235 .num_adapters = 1,
1236 .adapter = {
1237 {
1238 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1239 .num_frontends = 1,
1240 .fe = {{
Michael Krufky4f984802011-10-15 23:10:15 +01001241 .frontend_attach = mxl111sf_attach_demod,
1242 .tuner_attach = mxl111sf_attach_tuner,
1243
1244 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1245 } },
1246 },
1247 },
Michael Krufky31136212012-01-29 15:53:55 -03001248 .num_device_descs = 3,
Michael Krufky4f984802011-10-15 23:10:15 +01001249 .devices = {
1250 { "Hauppauge 126xxx DVBT (isoc)",
1251 { NULL },
1252 { &mxl111sf_table[4], &mxl111sf_table[8],
1253 NULL },
1254 },
1255 { "Hauppauge 117xxx DVBT (isoc)",
1256 { NULL },
1257 { &mxl111sf_table[15], &mxl111sf_table[18],
1258 NULL },
1259 },
1260 { "Hauppauge 138xxx DVBT (isoc)",
1261 { NULL },
1262 { &mxl111sf_table[20], &mxl111sf_table[22],
1263 &mxl111sf_table[24], &mxl111sf_table[26],
1264 NULL },
1265 },
Michael Krufky4f984802011-10-15 23:10:15 +01001266 }
1267};
1268
1269static struct dvb_usb_device_properties mxl111sf_atsc_bulk_properties = {
1270 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1271
1272 .num_adapters = 1,
1273 .adapter = {
1274 {
1275 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
Michael Krufky31136212012-01-29 15:53:55 -03001276 .num_frontends = 1,
Michael Krufky4f984802011-10-15 23:10:15 +01001277 .fe = {{
Michael Krufky4c66c922011-08-29 00:05:35 -03001278 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1279 .tuner_attach = mxl111sf_attach_tuner,
1280
1281 MXL111SF_EP6_BULK_STREAMING_CONFIG,
Michael Krufky77eed212011-09-06 09:31:57 -03001282 }},
Michael Krufky4c66c922011-08-29 00:05:35 -03001283 },
1284 },
Michael Krufky31136212012-01-29 15:53:55 -03001285 .num_device_descs = 2,
Michael Krufky4c66c922011-08-29 00:05:35 -03001286 .devices = {
1287 { "Hauppauge 126xxx ATSC (bulk)",
1288 { NULL },
1289 { &mxl111sf_table[1], &mxl111sf_table[5],
1290 NULL },
1291 },
1292 { "Hauppauge 117xxx ATSC (bulk)",
1293 { NULL },
1294 { &mxl111sf_table[12],
1295 NULL },
1296 },
Michael Krufky31136212012-01-29 15:53:55 -03001297 }
1298};
1299
1300static struct dvb_usb_device_properties mxl111sf_atsc_isoc_properties = {
1301 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1302
1303 .num_adapters = 1,
1304 .adapter = {
1305 {
1306 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1307 .num_frontends = 1,
1308 .fe = {{
1309 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1310 .tuner_attach = mxl111sf_attach_tuner,
1311
1312 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
1313 }},
1314 },
1315 },
1316 .num_device_descs = 2,
1317 .devices = {
1318 { "Hauppauge 126xxx ATSC (isoc)",
1319 { NULL },
1320 { &mxl111sf_table[1], &mxl111sf_table[5],
1321 NULL },
1322 },
1323 { "Hauppauge 117xxx ATSC (isoc)",
1324 { NULL },
1325 { &mxl111sf_table[12],
1326 NULL },
1327 },
1328 }
1329};
1330
1331static struct dvb_usb_device_properties mxl111sf_mh_bulk_properties = {
1332 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1333
1334 .num_adapters = 1,
1335 .adapter = {
1336 {
1337 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1338 .num_frontends = 1,
1339 .fe = {{
1340 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1341
1342 .frontend_attach = mxl111sf_lg2160_frontend_attach,
1343 .tuner_attach = mxl111sf_attach_tuner,
1344
1345 MXL111SF_EP5_BULK_STREAMING_CONFIG,
1346 }},
1347 },
1348 },
1349 .num_device_descs = 2,
1350 .devices = {
1351 { "HCW 126xxx (bulk)",
1352 { NULL },
1353 { &mxl111sf_table[2], &mxl111sf_table[6],
1354 NULL },
1355 },
1356 { "HCW 117xxx (bulk)",
1357 { NULL },
1358 { &mxl111sf_table[13],
1359 NULL },
1360 },
1361 }
1362};
1363
1364static struct dvb_usb_device_properties mxl111sf_mh_isoc_properties = {
1365 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1366
1367 .num_adapters = 1,
1368 .adapter = {
1369 {
1370 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1371 .num_frontends = 1,
1372 .fe = {{
1373 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1374
1375 .frontend_attach = mxl111sf_lg2160_frontend_attach,
1376 .tuner_attach = mxl111sf_attach_tuner,
1377
1378 MXL111SF_EP5_ISOC_STREAMING_CONFIG,
1379 }},
1380 },
1381 },
1382 .num_device_descs = 2,
1383 .devices = {
1384 { "HCW 126xxx (isoc)",
1385 { NULL },
1386 { &mxl111sf_table[2], &mxl111sf_table[6],
1387 NULL },
1388 },
1389 { "HCW 117xxx (isoc)",
1390 { NULL },
1391 { &mxl111sf_table[13],
1392 NULL },
1393 },
1394 }
1395};
1396
1397static struct dvb_usb_device_properties mxl111sf_atsc_mh_bulk_properties = {
1398 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1399
1400 .num_adapters = 1,
1401 .adapter = {
1402 {
1403 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1404 .num_frontends = 3,
1405 .fe = {{
1406 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1407 .tuner_attach = mxl111sf_attach_tuner,
1408
1409 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1410 },
1411 {
1412 .frontend_attach = mxl111sf_attach_demod,
1413 .tuner_attach = mxl111sf_attach_tuner,
1414
1415 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1416 },
1417 {
1418 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1419
1420 .frontend_attach = mxl111sf_lg2160_frontend_attach,
1421 .tuner_attach = mxl111sf_attach_tuner,
1422
1423 MXL111SF_EP5_BULK_STREAMING_CONFIG,
1424 }},
1425 },
1426 },
1427 .num_device_descs = 2,
1428 .devices = {
Michael Krufky4c66c922011-08-29 00:05:35 -03001429 { "Hauppauge 126xxx ATSC+ (bulk)",
1430 { NULL },
1431 { &mxl111sf_table[0], &mxl111sf_table[3],
1432 &mxl111sf_table[7], &mxl111sf_table[9],
1433 &mxl111sf_table[10], NULL },
1434 },
1435 { "Hauppauge 117xxx ATSC+ (bulk)",
1436 { NULL },
1437 { &mxl111sf_table[11], &mxl111sf_table[14],
1438 &mxl111sf_table[16], &mxl111sf_table[17],
1439 &mxl111sf_table[32], &mxl111sf_table[33],
1440 NULL },
1441 },
Michael Krufky31136212012-01-29 15:53:55 -03001442 }
1443};
1444
1445static struct dvb_usb_device_properties mxl111sf_atsc_mh_isoc_properties = {
1446 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1447
1448 .num_adapters = 1,
1449 .adapter = {
1450 {
1451 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1452 .num_frontends = 3,
1453 .fe = {{
1454 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1455 .tuner_attach = mxl111sf_attach_tuner,
1456
1457 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
1458 },
1459 {
1460 .frontend_attach = mxl111sf_attach_demod,
1461 .tuner_attach = mxl111sf_attach_tuner,
1462
1463 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1464 },
1465 {
1466 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1467
1468 .frontend_attach = mxl111sf_lg2160_frontend_attach,
1469 .tuner_attach = mxl111sf_attach_tuner,
1470
1471 MXL111SF_EP5_ISOC_STREAMING_CONFIG,
1472 }},
1473 },
1474 },
1475 .num_device_descs = 2,
1476 .devices = {
1477 { "Hauppauge 126xxx ATSC+ (isoc)",
1478 { NULL },
1479 { &mxl111sf_table[0], &mxl111sf_table[3],
1480 &mxl111sf_table[7], &mxl111sf_table[9],
1481 &mxl111sf_table[10], NULL },
1482 },
1483 { "Hauppauge 117xxx ATSC+ (isoc)",
1484 { NULL },
1485 { &mxl111sf_table[11], &mxl111sf_table[14],
1486 &mxl111sf_table[16], &mxl111sf_table[17],
1487 &mxl111sf_table[32], &mxl111sf_table[33],
1488 NULL },
1489 },
1490 }
1491};
1492
1493static struct dvb_usb_device_properties mxl111sf_mercury_spi_bulk_properties = {
1494 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1495
1496 .num_adapters = 1,
1497 .adapter = {
1498 {
1499 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1500 .num_frontends = 3,
1501 .fe = {{
1502 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1503 .tuner_attach = mxl111sf_attach_tuner,
1504
1505 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1506 },
1507 {
1508 .frontend_attach = mxl111sf_attach_demod,
1509 .tuner_attach = mxl111sf_attach_tuner,
1510
1511 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1512 },
1513 {
1514 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1515
1516 .frontend_attach = mxl111sf_lg2161_frontend_attach,
1517 .tuner_attach = mxl111sf_attach_tuner,
1518
1519 MXL111SF_EP5_BULK_STREAMING_CONFIG,
1520 }},
1521 },
1522 },
1523 .num_device_descs = 2,
1524 .devices = {
1525 { "Hauppauge Mercury (spi-bulk)",
1526 { NULL },
1527 { &mxl111sf_table[19], &mxl111sf_table[21],
1528 &mxl111sf_table[23], &mxl111sf_table[25],
1529 NULL },
1530 },
1531 { "Hauppauge WinTV-Aero-M (spi-bulk)",
1532 { NULL },
1533 { &mxl111sf_table[29], &mxl111sf_table[31],
1534 NULL },
1535 },
1536 }
1537};
1538
1539static struct dvb_usb_device_properties mxl111sf_mercury_spi_isoc_properties = {
1540 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1541
1542 .num_adapters = 1,
1543 .adapter = {
1544 {
1545 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1546 .num_frontends = 3,
1547 .fe = {{
1548 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1549 .tuner_attach = mxl111sf_attach_tuner,
1550
1551 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
1552 },
1553 {
1554 .frontend_attach = mxl111sf_attach_demod,
1555 .tuner_attach = mxl111sf_attach_tuner,
1556
1557 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1558 },
1559 {
1560 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1561
1562 .frontend_attach = mxl111sf_lg2161_frontend_attach,
1563 .tuner_attach = mxl111sf_attach_tuner,
1564
1565 MXL111SF_EP5_ISOC_STREAMING_CONFIG,
1566 }},
1567 },
1568 },
1569 .num_device_descs = 2,
1570 .devices = {
1571 { "Hauppauge Mercury (spi-isoc)",
1572 { NULL },
1573 { &mxl111sf_table[19], &mxl111sf_table[21],
1574 &mxl111sf_table[23], &mxl111sf_table[25],
1575 NULL },
1576 },
1577 { "Hauppauge WinTV-Aero-M (spi-isoc)",
1578 { NULL },
1579 { &mxl111sf_table[29], &mxl111sf_table[31],
1580 NULL },
1581 },
1582 }
1583};
1584
1585static struct dvb_usb_device_properties mxl111sf_mercury_tp_bulk_properties = {
1586 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1587
1588 .num_adapters = 1,
1589 .adapter = {
1590 {
1591 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1592 .num_frontends = 3,
1593 .fe = {{
1594 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1595 .tuner_attach = mxl111sf_attach_tuner,
1596
1597 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1598 },
1599 {
1600 .frontend_attach = mxl111sf_attach_demod,
1601 .tuner_attach = mxl111sf_attach_tuner,
1602
1603 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1604 },
1605 {
1606 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1607
1608 .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
1609 .tuner_attach = mxl111sf_attach_tuner,
1610
1611 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1612 }},
1613 },
1614 },
1615 .num_device_descs = 2,
1616 .devices = {
Michael Krufky4c66c922011-08-29 00:05:35 -03001617 { "Hauppauge Mercury (tp-bulk)",
1618 { NULL },
1619 { &mxl111sf_table[19], &mxl111sf_table[21],
1620 &mxl111sf_table[23], &mxl111sf_table[25],
1621 &mxl111sf_table[27], NULL },
1622 },
1623 { "Hauppauge WinTV-Aero-M",
1624 { NULL },
1625 { &mxl111sf_table[29], &mxl111sf_table[31],
1626 NULL },
1627 },
1628 }
1629};
1630
Michael Krufky31136212012-01-29 15:53:55 -03001631static struct dvb_usb_device_properties mxl111sf_mercury_tp_isoc_properties = {
Michael Krufky4c66c922011-08-29 00:05:35 -03001632 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1633
1634 .num_adapters = 1,
1635 .adapter = {
1636 {
Michael Krufky77eed212011-09-06 09:31:57 -03001637 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
Michael Krufky31136212012-01-29 15:53:55 -03001638 .num_frontends = 3,
Michael Krufky77eed212011-09-06 09:31:57 -03001639 .fe = {{
Michael Krufky4c66c922011-08-29 00:05:35 -03001640 .frontend_attach = mxl111sf_lgdt3305_frontend_attach,
1641 .tuner_attach = mxl111sf_attach_tuner,
1642
1643 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
Michael Krufky4f984802011-10-15 23:10:15 +01001644 },
1645 {
Michael Krufky4f984802011-10-15 23:10:15 +01001646 .frontend_attach = mxl111sf_attach_demod,
1647 .tuner_attach = mxl111sf_attach_tuner,
1648
1649 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
Michael Krufky31136212012-01-29 15:53:55 -03001650 },
1651 {
1652 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1653
1654 .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
1655 .tuner_attach = mxl111sf_attach_tuner,
1656
1657 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
Michael Krufky77eed212011-09-06 09:31:57 -03001658 }},
Michael Krufky4c66c922011-08-29 00:05:35 -03001659 },
1660 },
Michael Krufky31136212012-01-29 15:53:55 -03001661 .num_device_descs = 2,
Michael Krufky4c66c922011-08-29 00:05:35 -03001662 .devices = {
Michael Krufky4c66c922011-08-29 00:05:35 -03001663 { "Hauppauge Mercury (tp-isoc)",
1664 { NULL },
1665 { &mxl111sf_table[19], &mxl111sf_table[21],
1666 &mxl111sf_table[23], &mxl111sf_table[25],
1667 &mxl111sf_table[27], NULL },
1668 },
1669 { "Hauppauge WinTV-Aero-M (tp-isoc)",
1670 { NULL },
1671 { &mxl111sf_table[29], &mxl111sf_table[31],
1672 NULL },
1673 },
1674 }
1675};
1676
Michael Krufky31136212012-01-29 15:53:55 -03001677static
1678struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_bulk_properties = {
1679 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1680
1681 .num_adapters = 1,
1682 .adapter = {
1683 {
1684 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1685 .num_frontends = 2,
1686 .fe = {{
1687 .frontend_attach = mxl111sf_attach_demod,
1688 .tuner_attach = mxl111sf_attach_tuner,
1689
1690 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1691 },
1692 {
1693 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1694
1695 .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
1696 .tuner_attach = mxl111sf_attach_tuner,
1697
1698 MXL111SF_EP6_BULK_STREAMING_CONFIG,
1699 }},
1700 },
1701 },
1702 .num_device_descs = 1,
1703 .devices = {
1704 { "Hauppauge 126xxx (tp-bulk)",
1705 { NULL },
1706 { &mxl111sf_table[28], &mxl111sf_table[30],
1707 NULL },
1708 },
1709 }
1710};
1711
1712static
1713struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_isoc_properties = {
1714 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1715
1716 .num_adapters = 1,
1717 .adapter = {
1718 {
1719 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1720 .num_frontends = 2,
1721 .fe = {{
1722 .frontend_attach = mxl111sf_attach_demod,
1723 .tuner_attach = mxl111sf_attach_tuner,
1724
1725 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1726 },
1727 {
1728 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1729
1730 .frontend_attach = mxl111sf_lg2161_ep6_frontend_attach,
1731 .tuner_attach = mxl111sf_attach_tuner,
1732
1733 MXL111SF_EP6_ISOC_STREAMING_CONFIG,
1734 }},
1735 },
1736 },
1737 .num_device_descs = 1,
1738 .devices = {
1739 { "Hauppauge 126xxx (tp-isoc)",
1740 { NULL },
1741 { &mxl111sf_table[28], &mxl111sf_table[30],
1742 NULL },
1743 },
1744 }
1745};
1746
1747static
1748struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_bulk_properties = {
1749 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1750
1751 .num_adapters = 1,
1752 .adapter = {
1753 {
1754 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1755 .num_frontends = 2,
1756 .fe = {{
1757 .frontend_attach = mxl111sf_attach_demod,
1758 .tuner_attach = mxl111sf_attach_tuner,
1759
1760 MXL111SF_EP4_BULK_STREAMING_CONFIG,
1761 },
1762 {
1763 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1764
1765 .frontend_attach = mxl111sf_lg2161_frontend_attach,
1766 .tuner_attach = mxl111sf_attach_tuner,
1767
1768 MXL111SF_EP5_BULK_STREAMING_CONFIG,
1769 }},
1770 },
1771 },
1772 .num_device_descs = 1,
1773 .devices = {
1774 { "Hauppauge 126xxx (spi-bulk)",
1775 { NULL },
1776 { &mxl111sf_table[28], &mxl111sf_table[30],
1777 NULL },
1778 },
1779 }
1780};
1781
1782static
1783struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_isoc_properties = {
1784 MXL111SF_DEFAULT_DEVICE_PROPERTIES,
1785
1786 .num_adapters = 1,
1787 .adapter = {
1788 {
1789 .fe_ioctl_override = mxl111sf_fe_ioctl_override,
1790 .num_frontends = 2,
1791 .fe = {{
1792 .frontend_attach = mxl111sf_attach_demod,
1793 .tuner_attach = mxl111sf_attach_tuner,
1794
1795 MXL111SF_EP4_ISOC_STREAMING_CONFIG,
1796 },
1797 {
1798 .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD,
1799
1800 .frontend_attach = mxl111sf_lg2161_frontend_attach,
1801 .tuner_attach = mxl111sf_attach_tuner,
1802
1803 MXL111SF_EP5_ISOC_STREAMING_CONFIG,
1804 }},
1805 },
1806 },
1807 .num_device_descs = 1,
1808 .devices = {
1809 { "Hauppauge 126xxx (spi-isoc)",
1810 { NULL },
1811 { &mxl111sf_table[28], &mxl111sf_table[30],
1812 NULL },
1813 },
1814 }
1815};
1816
Michael Krufky4c66c922011-08-29 00:05:35 -03001817static 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,
1822};
1823
Greg Kroah-Hartmanecb3b2b2011-11-18 09:46:12 -08001824module_usb_driver(mxl111sf_driver);
Michael Krufky4c66c922011-08-29 00:05:35 -03001825
1826MODULE_AUTHOR("Michael Krufky <mkrufky@kernellabs.com>");
1827MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF");
1828MODULE_VERSION("1.0");
1829MODULE_LICENSE("GPL");
1830
1831/*
1832 * Local variables:
1833 * c-basic-offset: 8
1834 * End:
1835 */