summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-input.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-05-13 16:49:32 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 18:21:11 -0300
commit4d7a2d6721a6380d4ffc26d81d2c8232fd0d2dfc (patch)
tree5ccac1dc6084363abdea5a63fe5d305421bd894c /drivers/media/video/saa7134/saa7134-input.c
parentc668f32dca105d876e51862a003a302fa61e4ae4 (diff)
V4L/DVB (11845): ir-kbd-i2c: Use initialization data
For specific boards, pass initialization data to ir-kbd-i2c instead of modifying the settings after the device is initialized. This is more efficient and easier to read. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-input.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c94
1 files changed, 46 insertions, 48 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 4144ca9cc7e..a20f687f81a 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -685,6 +685,7 @@ void saa7134_input_fini(struct saa7134_dev *dev)
void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
{
struct i2c_board_info info;
+ struct IR_i2c_init_data init_data;
const unsigned short addr_list[] = {
0x7a, 0x47, 0x71, 0x2d,
I2C_CLIENT_END
@@ -722,62 +723,35 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
}
memset(&info, 0, sizeof(struct i2c_board_info));
+ memset(&init_data, 0, sizeof(struct IR_i2c_init_data));
strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
- client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list);
- if (client)
- return;
-
- /* MSI TV@nywhere Plus controller doesn't seem to
- respond to probes unless we read something from
- an existing device. Weird... */
- rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
- dprintk(KERN_DEBUG "probe 0x%02x @ %s: %s\n",
- msg_msi.addr, dev->i2c_adap.name,
- (1 == rc) ? "yes" : "no");
- client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list_msi);
- if (client)
- return;
- /* Special case for AVerMedia Cardbus remote */
- subaddr = 0x0d;
- rc = i2c_transfer(&dev->i2c_adap, msg_avermedia, 2);
- dprintk(KERN_DEBUG "probe 0x%02x/0x%02x @ %s: %s\n",
- msg_avermedia[0].addr, subaddr, dev->i2c_adap.name,
- (2 == rc) ? "yes" : "no");
- if (2 == rc) {
- info.addr = msg_avermedia[0].addr;
- i2c_new_device(&dev->i2c_adap, &info);
- }
-}
-
-void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir)
-{
switch (dev->board) {
case SAA7134_BOARD_PINNACLE_PCTV_110i:
case SAA7134_BOARD_PINNACLE_PCTV_310i:
- snprintf(ir->name, sizeof(ir->name), "Pinnacle PCTV");
+ init_data.name = "Pinnacle PCTV";
if (pinnacle_remote == 0) {
- ir->get_key = get_key_pinnacle_color;
- ir->ir_codes = ir_codes_pinnacle_color;
+ init_data.get_key = get_key_pinnacle_color;
+ init_data.ir_codes = ir_codes_pinnacle_color;
} else {
- ir->get_key = get_key_pinnacle_grey;
- ir->ir_codes = ir_codes_pinnacle_grey;
+ init_data.get_key = get_key_pinnacle_grey;
+ init_data.ir_codes = ir_codes_pinnacle_grey;
}
break;
case SAA7134_BOARD_UPMOST_PURPLE_TV:
- snprintf(ir->name, sizeof(ir->name), "Purple TV");
- ir->get_key = get_key_purpletv;
- ir->ir_codes = ir_codes_purpletv;
+ init_data.name = "Purple TV";
+ init_data.get_key = get_key_purpletv;
+ init_data.ir_codes = ir_codes_purpletv;
break;
case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS:
- snprintf(ir->name, sizeof(ir->name), "MSI TV@nywhere Plus");
- ir->get_key = get_key_msi_tvanywhere_plus;
- ir->ir_codes = ir_codes_msi_tvanywhere_plus;
+ init_data.name = "MSI TV@nywhere Plus";
+ init_data.get_key = get_key_msi_tvanywhere_plus;
+ init_data.ir_codes = ir_codes_msi_tvanywhere_plus;
break;
case SAA7134_BOARD_HAUPPAUGE_HVR1110:
- snprintf(ir->name, sizeof(ir->name), "HVR 1110");
- ir->get_key = get_key_hvr1110;
- ir->ir_codes = ir_codes_hauppauge_new;
+ init_data.name = "HVR 1110";
+ init_data.get_key = get_key_hvr1110;
+ init_data.ir_codes = ir_codes_hauppauge_new;
break;
case SAA7134_BOARD_BEHOLD_607FM_MK3:
case SAA7134_BOARD_BEHOLD_607FM_MK5:
@@ -791,15 +765,39 @@ void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir)
case SAA7134_BOARD_BEHOLD_M63:
case SAA7134_BOARD_BEHOLD_M6_EXTRA:
case SAA7134_BOARD_BEHOLD_H6:
- snprintf(ir->name, sizeof(ir->name), "BeholdTV");
- ir->get_key = get_key_beholdm6xx;
- ir->ir_codes = ir_codes_behold;
- break;
- default:
- dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board);
+ init_data.name = "BeholdTV";
+ init_data.get_key = get_key_beholdm6xx;
+ init_data.ir_codes = ir_codes_behold;
break;
}
+ if (init_data.name)
+ info.platform_data = &init_data;
+ client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list);
+ if (client)
+ return;
+
+ /* MSI TV@nywhere Plus controller doesn't seem to
+ respond to probes unless we read something from
+ an existing device. Weird... */
+ rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
+ dprintk(KERN_DEBUG "probe 0x%02x @ %s: %s\n",
+ msg_msi.addr, dev->i2c_adap.name,
+ (1 == rc) ? "yes" : "no");
+ client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list_msi);
+ if (client)
+ return;
+
+ /* Special case for AVerMedia Cardbus remote */
+ subaddr = 0x0d;
+ rc = i2c_transfer(&dev->i2c_adap, msg_avermedia, 2);
+ dprintk(KERN_DEBUG "probe 0x%02x/0x%02x @ %s: %s\n",
+ msg_avermedia[0].addr, subaddr, dev->i2c_adap.name,
+ (2 == rc) ? "yes" : "no");
+ if (2 == rc) {
+ info.addr = msg_avermedia[0].addr;
+ i2c_new_device(&dev->i2c_adap, &info);
+ }
}
static int saa7134_rc5_irq(struct saa7134_dev *dev)