aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ir-kbd-i2c.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/ir-kbd-i2c.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/ir-kbd-i2c.c')
-rw-r--r--drivers/media/video/ir-kbd-i2c.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index b92ddcabf0b6..247d3115a9b7 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -297,7 +297,7 @@ static void ir_work(struct work_struct *work)
297 297
298static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) 298static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
299{ 299{
300 IR_KEYTAB_TYPE *ir_codes = NULL; 300 struct ir_scancode_table *ir_codes = NULL;
301 const char *name = NULL; 301 const char *name = NULL;
302 int ir_type; 302 int ir_type;
303 struct IR_i2c *ir; 303 struct IR_i2c *ir;
@@ -322,13 +322,13 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
322 name = "Pixelview"; 322 name = "Pixelview";
323 ir->get_key = get_key_pixelview; 323 ir->get_key = get_key_pixelview;
324 ir_type = IR_TYPE_OTHER; 324 ir_type = IR_TYPE_OTHER;
325 ir_codes = ir_codes_empty; 325 ir_codes = &ir_codes_empty_table;
326 break; 326 break;
327 case 0x4b: 327 case 0x4b:
328 name = "PV951"; 328 name = "PV951";
329 ir->get_key = get_key_pv951; 329 ir->get_key = get_key_pv951;
330 ir_type = IR_TYPE_OTHER; 330 ir_type = IR_TYPE_OTHER;
331 ir_codes = ir_codes_pv951; 331 ir_codes = &ir_codes_pv951_table;
332 break; 332 break;
333 case 0x18: 333 case 0x18:
334 case 0x1a: 334 case 0x1a:
@@ -336,22 +336,22 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
336 ir->get_key = get_key_haup; 336 ir->get_key = get_key_haup;
337 ir_type = IR_TYPE_RC5; 337 ir_type = IR_TYPE_RC5;
338 if (hauppauge == 1) { 338 if (hauppauge == 1) {
339 ir_codes = ir_codes_hauppauge_new; 339 ir_codes = &ir_codes_hauppauge_new_table;
340 } else { 340 } else {
341 ir_codes = ir_codes_rc5_tv; 341 ir_codes = &ir_codes_rc5_tv_table;
342 } 342 }
343 break; 343 break;
344 case 0x30: 344 case 0x30:
345 name = "KNC One"; 345 name = "KNC One";
346 ir->get_key = get_key_knc1; 346 ir->get_key = get_key_knc1;
347 ir_type = IR_TYPE_OTHER; 347 ir_type = IR_TYPE_OTHER;
348 ir_codes = ir_codes_empty; 348 ir_codes = &ir_codes_empty_table;
349 break; 349 break;
350 case 0x6b: 350 case 0x6b:
351 name = "FusionHDTV"; 351 name = "FusionHDTV";
352 ir->get_key = get_key_fusionhdtv; 352 ir->get_key = get_key_fusionhdtv;
353 ir_type = IR_TYPE_RC5; 353 ir_type = IR_TYPE_RC5;
354 ir_codes = ir_codes_fusionhdtv_mce; 354 ir_codes = &ir_codes_fusionhdtv_mce_table;
355 break; 355 break;
356 case 0x7a: 356 case 0x7a:
357 case 0x47: 357 case 0x47:
@@ -365,9 +365,9 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
365 ir_type = IR_TYPE_RC5; 365 ir_type = IR_TYPE_RC5;
366 ir->get_key = get_key_haup_xvr; 366 ir->get_key = get_key_haup_xvr;
367 if (hauppauge == 1) { 367 if (hauppauge == 1) {
368 ir_codes = ir_codes_hauppauge_new; 368 ir_codes = &ir_codes_hauppauge_new_table;
369 } else { 369 } else {
370 ir_codes = ir_codes_rc5_tv; 370 ir_codes = &ir_codes_rc5_tv_table;
371 } 371 }
372 } else { 372 } else {
373 /* Handled by saa7134-input */ 373 /* Handled by saa7134-input */
@@ -379,7 +379,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
379 name = "AVerMedia Cardbus remote"; 379 name = "AVerMedia Cardbus remote";
380 ir->get_key = get_key_avermedia_cardbus; 380 ir->get_key = get_key_avermedia_cardbus;
381 ir_type = IR_TYPE_OTHER; 381 ir_type = IR_TYPE_OTHER;
382 ir_codes = ir_codes_avermedia_cardbus; 382 ir_codes = &ir_codes_avermedia_cardbus_table;
383 break; 383 break;
384 default: 384 default:
385 dprintk(1, DEVNAME ": Unsupported i2c address 0x%02x\n", addr); 385 dprintk(1, DEVNAME ": Unsupported i2c address 0x%02x\n", addr);