diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2006-09-23 19:01:29 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-21 10:34:50 -0500 |
commit | 01cb34dba930accdb9356247bbe64b1c5393c5d5 (patch) | |
tree | 96c37c3816d8fb9fbd5c172d04bce7de916da17b /drivers/media/dvb/dvb-usb/m920x.c | |
parent | baa2ed09000de94c02e4b6690a6097314d282928 (diff) |
V4L/DVB (5127): M920x: update megasky driver for recent changes in the dvb tree
update code to use dvb_attach()
update code to reflect recent changes to the dvb_usb framework
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/m920x.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/m920x.c | 83 |
1 files changed, 44 insertions, 39 deletions
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index ba2c5c91da09..6e96c11a0c19 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c | |||
@@ -179,7 +179,7 @@ static struct i2c_algorithm m9206_i2c_algo = { | |||
179 | 179 | ||
180 | /* Callbacks for DVB USB */ | 180 | /* Callbacks for DVB USB */ |
181 | static int megasky_identify_state (struct usb_device *udev, | 181 | static int megasky_identify_state (struct usb_device *udev, |
182 | struct dvb_usb_properties *props, | 182 | struct dvb_usb_device_properties *props, |
183 | struct dvb_usb_device_description **desc, | 183 | struct dvb_usb_device_description **desc, |
184 | int *cold) | 184 | int *cold) |
185 | { | 185 | { |
@@ -434,19 +434,19 @@ static struct mt352_config megasky_mt352_config = { | |||
434 | .demod_init = megasky_mt352_demod_init, | 434 | .demod_init = megasky_mt352_demod_init, |
435 | }; | 435 | }; |
436 | 436 | ||
437 | static int megasky_frontend_attach(struct dvb_usb_device *d) | 437 | static int megasky_frontend_attach(struct dvb_usb_adapter *adap) |
438 | { | 438 | { |
439 | deb_rc("megasky_frontend_attach!\n"); | 439 | deb_rc("megasky_frontend_attach!\n"); |
440 | 440 | ||
441 | if ((d->fe = mt352_attach(&megasky_mt352_config, &d->i2c_adap)) != NULL) { | 441 | if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config, &adap->dev->i2c_adap)) != NULL) { |
442 | d->fe->ops.tuner_ops.calc_regs = qt1010_set_params; | 442 | adap->fe->ops.tuner_ops.calc_regs = qt1010_set_params; |
443 | return 0; | 443 | return 0; |
444 | } | 444 | } |
445 | return -EIO; | 445 | return -EIO; |
446 | } | 446 | } |
447 | 447 | ||
448 | /* DVB USB Driver stuff */ | 448 | /* DVB USB Driver stuff */ |
449 | static struct dvb_usb_properties megasky_properties; | 449 | static struct dvb_usb_device_properties megasky_properties; |
450 | 450 | ||
451 | static int megasky_probe(struct usb_interface *intf, const struct usb_device_id *id) | 451 | static int megasky_probe(struct usb_interface *intf, const struct usb_device_id *id) |
452 | { | 452 | { |
@@ -485,7 +485,7 @@ static struct usb_device_id m920x_table [] = { | |||
485 | }; | 485 | }; |
486 | MODULE_DEVICE_TABLE (usb, m920x_table); | 486 | MODULE_DEVICE_TABLE (usb, m920x_table); |
487 | 487 | ||
488 | static int set_filter(struct dvb_usb_device *d, int type, int idx, int pid) | 488 | static int set_filter(struct dvb_usb_adapter *adap, int type, int idx, int pid) |
489 | { | 489 | { |
490 | int ret = 0; | 490 | int ret = 0; |
491 | 491 | ||
@@ -494,61 +494,61 @@ static int set_filter(struct dvb_usb_device *d, int type, int idx, int pid) | |||
494 | 494 | ||
495 | pid |= 0x8000; | 495 | pid |= 0x8000; |
496 | 496 | ||
497 | if ((ret = m9206_write(d->udev, 0x25, pid, (type << 8) | (idx * 4) )) != 0) | 497 | if ((ret = m9206_write(adap->dev->udev, 0x25, pid, (type << 8) | (idx * 4) )) != 0) |
498 | return ret; | 498 | return ret; |
499 | 499 | ||
500 | if ((ret = m9206_write(d->udev, 0x25, 0, (type << 8) | (idx * 4) )) != 0) | 500 | if ((ret = m9206_write(adap->dev->udev, 0x25, 0, (type << 8) | (idx * 4) )) != 0) |
501 | return ret; | 501 | return ret; |
502 | 502 | ||
503 | return ret; | 503 | return ret; |
504 | } | 504 | } |
505 | 505 | ||
506 | static int m9206_pid_filter_ctrl(struct dvb_usb_device *d, int onoff) | 506 | static int m9206_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) |
507 | { | 507 | { |
508 | int ret = 0; | 508 | int ret = 0; |
509 | 509 | ||
510 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | 510 | if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0) |
511 | return -EAGAIN; | 511 | return -EAGAIN; |
512 | 512 | ||
513 | deb_rc("filtering %s\n", onoff ? "on" : "off"); | 513 | deb_rc("filtering %s\n", onoff ? "on" : "off"); |
514 | if (onoff == 0) { | 514 | if (onoff == 0) { |
515 | if ((ret = set_filter(d, 0x81, 1, 0x00)) != 0) | 515 | if ((ret = set_filter(adap, 0x81, 1, 0x00)) != 0) |
516 | goto unlock; | 516 | goto unlock; |
517 | 517 | ||
518 | if ((ret = set_filter(d, 0x82, 0, 0x02f5)) != 0) | 518 | if ((ret = set_filter(adap, 0x82, 0, 0x02f5)) != 0) |
519 | goto unlock; | 519 | goto unlock; |
520 | } | 520 | } |
521 | unlock: | 521 | unlock: |
522 | mutex_unlock(&d->i2c_mutex); | 522 | mutex_unlock(&adap->dev->i2c_mutex); |
523 | 523 | ||
524 | return ret; | 524 | return ret; |
525 | } | 525 | } |
526 | 526 | ||
527 | static int m9206_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) | 527 | static int m9206_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) |
528 | { | 528 | { |
529 | int ret = 0; | 529 | int ret = 0; |
530 | 530 | ||
531 | if (pid == 8192) | 531 | if (pid == 8192) |
532 | return m9206_pid_filter_ctrl(d, !onoff); | 532 | return m9206_pid_filter_ctrl(adap, !onoff); |
533 | 533 | ||
534 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | 534 | if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0) |
535 | return -EAGAIN; | 535 | return -EAGAIN; |
536 | 536 | ||
537 | deb_rc("filter %d, pid %x, %s\n", index, pid, onoff ? "on" : "off"); | 537 | deb_rc("filter %d, pid %x, %s\n", index, pid, onoff ? "on" : "off"); |
538 | if (onoff == 0) | 538 | if (onoff == 0) |
539 | pid = 0; | 539 | pid = 0; |
540 | 540 | ||
541 | if ((ret = set_filter(d, 0x81, 1, 0x01)) != 0) | 541 | if ((ret = set_filter(adap, 0x81, 1, 0x01)) != 0) |
542 | goto unlock; | 542 | goto unlock; |
543 | 543 | ||
544 | if ((ret = set_filter(d, 0x81, index + 2, pid)) != 0) | 544 | if ((ret = set_filter(adap, 0x81, index + 2, pid)) != 0) |
545 | goto unlock; | 545 | goto unlock; |
546 | 546 | ||
547 | if ((ret = set_filter(d, 0x82, 0, 0x02f5)) != 0) | 547 | if ((ret = set_filter(adap, 0x82, 0, 0x02f5)) != 0) |
548 | goto unlock; | 548 | goto unlock; |
549 | 549 | ||
550 | unlock: | 550 | unlock: |
551 | mutex_unlock(&d->i2c_mutex); | 551 | mutex_unlock(&adap->dev->i2c_mutex); |
552 | 552 | ||
553 | return ret; | 553 | return ret; |
554 | } | 554 | } |
@@ -614,19 +614,11 @@ static int m9206_firmware_download(struct usb_device *udev, const struct firmwar | |||
614 | return ret; | 614 | return ret; |
615 | } | 615 | } |
616 | 616 | ||
617 | static struct dvb_usb_properties megasky_properties = { | 617 | static struct dvb_usb_device_properties megasky_properties = { |
618 | .caps = DVB_USB_IS_AN_I2C_ADAPTER | DVB_USB_HAS_PID_FILTER | | ||
619 | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_NEED_PID_FILTERING, | ||
620 | .pid_filter_count = 8, | ||
621 | |||
622 | .usb_ctrl = DEVICE_SPECIFIC, | 618 | .usb_ctrl = DEVICE_SPECIFIC, |
623 | .firmware = "dvb-usb-megasky-02.fw", | 619 | .firmware = "dvb-usb-megasky-02.fw", |
624 | .download_firmware = m9206_firmware_download, | 620 | .download_firmware = m9206_firmware_download, |
625 | 621 | ||
626 | .pid_filter = m9206_pid_filter, | ||
627 | .pid_filter_ctrl = m9206_pid_filter_ctrl, | ||
628 | .frontend_attach = megasky_frontend_attach, | ||
629 | |||
630 | .rc_interval = 200, | 622 | .rc_interval = 200, |
631 | .rc_key_map = megasky_rc_keys, | 623 | .rc_key_map = megasky_rc_keys, |
632 | .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys), | 624 | .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys), |
@@ -635,19 +627,32 @@ static struct dvb_usb_properties megasky_properties = { | |||
635 | .size_of_priv = 0, | 627 | .size_of_priv = 0, |
636 | 628 | ||
637 | .identify_state = megasky_identify_state, | 629 | .identify_state = megasky_identify_state, |
630 | .num_adapters = 1, | ||
631 | .adapter = {{ | ||
632 | .caps = DVB_USB_IS_AN_I2C_ADAPTER | DVB_USB_ADAP_HAS_PID_FILTER | | ||
633 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF | | ||
634 | DVB_USB_ADAP_NEED_PID_FILTERING, | ||
635 | .pid_filter_count = 8, | ||
636 | .pid_filter = m9206_pid_filter, | ||
637 | .pid_filter_ctrl = m9206_pid_filter_ctrl, | ||
638 | |||
639 | .frontend_attach = megasky_frontend_attach, | ||
640 | |||
641 | .stream = { | ||
642 | .type = USB_BULK, | ||
643 | .count = 8, | ||
644 | .endpoint = 0x81, | ||
645 | .u = { | ||
646 | .bulk = { | ||
647 | .buffersize = 512, | ||
648 | } | ||
649 | } | ||
650 | }, | ||
651 | }}, | ||
638 | .i2c_algo = &m9206_i2c_algo, | 652 | .i2c_algo = &m9206_i2c_algo, |
639 | 653 | ||
640 | .generic_bulk_ctrl_endpoint = 0x01, | 654 | .generic_bulk_ctrl_endpoint = 0x01, |
641 | .urb = { | 655 | |
642 | .type = DVB_USB_BULK, | ||
643 | .count = 8, | ||
644 | .endpoint = 0x81, | ||
645 | .u = { | ||
646 | .bulk = { | ||
647 | .buffersize = 512, | ||
648 | } | ||
649 | } | ||
650 | }, | ||
651 | .num_device_descs = 1, | 656 | .num_device_descs = 1, |
652 | .devices = { | 657 | .devices = { |
653 | { "MSI Mega Sky 580 DVB-T USB2.0", | 658 | { "MSI Mega Sky 580 DVB-T USB2.0", |