diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-08-29 14:15:55 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-12 12:19:47 -0300 |
commit | 715a223323c8c8bcbe7739e20f6c619f7343b595 (patch) | |
tree | 0c7eddcdd3c778428fc936009af085940c0394bb /drivers/media/video/saa7134/saa7134-input.c | |
parent | 47f7f6fb7949b6546baf4b6f26bf0ca075d12759 (diff) |
V4L/DVB (12595): common/ir: use a struct for keycode tables
Currently, V4L uses a scancode table whose index is the scancode and
the value is the keycode. While this works, it has some drawbacks:
1) It requires that the scancode to be at the range 00-7f;
2) keycodes should be masked on 7 bits in order for it to work;
3) due to the 7 bits approach, sometimes it is not possible to replace
the default keyboard to another one with a different encoding rule;
4) it is different than what is done with dvb-usb approach;
5) it requires a typedef for it to work. This is not a recommended
Linux CodingStyle.
This patch is part of a larger series of IR changes. It basically
replaces the IR_KEYTAB_TYPE tables by a structured table:
struct ir_scancode {
u16 scancode;
u32 keycode;
};
This is very close to what dvb does. So, a further integration with DVB
code will be easy.
While we've changed the tables, for now, the IR keycode handling is still
based on the old approach.
The only notable effect is the redution of about 35% of the ir-common
module size:
text data bss dec hex filename
6721 29208 4 35933 8c5d old/ir-common.ko
5756 18040 4 23800 5cf8 new/ir-common.ko
In thesis, we could be using above u8 for scancode, reducing even more the size
of the module, but defining it as u16 is more convenient, since, on dvb, each
scancode has up to 16 bits, and we currently have a few troubles with rc5, as their
scancodes are defined with more than 8 bits.
This patch itself shouldn't be doing any functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-input.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 65fb7b17b678..9070e5fabb4e 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -394,7 +394,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) { struct card_ir *ir; struct input_dev *input_dev; - IR_KEYTAB_TYPE *ir_codes = NULL; + struct ir_scancode_table *ir_codes = NULL; u32 mask_keycode = 0; u32 mask_keydown = 0; u32 mask_keyup = 0; @@ -416,27 +416,27 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_FLYTVPLATINUM_FM: case SAA7134_BOARD_FLYTVPLATINUM_MINI2: case SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM: - ir_codes = ir_codes_flyvideo; + ir_codes = &ir_codes_flyvideo_table; mask_keycode = 0xEC00000; mask_keydown = 0x0040000; break; case SAA7134_BOARD_CINERGY400: case SAA7134_BOARD_CINERGY600: case SAA7134_BOARD_CINERGY600_MK3: - ir_codes = ir_codes_cinergy; + ir_codes = &ir_codes_cinergy_table; mask_keycode = 0x00003f; mask_keyup = 0x040000; break; case SAA7134_BOARD_ECS_TVP3XP: case SAA7134_BOARD_ECS_TVP3XP_4CB5: - ir_codes = ir_codes_eztv; + ir_codes = &ir_codes_eztv_table; mask_keycode = 0x00017c; mask_keyup = 0x000002; polling = 50; // ms break; case SAA7134_BOARD_KWORLD_XPERT: case SAA7134_BOARD_AVACSSMARTTV: - ir_codes = ir_codes_pixelview; + ir_codes = &ir_codes_pixelview_table; mask_keycode = 0x00001F; mask_keyup = 0x000020; polling = 50; // ms @@ -453,7 +453,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_AVERMEDIA_GO_007_FM: case SAA7134_BOARD_AVERMEDIA_M102: case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS: - ir_codes = ir_codes_avermedia; + ir_codes = &ir_codes_avermedia_table; mask_keycode = 0x0007C8; mask_keydown = 0x000010; polling = 50; // ms @@ -462,14 +462,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); break; case SAA7134_BOARD_AVERMEDIA_M135A: - ir_codes = ir_codes_avermedia_m135a; + ir_codes = &ir_codes_avermedia_m135a_table; mask_keydown = 0x0040000; mask_keycode = 0x00013f; nec_gpio = 1; break; case SAA7134_BOARD_AVERMEDIA_777: case SAA7134_BOARD_AVERMEDIA_A16AR: - ir_codes = ir_codes_avermedia; + ir_codes = &ir_codes_avermedia_table; mask_keycode = 0x02F200; mask_keydown = 0x000400; polling = 50; // ms @@ -478,7 +478,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); break; case SAA7134_BOARD_AVERMEDIA_A16D: - ir_codes = ir_codes_avermedia_a16d; + ir_codes = &ir_codes_avermedia_a16d_table; mask_keycode = 0x02F200; mask_keydown = 0x000400; polling = 50; /* ms */ @@ -487,14 +487,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); break; case SAA7134_BOARD_KWORLD_TERMINATOR: - ir_codes = ir_codes_pixelview; + ir_codes = &ir_codes_pixelview_table; mask_keycode = 0x00001f; mask_keyup = 0x000060; polling = 50; // ms break; case SAA7134_BOARD_MANLI_MTV001: case SAA7134_BOARD_MANLI_MTV002: - ir_codes = ir_codes_manli; + ir_codes = &ir_codes_manli_table; mask_keycode = 0x001f00; mask_keyup = 0x004000; polling = 50; /* ms */ @@ -513,25 +513,25 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_BEHOLD_507_9FM: case SAA7134_BOARD_BEHOLD_507RDS_MK3: case SAA7134_BOARD_BEHOLD_507RDS_MK5: - ir_codes = ir_codes_manli; + ir_codes = &ir_codes_manli_table; mask_keycode = 0x003f00; mask_keyup = 0x004000; polling = 50; /* ms */ break; case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: - ir_codes = ir_codes_behold_columbus; + ir_codes = &ir_codes_behold_columbus_table; mask_keycode = 0x003f00; mask_keyup = 0x004000; polling = 50; // ms break; case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: - ir_codes = ir_codes_pctv_sedna; + ir_codes = &ir_codes_pctv_sedna_table; mask_keycode = 0x001f00; mask_keyup = 0x004000; polling = 50; // ms break; case SAA7134_BOARD_GOTVIEW_7135: - ir_codes = ir_codes_gotview7135; + ir_codes = &ir_codes_gotview7135_table; mask_keycode = 0x0003CC; mask_keydown = 0x000010; polling = 5; /* ms */ @@ -540,75 +540,75 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_VIDEOMATE_TV_PVR: case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: - ir_codes = ir_codes_videomate_tv_pvr; + ir_codes = &ir_codes_videomate_tv_pvr_table; mask_keycode = 0x00003F; mask_keyup = 0x400000; polling = 50; // ms break; case SAA7134_BOARD_PROTEUS_2309: - ir_codes = ir_codes_proteus_2309; + ir_codes = &ir_codes_proteus_2309_table; mask_keycode = 0x00007F; mask_keyup = 0x000080; polling = 50; // ms break; case SAA7134_BOARD_VIDEOMATE_DVBT_300: case SAA7134_BOARD_VIDEOMATE_DVBT_200: - ir_codes = ir_codes_videomate_tv_pvr; + ir_codes = &ir_codes_videomate_tv_pvr_table; mask_keycode = 0x003F00; mask_keyup = 0x040000; break; case SAA7134_BOARD_FLYDVBS_LR300: case SAA7134_BOARD_FLYDVBT_LR301: case SAA7134_BOARD_FLYDVBTDUO: - ir_codes = ir_codes_flydvb; + ir_codes = &ir_codes_flydvb_table; mask_keycode = 0x0001F00; mask_keydown = 0x0040000; break; case SAA7134_BOARD_ASUSTeK_P7131_DUAL: case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: case SAA7134_BOARD_ASUSTeK_P7131_ANALOG: - ir_codes = ir_codes_asus_pc39; + ir_codes = &ir_codes_asus_pc39_table; mask_keydown = 0x0040000; rc5_gpio = 1; break; case SAA7134_BOARD_ENCORE_ENLTV: case SAA7134_BOARD_ENCORE_ENLTV_FM: - ir_codes = ir_codes_encore_enltv; + ir_codes = &ir_codes_encore_enltv_table; mask_keycode = 0x00007f; mask_keyup = 0x040000; polling = 50; // ms break; case SAA7134_BOARD_ENCORE_ENLTV_FM53: - ir_codes = ir_codes_encore_enltv_fm53; + ir_codes = &ir_codes_encore_enltv_fm53_table; mask_keydown = 0x0040000; mask_keycode = 0x00007f; nec_gpio = 1; break; case SAA7134_BOARD_10MOONSTVMASTER3: - ir_codes = ir_codes_encore_enltv; + ir_codes = &ir_codes_encore_enltv_table; mask_keycode = 0x5f80000; mask_keyup = 0x8000000; polling = 50; //ms break; case SAA7134_BOARD_GENIUS_TVGO_A11MCE: - ir_codes = ir_codes_genius_tvgo_a11mce; + ir_codes = &ir_codes_genius_tvgo_a11mce_table; mask_keycode = 0xff; mask_keydown = 0xf00000; polling = 50; /* ms */ break; case SAA7134_BOARD_REAL_ANGEL_220: - ir_codes = ir_codes_real_audio_220_32_keys; + ir_codes = &ir_codes_real_audio_220_32_keys_table; mask_keycode = 0x3f00; mask_keyup = 0x4000; polling = 50; /* ms */ break; case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: - ir_codes = ir_codes_kworld_plus_tv_analog; + ir_codes = &ir_codes_kworld_plus_tv_analog_table; mask_keycode = 0x7f; polling = 40; /* ms */ break; case SAA7134_BOARD_VIDEOMATE_S350: - ir_codes = ir_codes_videomate_s350; + ir_codes = &ir_codes_videomate_s350_table; mask_keycode = 0x003f00; mask_keydown = 0x040000; break; @@ -722,23 +722,23 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) init_data.name = "Pinnacle PCTV"; if (pinnacle_remote == 0) { init_data.get_key = get_key_pinnacle_color; - init_data.ir_codes = ir_codes_pinnacle_color; + init_data.ir_codes = &ir_codes_pinnacle_color_table; info.addr = 0x47; } else { init_data.get_key = get_key_pinnacle_grey; - init_data.ir_codes = ir_codes_pinnacle_grey; + init_data.ir_codes = &ir_codes_pinnacle_grey_table; info.addr = 0x47; } break; case SAA7134_BOARD_UPMOST_PURPLE_TV: init_data.name = "Purple TV"; init_data.get_key = get_key_purpletv; - init_data.ir_codes = ir_codes_purpletv; + init_data.ir_codes = &ir_codes_purpletv_table; break; case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: init_data.name = "MSI TV@nywhere Plus"; init_data.get_key = get_key_msi_tvanywhere_plus; - init_data.ir_codes = ir_codes_msi_tvanywhere_plus; + init_data.ir_codes = &ir_codes_msi_tvanywhere_plus_table; info.addr = 0x30; /* MSI TV@nywhere Plus controller doesn't seem to respond to probes unless we read something from @@ -752,7 +752,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) case SAA7134_BOARD_HAUPPAUGE_HVR1110: init_data.name = "HVR 1110"; init_data.get_key = get_key_hvr1110; - init_data.ir_codes = ir_codes_hauppauge_new; + init_data.ir_codes = &ir_codes_hauppauge_new_table; break; case SAA7134_BOARD_BEHOLD_607FM_MK3: case SAA7134_BOARD_BEHOLD_607FM_MK5: @@ -769,7 +769,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) case SAA7134_BOARD_BEHOLD_X7: init_data.name = "BeholdTV"; init_data.get_key = get_key_beholdm6xx; - init_data.ir_codes = ir_codes_behold; + init_data.ir_codes = &ir_codes_behold_table; break; case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: |