diff options
author | Mike Isely <isely@pobox.com> | 2009-05-01 21:23:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:20:59 -0400 |
commit | cd85b7afe1b76e899c387a5d1fd727021aff4a51 (patch) | |
tree | 731791f1643a8bdcca2c4a7e3f24d40eb1da91ea /drivers/media | |
parent | 27eab3840baaee469eb6377607520ca2128b66f7 (diff) |
V4L/DVB (11745): pvrusb2: Update to work with upcoming ir_video changes in v4l-dvb core
The ir-kbd-i2c module is about to be updated to match the new style
i2c binding model. These pvrusb2 changes maintain compatibility with
that change. Note that this does not actually break anything even
without the expected ir-kbd-i2c changes yet because previously the
pvrusb2 didn't autoload ir-kbd-i2c anyway.
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c index 838d01c9d02e..610bd848df24 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | |||
@@ -42,6 +42,18 @@ static int ir_mode[PVR_NUM] = { [0 ... PVR_NUM-1] = 1 }; | |||
42 | module_param_array(ir_mode, int, NULL, 0444); | 42 | module_param_array(ir_mode, int, NULL, 0444); |
43 | MODULE_PARM_DESC(ir_mode,"specify: 0=disable IR reception, 1=normal IR"); | 43 | MODULE_PARM_DESC(ir_mode,"specify: 0=disable IR reception, 1=normal IR"); |
44 | 44 | ||
45 | static int pvr2_disable_ir_video; | ||
46 | module_param_named(disable_autoload_ir_video, pvr2_disable_ir_video, | ||
47 | int, S_IRUGO|S_IWUSR); | ||
48 | MODULE_PARM_DESC(disable_autoload_ir_video, | ||
49 | "1=do not try to autoload ir_video IR receiver"); | ||
50 | |||
51 | /* Mapping of IR schemes to known I2C addresses - if any */ | ||
52 | static const unsigned char ir_video_addresses[] = { | ||
53 | [PVR2_IR_SCHEME_29XXX] = 0x18, | ||
54 | [PVR2_IR_SCHEME_24XXX] = 0x18, | ||
55 | }; | ||
56 | |||
45 | static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */ | 57 | static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */ |
46 | u8 i2c_addr, /* I2C address we're talking to */ | 58 | u8 i2c_addr, /* I2C address we're talking to */ |
47 | u8 *data, /* Data to write */ | 59 | u8 *data, /* Data to write */ |
@@ -559,6 +571,31 @@ static void do_i2c_scan(struct pvr2_hdw *hdw) | |||
559 | printk(KERN_INFO "%s: i2c scan done.\n", hdw->name); | 571 | printk(KERN_INFO "%s: i2c scan done.\n", hdw->name); |
560 | } | 572 | } |
561 | 573 | ||
574 | static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) | ||
575 | { | ||
576 | struct i2c_board_info info; | ||
577 | unsigned char addr = 0; | ||
578 | if (pvr2_disable_ir_video) { | ||
579 | pvr2_trace(PVR2_TRACE_INFO, | ||
580 | "Automatic binding of ir_video has been disabled."); | ||
581 | return; | ||
582 | } | ||
583 | if (hdw->ir_scheme_active < ARRAY_SIZE(ir_video_addresses)) { | ||
584 | addr = ir_video_addresses[hdw->ir_scheme_active]; | ||
585 | } | ||
586 | if (!addr) { | ||
587 | /* The device either doesn't support I2C-based IR or we | ||
588 | don't know (yet) how to operate IR on the device. */ | ||
589 | return; | ||
590 | } | ||
591 | pvr2_trace(PVR2_TRACE_INFO, | ||
592 | "Binding ir_video to i2c address 0x%02x.", addr); | ||
593 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
594 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | ||
595 | info.addr = addr; | ||
596 | i2c_new_device(&hdw->i2c_adap, &info); | ||
597 | } | ||
598 | |||
562 | void pvr2_i2c_core_init(struct pvr2_hdw *hdw) | 599 | void pvr2_i2c_core_init(struct pvr2_hdw *hdw) |
563 | { | 600 | { |
564 | unsigned int idx; | 601 | unsigned int idx; |
@@ -614,6 +651,8 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw) | |||
614 | } | 651 | } |
615 | } | 652 | } |
616 | if (i2c_scan) do_i2c_scan(hdw); | 653 | if (i2c_scan) do_i2c_scan(hdw); |
654 | |||
655 | pvr2_i2c_register_ir(hdw); | ||
617 | } | 656 | } |
618 | 657 | ||
619 | void pvr2_i2c_core_done(struct pvr2_hdw *hdw) | 658 | void pvr2_i2c_core_done(struct pvr2_hdw *hdw) |