aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2007-04-28 19:11:03 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-05-09 09:12:34 -0400
commit5c808e641741ecd7a7d5e65e38f740378d7406fc (patch)
tree60a142f32e38d9e19fc8dc9c972ccd753e24a758 /drivers/media/video
parentdb71b7df76dab261cc9f27525765211bd58345b1 (diff)
V4L/DVB (5575): Pvrusb2: Implement ability to disable IR receiver
Anyone using multiple PVR USB2 devices really only want one of them acting as the actual IR receiver. Implemented here is a new per-instance module option (ir_mode) which is a flag to enable the IR receiver. The default is enabled. IR reception is disabled by blocking access to the IR receiver chip in the device. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index 58fc3c730fe1..6786d3c0c98b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -23,6 +23,7 @@
23#include "pvrusb2-hdw-internal.h" 23#include "pvrusb2-hdw-internal.h"
24#include "pvrusb2-debug.h" 24#include "pvrusb2-debug.h"
25#include "pvrusb2-fx2-cmd.h" 25#include "pvrusb2-fx2-cmd.h"
26#include "pvrusb2.h"
26 27
27#define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__) 28#define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__)
28 29
@@ -38,6 +39,10 @@ static unsigned int i2c_scan = 0;
38module_param(i2c_scan, int, S_IRUGO|S_IWUSR); 39module_param(i2c_scan, int, S_IRUGO|S_IWUSR);
39MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); 40MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
40 41
42static int ir_mode[PVR_NUM] = { [0 ... PVR_NUM-1] = 1 };
43module_param_array(ir_mode, int, NULL, 0444);
44MODULE_PARM_DESC(ir_mode,"specify: 0=disable IR reception, 1=normal IR");
45
41static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp, 46static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp,
42 unsigned int detail, 47 unsigned int detail,
43 char *buf,unsigned int maxlen); 48 char *buf,unsigned int maxlen);
@@ -273,6 +278,15 @@ static int i2c_hack_wm8775(struct pvr2_hdw *hdw,
273 return pvr2_i2c_basic_op(hdw,i2c_addr,wdata,wlen,rdata,rlen); 278 return pvr2_i2c_basic_op(hdw,i2c_addr,wdata,wlen,rdata,rlen);
274} 279}
275 280
281/* This is an entry point designed to always fail any attempt to perform a
282 transfer. We use this to cause certain I2C addresses to not be
283 probed. */
284static int i2c_black_hole(struct pvr2_hdw *hdw,
285 u8 i2c_addr,u8 *wdata,u16 wlen,u8 *rdata,u16 rlen)
286{
287 return -EIO;
288}
289
276/* This is a special entry point that is entered if an I2C operation is 290/* This is a special entry point that is entered if an I2C operation is
277 attempted to a cx25840 chip on model 24xxx hardware. This chip can 291 attempted to a cx25840 chip on model 24xxx hardware. This chip can
278 sometimes wedge itself. Worse still, when this happens msp3400 can 292 sometimes wedge itself. Worse still, when this happens msp3400 can
@@ -994,10 +1008,17 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
994 } 1008 }
995 1009
996 /* However, deal with various special cases for 24xxx hardware. */ 1010 /* However, deal with various special cases for 24xxx hardware. */
1011 if (ir_mode[hdw->unit_number] == 0) {
1012 printk(KERN_INFO "%s: IR disabled\n",hdw->name);
1013 hdw->i2c_func[0x18] = i2c_black_hole;
1014 } else if (ir_mode[hdw->unit_number] == 1) {
1015 if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) {
1016 hdw->i2c_func[0x18] = i2c_24xxx_ir;
1017 }
1018 }
997 if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { 1019 if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) {
998 hdw->i2c_func[0x1b] = i2c_hack_wm8775; 1020 hdw->i2c_func[0x1b] = i2c_hack_wm8775;
999 hdw->i2c_func[0x44] = i2c_hack_cx25840; 1021 hdw->i2c_func[0x44] = i2c_hack_cx25840;
1000 hdw->i2c_func[0x18] = i2c_24xxx_ir;
1001 } 1022 }
1002 1023
1003 // Configure the adapter and set up everything else related to it. 1024 // Configure the adapter and set up everything else related to it.