Skip to contentSkip to conversation

saa7134: Simplify handling of IR on AVerMedia Cardbus

PATCH Oldrich Jedlicka 2 participants 4 messages Apr 9, 2009 – Apr 17, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi Jean,

Quoted 38 lines · Jean Delvare

Now that we instantiate I2C IR devices explicitly, we can skip probing altogether on boards where the I2C IR device address is known. The AVerMedia Cardbus are two of these boards.

---
 linux/drivers/media/video/saa7134/saa7134-input.c |   35

+++------------------ 1 file changed, 5 insertions(+), 30 deletions(-)

---
v4l-dvb.orig/linux/drivers/media/video/saa7134/saa7134-input.c 2009-04-04
10:41:44.000000000 +0200 +++
v4l-dvb/linux/drivers/media/video/saa7134/saa7134-input.c 2009-04-04
10:47:10.000000000 +0200 @@ -691,22 +691,6 @@ void saa7134_probe_i2c_ir(struct saa7134

(quoted diff) +0 -16
 		I2C_CLIENT_END
 	};
 
-	unsigned char subaddr, data;
-	struct i2c_msg msg_avermedia[] = { {
-		.addr = 0x40,
-		.flags = 0,
-		.len = 1,
-		.buf = &subaddr,
-	}, {
-		.addr = 0x40,
-		.flags = I2C_M_RD,
-		.len = 1,
-		.buf = &data,
-	} };
-
-	struct i2c_client *client;
-	int rc;
-
 	if (disable_ir) {
 		dprintk("IR has been disabled, not probing for i2c remote\n");
 		return;

Review void saa7134_probe_i2c_ir(struct saa7134 · line 744

Quoted 8 lines
(quoted diff) +4 -0
@@ -753,6 +737,10 @@ void saa7134_probe_i2c_ir(struct saa7134
 		init_data.get_key = get_key_beholdm6xx;
 		init_data.ir_codes = ir_codes_behold;
 		break;
+	case SAA7134_BOARD_AVERMEDIA_CARDBUS:
+	case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
+		info.addr = 0x40;
+		break;
 	}

The Avermedia Cardbus (E500 - SAA7134_BOARD_AVERMEDIA_CARDBUS) doesn't have remote control as far as I know. The first model was Cardbus Plus (E501R) which is not supported (yet), but Grigory Milev reported that it works with small patching. I plan to send patches after some more testing.

Cheers,
Oldrich.

(Jean, sorry for double-sending, I replied wrongly, so the LMML was not on the CC list)

Quoted 24 lines
(quoted diff) +1 -14
 	if (init_data.name)
@@ -764,20 +752,7 @@ void saa7134_probe_i2c_ir(struct saa7134
 	}
 
 	/* Address not known, fallback to probing */
-	client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list);
-	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);
-	}
+	i2c_new_probed_device(&dev->i2c_adap, &info, addr_list);
 }
 
 static int saa7134_rc5_irq(struct saa7134_dev *dev)
#1 lore raw

Hi Oldrich,

Quoted 44 lines · Oldrich Jedlicka
Quoted 43 lines · Jean Delvare

Now that we instantiate I2C IR devices explicitly, we can skip probing altogether on boards where the I2C IR device address is known. The AVerMedia Cardbus are two of these boards.

---
 linux/drivers/media/video/saa7134/saa7134-input.c |   35

+++------------------ 1 file changed, 5 insertions(+), 30 deletions(-)

---
v4l-dvb.orig/linux/drivers/media/video/saa7134/saa7134-input.c 2009-04-04
10:41:44.000000000 +0200 +++
v4l-dvb/linux/drivers/media/video/saa7134/saa7134-input.c 2009-04-04
10:47:10.000000000 +0200 @@ -691,22 +691,6 @@ void saa7134_probe_i2c_ir(struct saa7134

(quoted diff) +2 -16
 		I2C_CLIENT_END
 	};
 
-	unsigned char subaddr, data;
-	struct i2c_msg msg_avermedia[] = { {
-		.addr = 0x40,
-		.flags = 0,
-		.len = 1,
-		.buf = &subaddr,
-	}, {
-		.addr = 0x40,
-		.flags = I2C_M_RD,
-		.len = 1,
-		.buf = &data,
-	} };
-
-	struct i2c_client *client;
-	int rc;
-
 	if (disable_ir) {
 		dprintk("IR has been disabled, not probing for i2c remote\n");
 		return;
@@ -753,6 +737,10 @@ void saa7134_probe_i2c_ir(struct saa7134
 		init_data.get_key = get_key_beholdm6xx;
 		init_data.ir_codes = ir_codes_behold;
 		break;
+	case SAA7134_BOARD_AVERMEDIA_CARDBUS:
+	case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
Quoted 8 lines

Review void saa7134_probe_i2c_ir(struct saa7134 · line 744

Quoted 3 lines
(quoted diff) +2 -0
+		info.addr = 0x40;
+		break;
 	}

The Avermedia Cardbus (E500 - SAA7134_BOARD_AVERMEDIA_CARDBUS) doesn't have remote control as far as I know. The first model was Cardbus Plus (E501R) which is not supported (yet), but Grigory Milev reported that it works with small patching. I plan to send patches after some more testing.

OK, I've removed case SAA7134_BOARD_AVERMEDIA_CARDBUS from my patch, thanks for letting me know.

Signature · 1 line
Jean Delvare
#2 lore raw

Hi Jean,

Quoted 4 lines · Jean Delvare

Hi Oldrich,

Quoted 1 line · Oldrich Jedlicka

On Saturday 04 of April 2009 at 14:31:37, Jean Delvare wrote:

[sniff]

Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
(quoted diff) +3 -0
@@ -753,6 +737,10 @@ void saa7134_probe_i2c_ir(struct saa7134
 		init_data.get_key = get_key_beholdm6xx;
 		init_data.ir_codes = ir_codes_behold;
 		break;
+	case SAA7134_BOARD_AVERMEDIA_CARDBUS:
+	case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
+		info.addr = 0x40;
Quoted 8 lines

Review void saa7134_probe_i2c_ir(struct saa7134 · line 744

Quoted 2 lines
(quoted diff) +1 -0
+		break;
 	}

The Avermedia Cardbus (E500 - SAA7134_BOARD_AVERMEDIA_CARDBUS) doesn't have remote control as far as I know. The first model was Cardbus Plus (E501R) which is not supported (yet), but Grigory Milev reported that it works with small patching. I plan to send patches after some more testing.

Quoted 2 lines

OK, I've removed case SAA7134_BOARD_AVERMEDIA_CARDBUS from my patch, thanks for letting me know.

You can add SAA7134_BOARD_AVERMEDIA_501 there - if my patch for it get accepted :-)

Cheers,
Oldrich.

#3 lore raw
Quoted 24 lines · Oldrich Jedlicka

Hi Jean,

Quoted 4 lines · Jean Delvare

Hi Oldrich,

Quoted 1 line · Oldrich Jedlicka

On Saturday 04 of April 2009 at 14:31:37, Jean Delvare wrote:

[sniff]

Quoted 16 lines
Quoted 15 lines

Review void saa7134_probe_i2c_ir(struct saa7134 · line 744

Quoted 9 lines
(quoted diff) +4 -0
@@ -753,6 +737,10 @@ void saa7134_probe_i2c_ir(struct saa7134
 		init_data.get_key = get_key_beholdm6xx;
 		init_data.ir_codes = ir_codes_behold;
 		break;
+	case SAA7134_BOARD_AVERMEDIA_CARDBUS:
+	case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
+		info.addr = 0x40;
+		break;
 	}

The Avermedia Cardbus (E500 - SAA7134_BOARD_AVERMEDIA_CARDBUS) doesn't have remote control as far as I know. The first model was Cardbus Plus (E501R) which is not supported (yet), but Grigory Milev reported that it works with small patching. I plan to send patches after some more testing.

Quoted 5 lines
Quoted 2 lines

OK, I've removed case SAA7134_BOARD_AVERMEDIA_CARDBUS from my patch, thanks for letting me know.

You can add SAA7134_BOARD_AVERMEDIA_501 there - if my patch for it get accepted :-)

Obviously I can't add it before your own patch is in ;)

Signature · 1 line
Jean Delvare