]> git.karo-electronics.de Git - linux-beck.git/commitdiff
V4L/DVB: dib0700: break keytable into NEC and RC-5 variants
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 1 Aug 2010 11:02:35 +0000 (08:02 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 2 Aug 2010 19:43:49 +0000 (16:43 -0300)
Instead of having one big keytable with 2 protocols inside, break it
into two separate tables, being one for NEC and another for RC-5 variants,
and properly identify what variant should be used at the boards entries.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/IR/keymaps/Makefile
drivers/media/IR/keymaps/rc-dib0700-nec.c [new file with mode: 0644]
drivers/media/IR/keymaps/rc-dib0700-rc5.c [moved from drivers/media/IR/keymaps/rc-dib0700-big.c with 73% similarity]
drivers/media/dvb/dvb-usb/dib0700_devices.c
include/media/rc-map.h

index 85330d171c4e966e1fdf27d7e4285ad3e24e13ad..cbee06243b512c6b6c03b032e2d308dc8c115016 100644 (file)
@@ -14,7 +14,8 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
                        rc-budget-ci-old.o \
                        rc-cinergy-1400.o \
                        rc-cinergy.o \
-                       rc-dib0700-big.o \
+                       rc-dib0700-nec.o \
+                       rc-dib0700-rc5.o \
                        rc-dm1105-nec.o \
                        rc-dntv-live-dvb-t.o \
                        rc-dntv-live-dvbt-pro.o \
diff --git a/drivers/media/IR/keymaps/rc-dib0700-nec.c b/drivers/media/IR/keymaps/rc-dib0700-nec.c
new file mode 100644 (file)
index 0000000..f5809f4
--- /dev/null
@@ -0,0 +1,124 @@
+/* rc-dvb0700-big.c - Keytable for devices in dvb0700
+ *
+ * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
+ *
+ * TODO: This table is a real mess, as it merges RC codes from several
+ * devices into a big table. It also has both RC-5 and NEC codes inside.
+ * It should be broken into small tables, and the protocols should properly
+ * be indentificated.
+ *
+ * The table were imported from dib0700_devices.c.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <media/rc-map.h>
+
+static struct ir_scancode dib0700_table[] = {
+       /* Key codes for the Pixelview SBTVD remote */
+       { 0x8613, KEY_MUTE },
+       { 0x8612, KEY_POWER },
+       { 0x8601, KEY_1 },
+       { 0x8602, KEY_2 },
+       { 0x8603, KEY_3 },
+       { 0x8604, KEY_4 },
+       { 0x8605, KEY_5 },
+       { 0x8606, KEY_6 },
+       { 0x8607, KEY_7 },
+       { 0x8608, KEY_8 },
+       { 0x8609, KEY_9 },
+       { 0x8600, KEY_0 },
+       { 0x860d, KEY_CHANNELUP },
+       { 0x8619, KEY_CHANNELDOWN },
+       { 0x8610, KEY_VOLUMEUP },
+       { 0x860c, KEY_VOLUMEDOWN },
+
+       { 0x860a, KEY_CAMERA },
+       { 0x860b, KEY_ZOOM },
+       { 0x861b, KEY_BACKSPACE },
+       { 0x8615, KEY_ENTER },
+
+       { 0x861d, KEY_UP },
+       { 0x861e, KEY_DOWN },
+       { 0x860e, KEY_LEFT },
+       { 0x860f, KEY_RIGHT },
+
+       { 0x8618, KEY_RECORD },
+       { 0x861a, KEY_STOP },
+
+       /* Key codes for the EvolutePC TVWay+ remote */
+       { 0x7a00, KEY_MENU },
+       { 0x7a01, KEY_RECORD },
+       { 0x7a02, KEY_PLAY },
+       { 0x7a03, KEY_STOP },
+       { 0x7a10, KEY_CHANNELUP },
+       { 0x7a11, KEY_CHANNELDOWN },
+       { 0x7a12, KEY_VOLUMEUP },
+       { 0x7a13, KEY_VOLUMEDOWN },
+       { 0x7a40, KEY_POWER },
+       { 0x7a41, KEY_MUTE },
+
+       /* Key codes for the Elgato EyeTV Diversity silver remote */
+       { 0x4501, KEY_POWER },
+       { 0x4502, KEY_MUTE },
+       { 0x4503, KEY_1 },
+       { 0x4504, KEY_2 },
+       { 0x4505, KEY_3 },
+       { 0x4506, KEY_4 },
+       { 0x4507, KEY_5 },
+       { 0x4508, KEY_6 },
+       { 0x4509, KEY_7 },
+       { 0x450a, KEY_8 },
+       { 0x450b, KEY_9 },
+       { 0x450c, KEY_LAST },
+       { 0x450d, KEY_0 },
+       { 0x450e, KEY_ENTER },
+       { 0x450f, KEY_RED },
+       { 0x4510, KEY_CHANNELUP },
+       { 0x4511, KEY_GREEN },
+       { 0x4512, KEY_VOLUMEDOWN },
+       { 0x4513, KEY_OK },
+       { 0x4514, KEY_VOLUMEUP },
+       { 0x4515, KEY_YELLOW },
+       { 0x4516, KEY_CHANNELDOWN },
+       { 0x4517, KEY_BLUE },
+       { 0x4518, KEY_LEFT }, /* Skip backwards */
+       { 0x4519, KEY_PLAYPAUSE },
+       { 0x451a, KEY_RIGHT }, /* Skip forward */
+       { 0x451b, KEY_REWIND },
+       { 0x451c, KEY_L }, /* Live */
+       { 0x451d, KEY_FASTFORWARD },
+       { 0x451e, KEY_STOP }, /* 'Reveal' for Teletext */
+       { 0x451f, KEY_MENU }, /* KEY_TEXT for Teletext */
+       { 0x4540, KEY_RECORD }, /* Font 'Size' for Teletext */
+       { 0x4541, KEY_SCREEN }, /*  Full screen toggle, 'Hold' for Teletext */
+       { 0x4542, KEY_SELECT }, /* Select video input, 'Select' for Teletext */
+};
+
+static struct rc_keymap dib0700_map = {
+       .map = {
+               .scan    = dib0700_table,
+               .size    = ARRAY_SIZE(dib0700_table),
+               .ir_type = IR_TYPE_NEC,
+               .name    = RC_MAP_DIB0700_NEC_TABLE,
+       }
+};
+
+static int __init init_rc_map(void)
+{
+       return ir_register_map(&dib0700_map);
+}
+
+static void __exit exit_rc_map(void)
+{
+       ir_unregister_map(&dib0700_map);
+}
+
+module_init(init_rc_map)
+module_exit(exit_rc_map)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
similarity index 73%
rename from drivers/media/IR/keymaps/rc-dib0700-big.c
rename to drivers/media/IR/keymaps/rc-dib0700-rc5.c
index 2e83820d3e59005ce9184eb80906633b6e75ef65..e2d0fd2bbaf9cec510c1a675b2963a89a7a0b1c9 100644 (file)
@@ -44,6 +44,7 @@ static struct ir_scancode dib0700_table[] = {
        { 0x0736, KEY_RECORD },
        { 0x073c, KEY_STOP },
        { 0x073f, KEY_CANCEL }, /* '?' key */
+
        /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
        { 0xeb01, KEY_POWER },
        { 0xeb02, KEY_1 },
@@ -206,94 +207,14 @@ static struct ir_scancode dib0700_table[] = {
        { 0x1d37, KEY_RECORD },
        { 0x1d3b, KEY_GOTO },
        { 0x1d3d, KEY_POWER },
-
-       /* Key codes for the Pixelview SBTVD remote (proto NEC) */
-       { 0x8613, KEY_MUTE },
-       { 0x8612, KEY_POWER },
-       { 0x8601, KEY_1 },
-       { 0x8602, KEY_2 },
-       { 0x8603, KEY_3 },
-       { 0x8604, KEY_4 },
-       { 0x8605, KEY_5 },
-       { 0x8606, KEY_6 },
-       { 0x8607, KEY_7 },
-       { 0x8608, KEY_8 },
-       { 0x8609, KEY_9 },
-       { 0x8600, KEY_0 },
-       { 0x860d, KEY_CHANNELUP },
-       { 0x8619, KEY_CHANNELDOWN },
-       { 0x8610, KEY_VOLUMEUP },
-       { 0x860c, KEY_VOLUMEDOWN },
-
-       { 0x860a, KEY_CAMERA },
-       { 0x860b, KEY_ZOOM },
-       { 0x861b, KEY_BACKSPACE },
-       { 0x8615, KEY_ENTER },
-
-       { 0x861d, KEY_UP },
-       { 0x861e, KEY_DOWN },
-       { 0x860e, KEY_LEFT },
-       { 0x860f, KEY_RIGHT },
-
-       { 0x8618, KEY_RECORD },
-       { 0x861a, KEY_STOP },
-
-       /* Key codes for the EvolutePC TVWay+ remote (proto NEC) */
-       { 0x7a00, KEY_MENU },
-       { 0x7a01, KEY_RECORD },
-       { 0x7a02, KEY_PLAY },
-       { 0x7a03, KEY_STOP },
-       { 0x7a10, KEY_CHANNELUP },
-       { 0x7a11, KEY_CHANNELDOWN },
-       { 0x7a12, KEY_VOLUMEUP },
-       { 0x7a13, KEY_VOLUMEDOWN },
-       { 0x7a40, KEY_POWER },
-       { 0x7a41, KEY_MUTE },
-
-       /* Key codes for the Elgato EyeTV Diversity silver remote,
-          set dvb_usb_dib0700_ir_proto=0 */
-       { 0x4501, KEY_POWER },
-       { 0x4502, KEY_MUTE },
-       { 0x4503, KEY_1 },
-       { 0x4504, KEY_2 },
-       { 0x4505, KEY_3 },
-       { 0x4506, KEY_4 },
-       { 0x4507, KEY_5 },
-       { 0x4508, KEY_6 },
-       { 0x4509, KEY_7 },
-       { 0x450a, KEY_8 },
-       { 0x450b, KEY_9 },
-       { 0x450c, KEY_LAST },
-       { 0x450d, KEY_0 },
-       { 0x450e, KEY_ENTER },
-       { 0x450f, KEY_RED },
-       { 0x4510, KEY_CHANNELUP },
-       { 0x4511, KEY_GREEN },
-       { 0x4512, KEY_VOLUMEDOWN },
-       { 0x4513, KEY_OK },
-       { 0x4514, KEY_VOLUMEUP },
-       { 0x4515, KEY_YELLOW },
-       { 0x4516, KEY_CHANNELDOWN },
-       { 0x4517, KEY_BLUE },
-       { 0x4518, KEY_LEFT }, /* Skip backwards */
-       { 0x4519, KEY_PLAYPAUSE },
-       { 0x451a, KEY_RIGHT }, /* Skip forward */
-       { 0x451b, KEY_REWIND },
-       { 0x451c, KEY_L }, /* Live */
-       { 0x451d, KEY_FASTFORWARD },
-       { 0x451e, KEY_STOP }, /* 'Reveal' for Teletext */
-       { 0x451f, KEY_MENU }, /* KEY_TEXT for Teletext */
-       { 0x4540, KEY_RECORD }, /* Font 'Size' for Teletext */
-       { 0x4541, KEY_SCREEN }, /*  Full screen toggle, 'Hold' for Teletext */
-       { 0x4542, KEY_SELECT }, /* Select video input, 'Select' for Teletext */
 };
 
 static struct rc_keymap dib0700_map = {
        .map = {
                .scan    = dib0700_table,
                .size    = ARRAY_SIZE(dib0700_table),
-               .ir_type = IR_TYPE_UNKNOWN,     /* Legacy IR type */
-               .name    = RC_MAP_DIB0700_BIG_TABLE,
+               .ir_type = IR_TYPE_RC5,
+               .name    = RC_MAP_DIB0700_RC5_TABLE,
        }
 };
 
index 6e587cd1f5159a8ea01bcf273a4b186c659de412..ee2a84beb553d6d2a92ed2177526cf24a4dd40bd 100644 (file)
@@ -1872,7 +1872,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .rc_query         = dib0700_rc_query_old_firmware
                },
        }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -1902,7 +1902,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .rc_query         = dib0700_rc_query_old_firmware
                },
        }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -1957,7 +1957,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .rc_query         = dib0700_rc_query_old_firmware
                },
        }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -1994,7 +1994,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .module_name      = "dib0700",
                        .rc_query         = dib0700_rc_query_old_firmware
                },
@@ -2066,7 +2066,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .module_name      = "dib0700",
                        .rc_query         = dib0700_rc_query_old_firmware
                },
@@ -2106,7 +2106,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .module_name      = "dib0700",
                        .rc_query         = dib0700_rc_query_old_firmware
                },
@@ -2139,7 +2139,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
                        }
                },
 
-               .num_device_descs = 7,
+               .num_device_descs = 6,
                .devices = {
                        {   "DiBcom STK7070PD reference design",
                                { &dib0700_usb_id_table[17], NULL },
@@ -2166,6 +2166,45 @@ struct dvb_usb_device_properties dib0700_devices[] = {
                                { &dib0700_usb_id_table[44], NULL },
                                { NULL },
                        },
+               },
+
+               .rc.core = {
+                       .rc_interval      = DEFAULT_RC_INTERVAL,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
+                       .module_name      = "dib0700",
+                       .rc_query         = dib0700_rc_query_old_firmware
+               },
+       }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
+
+               .num_adapters = 2,
+               .adapter = {
+                       {
+                               .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
+                               .pid_filter_count = 32,
+                               .pid_filter       = stk70x0p_pid_filter,
+                               .pid_filter_ctrl  = stk70x0p_pid_filter_ctrl,
+                               .frontend_attach  = stk7070pd_frontend_attach0,
+                               .tuner_attach     = dib7070p_tuner_attach,
+
+                               DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
+
+                               .size_of_priv     = sizeof(struct dib0700_adapter_state),
+                       }, {
+                               .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
+                               .pid_filter_count = 32,
+                               .pid_filter       = stk70x0p_pid_filter,
+                               .pid_filter_ctrl  = stk70x0p_pid_filter_ctrl,
+                               .frontend_attach  = stk7070pd_frontend_attach1,
+                               .tuner_attach     = dib7070p_tuner_attach,
+
+                               DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
+
+                               .size_of_priv     = sizeof(struct dib0700_adapter_state),
+                       }
+               },
+
+               .num_device_descs = 1,
+               .devices = {
                        {   "Elgato EyeTV Diversity",
                                { &dib0700_usb_id_table[68], NULL },
                                { NULL },
@@ -2174,7 +2213,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_NEC_TABLE,
                        .module_name      = "dib0700",
                        .rc_query         = dib0700_rc_query_old_firmware
                },
@@ -2239,7 +2278,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .module_name      = "dib0700",
                        .rc_query         = dib0700_rc_query_old_firmware
                },
@@ -2271,7 +2310,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .module_name      = "dib0700",
                        .rc_query         = dib0700_rc_query_old_firmware
                },
@@ -2335,7 +2374,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .module_name      = "dib0700",
                        .rc_query         = dib0700_rc_query_old_firmware
                },
@@ -2375,7 +2414,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_NEC_TABLE,
                        .module_name      = "dib0700",
                        .rc_query         = dib0700_rc_query_old_firmware
                },
@@ -2420,7 +2459,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .module_name      = "dib0700",
                        .rc_query         = dib0700_rc_query_old_firmware
                },
@@ -2453,7 +2492,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
 
                .rc.core = {
                        .rc_interval      = DEFAULT_RC_INTERVAL,
-                       .rc_codes         = RC_MAP_DIB0700_BIG_TABLE,
+                       .rc_codes         = RC_MAP_DIB0700_RC5_TABLE,
                        .module_name      = "dib0700",
                        .rc_query         = dib0700_rc_query_old_firmware
                },
index adbcccb54c8b2a2eb4d8b0ae94e799c809576b87..9569d0863f8b98514d17b316b8ccce2d4d9379e5 100644 (file)
@@ -69,9 +69,8 @@ void rc_map_init(void);
 #define RC_MAP_BUDGET_CI_OLD             "rc-budget-ci-old"
 #define RC_MAP_CINERGY_1400              "rc-cinergy-1400"
 #define RC_MAP_CINERGY                   "rc-cinergy"
-/* Temporary table - should be broken into smaller tables */
-#define RC_MAP_DIB0700_BIG_TABLE         "rc-dib0700-big"
-
+#define RC_MAP_DIB0700_NEC_TABLE         "rc-dib0700-nec"
+#define RC_MAP_DIB0700_RC5_TABLE         "rc-dib0700-rc5"
 #define RC_MAP_DM1105_NEC                "rc-dm1105-nec"
 #define RC_MAP_DNTV_LIVE_DVBT_PRO        "rc-dntv-live-dvbt-pro"
 #define RC_MAP_DNTV_LIVE_DVB_T           "rc-dntv-live-dvb-t"