[PATCH] Flydvb Trio Remote - lr319sta

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


This patch enable remote control for Flydvb Trio Remote - lr319sta

With few changes may apply to other lifwview cards that use i2c for remote.
To check if your card may be supported:
install lm-sensors
modprobe i2c-dev
i2cdetect 0 (where 0 is address of your card)
If appear 0b you may have pic 16c505
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          XX XX XX XX XX 08 09 XX 0b XX XX 0e XX
[...]

Attacched the patch, lirc config for remote, and lircrc to test it

Thanks to "Nickolay V. Shmyrev" for help me in hacking remote.
Thanks to "Peter Missel" for initial hacking of this card.
Thanks to "Nico Sabbi" for his contribution on frontend switching.

Thanks to who wrote ATSC and TV@nywhere latest patch, since I reused some
code from these patches.

Signed-off-by: Eddi De Pieri <eddi@xxxxxxxxxx>


root@vdrsmp: # modprobe saa7134 i2c_scan=1 ir_debug=1

ACPI: PCI Interrupt 0000:02:0a.0[A] -> Link [LNKF] -> GSI 11 (level, low) ->
IRQ 11
saa7133[0]: found at 0000:02:0a.0, rev: 208, irq: 11, latency: 66, mmio:
0x40200000
saa7133[0]: subsystem: 5168:0319, board: LifeView FlyDVB Trio
[card=84,autodetected]
saa7133[0]: board init: gpio is 211400
tuner 0-004b: chip found @ 0x96 (saa7133[0])
tuner 0-004b: setting tuner address to 61
tuner 0-004b: type set to tda8290+75a
input: Lifeview as /class/input/input1
ir-kbd-i2c: Lifeview detected at i2c-0/0-000b/ir0 [saa7133[0]]
saa7133[0]: i2c eeprom 00: 68 51 19 03 54 20 1c 00 43 43 a9 1c 55 d2 b2 92
saa7133[0]: i2c eeprom 10: 00 00 60 0a ff 20 ff ff ff ff ff ff ff ff ff ff
saa7133[0]: i2c eeprom 20: 01 40 01 03 03 01 01 03 08 ff 01 f9 ff ff ff ff
saa7133[0]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
saa7133[0]: i2c eeprom 40: ff 00 10 c0 96 12 08 00 c2 96 c6 1c 16 3a 15 ff
saa7133[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
saa7133[0]: i2c eeprom 60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
saa7133[0]: i2c eeprom 70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
saa7133[0]: i2c scan: found device @ 0x10  [???]
saa7133[0]: i2c scan: found device @ 0x12  [???]
saa7133[0]: i2c scan: found device @ 0x1c  [???]
saa7133[0]: i2c scan: found device @ 0x96  [???]
saa7133[0]: i2c scan: found device @ 0xa0  [eeprom]
saa7133[0]: registered device video0 [v4l2]
saa7133[0]: registered device vbi0
saa7133[0]: registered device radio0

root@vdrsmp:~# irexec
zoom
power
3
6
0


Best Regards,
Eddi

=====================================================
diff -u -N -r v4l-dvb.ori/linux/drivers/media/video/ir-kbd-i2c.c
v4l-dvb/linux/drivers/media/video/ir-kbd-i2c.c
--- v4l-dvb.ori/linux/drivers/media/video/ir-kbd-i2c.c	2006-09-15
22:59:46.000000000 +0200
+++ v4l-dvb/linux/drivers/media/video/ir-kbd-i2c.c	2006-12-01
01:04:39.000000000 +0100
@@ -353,6 +353,7 @@
 		ir_type     = IR_TYPE_OTHER;
 		ir_codes    = ir_codes_empty;
 		break;
+	case 0xb:
 	case 0x7a:
 	case 0x47:
 		/* Handled by saa7134-input */
@@ -439,7 +440,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[] = { 0xb, 0x7a, 0x47, -1 };
 	static const int probe_em28XX[] = { 0x30, 0x47, -1 };
 	const int *probe = NULL;
 	struct i2c_client c;
@@ -467,6 +468,13 @@
 	c.adapter = adap;
 	for (i = 0; -1 != probe[i]; i++) {
 		c.addr = probe[i];
+
+		if (c.adapter->id == I2C_HW_SAA7134 && probe[i] == 0xb) {
+                        /* enable ir receiver */
+                        buf = 0;
+                        if (1 != i2c_master_send(&c,&buf,1))
+                                dprintk(1,"Unable to enable ir
receiver.\n");
+		}
 		rc = i2c_master_recv(&c,&buf,0);
 		dprintk(1,"probe 0x%02x @ %s: %s\n",
 			probe[i], adap->name,
diff -u -N -r v4l-dvb.ori/linux/drivers/media/video/saa7134/saa7134-cards.c
v4l-dvb/linux/drivers/media/video/saa7134/saa7134-cards.c
--- v4l-dvb.ori/linux/drivers/media/video/saa7134/saa7134-cards.c
2006-09-15 22:59:46.000000000 +0200
+++ v4l-dvb/linux/drivers/media/video/saa7134/saa7134-cards.c	2006-12-01
01:07:29.000000000 +0100
@@ -3800,6 +3800,7 @@
 	/* i2c remotes */
 	case SAA7134_BOARD_PINNACLE_PCTV_110i:
 	case SAA7134_BOARD_UPMOST_PURPLE_TV:
+	case SAA7134_BOARD_FLYDVB_TRIO:
 		dev->has_remote = SAA7134_REMOTE_I2C;
 		break;
 	case SAA7134_BOARD_AVERMEDIA_A169_B:
diff -u -N -r v4l-dvb.ori/linux/drivers/media/video/saa7134/saa7134-i2c.c
v4l-dvb/linux/drivers/media/video/saa7134/saa7134-i2c.c
--- v4l-dvb.ori/linux/drivers/media/video/saa7134/saa7134-i2c.c	2006-09-15
22:59:46.000000000 +0200
+++ v4l-dvb/linux/drivers/media/video/saa7134/saa7134-i2c.c	2006-11-30
01:47:23.000000000 +0100
@@ -349,6 +349,7 @@
 	/* Am I an i2c remote control? */
 
 	switch (client->addr) {
+		case 0xb:
 		case 0x7a:
 		case 0x47:
 		{
diff -u -N -r v4l-dvb.ori/linux/drivers/media/video/saa7134/saa7134-input.c
v4l-dvb/linux/drivers/media/video/saa7134/saa7134-input.c
--- v4l-dvb.ori/linux/drivers/media/video/saa7134/saa7134-input.c
2006-09-15 22:59:46.000000000 +0200
+++ v4l-dvb/linux/drivers/media/video/saa7134/saa7134-input.c	2006-12-01
00:03:09.000000000 +0100
@@ -113,6 +113,48 @@
 	return 1;
 }
 
+static int get_key_lifeview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	int gpio;
+
+	unsigned long b;
+
+	/* We need this to access GPIO. Used by the saa_readl macro. */
+	struct saa7134_dev *dev = ir->c.adapter->algo_data;
+	if (dev == NULL) {
+		dprintk ("ir->c.adapter->algo_data is NULL!\n");
+		return -EIO;
+	}
+
+	/* rising SAA7134_GPIO_GPRESCAN reads the status */
+	saa_clearb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN);
+	saa_setb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN);
+
+	gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
+
+	if (0x40000 &~ gpio)
+	    return 0;       /* No button press */
+
+	/* No button press - only before first key pressed */
+	if (b == 0xFF)
+	    return 0;
+
+	/* poll IR chip */
+	b = 0;
+	if (1 != i2c_master_send(&ir->c,(char *)&b,1)) {
+		i2cdprintk("send wake up byte to pic16C505 failed\n");
+		return -EIO;
+	}
+	if (1 != i2c_master_recv(&ir->c,(char *)&b,1)) {
+		i2cdprintk("read error\n");
+		return -EIO;
+	}
+
+	*ir_key = b;
+	*ir_raw = b;
+	return 1;
+}
+
 void saa7134_input_irq(struct saa7134_dev *dev)
 {
 	struct saa7134_ir *ir = dev->remote;
@@ -346,6 +388,11 @@
 		ir->get_key   = get_key_purpletv;
 		ir->ir_codes  = ir_codes_purpletv;
 		break;
+	case SAA7134_BOARD_FLYDVB_TRIO:
+		snprintf(ir->c.name, sizeof(ir->c.name), "Lifeview");
+		ir->get_key   = get_key_lifeview;
+		ir->ir_codes  = ir_codes_flydvb;
+		break;
 	default:
 		dprintk("Shouldn't get here: Unknown board %x for I2C
IR?\n",dev->board);
 		break;

Attachment: flydvb_trio_remote_final.diff
Description: Binary data

Attachment: lircd.conf
Description: Binary data

Attachment: lircrc
Description: Binary data

--
video4linux discussion
Unsubscribe mailto:video4linux-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

[Linux Media]     [Older V4L]     [Linux DVB]     [Video Disk Recorder]     [Linux Kernel]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [SSH]     [DVB Maintainers]     [Linux USB]     [Yosemite Information]

Add to Google Powered by Linux