aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-04-04 13:06:55 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:56:58 -0400
commit9dfe4e8339499bfe8e9a362fefc290b4cb9c3803 (patch)
treea42ab74108d03f8009f01e2fc896df15638dfc06 /drivers/media/video/cx88
parent4f9256b496677adf799342cee7d406dd46e566d9 (diff)
V4L/DVB: ir-core: Add support for badly-implemented hardware decoders
A few hardware Remote Controller decoders, even using a standard protocol, aren't able to provide the entire scancode. Due to that, the capability of using other IR's are limited on those hardware. Adds a way to indicate to ir-core what are the bits that the hardware provides, from a scancode, allowing the addition of a complete IR table to the kernel and allowing a limited support for changing the Remote Controller on those devices. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r--drivers/media/video/cx88/cx88-input.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index 7ddc8bb463f8..76733349c6cc 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -248,6 +248,9 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
248 char *ir_codes = NULL; 248 char *ir_codes = NULL;
249 u64 ir_type = IR_TYPE_OTHER; 249 u64 ir_type = IR_TYPE_OTHER;
250 int err = -ENOMEM; 250 int err = -ENOMEM;
251 u32 hardware_mask = 0; /* For devices with a hardware mask, when
252 * used with a full-code IR table
253 */
251 254
252 ir = kzalloc(sizeof(*ir), GFP_KERNEL); 255 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
253 input_dev = input_allocate_device(); 256 input_dev = input_allocate_device();
@@ -314,11 +317,18 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
314 break; 317 break;
315 case CX88_BOARD_PROLINK_PLAYTVPVR: 318 case CX88_BOARD_PROLINK_PLAYTVPVR:
316 case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: 319 case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO:
317 ir_codes = RC_MAP_PIXELVIEW; 320 /*
321 * It seems that this hardware is paired with NEC extended
322 * address 0x866b. So, unfortunately, its usage with other
323 * IR's with different address won't work. Still, there are
324 * other IR's from the same manufacturer that works, like the
325 * 002-T mini RC, provided with newer PV hardware
326 */
327 ir_codes = RC_MAP_PIXELVIEW_MK12;
318 ir->gpio_addr = MO_GP1_IO; 328 ir->gpio_addr = MO_GP1_IO;
319 ir->mask_keycode = 0x1f; /* Only command is retrieved */
320 ir->mask_keyup = 0x80; 329 ir->mask_keyup = 0x80;
321 ir->polling = 10; /* ms */ 330 ir->polling = 10; /* ms */
331 hardware_mask = 0x3f; /* Hardware returns only 6 bits from command part */
322 break; 332 break;
323 case CX88_BOARD_PROLINK_PV_8000GT: 333 case CX88_BOARD_PROLINK_PV_8000GT:
324 case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME: 334 case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME:
@@ -410,6 +420,21 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
410 goto err_out_free; 420 goto err_out_free;
411 } 421 }
412 422
423 /*
424 * The usage of mask_keycode were very convenient, due to several
425 * reasons. Among others, the scancode tables were using the scancode
426 * as the index elements. So, the less bits it was used, the smaller
427 * the table were stored. After the input changes, the better is to use
428 * the full scancodes, since it allows replacing the IR remote by
429 * another one. Unfortunately, there are still some hardware, like
430 * Pixelview Ultra Pro, where only part of the scancode is sent via
431 * GPIO. So, there's no way to get the full scancode. Due to that,
432 * hardware_mask were introduced here: it represents those hardware
433 * that has such limits.
434 */
435 if (hardware_mask && !ir->mask_keycode)
436 ir->mask_keycode = hardware_mask;
437
413 /* init input device */ 438 /* init input device */
414 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name); 439 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name);
415 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); 440 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
@@ -437,6 +462,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
437 ir->props.priv = core; 462 ir->props.priv = core;
438 ir->props.open = cx88_ir_open; 463 ir->props.open = cx88_ir_open;
439 ir->props.close = cx88_ir_close; 464 ir->props.close = cx88_ir_close;
465 ir->props.scanmask = hardware_mask;
440 466
441 /* all done */ 467 /* all done */
442 err = ir_input_register(ir->input, ir_codes, &ir->props, MODULE_NAME); 468 err = ir_input_register(ir->input, ir_codes, &ir->props, MODULE_NAME);