Patch : remote control on hvr1110

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

This patch :

- remove gpio settings (no need),
- implement remote control on hvr1110 via i2c protocol.

All comments are welcome,

Cheers,

Tom


Signed-off-by : Thomas Genty <tomlohave@xxxxxxxxx>

diff -ur v4l-dvb-origin/linux/drivers/media/video/ir-kbd-i2c.c v4l-dvb/linux/drivers/media/video/ir-kbd-i2c.c
--- v4l-dvb-origin/linux/drivers/media/video/ir-kbd-i2c.c	2006-11-23 20:29:05.000000000 +0100
+++ v4l-dvb/linux/drivers/media/video/ir-kbd-i2c.c	2006-11-23 20:32:41.000000000 +0100
@@ -363,6 +363,7 @@
 		break;
 	case 0x7a:
 	case 0x47:
+	case 0x71:
 		/* Handled by saa7134-input */
 		name        = "SAA713x remote";
 		ir_type     = IR_TYPE_OTHER;
@@ -457,7 +458,7 @@
 	*/
 
 	static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1};
-	static const int probe_saa7134[] = { 0x7a, 0x47, -1 };
+	static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 };
 	static const int probe_em28XX[] = { 0x30, 0x47, -1 };
 	const int *probe = NULL;
 	struct i2c_client c;
diff -ur v4l-dvb-origin/linux/drivers/media/video/saa7134/saa7134-cards.c v4l-dvb/linux/drivers/media/video/saa7134/saa7134-cards.c
--- v4l-dvb-origin/linux/drivers/media/video/saa7134/saa7134-cards.c	2006-11-23 20:29:13.000000000 +0100
+++ v4l-dvb/linux/drivers/media/video/saa7134/saa7134-cards.c	2006-11-23 20:35:36.000000000 +0100
@@ -3175,17 +3175,26 @@
 		.tuner_addr     = ADDR_UNSET,
 		.radio_addr     = ADDR_UNSET,
 		.mpeg           = SAA7134_MPEG_DVB,
-		.gpiomask       = 0x000200000,
+		/*.gpiomask       = 0x000200000,*/
 		.inputs         = {{
 			.name = name_tv,
 			.vmux = 1,
 			.amux = TV,
 			.tv   = 1,
+		},{
+			.name   = name_comp1,
+			.vmux   = 3,
+			.amux   = LINE2,
+		},{
+			.name   = name_svideo,
+			.vmux   = 8,
+			.amux   = LINE2,
+			/*.gpio	= 0x0200000,*/
 		}},
 		.radio = {
 			.name = name_radio,
 			.amux   = TV,
-			.gpio   = 0x0200000,
+		/*	.gpio   = 0x0200000,*/
 		},
 	},
 	[SAA7134_BOARD_CINERGY_HT_PCMCIA] = {
@@ -4053,6 +4062,7 @@
 	case SAA7134_BOARD_PINNACLE_PCTV_110i:
 	case SAA7134_BOARD_PINNACLE_PCTV_310i:
 	case SAA7134_BOARD_UPMOST_PURPLE_TV:
+	case SAA7134_BOARD_HAUPPAUGE_HVR1110:
 		dev->has_remote = SAA7134_REMOTE_I2C;
 		break;
 	case SAA7134_BOARD_AVERMEDIA_A169_B:
diff -ur v4l-dvb-origin/linux/drivers/media/video/saa7134/saa7134-i2c.c v4l-dvb/linux/drivers/media/video/saa7134/saa7134-i2c.c
--- v4l-dvb-origin/linux/drivers/media/video/saa7134/saa7134-i2c.c	2006-11-23 20:29:13.000000000 +0100
+++ v4l-dvb/linux/drivers/media/video/saa7134/saa7134-i2c.c	2006-11-23 20:39:03.000000000 +0100
@@ -351,6 +351,7 @@
 	switch (client->addr) {
 		case 0x7a:
 		case 0x47:
+		case 0x71:
 		{
 			struct IR_i2c *ir = i2c_get_clientdata(client);
 			d1printk("%s i2c IR detected (%s).\n",
diff -ur v4l-dvb-origin/linux/drivers/media/video/saa7134/saa7134-input.c v4l-dvb/linux/drivers/media/video/saa7134/saa7134-input.c
--- v4l-dvb-origin/linux/drivers/media/video/saa7134/saa7134-input.c	2006-11-23 20:29:13.000000000 +0100
+++ v4l-dvb/linux/drivers/media/video/saa7134/saa7134-input.c	2006-11-23 20:41:01.000000000 +0100
@@ -113,6 +113,30 @@
 	return 1;
 }
 
+static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	unsigned char buf[5], cod4, code3, code4;
+
+	/* poll IR chip */
+	if (5 != i2c_master_recv(&ir->c,buf,5))
+		return -EIO;
+
+	cod4	= buf[4];
+	code4	= (cod4 >> 2);
+	code3	= buf[3];
+	if (code3==0)
+		/* no key pressed */
+		return 0;
+
+	if (code3!=0)
+	i2cdprintk("code4=%02x\n",code4);
+	
+	/* return key */
+	*ir_key = code4;
+	*ir_raw = code4;
+	return 1;
+}
+
 void saa7134_input_irq(struct saa7134_dev *dev)
 {
 	struct saa7134_ir *ir = dev->remote;
@@ -378,6 +402,11 @@
 		ir->get_key   = get_key_purpletv;
 		ir->ir_codes  = ir_codes_purpletv;
 		break;
+	case SAA7134_BOARD_HAUPPAUGE_HVR1110:
+		snprintf(ir->c.name, sizeof(ir->c.name), "HVR 1110");
+		ir->get_key   = get_key_hvr1110;
+		ir->ir_codes  = ir_codes_hauppauge_new;
+		break;
 	default:
 		dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board);
 		break;
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux