aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2010-10-29 15:08:23 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 05:16:37 -0500
commitd8b4b5822f51e2142b731b42c81e3f03eec475b2 (patch)
treefce9a9b7ca5031adc95fbd6be118352fb2527da5 /drivers/media/dvb/dvb-usb
parent4c7b355df6e7f05304e05f6b7a286e59a5f1cc54 (diff)
[media] ir-core: make struct rc_dev the primary interface
This patch merges the ir_input_dev and ir_dev_props structs into a single struct called rc_dev. The drivers and various functions in rc-core used by the drivers are also changed to use rc_dev as the primary interface when dealing with rc-core. This means that the input_dev is abstracted away from the drivers which is necessary if we ever want to support multiple input devs per rc device. The new API is similar to what the input subsystem uses, i.e: rc_device_alloc() rc_device_free() rc_device_register() rc_device_unregister() [mchehab@redhat.com: Fix compilation on mceusb and cx231xx, due to merge conflicts] Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Jarod Wilson <jarod@redhat.com> Tested-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r--drivers/media/dvb/dvb-usb/af9015.c16
-rw-r--r--drivers/media/dvb/dvb-usb/anysee.c2
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700.h2
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_core.c8
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c144
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-remote.c77
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb.h12
-rw-r--r--drivers/media/dvb/dvb-usb/lmedm04.c41
8 files changed, 142 insertions, 160 deletions
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c
index 31c0a0ed39f5..8b9ab3002e11 100644
--- a/drivers/media/dvb/dvb-usb/af9015.c
+++ b/drivers/media/dvb/dvb-usb/af9015.c
@@ -1041,13 +1041,13 @@ static int af9015_rc_query(struct dvb_usb_device *d)
1041 priv->rc_keycode = buf[12] << 16 | 1041 priv->rc_keycode = buf[12] << 16 |
1042 buf[13] << 8 | buf[14]; 1042 buf[13] << 8 | buf[14];
1043 } 1043 }
1044 ir_keydown(d->rc_input_dev, priv->rc_keycode, 0); 1044 ir_keydown(d->rc_dev, priv->rc_keycode, 0);
1045 } else { 1045 } else {
1046 priv->rc_keycode = 0; /* clear just for sure */ 1046 priv->rc_keycode = 0; /* clear just for sure */
1047 } 1047 }
1048 } else if (priv->rc_repeat != buf[6] || buf[0]) { 1048 } else if (priv->rc_repeat != buf[6] || buf[0]) {
1049 deb_rc("%s: key repeated\n", __func__); 1049 deb_rc("%s: key repeated\n", __func__);
1050 ir_keydown(d->rc_input_dev, priv->rc_keycode, 0); 1050 ir_keydown(d->rc_dev, priv->rc_keycode, 0);
1051 } else { 1051 } else {
1052 deb_rc("%s: no key press\n", __func__); 1052 deb_rc("%s: no key press\n", __func__);
1053 } 1053 }
@@ -1348,9 +1348,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
1348 .module_name = "af9015", 1348 .module_name = "af9015",
1349 .rc_query = af9015_rc_query, 1349 .rc_query = af9015_rc_query,
1350 .rc_interval = AF9015_RC_INTERVAL, 1350 .rc_interval = AF9015_RC_INTERVAL,
1351 .rc_props = { 1351 .allowed_protos = IR_TYPE_NEC,
1352 .allowed_protos = IR_TYPE_NEC,
1353 },
1354 }, 1352 },
1355 1353
1356 .i2c_algo = &af9015_i2c_algo, 1354 .i2c_algo = &af9015_i2c_algo,
@@ -1478,9 +1476,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
1478 .module_name = "af9015", 1476 .module_name = "af9015",
1479 .rc_query = af9015_rc_query, 1477 .rc_query = af9015_rc_query,
1480 .rc_interval = AF9015_RC_INTERVAL, 1478 .rc_interval = AF9015_RC_INTERVAL,
1481 .rc_props = { 1479 .allowed_protos = IR_TYPE_NEC,
1482 .allowed_protos = IR_TYPE_NEC,
1483 },
1484 }, 1480 },
1485 1481
1486 .i2c_algo = &af9015_i2c_algo, 1482 .i2c_algo = &af9015_i2c_algo,
@@ -1592,9 +1588,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
1592 .module_name = "af9015", 1588 .module_name = "af9015",
1593 .rc_query = af9015_rc_query, 1589 .rc_query = af9015_rc_query,
1594 .rc_interval = AF9015_RC_INTERVAL, 1590 .rc_interval = AF9015_RC_INTERVAL,
1595 .rc_props = { 1591 .allowed_protos = IR_TYPE_NEC,
1596 .allowed_protos = IR_TYPE_NEC,
1597 },
1598 }, 1592 },
1599 1593
1600 .i2c_algo = &af9015_i2c_algo, 1594 .i2c_algo = &af9015_i2c_algo,
diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c
index 1759d26bca42..c6e4ba53ad61 100644
--- a/drivers/media/dvb/dvb-usb/anysee.c
+++ b/drivers/media/dvb/dvb-usb/anysee.c
@@ -394,7 +394,7 @@ static int anysee_rc_query(struct dvb_usb_device *d)
394 394
395 if (ircode[0]) { 395 if (ircode[0]) {
396 deb_rc("%s: key pressed %02x\n", __func__, ircode[1]); 396 deb_rc("%s: key pressed %02x\n", __func__, ircode[1]);
397 ir_keydown(d->rc_input_dev, 0x08 << 8 | ircode[1], 0); 397 ir_keydown(d->rc_dev, 0x08 << 8 | ircode[1], 0);
398 } 398 }
399 399
400 return 0; 400 return 0;
diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h
index c2c9d236ec7e..1e7d780332b5 100644
--- a/drivers/media/dvb/dvb-usb/dib0700.h
+++ b/drivers/media/dvb/dvb-usb/dib0700.h
@@ -60,7 +60,7 @@ extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
60extern struct i2c_algorithm dib0700_i2c_algo; 60extern struct i2c_algorithm dib0700_i2c_algo;
61extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, 61extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
62 struct dvb_usb_device_description **desc, int *cold); 62 struct dvb_usb_device_description **desc, int *cold);
63extern int dib0700_change_protocol(void *priv, u64 ir_type); 63extern int dib0700_change_protocol(struct rc_dev *dev, u64 ir_type);
64 64
65extern int dib0700_device_count; 65extern int dib0700_device_count;
66extern int dvb_usb_dib0700_ir_proto; 66extern int dvb_usb_dib0700_ir_proto;
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
index 48397f103d32..3b58f4575689 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_core.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
@@ -471,9 +471,9 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
471 return dib0700_ctrl_wr(adap->dev, b, 4); 471 return dib0700_ctrl_wr(adap->dev, b, 4);
472} 472}
473 473
474int dib0700_change_protocol(void *priv, u64 ir_type) 474int dib0700_change_protocol(struct rc_dev *rc, u64 ir_type)
475{ 475{
476 struct dvb_usb_device *d = priv; 476 struct dvb_usb_device *d = rc->priv;
477 struct dib0700_state *st = d->priv; 477 struct dib0700_state *st = d->priv;
478 u8 rc_setup[3] = { REQUEST_SET_RC, 0, 0 }; 478 u8 rc_setup[3] = { REQUEST_SET_RC, 0, 0 };
479 int new_proto, ret; 479 int new_proto, ret;
@@ -535,7 +535,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
535 if (d == NULL) 535 if (d == NULL)
536 return; 536 return;
537 537
538 if (d->rc_input_dev == NULL) { 538 if (d->rc_dev == NULL) {
539 /* This will occur if disable_rc_polling=1 */ 539 /* This will occur if disable_rc_polling=1 */
540 usb_free_urb(purb); 540 usb_free_urb(purb);
541 return; 541 return;
@@ -600,7 +600,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
600 goto resubmit; 600 goto resubmit;
601 } 601 }
602 602
603 ir_keydown(d->rc_input_dev, keycode, toggle); 603 ir_keydown(d->rc_dev, keycode, toggle);
604 604
605resubmit: 605resubmit:
606 /* Clean the buffer before we requeue */ 606 /* Clean the buffer before we requeue */
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index e06acd1fecb6..be167f2bea33 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -520,13 +520,13 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
520 d->last_event = keycode; 520 d->last_event = keycode;
521 } 521 }
522 522
523 ir_keydown(d->rc_input_dev, keycode, 0); 523 ir_keydown(d->rc_dev, keycode, 0);
524 break; 524 break;
525 default: 525 default:
526 /* RC-5 protocol changes toggle bit on new keypress */ 526 /* RC-5 protocol changes toggle bit on new keypress */
527 keycode = key[3-2] << 8 | key[3-3]; 527 keycode = key[3-2] << 8 | key[3-3];
528 toggle = key[3-1]; 528 toggle = key[3-1];
529 ir_keydown(d->rc_input_dev, keycode, toggle); 529 ir_keydown(d->rc_dev, keycode, toggle);
530 530
531 break; 531 break;
532 } 532 }
@@ -1924,12 +1924,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
1924 .rc_interval = DEFAULT_RC_INTERVAL, 1924 .rc_interval = DEFAULT_RC_INTERVAL,
1925 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 1925 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
1926 .rc_query = dib0700_rc_query_old_firmware, 1926 .rc_query = dib0700_rc_query_old_firmware,
1927 .rc_props = { 1927 .allowed_protos = IR_TYPE_RC5 |
1928 .allowed_protos = IR_TYPE_RC5 | 1928 IR_TYPE_RC6 |
1929 IR_TYPE_RC6 | 1929 IR_TYPE_NEC,
1930 IR_TYPE_NEC, 1930 .change_protocol = dib0700_change_protocol,
1931 .change_protocol = dib0700_change_protocol,
1932 },
1933 }, 1931 },
1934 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 1932 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1935 1933
@@ -1960,12 +1958,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
1960 .rc_interval = DEFAULT_RC_INTERVAL, 1958 .rc_interval = DEFAULT_RC_INTERVAL,
1961 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 1959 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
1962 .rc_query = dib0700_rc_query_old_firmware, 1960 .rc_query = dib0700_rc_query_old_firmware,
1963 .rc_props = { 1961 .allowed_protos = IR_TYPE_RC5 |
1964 .allowed_protos = IR_TYPE_RC5 | 1962 IR_TYPE_RC6 |
1965 IR_TYPE_RC6 | 1963 IR_TYPE_NEC,
1966 IR_TYPE_NEC, 1964 .change_protocol = dib0700_change_protocol,
1967 .change_protocol = dib0700_change_protocol,
1968 },
1969 }, 1965 },
1970 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 1966 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1971 1967
@@ -2021,12 +2017,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2021 .rc_interval = DEFAULT_RC_INTERVAL, 2017 .rc_interval = DEFAULT_RC_INTERVAL,
2022 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 2018 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2023 .rc_query = dib0700_rc_query_old_firmware, 2019 .rc_query = dib0700_rc_query_old_firmware,
2024 .rc_props = { 2020 .allowed_protos = IR_TYPE_RC5 |
2025 .allowed_protos = IR_TYPE_RC5 | 2021 IR_TYPE_RC6 |
2026 IR_TYPE_RC6 | 2022 IR_TYPE_NEC,
2027 IR_TYPE_NEC, 2023 .change_protocol = dib0700_change_protocol,
2028 .change_protocol = dib0700_change_protocol,
2029 },
2030 }, 2024 },
2031 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2025 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2032 2026
@@ -2065,12 +2059,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2065 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 2059 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2066 .module_name = "dib0700", 2060 .module_name = "dib0700",
2067 .rc_query = dib0700_rc_query_old_firmware, 2061 .rc_query = dib0700_rc_query_old_firmware,
2068 .rc_props = { 2062 .allowed_protos = IR_TYPE_RC5 |
2069 .allowed_protos = IR_TYPE_RC5 | 2063 IR_TYPE_RC6 |
2070 IR_TYPE_RC6 | 2064 IR_TYPE_NEC,
2071 IR_TYPE_NEC, 2065 .change_protocol = dib0700_change_protocol,
2072 .change_protocol = dib0700_change_protocol,
2073 },
2074 }, 2066 },
2075 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2067 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2076 2068
@@ -2143,12 +2135,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2143 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 2135 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2144 .module_name = "dib0700", 2136 .module_name = "dib0700",
2145 .rc_query = dib0700_rc_query_old_firmware, 2137 .rc_query = dib0700_rc_query_old_firmware,
2146 .rc_props = { 2138 .allowed_protos = IR_TYPE_RC5 |
2147 .allowed_protos = IR_TYPE_RC5 | 2139 IR_TYPE_RC6 |
2148 IR_TYPE_RC6 | 2140 IR_TYPE_NEC,
2149 IR_TYPE_NEC, 2141 .change_protocol = dib0700_change_protocol,
2150 .change_protocol = dib0700_change_protocol,
2151 },
2152 }, 2142 },
2153 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2143 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2154 2144
@@ -2189,12 +2179,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2189 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 2179 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2190 .module_name = "dib0700", 2180 .module_name = "dib0700",
2191 .rc_query = dib0700_rc_query_old_firmware, 2181 .rc_query = dib0700_rc_query_old_firmware,
2192 .rc_props = { 2182 .allowed_protos = IR_TYPE_RC5 |
2193 .allowed_protos = IR_TYPE_RC5 | 2183 IR_TYPE_RC6 |
2194 IR_TYPE_RC6 | 2184 IR_TYPE_NEC,
2195 IR_TYPE_NEC, 2185 .change_protocol = dib0700_change_protocol,
2196 .change_protocol = dib0700_change_protocol,
2197 },
2198 }, 2186 },
2199 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2187 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2200 2188
@@ -2259,12 +2247,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2259 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 2247 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2260 .module_name = "dib0700", 2248 .module_name = "dib0700",
2261 .rc_query = dib0700_rc_query_old_firmware, 2249 .rc_query = dib0700_rc_query_old_firmware,
2262 .rc_props = { 2250 .allowed_protos = IR_TYPE_RC5 |
2263 .allowed_protos = IR_TYPE_RC5 | 2251 IR_TYPE_RC6 |
2264 IR_TYPE_RC6 | 2252 IR_TYPE_NEC,
2265 IR_TYPE_NEC, 2253 .change_protocol = dib0700_change_protocol,
2266 .change_protocol = dib0700_change_protocol,
2267 },
2268 }, 2254 },
2269 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2255 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2270 2256
@@ -2308,12 +2294,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2308 .rc_codes = RC_MAP_DIB0700_NEC_TABLE, 2294 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
2309 .module_name = "dib0700", 2295 .module_name = "dib0700",
2310 .rc_query = dib0700_rc_query_old_firmware, 2296 .rc_query = dib0700_rc_query_old_firmware,
2311 .rc_props = { 2297 .allowed_protos = IR_TYPE_RC5 |
2312 .allowed_protos = IR_TYPE_RC5 | 2298 IR_TYPE_RC6 |
2313 IR_TYPE_RC6 | 2299 IR_TYPE_NEC,
2314 IR_TYPE_NEC, 2300 .change_protocol = dib0700_change_protocol,
2315 .change_protocol = dib0700_change_protocol,
2316 },
2317 }, 2301 },
2318 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2302 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2319 2303
@@ -2379,12 +2363,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2379 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 2363 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2380 .module_name = "dib0700", 2364 .module_name = "dib0700",
2381 .rc_query = dib0700_rc_query_old_firmware, 2365 .rc_query = dib0700_rc_query_old_firmware,
2382 .rc_props = { 2366 .allowed_protos = IR_TYPE_RC5 |
2383 .allowed_protos = IR_TYPE_RC5 | 2367 IR_TYPE_RC6 |
2384 IR_TYPE_RC6 | 2368 IR_TYPE_NEC,
2385 IR_TYPE_NEC, 2369 .change_protocol = dib0700_change_protocol,
2386 .change_protocol = dib0700_change_protocol,
2387 },
2388 }, 2370 },
2389 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2371 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2390 .num_adapters = 1, 2372 .num_adapters = 1,
@@ -2417,12 +2399,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2417 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 2399 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2418 .module_name = "dib0700", 2400 .module_name = "dib0700",
2419 .rc_query = dib0700_rc_query_old_firmware, 2401 .rc_query = dib0700_rc_query_old_firmware,
2420 .rc_props = { 2402 .allowed_protos = IR_TYPE_RC5 |
2421 .allowed_protos = IR_TYPE_RC5 | 2403 IR_TYPE_RC6 |
2422 IR_TYPE_RC6 | 2404 IR_TYPE_NEC,
2423 IR_TYPE_NEC, 2405 .change_protocol = dib0700_change_protocol,
2424 .change_protocol = dib0700_change_protocol,
2425 },
2426 }, 2406 },
2427 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2407 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2428 .num_adapters = 1, 2408 .num_adapters = 1,
@@ -2487,12 +2467,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2487 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 2467 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2488 .module_name = "dib0700", 2468 .module_name = "dib0700",
2489 .rc_query = dib0700_rc_query_old_firmware, 2469 .rc_query = dib0700_rc_query_old_firmware,
2490 .rc_props = { 2470 .allowed_protos = IR_TYPE_RC5 |
2491 .allowed_protos = IR_TYPE_RC5 | 2471 IR_TYPE_RC6 |
2492 IR_TYPE_RC6 | 2472 IR_TYPE_NEC,
2493 IR_TYPE_NEC, 2473 .change_protocol = dib0700_change_protocol,
2494 .change_protocol = dib0700_change_protocol,
2495 },
2496 }, 2474 },
2497 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2475 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2498 .num_adapters = 1, 2476 .num_adapters = 1,
@@ -2533,12 +2511,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2533 .rc_codes = RC_MAP_DIB0700_NEC_TABLE, 2511 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
2534 .module_name = "dib0700", 2512 .module_name = "dib0700",
2535 .rc_query = dib0700_rc_query_old_firmware, 2513 .rc_query = dib0700_rc_query_old_firmware,
2536 .rc_props = { 2514 .allowed_protos = IR_TYPE_RC5 |
2537 .allowed_protos = IR_TYPE_RC5 | 2515 IR_TYPE_RC6 |
2538 IR_TYPE_RC6 | 2516 IR_TYPE_NEC,
2539 IR_TYPE_NEC, 2517 .change_protocol = dib0700_change_protocol,
2540 .change_protocol = dib0700_change_protocol,
2541 },
2542 }, 2518 },
2543 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2519 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2544 .num_adapters = 2, 2520 .num_adapters = 2,
@@ -2584,12 +2560,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2584 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 2560 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2585 .module_name = "dib0700", 2561 .module_name = "dib0700",
2586 .rc_query = dib0700_rc_query_old_firmware, 2562 .rc_query = dib0700_rc_query_old_firmware,
2587 .rc_props = { 2563 .allowed_protos = IR_TYPE_RC5 |
2588 .allowed_protos = IR_TYPE_RC5 | 2564 IR_TYPE_RC6 |
2589 IR_TYPE_RC6 | 2565 IR_TYPE_NEC,
2590 IR_TYPE_NEC, 2566 .change_protocol = dib0700_change_protocol,
2591 .change_protocol = dib0700_change_protocol,
2592 },
2593 }, 2567 },
2594 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 2568 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2595 .num_adapters = 1, 2569 .num_adapters = 1,
@@ -2623,12 +2597,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
2623 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 2597 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2624 .module_name = "dib0700", 2598 .module_name = "dib0700",
2625 .rc_query = dib0700_rc_query_old_firmware, 2599 .rc_query = dib0700_rc_query_old_firmware,
2626 .rc_props = { 2600 .allowed_protos = IR_TYPE_RC5 |
2627 .allowed_protos = IR_TYPE_RC5 | 2601 IR_TYPE_RC6 |
2628 IR_TYPE_RC6 | 2602 IR_TYPE_NEC,
2629 IR_TYPE_NEC, 2603 .change_protocol = dib0700_change_protocol,
2630 .change_protocol = dib0700_change_protocol,
2631 },
2632 }, 2604 },
2633 }, 2605 },
2634}; 2606};
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index b579fed3ab3f..bbba149a2ceb 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -106,10 +106,10 @@ static void legacy_dvb_usb_read_remote_control(struct work_struct *work)
106 d->last_event = event; 106 d->last_event = event;
107 case REMOTE_KEY_REPEAT: 107 case REMOTE_KEY_REPEAT:
108 deb_rc("key repeated\n"); 108 deb_rc("key repeated\n");
109 input_event(d->rc_input_dev, EV_KEY, event, 1); 109 input_event(d->input_dev, EV_KEY, event, 1);
110 input_sync(d->rc_input_dev); 110 input_sync(d->input_dev);
111 input_event(d->rc_input_dev, EV_KEY, d->last_event, 0); 111 input_event(d->input_dev, EV_KEY, d->last_event, 0);
112 input_sync(d->rc_input_dev); 112 input_sync(d->input_dev);
113 break; 113 break;
114 default: 114 default:
115 break; 115 break;
@@ -154,10 +154,22 @@ schedule:
154 schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc.legacy.rc_interval)); 154 schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc.legacy.rc_interval));
155} 155}
156 156
157static int legacy_dvb_usb_remote_init(struct dvb_usb_device *d, 157static int legacy_dvb_usb_remote_init(struct dvb_usb_device *d)
158 struct input_dev *input_dev)
159{ 158{
160 int i, err, rc_interval; 159 int i, err, rc_interval;
160 struct input_dev *input_dev;
161
162 input_dev = input_allocate_device();
163 if (!input_dev)
164 return -ENOMEM;
165
166 input_dev->evbit[0] = BIT_MASK(EV_KEY);
167 input_dev->name = "IR-receiver inside an USB DVB receiver";
168 input_dev->phys = d->rc_phys;
169 usb_to_input_id(d->udev, &input_dev->id);
170 input_dev->dev.parent = &d->udev->dev;
171 d->input_dev = input_dev;
172 d->rc_dev = NULL;
161 173
162 input_dev->getkeycode = legacy_dvb_usb_getkeycode; 174 input_dev->getkeycode = legacy_dvb_usb_getkeycode;
163 input_dev->setkeycode = legacy_dvb_usb_setkeycode; 175 input_dev->setkeycode = legacy_dvb_usb_setkeycode;
@@ -221,18 +233,34 @@ static void dvb_usb_read_remote_control(struct work_struct *work)
221 msecs_to_jiffies(d->props.rc.core.rc_interval)); 233 msecs_to_jiffies(d->props.rc.core.rc_interval));
222} 234}
223 235
224static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d, 236static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d)
225 struct input_dev *input_dev)
226{ 237{
227 int err, rc_interval; 238 int err, rc_interval;
239 struct rc_dev *dev;
240
241 dev = rc_allocate_device();
242 if (!dev)
243 return -ENOMEM;
228 244
229 d->props.rc.core.rc_props.priv = d; 245 dev->driver_name = d->props.rc.core.module_name;
230 err = ir_input_register(input_dev, 246 dev->map_name = d->props.rc.core.rc_codes;
231 d->props.rc.core.rc_codes, 247 dev->change_protocol = d->props.rc.core.change_protocol;
232 &d->props.rc.core.rc_props, 248 dev->allowed_protos = d->props.rc.core.allowed_protos;
233 d->props.rc.core.module_name); 249 dev->driver_type = RC_DRIVER_SCANCODE;
234 if (err < 0) 250 usb_to_input_id(d->udev, &dev->input_id);
251 dev->input_name = "IR-receiver inside an USB DVB receiver";
252 dev->input_phys = d->rc_phys;
253 dev->dev.parent = &d->udev->dev;
254 dev->priv = d;
255
256 err = rc_register_device(dev);
257 if (err < 0) {
258 rc_free_device(dev);
235 return err; 259 return err;
260 }
261
262 d->input_dev = NULL;
263 d->rc_dev = dev;
236 264
237 if (!d->props.rc.core.rc_query || d->props.rc.core.bulk_mode) 265 if (!d->props.rc.core.rc_query || d->props.rc.core.bulk_mode)
238 return 0; 266 return 0;
@@ -251,7 +279,6 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d,
251 279
252int dvb_usb_remote_init(struct dvb_usb_device *d) 280int dvb_usb_remote_init(struct dvb_usb_device *d)
253{ 281{
254 struct input_dev *input_dev;
255 int err; 282 int err;
256 283
257 if (dvb_usb_disable_rc_polling) 284 if (dvb_usb_disable_rc_polling)
@@ -267,26 +294,14 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
267 usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); 294 usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys));
268 strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys)); 295 strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys));
269 296
270 input_dev = input_allocate_device();
271 if (!input_dev)
272 return -ENOMEM;
273
274 input_dev->evbit[0] = BIT_MASK(EV_KEY);
275 input_dev->name = "IR-receiver inside an USB DVB receiver";
276 input_dev->phys = d->rc_phys;
277 usb_to_input_id(d->udev, &input_dev->id);
278 input_dev->dev.parent = &d->udev->dev;
279
280 /* Start the remote-control polling. */ 297 /* Start the remote-control polling. */
281 if (d->props.rc.legacy.rc_interval < 40) 298 if (d->props.rc.legacy.rc_interval < 40)
282 d->props.rc.legacy.rc_interval = 100; /* default */ 299 d->props.rc.legacy.rc_interval = 100; /* default */
283 300
284 d->rc_input_dev = input_dev;
285
286 if (d->props.rc.mode == DVB_RC_LEGACY) 301 if (d->props.rc.mode == DVB_RC_LEGACY)
287 err = legacy_dvb_usb_remote_init(d, input_dev); 302 err = legacy_dvb_usb_remote_init(d);
288 else 303 else
289 err = rc_core_dvb_usb_remote_init(d, input_dev); 304 err = rc_core_dvb_usb_remote_init(d);
290 if (err) 305 if (err)
291 return err; 306 return err;
292 307
@@ -301,9 +316,9 @@ int dvb_usb_remote_exit(struct dvb_usb_device *d)
301 cancel_rearming_delayed_work(&d->rc_query_work); 316 cancel_rearming_delayed_work(&d->rc_query_work);
302 flush_scheduled_work(); 317 flush_scheduled_work();
303 if (d->props.rc.mode == DVB_RC_LEGACY) 318 if (d->props.rc.mode == DVB_RC_LEGACY)
304 input_unregister_device(d->rc_input_dev); 319 input_unregister_device(d->input_dev);
305 else 320 else
306 ir_input_unregister(d->rc_input_dev); 321 rc_unregister_device(d->rc_dev);
307 } 322 }
308 d->state &= ~DVB_USB_STATE_REMOTE; 323 d->state &= ~DVB_USB_STATE_REMOTE;
309 return 0; 324 return 0;
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h
index 34f7b3ba8cc7..83aa9826560f 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -180,18 +180,20 @@ struct dvb_rc_legacy {
180 * struct dvb_rc properties of remote controller, using rc-core 180 * struct dvb_rc properties of remote controller, using rc-core
181 * @rc_codes: name of rc codes table 181 * @rc_codes: name of rc codes table
182 * @protocol: type of protocol(s) currently used by the driver 182 * @protocol: type of protocol(s) currently used by the driver
183 * @allowed_protos: protocol(s) supported by the driver
184 * @change_protocol: callback to change protocol
183 * @rc_query: called to query an event event. 185 * @rc_query: called to query an event event.
184 * @rc_interval: time in ms between two queries. 186 * @rc_interval: time in ms between two queries.
185 * @rc_props: remote controller properties
186 * @bulk_mode: device supports bulk mode for RC (disable polling mode) 187 * @bulk_mode: device supports bulk mode for RC (disable polling mode)
187 */ 188 */
188struct dvb_rc { 189struct dvb_rc {
189 char *rc_codes; 190 char *rc_codes;
190 u64 protocol; 191 u64 protocol;
192 u64 allowed_protos;
193 int (*change_protocol)(struct rc_dev *dev, u64 ir_type);
191 char *module_name; 194 char *module_name;
192 int (*rc_query) (struct dvb_usb_device *d); 195 int (*rc_query) (struct dvb_usb_device *d);
193 int rc_interval; 196 int rc_interval;
194 struct ir_dev_props rc_props;
195 bool bulk_mode; /* uses bulk mode */ 197 bool bulk_mode; /* uses bulk mode */
196}; 198};
197 199
@@ -385,7 +387,8 @@ struct dvb_usb_adapter {
385 * 387 *
386 * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB 388 * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB
387 * 389 *
388 * @rc_input_dev: input device for the remote control. 390 * @rc_dev: rc device for the remote control (rc-core mode)
391 * @input_dev: input device for the remote control (legacy mode)
389 * @rc_query_work: struct work_struct frequent rc queries 392 * @rc_query_work: struct work_struct frequent rc queries
390 * @last_event: last triggered event 393 * @last_event: last triggered event
391 * @last_state: last state (no, pressed, repeat) 394 * @last_state: last state (no, pressed, repeat)
@@ -418,7 +421,8 @@ struct dvb_usb_device {
418 struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE]; 421 struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
419 422
420 /* remote control */ 423 /* remote control */
421 struct input_dev *rc_input_dev; 424 struct rc_dev *rc_dev;
425 struct input_dev *input_dev;
422 char rc_phys[64]; 426 char rc_phys[64];
423 struct delayed_work rc_query_work; 427 struct delayed_work rc_query_work;
424 u32 last_event; 428 u32 last_event;
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c
index de7f1fbec92e..d8f1b150e1cb 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.c
+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
@@ -198,7 +198,7 @@ static int lme2510_remote_keypress(struct dvb_usb_adapter *adap, u16 keypress)
198 deb_info(1, "INT Key Keypress =%04x", keypress); 198 deb_info(1, "INT Key Keypress =%04x", keypress);
199 199
200 if (keypress > 0) 200 if (keypress > 0)
201 ir_keydown(d->rc_input_dev, keypress, 0); 201 ir_keydown(d->rc_dev, keypress, 0);
202 202
203 return 0; 203 return 0;
204} 204}
@@ -555,42 +555,39 @@ static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
555static int lme2510_int_service(struct dvb_usb_adapter *adap) 555static int lme2510_int_service(struct dvb_usb_adapter *adap)
556{ 556{
557 struct dvb_usb_device *d = adap->dev; 557 struct dvb_usb_device *d = adap->dev;
558 struct input_dev *input_dev; 558 struct rc_dev *rc;
559 char *ir_codes = RC_MAP_LME2510; 559 int ret;
560 int ret = 0;
561 560
562 info("STA Configuring Remote"); 561 info("STA Configuring Remote");
563 562
564 usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); 563 rc = rc_allocate_device();
565 564 if (!rc)
566 strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys));
567
568 input_dev = input_allocate_device();
569 if (!input_dev)
570 return -ENOMEM; 565 return -ENOMEM;
571 566
572 input_dev->name = "LME2510 Remote Control"; 567 usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys));
573 input_dev->phys = d->rc_phys; 568 strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys));
574
575 usb_to_input_id(d->udev, &input_dev->id);
576 569
577 ret |= ir_input_register(input_dev, ir_codes, NULL, "LME 2510"); 570 rc->input_name = "LME2510 Remote Control";
571 rc->input_phys = d->rc_phys;
572 rc->map_name = RC_MAP_LME2510;
573 rc->driver_name = "LME 2510";
574 usb_to_input_id(d->udev, &rc->input_id);
578 575
576 ret = rc_register_device(rc);
579 if (ret) { 577 if (ret) {
580 input_free_device(input_dev); 578 rc_free_device(rc);
581 return ret; 579 return ret;
582 } 580 }
581 d->rc_dev = rc;
583 582
584 d->rc_input_dev = input_dev;
585 /* Start the Interupt */ 583 /* Start the Interupt */
586 ret = lme2510_int_read(adap); 584 ret = lme2510_int_read(adap);
587
588 if (ret < 0) { 585 if (ret < 0) {
589 ir_input_unregister(input_dev); 586 rc_unregister_device(rc);
590 input_free_device(input_dev); 587 return -ENODEV;
591 } 588 }
592 589
593 return (ret < 0) ? -ENODEV : 0; 590 return 0;
594} 591}
595 592
596static u8 check_sum(u8 *p, u8 len) 593static u8 check_sum(u8 *p, u8 len)
@@ -1025,7 +1022,7 @@ void *lme2510_exit_int(struct dvb_usb_device *d)
1025 usb_free_coherent(d->udev, 5000, st->buffer, 1022 usb_free_coherent(d->udev, 5000, st->buffer,
1026 st->lme_urb->transfer_dma); 1023 st->lme_urb->transfer_dma);
1027 info("Interupt Service Stopped"); 1024 info("Interupt Service Stopped");
1028 ir_input_unregister(d->rc_input_dev); 1025 rc_unregister_device(d->rc_dev);
1029 info("Remote Stopped"); 1026 info("Remote Stopped");
1030 } 1027 }
1031 return buffer; 1028 return buffer;