aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-input.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-08-29 13:15:55 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-12 11:19:47 -0400
commit715a223323c8c8bcbe7739e20f6c619f7343b595 (patch)
tree0c7eddcdd3c778428fc936009af085940c0394bb /drivers/media/video/cx88/cx88-input.c
parent47f7f6fb7949b6546baf4b6f26bf0ca075d12759 (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/cx88/cx88-input.c')
-rw-r--r--drivers/media/video/cx88/cx88-input.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index 79c4408a617..78b3635178a 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -191,7 +191,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
191{ 191{
192 struct cx88_IR *ir; 192 struct cx88_IR *ir;
193 struct input_dev *input_dev; 193 struct input_dev *input_dev;
194 IR_KEYTAB_TYPE *ir_codes = NULL; 194 struct ir_scancode_table *ir_codes = NULL;
195 int ir_type = IR_TYPE_OTHER; 195 int ir_type = IR_TYPE_OTHER;
196 int err = -ENOMEM; 196 int err = -ENOMEM;
197 197
@@ -207,14 +207,14 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
207 case CX88_BOARD_DNTV_LIVE_DVB_T: 207 case CX88_BOARD_DNTV_LIVE_DVB_T:
208 case CX88_BOARD_KWORLD_DVB_T: 208 case CX88_BOARD_KWORLD_DVB_T:
209 case CX88_BOARD_KWORLD_DVB_T_CX22702: 209 case CX88_BOARD_KWORLD_DVB_T_CX22702:
210 ir_codes = ir_codes_dntv_live_dvb_t; 210 ir_codes = &ir_codes_dntv_live_dvb_t_table;
211 ir->gpio_addr = MO_GP1_IO; 211 ir->gpio_addr = MO_GP1_IO;
212 ir->mask_keycode = 0x1f; 212 ir->mask_keycode = 0x1f;
213 ir->mask_keyup = 0x60; 213 ir->mask_keyup = 0x60;
214 ir->polling = 50; /* ms */ 214 ir->polling = 50; /* ms */
215 break; 215 break;
216 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: 216 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1:
217 ir_codes = ir_codes_cinergy_1400; 217 ir_codes = &ir_codes_cinergy_1400_table;
218 ir_type = IR_TYPE_PD; 218 ir_type = IR_TYPE_PD;
219 ir->sampling = 0xeb04; /* address */ 219 ir->sampling = 0xeb04; /* address */
220 break; 220 break;
@@ -229,14 +229,14 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
229 case CX88_BOARD_PCHDTV_HD3000: 229 case CX88_BOARD_PCHDTV_HD3000:
230 case CX88_BOARD_PCHDTV_HD5500: 230 case CX88_BOARD_PCHDTV_HD5500:
231 case CX88_BOARD_HAUPPAUGE_IRONLY: 231 case CX88_BOARD_HAUPPAUGE_IRONLY:
232 ir_codes = ir_codes_hauppauge_new; 232 ir_codes = &ir_codes_hauppauge_new_table;
233 ir_type = IR_TYPE_RC5; 233 ir_type = IR_TYPE_RC5;
234 ir->sampling = 1; 234 ir->sampling = 1;
235 break; 235 break;
236 case CX88_BOARD_WINFAST_DTV2000H: 236 case CX88_BOARD_WINFAST_DTV2000H:
237 case CX88_BOARD_WINFAST_DTV2000H_J: 237 case CX88_BOARD_WINFAST_DTV2000H_J:
238 case CX88_BOARD_WINFAST_DTV1800H: 238 case CX88_BOARD_WINFAST_DTV1800H:
239 ir_codes = ir_codes_winfast; 239 ir_codes = &ir_codes_winfast_table;
240 ir->gpio_addr = MO_GP0_IO; 240 ir->gpio_addr = MO_GP0_IO;
241 ir->mask_keycode = 0x8f8; 241 ir->mask_keycode = 0x8f8;
242 ir->mask_keyup = 0x100; 242 ir->mask_keyup = 0x100;
@@ -245,14 +245,14 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
245 case CX88_BOARD_WINFAST2000XP_EXPERT: 245 case CX88_BOARD_WINFAST2000XP_EXPERT:
246 case CX88_BOARD_WINFAST_DTV1000: 246 case CX88_BOARD_WINFAST_DTV1000:
247 case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL: 247 case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
248 ir_codes = ir_codes_winfast; 248 ir_codes = &ir_codes_winfast_table;
249 ir->gpio_addr = MO_GP0_IO; 249 ir->gpio_addr = MO_GP0_IO;
250 ir->mask_keycode = 0x8f8; 250 ir->mask_keycode = 0x8f8;
251 ir->mask_keyup = 0x100; 251 ir->mask_keyup = 0x100;
252 ir->polling = 1; /* ms */ 252 ir->polling = 1; /* ms */
253 break; 253 break;
254 case CX88_BOARD_IODATA_GVBCTV7E: 254 case CX88_BOARD_IODATA_GVBCTV7E:
255 ir_codes = ir_codes_iodata_bctv7e; 255 ir_codes = &ir_codes_iodata_bctv7e_table;
256 ir->gpio_addr = MO_GP0_IO; 256 ir->gpio_addr = MO_GP0_IO;
257 ir->mask_keycode = 0xfd; 257 ir->mask_keycode = 0xfd;
258 ir->mask_keydown = 0x02; 258 ir->mask_keydown = 0x02;
@@ -260,7 +260,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
260 break; 260 break;
261 case CX88_BOARD_PROLINK_PLAYTVPVR: 261 case CX88_BOARD_PROLINK_PLAYTVPVR:
262 case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: 262 case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO:
263 ir_codes = ir_codes_pixelview; 263 ir_codes = &ir_codes_pixelview_table;
264 ir->gpio_addr = MO_GP1_IO; 264 ir->gpio_addr = MO_GP1_IO;
265 ir->mask_keycode = 0x1f; 265 ir->mask_keycode = 0x1f;
266 ir->mask_keyup = 0x80; 266 ir->mask_keyup = 0x80;
@@ -268,28 +268,28 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
268 break; 268 break;
269 case CX88_BOARD_PROLINK_PV_8000GT: 269 case CX88_BOARD_PROLINK_PV_8000GT:
270 case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME: 270 case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME:
271 ir_codes = ir_codes_pixelview_new; 271 ir_codes = &ir_codes_pixelview_new_table;
272 ir->gpio_addr = MO_GP1_IO; 272 ir->gpio_addr = MO_GP1_IO;
273 ir->mask_keycode = 0x3f; 273 ir->mask_keycode = 0x3f;
274 ir->mask_keyup = 0x80; 274 ir->mask_keyup = 0x80;
275 ir->polling = 1; /* ms */ 275 ir->polling = 1; /* ms */
276 break; 276 break;
277 case CX88_BOARD_KWORLD_LTV883: 277 case CX88_BOARD_KWORLD_LTV883:
278 ir_codes = ir_codes_pixelview; 278 ir_codes = &ir_codes_pixelview_table;
279 ir->gpio_addr = MO_GP1_IO; 279 ir->gpio_addr = MO_GP1_IO;
280 ir->mask_keycode = 0x1f; 280 ir->mask_keycode = 0x1f;
281 ir->mask_keyup = 0x60; 281 ir->mask_keyup = 0x60;
282 ir->polling = 1; /* ms */ 282 ir->polling = 1; /* ms */
283 break; 283 break;
284 case CX88_BOARD_ADSTECH_DVB_T_PCI: 284 case CX88_BOARD_ADSTECH_DVB_T_PCI:
285 ir_codes = ir_codes_adstech_dvb_t_pci; 285 ir_codes = &ir_codes_adstech_dvb_t_pci_table;
286 ir->gpio_addr = MO_GP1_IO; 286 ir->gpio_addr = MO_GP1_IO;
287 ir->mask_keycode = 0xbf; 287 ir->mask_keycode = 0xbf;
288 ir->mask_keyup = 0x40; 288 ir->mask_keyup = 0x40;
289 ir->polling = 50; /* ms */ 289 ir->polling = 50; /* ms */
290 break; 290 break;
291 case CX88_BOARD_MSI_TVANYWHERE_MASTER: 291 case CX88_BOARD_MSI_TVANYWHERE_MASTER:
292 ir_codes = ir_codes_msi_tvanywhere; 292 ir_codes = &ir_codes_msi_tvanywhere_table;
293 ir->gpio_addr = MO_GP1_IO; 293 ir->gpio_addr = MO_GP1_IO;
294 ir->mask_keycode = 0x1f; 294 ir->mask_keycode = 0x1f;
295 ir->mask_keyup = 0x40; 295 ir->mask_keyup = 0x40;
@@ -297,40 +297,40 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
297 break; 297 break;
298 case CX88_BOARD_AVERTV_303: 298 case CX88_BOARD_AVERTV_303:
299 case CX88_BOARD_AVERTV_STUDIO_303: 299 case CX88_BOARD_AVERTV_STUDIO_303:
300 ir_codes = ir_codes_avertv_303; 300 ir_codes = &ir_codes_avertv_303_table;
301 ir->gpio_addr = MO_GP2_IO; 301 ir->gpio_addr = MO_GP2_IO;
302 ir->mask_keycode = 0xfb; 302 ir->mask_keycode = 0xfb;
303 ir->mask_keydown = 0x02; 303 ir->mask_keydown = 0x02;
304 ir->polling = 50; /* ms */ 304 ir->polling = 50; /* ms */
305 break; 305 break;
306 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: 306 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
307 ir_codes = ir_codes_dntv_live_dvbt_pro; 307 ir_codes = &ir_codes_dntv_live_dvbt_pro_table;
308 ir_type = IR_TYPE_PD; 308 ir_type = IR_TYPE_PD;
309 ir->sampling = 0xff00; /* address */ 309 ir->sampling = 0xff00; /* address */
310 break; 310 break;
311 case CX88_BOARD_NORWOOD_MICRO: 311 case CX88_BOARD_NORWOOD_MICRO:
312 ir_codes = ir_codes_norwood; 312 ir_codes = &ir_codes_norwood_table;
313 ir->gpio_addr = MO_GP1_IO; 313 ir->gpio_addr = MO_GP1_IO;
314 ir->mask_keycode = 0x0e; 314 ir->mask_keycode = 0x0e;
315 ir->mask_keyup = 0x80; 315 ir->mask_keyup = 0x80;
316 ir->polling = 50; /* ms */ 316 ir->polling = 50; /* ms */
317 break; 317 break;
318 case CX88_BOARD_NPGTECH_REALTV_TOP10FM: 318 case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
319 ir_codes = ir_codes_npgtech; 319 ir_codes = &ir_codes_npgtech_table;
320 ir->gpio_addr = MO_GP0_IO; 320 ir->gpio_addr = MO_GP0_IO;
321 ir->mask_keycode = 0xfa; 321 ir->mask_keycode = 0xfa;
322 ir->polling = 50; /* ms */ 322 ir->polling = 50; /* ms */
323 break; 323 break;
324 case CX88_BOARD_PINNACLE_PCTV_HD_800i: 324 case CX88_BOARD_PINNACLE_PCTV_HD_800i:
325 ir_codes = ir_codes_pinnacle_pctv_hd; 325 ir_codes = &ir_codes_pinnacle_pctv_hd_table;
326 ir_type = IR_TYPE_RC5; 326 ir_type = IR_TYPE_RC5;
327 ir->sampling = 1; 327 ir->sampling = 1;
328 break; 328 break;
329 case CX88_BOARD_POWERCOLOR_REAL_ANGEL: 329 case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
330 ir_codes = ir_codes_powercolor_real_angel; 330 ir_codes = &ir_codes_powercolor_real_angel_table;
331 ir->gpio_addr = MO_GP2_IO; 331 ir->gpio_addr = MO_GP2_IO;
332 ir->mask_keycode = 0x7e; 332 ir->mask_keycode = 0x7e;
333 ir->polling = 100; /* ms */ 333 ir->polling = 100; /* ms */
334 break; 334 break;
335 } 335 }
336 336