diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-07-31 17:04:09 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-02 15:43:45 -0400 |
commit | f72a27b8ed4458bb9f7203408441d27382bc93f4 (patch) | |
tree | 667c20a22af36fecdfb770384afb3ef85a9578e2 /drivers/media/dvb/dvb-usb/cxusb.c | |
parent | 34abf2194499571b2efa6b4aface8c0ea0c47ce1 (diff) |
V4L/DVB: dvb-usb: prepare drivers for using rc-core
This is a big patch, yet trivial. It just move the RC properties
to a separate struct, in order to prepare the dvb-usb drivers to
use rc-core. There's no change on the behavior of the drivers.
With this change, it is possible to have both legacy and rc-core
based code inside the dvb-usb-remote, allowing a gradual migration
to rc-core, driver per driver.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/cxusb.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 116 |
1 files changed, 68 insertions, 48 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 22fc0a99f5ad..cd9f362c37b2 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -385,7 +385,7 @@ static int cxusb_d680_dmb_streaming_ctrl( | |||
385 | 385 | ||
386 | static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 386 | static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
387 | { | 387 | { |
388 | struct ir_scancode *keymap = d->props.rc_key_map; | 388 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; |
389 | u8 ircode[4]; | 389 | u8 ircode[4]; |
390 | int i; | 390 | int i; |
391 | 391 | ||
@@ -394,7 +394,7 @@ static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
394 | *event = 0; | 394 | *event = 0; |
395 | *state = REMOTE_NO_KEY_PRESSED; | 395 | *state = REMOTE_NO_KEY_PRESSED; |
396 | 396 | ||
397 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 397 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { |
398 | if (rc5_custom(&keymap[i]) == ircode[2] && | 398 | if (rc5_custom(&keymap[i]) == ircode[2] && |
399 | rc5_data(&keymap[i]) == ircode[3]) { | 399 | rc5_data(&keymap[i]) == ircode[3]) { |
400 | *event = keymap[i].keycode; | 400 | *event = keymap[i].keycode; |
@@ -410,7 +410,7 @@ static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
410 | static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, | 410 | static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, |
411 | int *state) | 411 | int *state) |
412 | { | 412 | { |
413 | struct ir_scancode *keymap = d->props.rc_key_map; | 413 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; |
414 | u8 ircode[4]; | 414 | u8 ircode[4]; |
415 | int i; | 415 | int i; |
416 | struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, | 416 | struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, |
@@ -422,7 +422,7 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, | |||
422 | if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) | 422 | if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) |
423 | return 0; | 423 | return 0; |
424 | 424 | ||
425 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 425 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { |
426 | if (rc5_custom(&keymap[i]) == ircode[1] && | 426 | if (rc5_custom(&keymap[i]) == ircode[1] && |
427 | rc5_data(&keymap[i]) == ircode[2]) { | 427 | rc5_data(&keymap[i]) == ircode[2]) { |
428 | *event = keymap[i].keycode; | 428 | *event = keymap[i].keycode; |
@@ -438,7 +438,7 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, | |||
438 | static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, | 438 | static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, |
439 | int *state) | 439 | int *state) |
440 | { | 440 | { |
441 | struct ir_scancode *keymap = d->props.rc_key_map; | 441 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; |
442 | u8 ircode[2]; | 442 | u8 ircode[2]; |
443 | int i; | 443 | int i; |
444 | 444 | ||
@@ -448,7 +448,7 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, | |||
448 | if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) | 448 | if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) |
449 | return 0; | 449 | return 0; |
450 | 450 | ||
451 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 451 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { |
452 | if (rc5_custom(&keymap[i]) == ircode[0] && | 452 | if (rc5_custom(&keymap[i]) == ircode[0] && |
453 | rc5_data(&keymap[i]) == ircode[1]) { | 453 | rc5_data(&keymap[i]) == ircode[1]) { |
454 | *event = keymap[i].keycode; | 454 | *event = keymap[i].keycode; |
@@ -923,7 +923,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) | |||
923 | return -EIO; | 923 | return -EIO; |
924 | 924 | ||
925 | /* try to determine if there is no IR decoder on the I2C bus */ | 925 | /* try to determine if there is no IR decoder on the I2C bus */ |
926 | for (i = 0; adap->dev->props.rc_key_map != NULL && i < 5; i++) { | 926 | for (i = 0; adap->dev->props.rc.legacy.rc_key_map != NULL && i < 5; i++) { |
927 | msleep(20); | 927 | msleep(20); |
928 | if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) | 928 | if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) |
929 | goto no_IR; | 929 | goto no_IR; |
@@ -931,7 +931,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) | |||
931 | continue; | 931 | continue; |
932 | if (ircode[2] + ircode[3] != 0xff) { | 932 | if (ircode[2] + ircode[3] != 0xff) { |
933 | no_IR: | 933 | no_IR: |
934 | adap->dev->props.rc_key_map = NULL; | 934 | adap->dev->props.rc.legacy.rc_key_map = NULL; |
935 | info("No IR receiver detected on this device."); | 935 | info("No IR receiver detected on this device."); |
936 | break; | 936 | break; |
937 | } | 937 | } |
@@ -1451,10 +1451,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = { | |||
1451 | 1451 | ||
1452 | .i2c_algo = &cxusb_i2c_algo, | 1452 | .i2c_algo = &cxusb_i2c_algo, |
1453 | 1453 | ||
1454 | .rc_interval = 100, | 1454 | .rc.legacy = { |
1455 | .rc_key_map = ir_codes_dvico_portable_table, | 1455 | .rc_interval = 100, |
1456 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1456 | .rc_key_map = ir_codes_dvico_portable_table, |
1457 | .rc_query = cxusb_rc_query, | 1457 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), |
1458 | .rc_query = cxusb_rc_query, | ||
1459 | }, | ||
1458 | 1460 | ||
1459 | .generic_bulk_ctrl_endpoint = 0x01, | 1461 | .generic_bulk_ctrl_endpoint = 0x01, |
1460 | 1462 | ||
@@ -1502,10 +1504,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = { | |||
1502 | 1504 | ||
1503 | .i2c_algo = &cxusb_i2c_algo, | 1505 | .i2c_algo = &cxusb_i2c_algo, |
1504 | 1506 | ||
1505 | .rc_interval = 150, | 1507 | .rc.legacy = { |
1506 | .rc_key_map = ir_codes_dvico_mce_table, | 1508 | .rc_interval = 150, |
1507 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), | 1509 | .rc_key_map = ir_codes_dvico_mce_table, |
1508 | .rc_query = cxusb_rc_query, | 1510 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), |
1511 | .rc_query = cxusb_rc_query, | ||
1512 | }, | ||
1509 | 1513 | ||
1510 | .generic_bulk_ctrl_endpoint = 0x01, | 1514 | .generic_bulk_ctrl_endpoint = 0x01, |
1511 | 1515 | ||
@@ -1561,10 +1565,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { | |||
1561 | 1565 | ||
1562 | .i2c_algo = &cxusb_i2c_algo, | 1566 | .i2c_algo = &cxusb_i2c_algo, |
1563 | 1567 | ||
1564 | .rc_interval = 100, | 1568 | .rc.legacy = { |
1565 | .rc_key_map = ir_codes_dvico_portable_table, | 1569 | .rc_interval = 100, |
1566 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1570 | .rc_key_map = ir_codes_dvico_portable_table, |
1567 | .rc_query = cxusb_rc_query, | 1571 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), |
1572 | .rc_query = cxusb_rc_query, | ||
1573 | }, | ||
1568 | 1574 | ||
1569 | .generic_bulk_ctrl_endpoint = 0x01, | 1575 | .generic_bulk_ctrl_endpoint = 0x01, |
1570 | .num_device_descs = 1, | 1576 | .num_device_descs = 1, |
@@ -1611,10 +1617,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { | |||
1611 | 1617 | ||
1612 | .i2c_algo = &cxusb_i2c_algo, | 1618 | .i2c_algo = &cxusb_i2c_algo, |
1613 | 1619 | ||
1614 | .rc_interval = 100, | 1620 | .rc.legacy = { |
1615 | .rc_key_map = ir_codes_dvico_portable_table, | 1621 | .rc_interval = 100, |
1616 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1622 | .rc_key_map = ir_codes_dvico_portable_table, |
1617 | .rc_query = cxusb_rc_query, | 1623 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), |
1624 | .rc_query = cxusb_rc_query, | ||
1625 | }, | ||
1618 | 1626 | ||
1619 | .generic_bulk_ctrl_endpoint = 0x01, | 1627 | .generic_bulk_ctrl_endpoint = 0x01, |
1620 | 1628 | ||
@@ -1660,10 +1668,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = { | |||
1660 | 1668 | ||
1661 | .generic_bulk_ctrl_endpoint = 0x01, | 1669 | .generic_bulk_ctrl_endpoint = 0x01, |
1662 | 1670 | ||
1663 | .rc_interval = 100, | 1671 | .rc.legacy = { |
1664 | .rc_key_map = ir_codes_dvico_mce_table, | 1672 | .rc_interval = 100, |
1665 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), | 1673 | .rc_key_map = ir_codes_dvico_mce_table, |
1666 | .rc_query = cxusb_bluebird2_rc_query, | 1674 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), |
1675 | .rc_query = cxusb_bluebird2_rc_query, | ||
1676 | }, | ||
1667 | 1677 | ||
1668 | .num_device_descs = 1, | 1678 | .num_device_descs = 1, |
1669 | .devices = { | 1679 | .devices = { |
@@ -1708,10 +1718,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = { | |||
1708 | 1718 | ||
1709 | .generic_bulk_ctrl_endpoint = 0x01, | 1719 | .generic_bulk_ctrl_endpoint = 0x01, |
1710 | 1720 | ||
1711 | .rc_interval = 100, | 1721 | .rc.legacy = { |
1712 | .rc_key_map = ir_codes_dvico_portable_table, | 1722 | .rc_interval = 100, |
1713 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1723 | .rc_key_map = ir_codes_dvico_portable_table, |
1714 | .rc_query = cxusb_bluebird2_rc_query, | 1724 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), |
1725 | .rc_query = cxusb_bluebird2_rc_query, | ||
1726 | }, | ||
1715 | 1727 | ||
1716 | .num_device_descs = 1, | 1728 | .num_device_descs = 1, |
1717 | .devices = { | 1729 | .devices = { |
@@ -1758,10 +1770,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope | |||
1758 | 1770 | ||
1759 | .generic_bulk_ctrl_endpoint = 0x01, | 1771 | .generic_bulk_ctrl_endpoint = 0x01, |
1760 | 1772 | ||
1761 | .rc_interval = 100, | 1773 | .rc.legacy = { |
1762 | .rc_key_map = ir_codes_dvico_portable_table, | 1774 | .rc_interval = 100, |
1763 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1775 | .rc_key_map = ir_codes_dvico_portable_table, |
1764 | .rc_query = cxusb_rc_query, | 1776 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), |
1777 | .rc_query = cxusb_rc_query, | ||
1778 | }, | ||
1765 | 1779 | ||
1766 | .num_device_descs = 1, | 1780 | .num_device_descs = 1, |
1767 | .devices = { | 1781 | .devices = { |
@@ -1849,10 +1863,12 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { | |||
1849 | 1863 | ||
1850 | .generic_bulk_ctrl_endpoint = 0x01, | 1864 | .generic_bulk_ctrl_endpoint = 0x01, |
1851 | 1865 | ||
1852 | .rc_interval = 100, | 1866 | .rc.legacy = { |
1853 | .rc_key_map = ir_codes_dvico_mce_table, | 1867 | .rc_interval = 100, |
1854 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), | 1868 | .rc_key_map = ir_codes_dvico_mce_table, |
1855 | .rc_query = cxusb_rc_query, | 1869 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), |
1870 | .rc_query = cxusb_rc_query, | ||
1871 | }, | ||
1856 | 1872 | ||
1857 | .num_device_descs = 1, | 1873 | .num_device_descs = 1, |
1858 | .devices = { | 1874 | .devices = { |
@@ -1897,10 +1913,12 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { | |||
1897 | 1913 | ||
1898 | .generic_bulk_ctrl_endpoint = 0x01, | 1914 | .generic_bulk_ctrl_endpoint = 0x01, |
1899 | 1915 | ||
1900 | .rc_interval = 100, | 1916 | .rc.legacy = { |
1901 | .rc_key_map = ir_codes_d680_dmb_table, | 1917 | .rc_interval = 100, |
1902 | .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), | 1918 | .rc_key_map = ir_codes_d680_dmb_table, |
1903 | .rc_query = cxusb_d680_dmb_rc_query, | 1919 | .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), |
1920 | .rc_query = cxusb_d680_dmb_rc_query, | ||
1921 | }, | ||
1904 | 1922 | ||
1905 | .num_device_descs = 1, | 1923 | .num_device_descs = 1, |
1906 | .devices = { | 1924 | .devices = { |
@@ -1946,10 +1964,12 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = { | |||
1946 | 1964 | ||
1947 | .generic_bulk_ctrl_endpoint = 0x01, | 1965 | .generic_bulk_ctrl_endpoint = 0x01, |
1948 | 1966 | ||
1949 | .rc_interval = 100, | 1967 | .rc.legacy = { |
1950 | .rc_key_map = ir_codes_d680_dmb_table, | 1968 | .rc_interval = 100, |
1951 | .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), | 1969 | .rc_key_map = ir_codes_d680_dmb_table, |
1952 | .rc_query = cxusb_d680_dmb_rc_query, | 1970 | .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), |
1971 | .rc_query = cxusb_d680_dmb_rc_query, | ||
1972 | }, | ||
1953 | 1973 | ||
1954 | .num_device_descs = 1, | 1974 | .num_device_descs = 1, |
1955 | .devices = { | 1975 | .devices = { |