diff options
author | Antti Palosaari <crope@iki.fi> | 2012-06-25 23:17:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-04 06:56:39 -0400 |
commit | 8572211842afc53c8450fb470f2b8d02ba7592e0 (patch) | |
tree | 286c3f210d50cc28ee03fd3b438a78f209ff8c40 /drivers/media/dvb | |
parent | de73beeed032f93f0106992c075357be5b1f2fab (diff) |
[media] mxl111sf: convert to new DVB USB
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/Kconfig | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/mxl111sf-tuner.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/mxl111sf.c | 1456 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/mxl111sf.h | 22 |
4 files changed, 557 insertions, 925 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index bf7e7222e4e3..a663c75505e5 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -426,7 +426,7 @@ config DVB_USB_IT913X | |||
426 | 426 | ||
427 | config DVB_USB_MXL111SF | 427 | config DVB_USB_MXL111SF |
428 | tristate "MxL111SF DTV USB2.0 support" | 428 | tristate "MxL111SF DTV USB2.0 support" |
429 | depends on DVB_USB | 429 | depends on DVB_USB_V2 |
430 | select DVB_LGDT3305 if !DVB_FE_CUSTOMISE | 430 | select DVB_LGDT3305 if !DVB_FE_CUSTOMISE |
431 | select DVB_LG2160 if !DVB_FE_CUSTOMISE | 431 | select DVB_LG2160 if !DVB_FE_CUSTOMISE |
432 | select VIDEO_TVEEPROM | 432 | select VIDEO_TVEEPROM |
diff --git a/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c b/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c index 74da5bb1ce99..ef4c65fcbb73 100644 --- a/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c +++ b/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c | |||
@@ -31,6 +31,8 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))."); | |||
31 | if (mxl111sf_tuner_debug) \ | 31 | if (mxl111sf_tuner_debug) \ |
32 | mxl_printk(KERN_DEBUG, fmt, ##arg) | 32 | mxl_printk(KERN_DEBUG, fmt, ##arg) |
33 | 33 | ||
34 | #define err pr_err | ||
35 | |||
34 | /* ------------------------------------------------------------------------ */ | 36 | /* ------------------------------------------------------------------------ */ |
35 | 37 | ||
36 | struct mxl111sf_tuner_state { | 38 | struct mxl111sf_tuner_state { |
diff --git a/drivers/media/dvb/dvb-usb/mxl111sf.c b/drivers/media/dvb/dvb-usb/mxl111sf.c index cd842798f5af..1fb017ecee74 100644 --- a/drivers/media/dvb/dvb-usb/mxl111sf.c +++ b/drivers/media/dvb/dvb-usb/mxl111sf.c | |||
@@ -52,9 +52,11 @@ MODULE_PARM_DESC(rfswitch, "force rf switch position (0=auto, 1=ext, 2=int)."); | |||
52 | 52 | ||
53 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 53 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
54 | 54 | ||
55 | #define deb_info(args...) dprintk(dvb_usb_mxl111sf_debug, 0x13, args) | 55 | #define deb_info pr_debug |
56 | #define deb_reg(args...) dprintk(dvb_usb_mxl111sf_debug, 0x08, args) | 56 | #define deb_reg pr_debug |
57 | #define deb_adv(args...) dprintk(dvb_usb_mxl111sf_debug, MXL_ADV_DBG, args) | 57 | #define deb_adv pr_debug |
58 | #define err pr_err | ||
59 | #define info pr_info | ||
58 | 60 | ||
59 | int mxl111sf_ctrl_msg(struct dvb_usb_device *d, | 61 | int mxl111sf_ctrl_msg(struct dvb_usb_device *d, |
60 | u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) | 62 | u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) |
@@ -70,8 +72,8 @@ int mxl111sf_ctrl_msg(struct dvb_usb_device *d, | |||
70 | sndbuf[0] = cmd; | 72 | sndbuf[0] = cmd; |
71 | memcpy(&sndbuf[1], wbuf, wlen); | 73 | memcpy(&sndbuf[1], wbuf, wlen); |
72 | 74 | ||
73 | ret = (wo) ? dvb_usb_generic_write(d, sndbuf, 1+wlen) : | 75 | ret = (wo) ? dvb_usbv2_generic_write(d, sndbuf, 1+wlen) : |
74 | dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0); | 76 | dvb_usbv2_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen); |
75 | mxl_fail(ret); | 77 | mxl_fail(ret); |
76 | 78 | ||
77 | return ret; | 79 | return ret; |
@@ -246,21 +248,20 @@ fail: | |||
246 | }) | 248 | }) |
247 | 249 | ||
248 | /* ------------------------------------------------------------------------ */ | 250 | /* ------------------------------------------------------------------------ */ |
249 | 251 | #if 0 | |
250 | static int mxl111sf_power_ctrl(struct dvb_usb_device *d, int onoff) | 252 | static int mxl111sf_power_ctrl(struct dvb_usb_device *d, int onoff) |
251 | { | 253 | { |
252 | /* power control depends on which adapter is being woken: | 254 | /* power control depends on which adapter is being woken: |
253 | * save this for init, instead, via mxl111sf_adap_fe_init */ | 255 | * save this for init, instead, via mxl111sf_adap_fe_init */ |
254 | return 0; | 256 | return 0; |
255 | } | 257 | } |
258 | #endif | ||
256 | 259 | ||
257 | static int mxl111sf_adap_fe_init(struct dvb_frontend *fe) | 260 | static int mxl111sf_adap_fe_init(struct dvb_frontend *fe) |
258 | { | 261 | { |
259 | struct dvb_usb_adapter *adap = fe->dvb->priv; | 262 | struct dvb_usb_device *d = fe_to_d(fe); |
260 | struct dvb_usb_device *d = adap->dev; | 263 | struct mxl111sf_state *state = fe_to_priv(fe); |
261 | struct mxl111sf_state *state = d->priv; | 264 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; |
262 | struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe->id].priv; | ||
263 | |||
264 | int err; | 265 | int err; |
265 | 266 | ||
266 | /* exit if we didnt initialize the driver yet */ | 267 | /* exit if we didnt initialize the driver yet */ |
@@ -275,7 +276,7 @@ static int mxl111sf_adap_fe_init(struct dvb_frontend *fe) | |||
275 | 276 | ||
276 | state->alt_mode = adap_state->alt_mode; | 277 | state->alt_mode = adap_state->alt_mode; |
277 | 278 | ||
278 | if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0) | 279 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
279 | err("set interface failed"); | 280 | err("set interface failed"); |
280 | 281 | ||
281 | err = mxl1x1sf_soft_reset(state); | 282 | err = mxl1x1sf_soft_reset(state); |
@@ -315,10 +316,8 @@ fail: | |||
315 | 316 | ||
316 | static int mxl111sf_adap_fe_sleep(struct dvb_frontend *fe) | 317 | static int mxl111sf_adap_fe_sleep(struct dvb_frontend *fe) |
317 | { | 318 | { |
318 | struct dvb_usb_adapter *adap = fe->dvb->priv; | 319 | struct mxl111sf_state *state = fe_to_priv(fe); |
319 | struct dvb_usb_device *d = adap->dev; | 320 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; |
320 | struct mxl111sf_state *state = d->priv; | ||
321 | struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe->id].priv; | ||
322 | int err; | 321 | int err; |
323 | 322 | ||
324 | /* exit if we didnt initialize the driver yet */ | 323 | /* exit if we didnt initialize the driver yet */ |
@@ -339,11 +338,10 @@ fail: | |||
339 | } | 338 | } |
340 | 339 | ||
341 | 340 | ||
342 | static int mxl111sf_ep6_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | 341 | static int mxl111sf_ep6_streaming_ctrl(struct dvb_frontend *fe, int onoff) |
343 | { | 342 | { |
344 | struct dvb_usb_device *d = adap->dev; | 343 | struct mxl111sf_state *state = fe_to_priv(fe); |
345 | struct mxl111sf_state *state = d->priv; | 344 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; |
346 | struct mxl111sf_adap_state *adap_state = adap->fe_adap[adap->active_fe].priv; | ||
347 | int ret = 0; | 345 | int ret = 0; |
348 | 346 | ||
349 | deb_info("%s(%d)\n", __func__, onoff); | 347 | deb_info("%s(%d)\n", __func__, onoff); |
@@ -365,10 +363,9 @@ static int mxl111sf_ep6_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
365 | return ret; | 363 | return ret; |
366 | } | 364 | } |
367 | 365 | ||
368 | static int mxl111sf_ep5_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | 366 | static int mxl111sf_ep5_streaming_ctrl(struct dvb_frontend *fe, int onoff) |
369 | { | 367 | { |
370 | struct dvb_usb_device *d = adap->dev; | 368 | struct mxl111sf_state *state = fe_to_priv(fe); |
371 | struct mxl111sf_state *state = d->priv; | ||
372 | int ret = 0; | 369 | int ret = 0; |
373 | 370 | ||
374 | deb_info("%s(%d)\n", __func__, onoff); | 371 | deb_info("%s(%d)\n", __func__, onoff); |
@@ -392,10 +389,9 @@ static int mxl111sf_ep5_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
392 | return ret; | 389 | return ret; |
393 | } | 390 | } |
394 | 391 | ||
395 | static int mxl111sf_ep4_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | 392 | static int mxl111sf_ep4_streaming_ctrl(struct dvb_frontend *fe, int onoff) |
396 | { | 393 | { |
397 | struct dvb_usb_device *d = adap->dev; | 394 | struct mxl111sf_state *state = fe_to_priv(fe); |
398 | struct mxl111sf_state *state = d->priv; | ||
399 | int ret = 0; | 395 | int ret = 0; |
400 | 396 | ||
401 | deb_info("%s(%d)\n", __func__, onoff); | 397 | deb_info("%s(%d)\n", __func__, onoff); |
@@ -421,12 +417,11 @@ static struct lgdt3305_config hauppauge_lgdt3305_config = { | |||
421 | .vsb_if_khz = 6000, | 417 | .vsb_if_khz = 6000, |
422 | }; | 418 | }; |
423 | 419 | ||
424 | static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap) | 420 | static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) |
425 | { | 421 | { |
426 | struct dvb_usb_device *d = adap->dev; | 422 | struct dvb_usb_device *d = adap_to_d(adap); |
427 | struct mxl111sf_state *state = d->priv; | 423 | struct mxl111sf_state *state = d_to_priv(d); |
428 | int fe_id = adap->num_frontends_initialized; | 424 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; |
429 | struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv; | ||
430 | int ret; | 425 | int ret; |
431 | 426 | ||
432 | deb_adv("%s()\n", __func__); | 427 | deb_adv("%s()\n", __func__); |
@@ -436,7 +431,7 @@ static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap) | |||
436 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; | 431 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; |
437 | state->alt_mode = adap_state->alt_mode; | 432 | state->alt_mode = adap_state->alt_mode; |
438 | 433 | ||
439 | if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0) | 434 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
440 | err("set interface failed"); | 435 | err("set interface failed"); |
441 | 436 | ||
442 | state->gpio_mode = MXL111SF_GPIO_MOD_ATSC; | 437 | state->gpio_mode = MXL111SF_GPIO_MOD_ATSC; |
@@ -469,14 +464,15 @@ static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap) | |||
469 | if (mxl_fail(ret)) | 464 | if (mxl_fail(ret)) |
470 | goto fail; | 465 | goto fail; |
471 | 466 | ||
472 | adap->fe_adap[fe_id].fe = dvb_attach(lgdt3305_attach, | 467 | adap->fe[fe_id] = dvb_attach(lgdt3305_attach, |
473 | &hauppauge_lgdt3305_config, | 468 | &hauppauge_lgdt3305_config, |
474 | &adap->dev->i2c_adap); | 469 | &d->i2c_adap); |
475 | if (adap->fe_adap[fe_id].fe) { | 470 | if (adap->fe[fe_id]) { |
476 | adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init; | 471 | state->num_frontends++; |
477 | adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init; | 472 | adap_state->fe_init = adap->fe[fe_id]->ops.init; |
478 | adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep; | 473 | adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; |
479 | adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep; | 474 | adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; |
475 | adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; | ||
480 | return 0; | 476 | return 0; |
481 | } | 477 | } |
482 | ret = -EIO; | 478 | ret = -EIO; |
@@ -492,12 +488,11 @@ static struct lg2160_config hauppauge_lg2160_config = { | |||
492 | .if_khz = 6000, | 488 | .if_khz = 6000, |
493 | }; | 489 | }; |
494 | 490 | ||
495 | static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap) | 491 | static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) |
496 | { | 492 | { |
497 | struct dvb_usb_device *d = adap->dev; | 493 | struct dvb_usb_device *d = adap_to_d(adap); |
498 | struct mxl111sf_state *state = d->priv; | 494 | struct mxl111sf_state *state = d_to_priv(d); |
499 | int fe_id = adap->num_frontends_initialized; | 495 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; |
500 | struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv; | ||
501 | int ret; | 496 | int ret; |
502 | 497 | ||
503 | deb_adv("%s()\n", __func__); | 498 | deb_adv("%s()\n", __func__); |
@@ -507,7 +502,7 @@ static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap) | |||
507 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; | 502 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; |
508 | state->alt_mode = adap_state->alt_mode; | 503 | state->alt_mode = adap_state->alt_mode; |
509 | 504 | ||
510 | if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0) | 505 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
511 | err("set interface failed"); | 506 | err("set interface failed"); |
512 | 507 | ||
513 | state->gpio_mode = MXL111SF_GPIO_MOD_MH; | 508 | state->gpio_mode = MXL111SF_GPIO_MOD_MH; |
@@ -544,14 +539,15 @@ static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap) | |||
544 | if (mxl_fail(ret)) | 539 | if (mxl_fail(ret)) |
545 | goto fail; | 540 | goto fail; |
546 | 541 | ||
547 | adap->fe_adap[fe_id].fe = dvb_attach(lg2160_attach, | 542 | adap->fe[fe_id] = dvb_attach(lg2160_attach, |
548 | &hauppauge_lg2160_config, | 543 | &hauppauge_lg2160_config, |
549 | &adap->dev->i2c_adap); | 544 | &d->i2c_adap); |
550 | if (adap->fe_adap[fe_id].fe) { | 545 | if (adap->fe[fe_id]) { |
551 | adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init; | 546 | state->num_frontends++; |
552 | adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init; | 547 | adap_state->fe_init = adap->fe[fe_id]->ops.init; |
553 | adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep; | 548 | adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; |
554 | adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep; | 549 | adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; |
550 | adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; | ||
555 | return 0; | 551 | return 0; |
556 | } | 552 | } |
557 | ret = -EIO; | 553 | ret = -EIO; |
@@ -577,12 +573,11 @@ static struct lg2160_config hauppauge_lg2161_1040_config = { | |||
577 | .output_if = 4, /* LG2161_OIF_SPI_MAS */ | 573 | .output_if = 4, /* LG2161_OIF_SPI_MAS */ |
578 | }; | 574 | }; |
579 | 575 | ||
580 | static int mxl111sf_lg2161_frontend_attach(struct dvb_usb_adapter *adap) | 576 | static int mxl111sf_lg2161_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) |
581 | { | 577 | { |
582 | struct dvb_usb_device *d = adap->dev; | 578 | struct dvb_usb_device *d = adap_to_d(adap); |
583 | struct mxl111sf_state *state = d->priv; | 579 | struct mxl111sf_state *state = d_to_priv(d); |
584 | int fe_id = adap->num_frontends_initialized; | 580 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; |
585 | struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv; | ||
586 | int ret; | 581 | int ret; |
587 | 582 | ||
588 | deb_adv("%s()\n", __func__); | 583 | deb_adv("%s()\n", __func__); |
@@ -592,7 +587,7 @@ static int mxl111sf_lg2161_frontend_attach(struct dvb_usb_adapter *adap) | |||
592 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; | 587 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; |
593 | state->alt_mode = adap_state->alt_mode; | 588 | state->alt_mode = adap_state->alt_mode; |
594 | 589 | ||
595 | if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0) | 590 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
596 | err("set interface failed"); | 591 | err("set interface failed"); |
597 | 592 | ||
598 | state->gpio_mode = MXL111SF_GPIO_MOD_MH; | 593 | state->gpio_mode = MXL111SF_GPIO_MOD_MH; |
@@ -629,16 +624,17 @@ static int mxl111sf_lg2161_frontend_attach(struct dvb_usb_adapter *adap) | |||
629 | if (mxl_fail(ret)) | 624 | if (mxl_fail(ret)) |
630 | goto fail; | 625 | goto fail; |
631 | 626 | ||
632 | adap->fe_adap[fe_id].fe = dvb_attach(lg2160_attach, | 627 | adap->fe[fe_id] = dvb_attach(lg2160_attach, |
633 | (MXL111SF_V8_200 == state->chip_rev) ? | 628 | (MXL111SF_V8_200 == state->chip_rev) ? |
634 | &hauppauge_lg2161_1040_config : | 629 | &hauppauge_lg2161_1040_config : |
635 | &hauppauge_lg2161_1019_config, | 630 | &hauppauge_lg2161_1019_config, |
636 | &adap->dev->i2c_adap); | 631 | &d->i2c_adap); |
637 | if (adap->fe_adap[fe_id].fe) { | 632 | if (adap->fe[fe_id]) { |
638 | adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init; | 633 | state->num_frontends++; |
639 | adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init; | 634 | adap_state->fe_init = adap->fe[fe_id]->ops.init; |
640 | adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep; | 635 | adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; |
641 | adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep; | 636 | adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; |
637 | adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; | ||
642 | return 0; | 638 | return 0; |
643 | } | 639 | } |
644 | ret = -EIO; | 640 | ret = -EIO; |
@@ -664,12 +660,11 @@ static struct lg2160_config hauppauge_lg2161_1040_ep6_config = { | |||
664 | .output_if = 7, /* LG2161_OIF_SERIAL_TS */ | 660 | .output_if = 7, /* LG2161_OIF_SERIAL_TS */ |
665 | }; | 661 | }; |
666 | 662 | ||
667 | static int mxl111sf_lg2161_ep6_frontend_attach(struct dvb_usb_adapter *adap) | 663 | static int mxl111sf_lg2161_ep6_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) |
668 | { | 664 | { |
669 | struct dvb_usb_device *d = adap->dev; | 665 | struct dvb_usb_device *d = adap_to_d(adap); |
670 | struct mxl111sf_state *state = d->priv; | 666 | struct mxl111sf_state *state = d_to_priv(d); |
671 | int fe_id = adap->num_frontends_initialized; | 667 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; |
672 | struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv; | ||
673 | int ret; | 668 | int ret; |
674 | 669 | ||
675 | deb_adv("%s()\n", __func__); | 670 | deb_adv("%s()\n", __func__); |
@@ -679,7 +674,7 @@ static int mxl111sf_lg2161_ep6_frontend_attach(struct dvb_usb_adapter *adap) | |||
679 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; | 674 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; |
680 | state->alt_mode = adap_state->alt_mode; | 675 | state->alt_mode = adap_state->alt_mode; |
681 | 676 | ||
682 | if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0) | 677 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
683 | err("set interface failed"); | 678 | err("set interface failed"); |
684 | 679 | ||
685 | state->gpio_mode = MXL111SF_GPIO_MOD_MH; | 680 | state->gpio_mode = MXL111SF_GPIO_MOD_MH; |
@@ -716,16 +711,17 @@ static int mxl111sf_lg2161_ep6_frontend_attach(struct dvb_usb_adapter *adap) | |||
716 | if (mxl_fail(ret)) | 711 | if (mxl_fail(ret)) |
717 | goto fail; | 712 | goto fail; |
718 | 713 | ||
719 | adap->fe_adap[fe_id].fe = dvb_attach(lg2160_attach, | 714 | adap->fe[fe_id] = dvb_attach(lg2160_attach, |
720 | (MXL111SF_V8_200 == state->chip_rev) ? | 715 | (MXL111SF_V8_200 == state->chip_rev) ? |
721 | &hauppauge_lg2161_1040_ep6_config : | 716 | &hauppauge_lg2161_1040_ep6_config : |
722 | &hauppauge_lg2161_1019_ep6_config, | 717 | &hauppauge_lg2161_1019_ep6_config, |
723 | &adap->dev->i2c_adap); | 718 | &d->i2c_adap); |
724 | if (adap->fe_adap[fe_id].fe) { | 719 | if (adap->fe[fe_id]) { |
725 | adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init; | 720 | state->num_frontends++; |
726 | adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init; | 721 | adap_state->fe_init = adap->fe[fe_id]->ops.init; |
727 | adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep; | 722 | adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; |
728 | adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep; | 723 | adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; |
724 | adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; | ||
729 | return 0; | 725 | return 0; |
730 | } | 726 | } |
731 | ret = -EIO; | 727 | ret = -EIO; |
@@ -739,12 +735,11 @@ static struct mxl111sf_demod_config mxl_demod_config = { | |||
739 | .program_regs = mxl111sf_ctrl_program_regs, | 735 | .program_regs = mxl111sf_ctrl_program_regs, |
740 | }; | 736 | }; |
741 | 737 | ||
742 | static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap) | 738 | static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap, u8 fe_id) |
743 | { | 739 | { |
744 | struct dvb_usb_device *d = adap->dev; | 740 | struct dvb_usb_device *d = adap_to_d(adap); |
745 | struct mxl111sf_state *state = d->priv; | 741 | struct mxl111sf_state *state = d_to_priv(d); |
746 | int fe_id = adap->num_frontends_initialized; | 742 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe_id]; |
747 | struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv; | ||
748 | int ret; | 743 | int ret; |
749 | 744 | ||
750 | deb_adv("%s()\n", __func__); | 745 | deb_adv("%s()\n", __func__); |
@@ -754,7 +749,7 @@ static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap) | |||
754 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 1 : 2; | 749 | adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 1 : 2; |
755 | state->alt_mode = adap_state->alt_mode; | 750 | state->alt_mode = adap_state->alt_mode; |
756 | 751 | ||
757 | if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0) | 752 | if (usb_set_interface(d->udev, 0, state->alt_mode) < 0) |
758 | err("set interface failed"); | 753 | err("set interface failed"); |
759 | 754 | ||
760 | state->gpio_mode = MXL111SF_GPIO_MOD_DVBT; | 755 | state->gpio_mode = MXL111SF_GPIO_MOD_DVBT; |
@@ -783,13 +778,14 @@ static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap) | |||
783 | /* dont care if this fails */ | 778 | /* dont care if this fails */ |
784 | mxl111sf_init_port_expander(state); | 779 | mxl111sf_init_port_expander(state); |
785 | 780 | ||
786 | adap->fe_adap[fe_id].fe = dvb_attach(mxl111sf_demod_attach, state, | 781 | adap->fe[fe_id] = dvb_attach(mxl111sf_demod_attach, state, |
787 | &mxl_demod_config); | 782 | &mxl_demod_config); |
788 | if (adap->fe_adap[fe_id].fe) { | 783 | if (adap->fe[fe_id]) { |
789 | adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init; | 784 | state->num_frontends++; |
790 | adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init; | 785 | adap_state->fe_init = adap->fe[fe_id]->ops.init; |
791 | adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep; | 786 | adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; |
792 | adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep; | 787 | adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; |
788 | adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; | ||
793 | return 0; | 789 | return 0; |
794 | } | 790 | } |
795 | ret = -EIO; | 791 | ret = -EIO; |
@@ -816,10 +812,7 @@ static inline int mxl111sf_set_ant_path(struct mxl111sf_state *state, | |||
816 | 812 | ||
817 | static int mxl111sf_ant_hunt(struct dvb_frontend *fe) | 813 | static int mxl111sf_ant_hunt(struct dvb_frontend *fe) |
818 | { | 814 | { |
819 | struct dvb_usb_adapter *adap = fe->dvb->priv; | 815 | struct mxl111sf_state *state = fe_to_priv(fe); |
820 | struct dvb_usb_device *d = adap->dev; | ||
821 | struct mxl111sf_state *state = d->priv; | ||
822 | |||
823 | int antctrl = dvb_usb_mxl111sf_rfswitch; | 816 | int antctrl = dvb_usb_mxl111sf_rfswitch; |
824 | 817 | ||
825 | u16 rxPwrA, rxPwr0, rxPwr1, rxPwr2; | 818 | u16 rxPwrA, rxPwr0, rxPwr1, rxPwr2; |
@@ -872,18 +865,18 @@ static struct mxl111sf_tuner_config mxl_tuner_config = { | |||
872 | 865 | ||
873 | static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap) | 866 | static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap) |
874 | { | 867 | { |
875 | struct dvb_usb_device *d = adap->dev; | 868 | struct mxl111sf_state *state = adap_to_priv(adap); |
876 | struct mxl111sf_state *state = d->priv; | 869 | int i; |
877 | int fe_id = adap->num_frontends_initialized; | ||
878 | 870 | ||
879 | deb_adv("%s()\n", __func__); | 871 | deb_adv("%s()\n", __func__); |
880 | 872 | ||
881 | if (NULL != dvb_attach(mxl111sf_tuner_attach, | 873 | for (i = 0; i < state->num_frontends; i++) { |
882 | adap->fe_adap[fe_id].fe, state, | 874 | if (dvb_attach(mxl111sf_tuner_attach, adap->fe[i], state, |
883 | &mxl_tuner_config)) | 875 | &mxl_tuner_config) == NULL) |
884 | return 0; | 876 | return -EIO; |
877 | } | ||
885 | 878 | ||
886 | return -EIO; | 879 | return 0; |
887 | } | 880 | } |
888 | 881 | ||
889 | static int mxl111sf_fe_ioctl_override(struct dvb_frontend *fe, | 882 | static int mxl111sf_fe_ioctl_override(struct dvb_frontend *fe, |
@@ -926,902 +919,537 @@ struct i2c_algorithm mxl111sf_i2c_algo = { | |||
926 | #endif | 919 | #endif |
927 | }; | 920 | }; |
928 | 921 | ||
929 | static struct dvb_usb_device_properties mxl111sf_dvbt_bulk_properties; | 922 | static int mxl111sf_init(struct dvb_usb_device *d) |
930 | static struct dvb_usb_device_properties mxl111sf_dvbt_isoc_properties; | ||
931 | static struct dvb_usb_device_properties mxl111sf_atsc_bulk_properties; | ||
932 | static struct dvb_usb_device_properties mxl111sf_atsc_isoc_properties; | ||
933 | static struct dvb_usb_device_properties mxl111sf_atsc_mh_bulk_properties; | ||
934 | static struct dvb_usb_device_properties mxl111sf_atsc_mh_isoc_properties; | ||
935 | static struct dvb_usb_device_properties mxl111sf_mh_bulk_properties; | ||
936 | static struct dvb_usb_device_properties mxl111sf_mh_isoc_properties; | ||
937 | static struct dvb_usb_device_properties mxl111sf_mercury_spi_bulk_properties; | ||
938 | static struct dvb_usb_device_properties mxl111sf_mercury_spi_isoc_properties; | ||
939 | static struct dvb_usb_device_properties mxl111sf_mercury_tp_bulk_properties; | ||
940 | static struct dvb_usb_device_properties mxl111sf_mercury_tp_isoc_properties; | ||
941 | static struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_bulk_properties; | ||
942 | static struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_isoc_properties; | ||
943 | static struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_bulk_properties; | ||
944 | static struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_isoc_properties; | ||
945 | |||
946 | static int mxl111sf_probe(struct usb_interface *intf, | ||
947 | const struct usb_device_id *id) | ||
948 | { | 923 | { |
949 | struct dvb_usb_device *d = NULL; | 924 | struct mxl111sf_state *state = d_to_priv(d); |
950 | 925 | int ret; | |
951 | deb_adv("%s()\n", __func__); | 926 | static u8 eeprom[256]; |
927 | struct i2c_client c; | ||
952 | 928 | ||
953 | if (((dvb_usb_mxl111sf_isoc) && | 929 | ret = get_chip_info(state); |
954 | (0 == dvb_usb_device_init(intf, | 930 | if (mxl_fail(ret)) |
955 | &mxl111sf_dvbt_isoc_properties, | 931 | err("failed to get chip info during probe"); |
956 | THIS_MODULE, &d, adapter_nr) || | ||
957 | 0 == dvb_usb_device_init(intf, | ||
958 | &mxl111sf_atsc_isoc_properties, | ||
959 | THIS_MODULE, &d, adapter_nr) || | ||
960 | 0 == dvb_usb_device_init(intf, | ||
961 | &mxl111sf_atsc_mh_isoc_properties, | ||
962 | THIS_MODULE, &d, adapter_nr) || | ||
963 | 0 == dvb_usb_device_init(intf, | ||
964 | &mxl111sf_mh_isoc_properties, | ||
965 | THIS_MODULE, &d, adapter_nr) || | ||
966 | ((dvb_usb_mxl111sf_spi) && | ||
967 | (0 == dvb_usb_device_init(intf, | ||
968 | &mxl111sf_mercury_spi_isoc_properties, | ||
969 | THIS_MODULE, &d, adapter_nr) || | ||
970 | 0 == dvb_usb_device_init(intf, | ||
971 | &mxl111sf_mercury_mh_spi_isoc_properties, | ||
972 | THIS_MODULE, &d, adapter_nr))) || | ||
973 | 0 == dvb_usb_device_init(intf, | ||
974 | &mxl111sf_mercury_tp_isoc_properties, | ||
975 | THIS_MODULE, &d, adapter_nr) || | ||
976 | 0 == dvb_usb_device_init(intf, | ||
977 | &mxl111sf_mercury_mh_tp_isoc_properties, | ||
978 | THIS_MODULE, &d, adapter_nr))) || | ||
979 | 0 == dvb_usb_device_init(intf, | ||
980 | &mxl111sf_dvbt_bulk_properties, | ||
981 | THIS_MODULE, &d, adapter_nr) || | ||
982 | 0 == dvb_usb_device_init(intf, | ||
983 | &mxl111sf_atsc_bulk_properties, | ||
984 | THIS_MODULE, &d, adapter_nr) || | ||
985 | 0 == dvb_usb_device_init(intf, | ||
986 | &mxl111sf_atsc_mh_bulk_properties, | ||
987 | THIS_MODULE, &d, adapter_nr) || | ||
988 | 0 == dvb_usb_device_init(intf, | ||
989 | &mxl111sf_mh_bulk_properties, | ||
990 | THIS_MODULE, &d, adapter_nr) || | ||
991 | ((dvb_usb_mxl111sf_spi) && | ||
992 | (0 == dvb_usb_device_init(intf, | ||
993 | &mxl111sf_mercury_spi_bulk_properties, | ||
994 | THIS_MODULE, &d, adapter_nr) || | ||
995 | 0 == dvb_usb_device_init(intf, | ||
996 | &mxl111sf_mercury_mh_spi_bulk_properties, | ||
997 | THIS_MODULE, &d, adapter_nr))) || | ||
998 | 0 == dvb_usb_device_init(intf, | ||
999 | &mxl111sf_mercury_tp_bulk_properties, | ||
1000 | THIS_MODULE, &d, adapter_nr) || | ||
1001 | 0 == dvb_usb_device_init(intf, | ||
1002 | &mxl111sf_mercury_mh_tp_bulk_properties, | ||
1003 | THIS_MODULE, &d, adapter_nr) || 0) { | ||
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 | 932 | ||
1014 | mutex_init(&state->fe_lock); | 933 | mutex_init(&state->fe_lock); |
1015 | 934 | ||
1016 | if (state->chip_rev > MXL111SF_V6) | 935 | if (state->chip_rev > MXL111SF_V6) |
1017 | mxl111sf_config_pin_mux_modes(state, | 936 | mxl111sf_config_pin_mux_modes(state, PIN_MUX_TS_SPI_IN_MODE_1); |
1018 | PIN_MUX_TS_SPI_IN_MODE_1); | ||
1019 | 937 | ||
1020 | c.adapter = &d->i2c_adap; | 938 | c.adapter = &d->i2c_adap; |
1021 | c.addr = 0xa0 >> 1; | 939 | c.addr = 0xa0 >> 1; |
1022 | 940 | ||
1023 | ret = tveeprom_read(&c, eeprom, sizeof(eeprom)); | 941 | ret = tveeprom_read(&c, eeprom, sizeof(eeprom)); |
1024 | if (mxl_fail(ret)) | 942 | 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; | 943 | return 0; |
944 | tveeprom_hauppauge_analog(&c, &state->tv, (0x84 == eeprom[0xa0]) ? | ||
945 | eeprom + 0xa0 : eeprom + 0x80); | ||
946 | #if 0 | ||
947 | switch (state->tv.model) { | ||
948 | case 117001: | ||
949 | case 126001: | ||
950 | case 138001: | ||
951 | break; | ||
952 | default: | ||
953 | printk(KERN_WARNING "%s: warning: " | ||
954 | "unknown hauppauge model #%d\n", | ||
955 | __func__, state->tv.model); | ||
1042 | } | 956 | } |
1043 | err("Your device is not yet supported by this driver. " | 957 | #endif |
1044 | "See kernellabs.com for more info"); | 958 | return 0; |
1045 | return -EINVAL; | ||
1046 | } | 959 | } |
1047 | 960 | ||
1048 | static struct usb_device_id mxl111sf_table[] = { | 961 | static int mxl111sf_frontend_attach_dvbt(struct dvb_usb_adapter *adap) |
1049 | /* 0 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc600) }, /* ATSC+ IR */ | 962 | { |
1050 | { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc601) }, /* ATSC */ | 963 | return mxl111sf_attach_demod(adap, 0); |
1051 | { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc602) }, /* + */ | 964 | } |
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 | }; | ||
1085 | MODULE_DEVICE_TABLE(usb, mxl111sf_table); | ||
1086 | |||
1087 | |||
1088 | #define MXL111SF_EP4_BULK_STREAMING_CONFIG \ | ||
1089 | .size_of_priv = sizeof(struct mxl111sf_adap_state), \ | ||
1090 | .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 | 965 | ||
1102 | /* FIXME: works for v6 but not v8 silicon */ | 966 | static int mxl111sf_frontend_attach_atsc(struct dvb_usb_adapter *adap) |
1103 | #define MXL111SF_EP4_ISOC_STREAMING_CONFIG \ | 967 | { |
1104 | .size_of_priv = sizeof(struct mxl111sf_adap_state), \ | 968 | return mxl111sf_lgdt3305_frontend_attach(adap, 0); |
1105 | .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, \ | 969 | } |
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 | 970 | ||
1120 | #define MXL111SF_EP5_BULK_STREAMING_CONFIG \ | 971 | static int mxl111sf_frontend_attach_mh(struct dvb_usb_adapter *adap) |
1121 | .size_of_priv = sizeof(struct mxl111sf_adap_state), \ | 972 | { |
1122 | .streaming_ctrl = mxl111sf_ep5_streaming_ctrl, \ | 973 | return mxl111sf_lg2160_frontend_attach(adap, 0); |
1123 | .stream = { \ | 974 | } |
1124 | .type = USB_BULK, \ | ||
1125 | .count = 5, \ | ||
1126 | .endpoint = 0x05, \ | ||
1127 | .u = { \ | ||
1128 | .bulk = { \ | ||
1129 | .buffersize = 8192, \ | ||
1130 | } \ | ||
1131 | } \ | ||
1132 | } | ||
1133 | 975 | ||
1134 | #define MXL111SF_EP5_ISOC_STREAMING_CONFIG \ | 976 | static int mxl111sf_frontend_attach_atsc_mh(struct dvb_usb_adapter *adap) |
1135 | .size_of_priv = sizeof(struct mxl111sf_adap_state), \ | 977 | { |
1136 | .streaming_ctrl = mxl111sf_ep5_streaming_ctrl, \ | 978 | int ret; |
1137 | .stream = { \ | 979 | deb_info("%s\n", __func__); |
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 | 980 | ||
1150 | #define MXL111SF_EP6_BULK_STREAMING_CONFIG \ | 981 | ret = mxl111sf_lgdt3305_frontend_attach(adap, 0); |
1151 | .size_of_priv = sizeof(struct mxl111sf_adap_state), \ | 982 | if (ret < 0) |
1152 | .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, \ | 983 | return ret; |
1153 | .stream = { \ | ||
1154 | .type = USB_BULK, \ | ||
1155 | .count = 5, \ | ||
1156 | .endpoint = 0x06, \ | ||
1157 | .u = { \ | ||
1158 | .bulk = { \ | ||
1159 | .buffersize = 8192, \ | ||
1160 | } \ | ||
1161 | } \ | ||
1162 | } | ||
1163 | 984 | ||
1164 | /* FIXME */ | 985 | ret = mxl111sf_attach_demod(adap, 1); |
1165 | #define MXL111SF_EP6_ISOC_STREAMING_CONFIG \ | 986 | if (ret < 0) |
1166 | .size_of_priv = sizeof(struct mxl111sf_adap_state), \ | 987 | return ret; |
1167 | .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 | 988 | ||
1181 | #define MXL111SF_DEFAULT_DEVICE_PROPERTIES \ | 989 | ret = mxl111sf_lg2160_frontend_attach(adap, 2); |
1182 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, \ | 990 | if (ret < 0) |
1183 | .usb_ctrl = DEVICE_SPECIFIC, \ | 991 | return ret; |
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 | |||
1195 | static struct dvb_usb_device_properties mxl111sf_dvbt_bulk_properties = { | ||
1196 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | ||
1197 | 992 | ||
1198 | .num_adapters = 1, | 993 | return ret; |
1199 | .adapter = { | 994 | } |
1200 | { | ||
1201 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | ||
1202 | .num_frontends = 1, | ||
1203 | .fe = {{ | ||
1204 | .frontend_attach = mxl111sf_attach_demod, | ||
1205 | .tuner_attach = mxl111sf_attach_tuner, | ||
1206 | |||
1207 | MXL111SF_EP4_BULK_STREAMING_CONFIG, | ||
1208 | } }, | ||
1209 | }, | ||
1210 | }, | ||
1211 | .num_device_descs = 3, | ||
1212 | .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 | }, | ||
1229 | } | ||
1230 | }; | ||
1231 | 995 | ||
1232 | static struct dvb_usb_device_properties mxl111sf_dvbt_isoc_properties = { | 996 | static int mxl111sf_frontend_attach_mercury(struct dvb_usb_adapter *adap) |
1233 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 997 | { |
998 | int ret; | ||
999 | deb_info("%s\n", __func__); | ||
1234 | 1000 | ||
1235 | .num_adapters = 1, | 1001 | ret = mxl111sf_lgdt3305_frontend_attach(adap, 0); |
1236 | .adapter = { | 1002 | if (ret < 0) |
1237 | { | 1003 | return ret; |
1238 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | ||
1239 | .num_frontends = 1, | ||
1240 | .fe = {{ | ||
1241 | .frontend_attach = mxl111sf_attach_demod, | ||
1242 | .tuner_attach = mxl111sf_attach_tuner, | ||
1243 | |||
1244 | MXL111SF_EP4_ISOC_STREAMING_CONFIG, | ||
1245 | } }, | ||
1246 | }, | ||
1247 | }, | ||
1248 | .num_device_descs = 3, | ||
1249 | .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 | }, | ||
1266 | } | ||
1267 | }; | ||
1268 | 1004 | ||
1269 | static struct dvb_usb_device_properties mxl111sf_atsc_bulk_properties = { | 1005 | ret = mxl111sf_attach_demod(adap, 1); |
1270 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1006 | if (ret < 0) |
1007 | return ret; | ||
1271 | 1008 | ||
1272 | .num_adapters = 1, | 1009 | ret = mxl111sf_lg2161_ep6_frontend_attach(adap, 2); |
1273 | .adapter = { | 1010 | if (ret < 0) |
1274 | { | 1011 | return ret; |
1275 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | ||
1276 | .num_frontends = 1, | ||
1277 | .fe = {{ | ||
1278 | .frontend_attach = mxl111sf_lgdt3305_frontend_attach, | ||
1279 | .tuner_attach = mxl111sf_attach_tuner, | ||
1280 | |||
1281 | MXL111SF_EP6_BULK_STREAMING_CONFIG, | ||
1282 | }}, | ||
1283 | }, | ||
1284 | }, | ||
1285 | .num_device_descs = 2, | ||
1286 | .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 | }, | ||
1297 | } | ||
1298 | }; | ||
1299 | 1012 | ||
1300 | static struct dvb_usb_device_properties mxl111sf_atsc_isoc_properties = { | 1013 | return ret; |
1301 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1014 | } |
1302 | 1015 | ||
1303 | .num_adapters = 1, | 1016 | static int mxl111sf_frontend_attach_mercury_mh(struct dvb_usb_adapter *adap) |
1304 | .adapter = { | 1017 | { |
1305 | { | 1018 | int ret; |
1306 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1019 | deb_info("%s\n", __func__); |
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 | 1020 | ||
1331 | static struct dvb_usb_device_properties mxl111sf_mh_bulk_properties = { | 1021 | ret = mxl111sf_attach_demod(adap, 0); |
1332 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1022 | if (ret < 0) |
1023 | return ret; | ||
1333 | 1024 | ||
1334 | .num_adapters = 1, | 1025 | if (dvb_usb_mxl111sf_spi) |
1335 | .adapter = { | 1026 | ret = mxl111sf_lg2161_frontend_attach(adap, 1); |
1336 | { | 1027 | else |
1337 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1028 | ret = mxl111sf_lg2161_ep6_frontend_attach(adap, 1); |
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 | 1029 | ||
1364 | static struct dvb_usb_device_properties mxl111sf_mh_isoc_properties = { | 1030 | return ret; |
1365 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1031 | } |
1366 | 1032 | ||
1367 | .num_adapters = 1, | 1033 | static void mxl111sf_stream_config_bulk(struct usb_data_stream_properties *stream, u8 endpoint) |
1368 | .adapter = { | 1034 | { |
1369 | { | 1035 | deb_info("%s: endpoint=%d size=8192\n", __func__, endpoint); |
1370 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1036 | stream->type = USB_BULK; |
1371 | .num_frontends = 1, | 1037 | stream->count = 5; |
1372 | .fe = {{ | 1038 | stream->endpoint = endpoint; |
1373 | .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD, | 1039 | stream->u.bulk.buffersize = 8192; |
1374 | 1040 | } | |
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 | 1041 | ||
1397 | static struct dvb_usb_device_properties mxl111sf_atsc_mh_bulk_properties = { | 1042 | static void mxl111sf_stream_config_isoc(struct usb_data_stream_properties *stream, |
1398 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1043 | u8 endpoint, int framesperurb, int framesize) |
1044 | { | ||
1045 | deb_info("%s: endpoint=%d size=%d\n", __func__, endpoint, | ||
1046 | framesperurb * framesize); | ||
1047 | stream->type = USB_ISOC; | ||
1048 | stream->count = 5; | ||
1049 | stream->endpoint = endpoint; | ||
1050 | stream->u.isoc.framesperurb = framesperurb; | ||
1051 | stream->u.isoc.framesize = framesize; | ||
1052 | stream->u.isoc.interval = 1; | ||
1053 | } | ||
1399 | 1054 | ||
1400 | .num_adapters = 1, | 1055 | /* DVB USB Driver stuff */ |
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 | 1056 | ||
1415 | MXL111SF_EP4_BULK_STREAMING_CONFIG, | 1057 | /* dvbt mxl111sf |
1416 | }, | 1058 | * bulk EP4/BULK/5/8192 |
1417 | { | 1059 | * isoc EP4/ISOC/5/96/564 |
1418 | .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD, | 1060 | */ |
1419 | 1061 | static int mxl111sf_get_stream_config_dvbt(struct dvb_frontend *fe, | |
1420 | .frontend_attach = mxl111sf_lg2160_frontend_attach, | 1062 | u8 *ts_type, struct usb_data_stream_properties *stream) |
1421 | .tuner_attach = mxl111sf_attach_tuner, | 1063 | { |
1422 | 1064 | deb_info("%s: fe=%d\n", __func__, fe->id); | |
1423 | MXL111SF_EP5_BULK_STREAMING_CONFIG, | ||
1424 | }}, | ||
1425 | }, | ||
1426 | }, | ||
1427 | .num_device_descs = 2, | ||
1428 | .devices = { | ||
1429 | { "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 | }, | ||
1442 | } | ||
1443 | }; | ||
1444 | 1065 | ||
1445 | static struct dvb_usb_device_properties mxl111sf_atsc_mh_isoc_properties = { | 1066 | *ts_type = DVB_USB_FE_TS_TYPE_188; |
1446 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1067 | if (dvb_usb_mxl111sf_isoc) |
1068 | mxl111sf_stream_config_isoc(stream, 4, 96, 564); | ||
1069 | else | ||
1070 | mxl111sf_stream_config_bulk(stream, 4); | ||
1071 | return 0; | ||
1072 | } | ||
1447 | 1073 | ||
1448 | .num_adapters = 1, | 1074 | static struct dvb_usb_device_properties mxl111sf_props_dvbt = { |
1449 | .adapter = { | 1075 | .driver_name = KBUILD_MODNAME, |
1450 | { | 1076 | .owner = THIS_MODULE, |
1451 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1077 | .adapter_nr = adapter_nr, |
1452 | .num_frontends = 3, | 1078 | .size_of_priv = sizeof(struct mxl111sf_state), |
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 | 1079 | ||
1463 | MXL111SF_EP4_ISOC_STREAMING_CONFIG, | 1080 | .generic_bulk_ctrl_endpoint = 0x02, |
1464 | }, | 1081 | .generic_bulk_ctrl_endpoint_response = 0x81, |
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 | 1082 | ||
1493 | static struct dvb_usb_device_properties mxl111sf_mercury_spi_bulk_properties = { | 1083 | .i2c_algo = &mxl111sf_i2c_algo, |
1494 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1084 | .frontend_attach = mxl111sf_frontend_attach_dvbt, |
1085 | .tuner_attach = mxl111sf_attach_tuner, | ||
1086 | .init = mxl111sf_init, | ||
1087 | .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, | ||
1088 | .get_stream_config = mxl111sf_get_stream_config_dvbt, | ||
1089 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | ||
1495 | 1090 | ||
1496 | .num_adapters = 1, | 1091 | .num_adapters = 1, |
1497 | .adapter = { | 1092 | .adapter = { |
1498 | { | 1093 | { |
1499 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1094 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1500 | .num_frontends = 3, | 1095 | } |
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 | } | 1096 | } |
1537 | }; | 1097 | }; |
1538 | 1098 | ||
1539 | static struct dvb_usb_device_properties mxl111sf_mercury_spi_isoc_properties = { | 1099 | /* atsc lgdt3305 |
1540 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1100 | * bulk EP6/BULK/5/8192 |
1101 | * isoc EP6/ISOC/5/24/3072 | ||
1102 | */ | ||
1103 | static int mxl111sf_get_stream_config_atsc(struct dvb_frontend *fe, | ||
1104 | u8 *ts_type, struct usb_data_stream_properties *stream) | ||
1105 | { | ||
1106 | deb_info("%s: fe=%d\n", __func__, fe->id); | ||
1541 | 1107 | ||
1542 | .num_adapters = 1, | 1108 | *ts_type = DVB_USB_FE_TS_TYPE_188; |
1543 | .adapter = { | 1109 | if (dvb_usb_mxl111sf_isoc) |
1544 | { | 1110 | mxl111sf_stream_config_isoc(stream, 6, 24, 3072); |
1545 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1111 | else |
1546 | .num_frontends = 3, | 1112 | mxl111sf_stream_config_bulk(stream, 6); |
1547 | .fe = {{ | 1113 | return 0; |
1548 | .frontend_attach = mxl111sf_lgdt3305_frontend_attach, | 1114 | } |
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 | 1115 | ||
1557 | MXL111SF_EP4_ISOC_STREAMING_CONFIG, | 1116 | static struct dvb_usb_device_properties mxl111sf_props_atsc = { |
1558 | }, | 1117 | .driver_name = KBUILD_MODNAME, |
1559 | { | 1118 | .owner = THIS_MODULE, |
1560 | .caps = DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD, | 1119 | .adapter_nr = adapter_nr, |
1561 | 1120 | .size_of_priv = sizeof(struct mxl111sf_state), | |
1562 | .frontend_attach = mxl111sf_lg2161_frontend_attach, | 1121 | |
1563 | .tuner_attach = mxl111sf_attach_tuner, | 1122 | .generic_bulk_ctrl_endpoint = 0x02, |
1564 | 1123 | .generic_bulk_ctrl_endpoint_response = 0x81, | |
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 | 1124 | ||
1585 | static struct dvb_usb_device_properties mxl111sf_mercury_tp_bulk_properties = { | 1125 | .i2c_algo = &mxl111sf_i2c_algo, |
1586 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1126 | .frontend_attach = mxl111sf_frontend_attach_atsc, |
1127 | .tuner_attach = mxl111sf_attach_tuner, | ||
1128 | .init = mxl111sf_init, | ||
1129 | .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, | ||
1130 | .get_stream_config = mxl111sf_get_stream_config_atsc, | ||
1131 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | ||
1587 | 1132 | ||
1588 | .num_adapters = 1, | 1133 | .num_adapters = 1, |
1589 | .adapter = { | 1134 | .adapter = { |
1590 | { | 1135 | { |
1591 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1136 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1592 | .num_frontends = 3, | 1137 | } |
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 = { | ||
1617 | { "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 | } | 1138 | } |
1629 | }; | 1139 | }; |
1630 | 1140 | ||
1631 | static struct dvb_usb_device_properties mxl111sf_mercury_tp_isoc_properties = { | 1141 | /* mh lg2160 |
1632 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1142 | * bulk EP5/BULK/5/8192/RAW |
1143 | * isoc EP5/ISOC/5/96/200/RAW | ||
1144 | */ | ||
1145 | static int mxl111sf_get_stream_config_mh(struct dvb_frontend *fe, | ||
1146 | u8 *ts_type, struct usb_data_stream_properties *stream) | ||
1147 | { | ||
1148 | deb_info("%s: fe=%d\n", __func__, fe->id); | ||
1149 | |||
1150 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | ||
1151 | if (dvb_usb_mxl111sf_isoc) | ||
1152 | mxl111sf_stream_config_isoc(stream, 5, 96, 200); | ||
1153 | else | ||
1154 | mxl111sf_stream_config_bulk(stream, 5); | ||
1155 | return 0; | ||
1156 | } | ||
1633 | 1157 | ||
1634 | .num_adapters = 1, | 1158 | static struct dvb_usb_device_properties mxl111sf_props_mh = { |
1635 | .adapter = { | 1159 | .driver_name = KBUILD_MODNAME, |
1636 | { | 1160 | .owner = THIS_MODULE, |
1637 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1161 | .adapter_nr = adapter_nr, |
1638 | .num_frontends = 3, | 1162 | .size_of_priv = sizeof(struct mxl111sf_state), |
1639 | .fe = {{ | ||
1640 | .frontend_attach = mxl111sf_lgdt3305_frontend_attach, | ||
1641 | .tuner_attach = mxl111sf_attach_tuner, | ||
1642 | |||
1643 | MXL111SF_EP6_ISOC_STREAMING_CONFIG, | ||
1644 | }, | ||
1645 | { | ||
1646 | .frontend_attach = mxl111sf_attach_demod, | ||
1647 | .tuner_attach = mxl111sf_attach_tuner, | ||
1648 | 1163 | ||
1649 | MXL111SF_EP4_ISOC_STREAMING_CONFIG, | 1164 | .generic_bulk_ctrl_endpoint = 0x02, |
1650 | }, | 1165 | .generic_bulk_ctrl_endpoint_response = 0x81, |
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, | ||
1658 | }}, | ||
1659 | }, | ||
1660 | }, | ||
1661 | .num_device_descs = 2, | ||
1662 | .devices = { | ||
1663 | { "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 | 1166 | ||
1677 | static | 1167 | .i2c_algo = &mxl111sf_i2c_algo, |
1678 | struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_bulk_properties = { | 1168 | .frontend_attach = mxl111sf_frontend_attach_mh, |
1679 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1169 | .tuner_attach = mxl111sf_attach_tuner, |
1170 | .init = mxl111sf_init, | ||
1171 | .streaming_ctrl = mxl111sf_ep5_streaming_ctrl, | ||
1172 | .get_stream_config = mxl111sf_get_stream_config_mh, | ||
1173 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | ||
1680 | 1174 | ||
1681 | .num_adapters = 1, | 1175 | .num_adapters = 1, |
1682 | .adapter = { | 1176 | .adapter = { |
1683 | { | 1177 | { |
1684 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1178 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1685 | .num_frontends = 2, | 1179 | } |
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 | } | 1180 | } |
1710 | }; | 1181 | }; |
1711 | 1182 | ||
1712 | static | 1183 | /* atsc mh lgdt3305 mxl111sf lg2160 |
1713 | struct dvb_usb_device_properties mxl111sf_mercury_mh_tp_isoc_properties = { | 1184 | * bulk EP6/BULK/5/8192 EP4/BULK/5/8192 EP5/BULK/5/8192/RAW |
1714 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1185 | * isoc EP6/ISOC/5/24/3072 EP4/ISOC/5/96/564 EP5/ISOC/5/96/200/RAW |
1186 | */ | ||
1187 | static int mxl111sf_get_stream_config_atsc_mh(struct dvb_frontend *fe, | ||
1188 | u8 *ts_type, struct usb_data_stream_properties *stream) | ||
1189 | { | ||
1190 | deb_info("%s: fe=%d\n", __func__, fe->id); | ||
1191 | |||
1192 | if (fe->id == 0) { | ||
1193 | *ts_type = DVB_USB_FE_TS_TYPE_188; | ||
1194 | if (dvb_usb_mxl111sf_isoc) | ||
1195 | mxl111sf_stream_config_isoc(stream, 6, 24, 3072); | ||
1196 | else | ||
1197 | mxl111sf_stream_config_bulk(stream, 6); | ||
1198 | } else if (fe->id == 1) { | ||
1199 | *ts_type = DVB_USB_FE_TS_TYPE_188; | ||
1200 | if (dvb_usb_mxl111sf_isoc) | ||
1201 | mxl111sf_stream_config_isoc(stream, 4, 96, 564); | ||
1202 | else | ||
1203 | mxl111sf_stream_config_bulk(stream, 4); | ||
1204 | } else if (fe->id == 2) { | ||
1205 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | ||
1206 | if (dvb_usb_mxl111sf_isoc) | ||
1207 | mxl111sf_stream_config_isoc(stream, 5, 96, 200); | ||
1208 | else | ||
1209 | mxl111sf_stream_config_bulk(stream, 5); | ||
1210 | } | ||
1211 | return 0; | ||
1212 | } | ||
1213 | |||
1214 | static int mxl111sf_streaming_ctrl_atsc_mh(struct dvb_frontend *fe, int onoff) | ||
1215 | { | ||
1216 | deb_info("%s: fe=%d onoff=%d\n", __func__, fe->id, onoff); | ||
1217 | |||
1218 | if (fe->id == 0) | ||
1219 | return mxl111sf_ep6_streaming_ctrl(fe, onoff); | ||
1220 | else if (fe->id == 1) | ||
1221 | return mxl111sf_ep4_streaming_ctrl(fe, onoff); | ||
1222 | else if (fe->id == 2) | ||
1223 | return mxl111sf_ep5_streaming_ctrl(fe, onoff); | ||
1224 | return 0; | ||
1225 | } | ||
1226 | |||
1227 | static struct dvb_usb_device_properties mxl111sf_props_atsc_mh = { | ||
1228 | .driver_name = KBUILD_MODNAME, | ||
1229 | .owner = THIS_MODULE, | ||
1230 | .adapter_nr = adapter_nr, | ||
1231 | .size_of_priv = sizeof(struct mxl111sf_state), | ||
1232 | |||
1233 | .generic_bulk_ctrl_endpoint = 0x02, | ||
1234 | .generic_bulk_ctrl_endpoint_response = 0x81, | ||
1235 | |||
1236 | .i2c_algo = &mxl111sf_i2c_algo, | ||
1237 | .frontend_attach = mxl111sf_frontend_attach_atsc_mh, | ||
1238 | .tuner_attach = mxl111sf_attach_tuner, | ||
1239 | .init = mxl111sf_init, | ||
1240 | .streaming_ctrl = mxl111sf_streaming_ctrl_atsc_mh, | ||
1241 | .get_stream_config = mxl111sf_get_stream_config_atsc_mh, | ||
1242 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | ||
1715 | 1243 | ||
1716 | .num_adapters = 1, | 1244 | .num_adapters = 1, |
1717 | .adapter = { | 1245 | .adapter = { |
1718 | { | 1246 | { |
1719 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1247 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1720 | .num_frontends = 2, | 1248 | } |
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 | } | 1249 | } |
1745 | }; | 1250 | }; |
1746 | 1251 | ||
1747 | static | 1252 | /* mercury lgdt3305 mxl111sf lg2161 |
1748 | struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_bulk_properties = { | 1253 | * tp bulk EP6/BULK/5/8192 EP4/BULK/5/8192 EP6/BULK/5/8192/RAW |
1749 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1254 | * tp isoc EP6/ISOC/5/24/3072 EP4/ISOC/5/96/564 EP6/ISOC/5/24/3072/RAW |
1255 | * spi bulk EP6/BULK/5/8192 EP4/BULK/5/8192 EP5/BULK/5/8192/RAW | ||
1256 | * spi isoc EP6/ISOC/5/24/3072 EP4/ISOC/5/96/564 EP5/ISOC/5/96/200/RAW | ||
1257 | */ | ||
1258 | static int mxl111sf_get_stream_config_mercury(struct dvb_frontend *fe, | ||
1259 | u8 *ts_type, struct usb_data_stream_properties *stream) | ||
1260 | { | ||
1261 | deb_info("%s: fe=%d\n", __func__, fe->id); | ||
1262 | |||
1263 | if (fe->id == 0) { | ||
1264 | *ts_type = DVB_USB_FE_TS_TYPE_188; | ||
1265 | if (dvb_usb_mxl111sf_isoc) | ||
1266 | mxl111sf_stream_config_isoc(stream, 6, 24, 3072); | ||
1267 | else | ||
1268 | mxl111sf_stream_config_bulk(stream, 6); | ||
1269 | } else if (fe->id == 1) { | ||
1270 | *ts_type = DVB_USB_FE_TS_TYPE_188; | ||
1271 | if (dvb_usb_mxl111sf_isoc) | ||
1272 | mxl111sf_stream_config_isoc(stream, 4, 96, 564); | ||
1273 | else | ||
1274 | mxl111sf_stream_config_bulk(stream, 4); | ||
1275 | } else if (fe->id == 2 && dvb_usb_mxl111sf_spi) { | ||
1276 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | ||
1277 | if (dvb_usb_mxl111sf_isoc) | ||
1278 | mxl111sf_stream_config_isoc(stream, 5, 96, 200); | ||
1279 | else | ||
1280 | mxl111sf_stream_config_bulk(stream, 5); | ||
1281 | } else if (fe->id == 2 && !dvb_usb_mxl111sf_spi) { | ||
1282 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | ||
1283 | if (dvb_usb_mxl111sf_isoc) | ||
1284 | mxl111sf_stream_config_isoc(stream, 6, 24, 3072); | ||
1285 | else | ||
1286 | mxl111sf_stream_config_bulk(stream, 6); | ||
1287 | } | ||
1288 | return 0; | ||
1289 | } | ||
1290 | |||
1291 | static int mxl111sf_streaming_ctrl_mercury(struct dvb_frontend *fe, int onoff) | ||
1292 | { | ||
1293 | deb_info("%s: fe=%d onoff=%d\n", __func__, fe->id, onoff); | ||
1294 | |||
1295 | if (fe->id == 0) | ||
1296 | return mxl111sf_ep6_streaming_ctrl(fe, onoff); | ||
1297 | else if (fe->id == 1) | ||
1298 | return mxl111sf_ep4_streaming_ctrl(fe, onoff); | ||
1299 | else if (fe->id == 2 && dvb_usb_mxl111sf_spi) | ||
1300 | return mxl111sf_ep5_streaming_ctrl(fe, onoff); | ||
1301 | else if (fe->id == 2 && !dvb_usb_mxl111sf_spi) | ||
1302 | return mxl111sf_ep6_streaming_ctrl(fe, onoff); | ||
1303 | return 0; | ||
1304 | } | ||
1305 | |||
1306 | static struct dvb_usb_device_properties mxl111sf_props_mercury = { | ||
1307 | .driver_name = KBUILD_MODNAME, | ||
1308 | .owner = THIS_MODULE, | ||
1309 | .adapter_nr = adapter_nr, | ||
1310 | .size_of_priv = sizeof(struct mxl111sf_state), | ||
1311 | |||
1312 | .generic_bulk_ctrl_endpoint = 0x02, | ||
1313 | .generic_bulk_ctrl_endpoint_response = 0x81, | ||
1314 | |||
1315 | .i2c_algo = &mxl111sf_i2c_algo, | ||
1316 | .frontend_attach = mxl111sf_frontend_attach_mercury, | ||
1317 | .tuner_attach = mxl111sf_attach_tuner, | ||
1318 | .init = mxl111sf_init, | ||
1319 | .streaming_ctrl = mxl111sf_streaming_ctrl_mercury, | ||
1320 | .get_stream_config = mxl111sf_get_stream_config_mercury, | ||
1321 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | ||
1750 | 1322 | ||
1751 | .num_adapters = 1, | 1323 | .num_adapters = 1, |
1752 | .adapter = { | 1324 | .adapter = { |
1753 | { | 1325 | { |
1754 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1326 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1755 | .num_frontends = 2, | 1327 | } |
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 | } | 1328 | } |
1780 | }; | 1329 | }; |
1781 | 1330 | ||
1782 | static | 1331 | /* mercury mh mxl111sf lg2161 |
1783 | struct dvb_usb_device_properties mxl111sf_mercury_mh_spi_isoc_properties = { | 1332 | * tp bulk EP4/BULK/5/8192 EP6/BULK/5/8192/RAW |
1784 | MXL111SF_DEFAULT_DEVICE_PROPERTIES, | 1333 | * tp isoc EP4/ISOC/5/96/564 EP6/ISOC/5/24/3072/RAW |
1334 | * spi bulk EP4/BULK/5/8192 EP5/BULK/5/8192/RAW | ||
1335 | * spi isoc EP4/ISOC/5/96/564 EP5/ISOC/5/96/200/RAW | ||
1336 | */ | ||
1337 | static int mxl111sf_get_stream_config_mercury_mh(struct dvb_frontend *fe, | ||
1338 | u8 *ts_type, struct usb_data_stream_properties *stream) | ||
1339 | { | ||
1340 | deb_info("%s: fe=%d\n", __func__, fe->id); | ||
1341 | |||
1342 | if (fe->id == 0) { | ||
1343 | *ts_type = DVB_USB_FE_TS_TYPE_188; | ||
1344 | if (dvb_usb_mxl111sf_isoc) | ||
1345 | mxl111sf_stream_config_isoc(stream, 4, 96, 564); | ||
1346 | else | ||
1347 | mxl111sf_stream_config_bulk(stream, 4); | ||
1348 | } else if (fe->id == 1 && dvb_usb_mxl111sf_spi) { | ||
1349 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | ||
1350 | if (dvb_usb_mxl111sf_isoc) | ||
1351 | mxl111sf_stream_config_isoc(stream, 5, 96, 200); | ||
1352 | else | ||
1353 | mxl111sf_stream_config_bulk(stream, 5); | ||
1354 | } else if (fe->id == 1 && !dvb_usb_mxl111sf_spi) { | ||
1355 | *ts_type = DVB_USB_FE_TS_TYPE_RAW; | ||
1356 | if (dvb_usb_mxl111sf_isoc) | ||
1357 | mxl111sf_stream_config_isoc(stream, 6, 24, 3072); | ||
1358 | else | ||
1359 | mxl111sf_stream_config_bulk(stream, 6); | ||
1360 | } | ||
1361 | return 0; | ||
1362 | } | ||
1363 | |||
1364 | static int mxl111sf_streaming_ctrl_mercury_mh(struct dvb_frontend *fe, int onoff) | ||
1365 | { | ||
1366 | deb_info("%s: fe=%d onoff=%d\n", __func__, fe->id, onoff); | ||
1367 | |||
1368 | if (fe->id == 0) | ||
1369 | return mxl111sf_ep4_streaming_ctrl(fe, onoff); | ||
1370 | else if (fe->id == 1 && dvb_usb_mxl111sf_spi) | ||
1371 | return mxl111sf_ep5_streaming_ctrl(fe, onoff); | ||
1372 | else if (fe->id == 1 && !dvb_usb_mxl111sf_spi) | ||
1373 | return mxl111sf_ep6_streaming_ctrl(fe, onoff); | ||
1374 | return 0; | ||
1375 | } | ||
1376 | |||
1377 | static struct dvb_usb_device_properties mxl111sf_props_mercury_mh = { | ||
1378 | .driver_name = KBUILD_MODNAME, | ||
1379 | .owner = THIS_MODULE, | ||
1380 | .adapter_nr = adapter_nr, | ||
1381 | .size_of_priv = sizeof(struct mxl111sf_state), | ||
1382 | |||
1383 | .generic_bulk_ctrl_endpoint = 0x02, | ||
1384 | .generic_bulk_ctrl_endpoint_response = 0x81, | ||
1385 | |||
1386 | .i2c_algo = &mxl111sf_i2c_algo, | ||
1387 | .frontend_attach = mxl111sf_frontend_attach_mercury_mh, | ||
1388 | .tuner_attach = mxl111sf_attach_tuner, | ||
1389 | .init = mxl111sf_init, | ||
1390 | .streaming_ctrl = mxl111sf_streaming_ctrl_mercury_mh, | ||
1391 | .get_stream_config = mxl111sf_get_stream_config_mercury_mh, | ||
1392 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | ||
1785 | 1393 | ||
1786 | .num_adapters = 1, | 1394 | .num_adapters = 1, |
1787 | .adapter = { | 1395 | .adapter = { |
1788 | { | 1396 | { |
1789 | .fe_ioctl_override = mxl111sf_fe_ioctl_override, | 1397 | .stream = DVB_USB_STREAM_ISOC(6, 5, 24, 3072, 1), |
1790 | .num_frontends = 2, | 1398 | } |
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 | } | 1399 | } |
1815 | }; | 1400 | }; |
1816 | 1401 | ||
1817 | static struct usb_driver mxl111sf_driver = { | 1402 | static const struct usb_device_id mxl111sf_id_table[] = { |
1818 | .name = "dvb_usb_mxl111sf", | 1403 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc600, &mxl111sf_props_atsc_mh, "Hauppauge 126xxx ATSC+", NULL) }, |
1819 | .probe = mxl111sf_probe, | 1404 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc601, &mxl111sf_props_atsc, "Hauppauge 126xxx ATSC", NULL) }, |
1820 | .disconnect = dvb_usb_device_exit, | 1405 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xc602, &mxl111sf_props_mh, "HCW 126xxx", NULL) }, |
1821 | .id_table = mxl111sf_table, | 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) }, | ||
1437 | { } | ||
1438 | }; | ||
1439 | MODULE_DEVICE_TABLE(usb, mxl111sf_id_table); | ||
1440 | |||
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, | ||
1448 | .no_dynamic_id = 1, | ||
1449 | .soft_unbind = 1, | ||
1822 | }; | 1450 | }; |
1823 | 1451 | ||
1824 | module_usb_driver(mxl111sf_driver); | 1452 | module_usb_driver(mxl111sf_usb_driver); |
1825 | 1453 | ||
1826 | MODULE_AUTHOR("Michael Krufky <mkrufky@kernellabs.com>"); | 1454 | MODULE_AUTHOR("Michael Krufky <mkrufky@kernellabs.com>"); |
1827 | MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF"); | 1455 | MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF"); |
diff --git a/drivers/media/dvb/dvb-usb/mxl111sf.h b/drivers/media/dvb/dvb-usb/mxl111sf.h index 364d89f826bd..9816de86e48c 100644 --- a/drivers/media/dvb/dvb-usb/mxl111sf.h +++ b/drivers/media/dvb/dvb-usb/mxl111sf.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #undef DVB_USB_LOG_PREFIX | 15 | #undef DVB_USB_LOG_PREFIX |
16 | #endif | 16 | #endif |
17 | #define DVB_USB_LOG_PREFIX "mxl111sf" | 17 | #define DVB_USB_LOG_PREFIX "mxl111sf" |
18 | #include "dvb-usb.h" | 18 | #include "dvb_usb.h" |
19 | #include <media/tveeprom.h> | 19 | #include <media/tveeprom.h> |
20 | 20 | ||
21 | #define MXL_EP1_REG_READ 1 | 21 | #define MXL_EP1_REG_READ 1 |
@@ -39,6 +39,15 @@ enum mxl111sf_gpio_port_expander { | |||
39 | mxl111sf_PCA9534, | 39 | mxl111sf_PCA9534, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct mxl111sf_adap_state { | ||
43 | int alt_mode; | ||
44 | int gpio_mode; | ||
45 | int device_mode; | ||
46 | int ep6_clockphase; | ||
47 | int (*fe_init)(struct dvb_frontend *); | ||
48 | int (*fe_sleep)(struct dvb_frontend *); | ||
49 | }; | ||
50 | |||
42 | struct mxl111sf_state { | 51 | struct mxl111sf_state { |
43 | struct dvb_usb_device *d; | 52 | struct dvb_usb_device *d; |
44 | 53 | ||
@@ -74,15 +83,8 @@ struct mxl111sf_state { | |||
74 | struct tveeprom tv; | 83 | struct tveeprom tv; |
75 | 84 | ||
76 | struct mutex fe_lock; | 85 | struct mutex fe_lock; |
77 | }; | 86 | u8 num_frontends; |
78 | 87 | struct mxl111sf_adap_state adap_state[3]; | |
79 | struct mxl111sf_adap_state { | ||
80 | int alt_mode; | ||
81 | int gpio_mode; | ||
82 | int device_mode; | ||
83 | int ep6_clockphase; | ||
84 | int (*fe_init)(struct dvb_frontend *); | ||
85 | int (*fe_sleep)(struct dvb_frontend *); | ||
86 | }; | 88 | }; |
87 | 89 | ||
88 | int mxl111sf_read_reg(struct mxl111sf_state *state, u8 addr, u8 *data); | 90 | int mxl111sf_read_reg(struct mxl111sf_state *state, u8 addr, u8 *data); |