Skip to contentSkip to conversation

bttv-input: Add a note about PV951 RC

PATCH In review Mauro Carvalho Chehab 3 participants 16 messages Dec 30, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/4 bttv-input: Add a note about PV951 RC

When comparing lirc-i2c and ir-kbd-i2c/bttv-input logic, a difference was noticed. As lirc-i2c will be removed soon, store the difference on a comment inside ir-kbd-i2c, in order to preserve the knowledge we have about that remote controller.

drivers/media/video/bt8xx/bttv-input.c +12 -0
index 7f48306..97793b9 100644
@@ -354,6 +354,18 @@ static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
 		return 0;
 	dprintk(KERN_INFO DEVNAME ": key %02x\n", b);
 
+	/*
+	 * NOTE:
+	 * lirc_i2c maps the pv951 code as:
+	 *	addr = 0x61D6
+	 * 	cmd = bit_reverse (b)
+	 * So, it seems that this device uses NEC extended
+	 * I decided to not fix the table, due to two reasons:
+	 * 	1) Without the actual device, this is only a guess;
+	 * 	2) As the addr is not reported via I2C, nor can be changed,
+	 * 	   the device is bound to the vendor-provided RC.
+	 */
+
 	*ir_key = b;
 	*ir_raw = b;
 	return 1;
Signature · 1 line
1.7.3.4
#2 lore raw

PATCH 2/4 cx88: Add RC logic for Leadtek PVR 2000

In reply to a message not in the archive

Currently, lirc-i2c has a decoding logic for Leadtek Remote Control. Move it to cx88, as we intend to remove lirc-i2c.

For now, initialize LIRC remote keytable with RC_MAP_EMPTY, as we don't know its keymap yet. It would be nice to later check if is there any file on LIRC userspace with that keytable.

drivers/media/video/cx88/cx88-input.c +48 -1
index 4a3bf54..06f7d1d 100644
@@ -68,6 +68,9 @@ MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
 #define ir_dprintk(fmt, arg...)	if (ir_debug) \
 	printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg)
 
+#define dprintk(fmt, arg...)	if (ir_debug) \
+	printk(KERN_DEBUG "cx88 IR: " fmt , ##arg)
+
 /* ---------------------------------------------------------------------- */
 
 static void cx88_ir_handle_key(struct cx88_IR *ir)
@@ -527,13 +530,47 @@ void cx88_ir_irq(struct cx88_core *core)
 	ir_raw_event_handle(ir->dev);
 }
 
+static int get_key_pvr2000(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	int flags, code;
+
+	/* poll IR chip */
+	flags = i2c_smbus_read_byte_data(ir->c, 0x10);
+	if (flags < 0) {
+		dprintk("read error\n");
+		return 0;
+	}
+	/* key pressed ? */
+	if (0 == (flags & 0x80))
+		return 0;
+
+	/* read actual key code */
+	code = i2c_smbus_read_byte_data(ir->c, 0x00);
+	if (code < 0) {
+		dprintk("read error\n");
+		return 0;
+	}
+
+	dprintk("IR Key/Flags: (0x%02x/0x%02x)\n",
+		   code & 0xff, flags & 0xff);
+
+	*ir_key = code & 0xff;
+	*ir_raw = code;
+	return 1;
+}
+
 void cx88_i2c_init_ir(struct cx88_core *core)
 {
 	struct i2c_board_info info;
-	const unsigned short addr_list[] = {
+	const unsigned short default_addr_list[] = {
 		0x18, 0x6b, 0x71,
 		I2C_CLIENT_END
 	};
+	const unsigned short pvr2000_addr_list[] = {
+		0x18, 0x1a,
+		I2C_CLIENT_END
+	};
+	const unsigned short *addr_list = default_addr_list;
 	const unsigned short *addrp;
 	/* Instantiate the IR receiver device, if present */
 	if (0 != core->i2c_rc)
@@ -542,6 +579,16 @@ void cx88_i2c_init_ir(struct cx88_core *core)
 	memset(&info, 0, sizeof(struct i2c_board_info));
 	strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
 
+	switch (core->boardnr) {
+	case CX88_BOARD_LEADTEK_PVR2000:
+		addr_list = pvr2000_addr_list;
+		core->init_data.name = "cx88 Leadtek PVR 2000 remote";
+		core->init_data.type = RC_TYPE_UNKNOWN;
+		core->init_data.get_key = get_key_pvr2000;
+		core->init_data.ir_codes = RC_MAP_EMPTY;
+		break;
+	}
+
 	/*
 	 * We can't call i2c_new_probed_device() because it uses
 	 * quick writes for probing and at least some RC receiver
Signature · 1 line
1.7.3.4
#3 lore raw

PATCH 3/4 ivtv: Add Adaptec Remote Controller

In reply to a message not in the archive

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver.
drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c:   /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410         7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010         8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC                 0x9005
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c:              0x6b,   /* Adaptec IR */

There are two Adaptec cards defined there, but only one has tuner. I never found any device without tuners, but with a remote controllers, so the logic at lirc_i2c seems to be for Adaptec AVC-2410.

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC2410.

drivers/media/video/ivtv/ivtv-i2c.c +33 -1
index 6817092..8d1b016 100644
@@ -94,6 +94,7 @@
 #define IVTV_HAUP_INT_IR_RX_I2C_ADDR 	0x18
 #define IVTV_Z8F0811_IR_TX_I2C_ADDR	0x70
 #define IVTV_Z8F0811_IR_RX_I2C_ADDR	0x71
+#define IVTV_ADAPTEC_IR			0x6b
 
 /* This array should match the IVTV_HW_ defines */
 static const u8 hw_addrs[] = {
@@ -118,6 +119,7 @@ static const u8 hw_addrs[] = {
 	IVTV_HAUP_INT_IR_RX_I2C_ADDR,	/* IVTV_HW_I2C_IR_RX_HAUP_INT */
 	IVTV_Z8F0811_IR_TX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_TX_HAUP */
 	IVTV_Z8F0811_IR_RX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
+	IVTV_ADAPTEC_IR,
 };
 
 /* This array should match the IVTV_HW_ defines */
@@ -145,6 +147,31 @@ static const char * const hw_devicenames[] = {
 	"ir_rx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
 };
 
+static int get_key_adaptec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	unsigned char keybuf[4];
+
+	keybuf[0] = 0x00;
+	i2c_master_send(ir->c, keybuf, 1);
+	/* poll IR chip */
+	if (i2c_master_recv(ir->c, keybuf, sizeof(keybuf)) != sizeof(keybuf)) {
+		return 0;
+	}
+
+	/* key pressed ? */
+	if (keybuf[2] == 0xff)
+		return 0;
+
+	/* remove repeat bit */
+	keybuf[2] &= 0x7f;
+	keybuf[3] |= 0x80;
+
+	*ir_key = (u32) keybuf;
+	*ir_raw = (u32) keybuf;
+
+	return 1;
+}
+
 static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 {
 	struct i2c_board_info info;
@@ -190,6 +217,12 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 		init_data->type = RC_TYPE_RC5;
 		init_data->name = itv->card_name;
 		break;
+	case IVTV_CARD_AVC2410:
+		init_data->ir_codes = RC_MAP_EMPTY;
+		init_data->get_key = get_key_adaptec;
+		init_data->type = RC_TYPE_UNKNOWN;
+		init_data->name = itv->card_name;
+		break;
 	}
 
 	memset(&info, 0, sizeof(struct i2c_board_info));
@@ -219,7 +252,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 		0x1a,	/* Hauppauge IR external - collides with WM8739 */
 		0x18,	/* Hauppauge IR internal */
 		0x71,	/* Hauppauge IR (PVR150) */
-		0x6b,	/* Adaptec IR */
 		I2C_CLIENT_END
 	};
 
Signature · 1 line
1.7.3.4
#4 lore raw

Re: [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller

Quoted 21 lines · On Thursday, December 30, 2010 12:45:09 Mauro Carvalho Chehab wrote:

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver.
drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c:   /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410         7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010         8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC                 0x9005
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c:              0x6b,   /* Adaptec IR */
Quoted 3 lines

There are two Adaptec cards defined there, but only one has tuner. I never found any device without tuners, but with a remote controllers, so the logic at lirc_i2c seems to be for Adaptec AVC-2410.

That's correct. The AVC-2010 does not come with a remote.

Regards,

Hans

Signature · 1 line
Hans Verkuil - video4linux developer - sponsored by Cisco
#5 lore raw

Re: [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller

Em 30-12-2010 09:56, Hans Verkuil escreveu:

Quoted 22 lines · On Thursday, December 30, 2010 12:45:09 Mauro Carvalho Chehab wrote:
Quoted 21 lines

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver.
drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c:   /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410         7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010         8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC                 0x9005
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c:              0x6b,   /* Adaptec IR */
Quoted 5 lines
Quoted 3 lines

There are two Adaptec cards defined there, but only one has tuner. I never found any device without tuners, but with a remote controllers, so the logic at lirc_i2c seems to be for Adaptec AVC-2410.

That's correct. The AVC-2010 does not come with a remote.

Thanks for double checking. I've replaced the comments to:

[media] ivtv: Add Adaptec Remote Controller

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver. drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c: /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c: { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c: .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c: { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c: .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410 7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010 8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC 0x9005
drivers/media/video/ivtv/ivtv-driver.c: "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c: "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c: 0x6b, /* Adaptec IR */

There are two Adaptec cards defined there, but AVC-2010 doesn't have a remote controller. So, the logic at lirc_i2c seems to be for Adaptec AVC-2410.

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC-2410.

I have no means to test the IR with AVC-2410, but I think it is safe to apply this patch, if none of us have this device, as the patch is trivial, and this allows us to remove i2c_adapter.id obsolete field and lirc_i2c, after applying this series, and the tree patches for lirc_zilog that Andy made.

Cheers,
Mauro

#6 lore raw

Re: [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller

Quoted 57 lines · On Thursday, December 30, 2010 13:09:52 Mauro Carvalho Chehab wrote:

Em 30-12-2010 09:56, Hans Verkuil escreveu:

Quoted 22 lines · On Thursday, December 30, 2010 12:45:09 Mauro Carvalho Chehab wrote:
Quoted 21 lines

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver.
drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c:   /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410         7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010         8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC                 0x9005
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c:              0x6b,   /* Adaptec IR */
Quoted 5 lines
Quoted 3 lines

There are two Adaptec cards defined there, but only one has tuner. I never found any device without tuners, but with a remote controllers, so the logic at lirc_i2c seems to be for Adaptec AVC-2410.

That's correct. The AVC-2010 does not come with a remote.

Thanks for double checking. I've replaced the comments to:

[media] ivtv: Add Adaptec Remote Controller

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver. drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c: /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c: { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c: .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c: { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c: .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410 7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010 8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC 0x9005
drivers/media/video/ivtv/ivtv-driver.c: "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c: "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c: 0x6b, /* Adaptec IR */

There are two Adaptec cards defined there, but AVC-2010 doesn't have a remote controller. So, the logic at lirc_i2c seems to be for Adaptec AVC-2410.

Quoted 7 lines

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC-2410.

I have no means to test the IR with AVC-2410, but I think it is safe to apply this patch, if none of us have this device, as the patch is trivial, and this allows us to remove i2c_adapter.id obsolete field and lirc_i2c, after applying this series, and the tree patches for lirc_zilog that Andy made.

I think I have the AVC-2410 but I think you have the remote for it. It's one of the remotes I gave you in San Franscisco.

So that's going to be hard to test :-)

BTW, pending unforseen circumstances I'll be at the ELC in San Francisco again this year.

Regards,

Hans

Signature · 1 line
Hans Verkuil - video4linux developer - sponsored by Cisco
#7 lore raw

Re: [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller

Em 30-12-2010 10:34, Hans Verkuil escreveu:

Quoted 66 lines · On Thursday, December 30, 2010 13:09:52 Mauro Carvalho Chehab wrote:
Quoted 57 lines

Em 30-12-2010 09:56, Hans Verkuil escreveu:

Quoted 22 lines · On Thursday, December 30, 2010 12:45:09 Mauro Carvalho Chehab wrote:
Quoted 21 lines

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver.
drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c:   /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410         7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010         8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC                 0x9005
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c:              0x6b,   /* Adaptec IR */
Quoted 5 lines
Quoted 3 lines

There are two Adaptec cards defined there, but only one has tuner. I never found any device without tuners, but with a remote controllers, so the logic at lirc_i2c seems to be for Adaptec AVC-2410.

That's correct. The AVC-2010 does not come with a remote.

Thanks for double checking. I've replaced the comments to:

[media] ivtv: Add Adaptec Remote Controller

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver. drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c: /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c: { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c: .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c: { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c: .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410 7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010 8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC 0x9005
drivers/media/video/ivtv/ivtv-driver.c: "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c: "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c: 0x6b, /* Adaptec IR */

There are two Adaptec cards defined there, but AVC-2010 doesn't have a remote controller. So, the logic at lirc_i2c seems to be for Adaptec AVC-2410.

Quoted 7 lines

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC-2410.

I have no means to test the IR with AVC-2410, but I think it is safe to apply this patch, if none of us have this device, as the patch is trivial, and this allows us to remove i2c_adapter.id obsolete field and lirc_i2c, after applying this series, and the tree patches for lirc_zilog that Andy made.

Quoted 4 lines

I think I have the AVC-2410 but I think you have the remote for it. It's one of the remotes I gave you in San Franscisco.

So that's going to be hard to test :-)

I'll see if I can identify the AVC RC protocol and its keymap table in Jan.

Quoted 2 lines

BTW, pending unforseen circumstances I'll be at the ELC in San Francisco again this year.

It is a little early to say, but I probably won't be there in 2011.

Cheers,
Mauro

#8 lore raw

Re: [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller

In reply to Mauro Carvalho Chehab
Quoted 21 lines · Mauro Carvalho Chehab

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver.
drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c:   /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410         7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010         8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC                 0x9005
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c:              0x6b,   /* Adaptec IR */
Quoted 8 lines

There are two Adaptec cards defined there, but only one has tuner. I never found any device without tuners, but with a remote controllers, so the logic at lirc_i2c seems to be for Adaptec AVC-2410.

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC2410.

Mauro,

This patch is missing a few things, so it won't work.
The required - and some desired - changes are in the comments below.

drivers/media/video/ivtv/ivtv-i2c.c line 97

Quoted 9 lines
drivers/media/video/ivtv/ivtv-i2c.c +1 -0
index 6817092..8d1b016 100644
@@ -94,6 +94,7 @@
 #define IVTV_HAUP_INT_IR_RX_I2C_ADDR 	0x18
 #define IVTV_Z8F0811_IR_TX_I2C_ADDR	0x70
 #define IVTV_Z8F0811_IR_RX_I2C_ADDR	0x71
+#define IVTV_ADAPTEC_IR			0x6b

For consistency with the other defines for I2C addresses, please rename this to "IVTV_ADAPTEC_IR_I2C_ADDR"

drivers/media/video/ivtv/ivtv-i2c.c static const u8 hw_addrs[] = { · line 123

Quoted 8 lines
drivers/media/video/ivtv/ivtv-i2c.c +1 -0
 /* This array should match the IVTV_HW_ defines */
 static const u8 hw_addrs[] = {
@@ -118,6 +119,7 @@ static const u8 hw_addrs[] = {
 	IVTV_HAUP_INT_IR_RX_I2C_ADDR,	/* IVTV_HW_I2C_IR_RX_HAUP_INT */
 	IVTV_Z8F0811_IR_TX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_TX_HAUP */
 	IVTV_Z8F0811_IR_RX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
+	IVTV_ADAPTEC_IR,
 };

Please add this comment to the right of the new entry: /* IVTV_HW_I2C_IR_RX_ADAPTEC */

You will need to add in ivtv-cards.h:

#define IVTV_HW_I2C_IR_RX_ADAPTEC (1 << 21)

and modify this define in ivtv-cards.h

#define IVTV_HW_IR_RX_ANY (IVTV_HW_I2C_IR_RX_AVER | \
                           IVTV_HW_I2C_IR_RX_HAUP_EXT | \
                           IVTV_HW_I2C_IR_RX_HAUP_INT | \
                           IVTV_HW_Z8F0811_IR_RX_HAUP | \
			   IVTV_HW_I2C_IR_RX_ADAPTEC)

In ivtv-cards.c, for the "ivtv_card_avc2410" entry, you must modify the ".hw_all" to be:

        .hw_all = IVTV_HW_MSP34XX | IVTV_HW_CS53L32A |
                  IVTV_HW_SAA7115 | IVTV_HW_TUNER |
		  IVTV_HW_I2C_IR_RX_ADAPTEC,

drivers/media/video/ivtv/ivtv-i2c.c static const char * const hw_devicenames[] = { · line 148

Quoted 4 lines
drivers/media/video/ivtv/ivtv-i2c.c +0 -0
 /* This array should match the IVTV_HW_ defines */
@@ -145,6 +147,31 @@ static const char * const hw_devicenames[] = {
 	"ir_rx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
 };

To avoid walking off the end of "hw_devicenames[]", you will need to add a new entry to the end of "hw_devicenames[]":

	"ir_video",	/* IVTV_HW_I2C_IR_RX_ADAPTEC */
Quoted 29 lines
drivers/media/video/ivtv/ivtv-i2c.c +25 -0
+static int get_key_adaptec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	unsigned char keybuf[4];
+
+	keybuf[0] = 0x00;
+	i2c_master_send(ir->c, keybuf, 1);
+	/* poll IR chip */
+	if (i2c_master_recv(ir->c, keybuf, sizeof(keybuf)) != sizeof(keybuf)) {
+		return 0;
+	}
+
+	/* key pressed ? */
+	if (keybuf[2] == 0xff)
+		return 0;
+
+	/* remove repeat bit */
+	keybuf[2] &= 0x7f;
+	keybuf[3] |= 0x80;
+
+	*ir_key = (u32) keybuf;
+	*ir_raw = (u32) keybuf;
+
+	return 1;
+}
+
 static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 {
 	struct i2c_board_info info;

drivers/media/video/ivtv/ivtv-i2c.c static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) · line 220

Quoted 4 lines
drivers/media/video/ivtv/ivtv-i2c.c +1 -0
@@ -190,6 +217,12 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 		init_data->type = RC_TYPE_RC5;
 		init_data->name = itv->card_name;
 		break;
+	case IVTV_CARD_AVC2410:

You are switching on a value from a different set. Instead use:

case IVTV_HW_I2C_IR_RX_ADAPTEC:

drivers/media/video/ivtv/ivtv-i2c.c static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) · line 225

Quoted 5 lines
drivers/media/video/ivtv/ivtv-i2c.c +5 -0
+		init_data->ir_codes = RC_MAP_EMPTY;
+		init_data->get_key = get_key_adaptec;
+		init_data->type = RC_TYPE_UNKNOWN;
+		init_data->name = itv->card_name;
+		break;

Please add a /*FIXME */ comment here, so that I will remember to figure out the default keymap and RC protocol type.

Regards,
Andy

Quoted 13 lines
drivers/media/video/ivtv/ivtv-i2c.c +0 -1
 	}
 
 	memset(&info, 0, sizeof(struct i2c_board_info));
@@ -219,7 +252,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 		0x1a,	/* Hauppauge IR external - collides with WM8739 */
 		0x18,	/* Hauppauge IR internal */
 		0x71,	/* Hauppauge IR (PVR150) */
-		0x6b,	/* Adaptec IR */
 		I2C_CLIENT_END
 	};
 
Signature · 1 line
1.7.3.4
#9 lore raw

Re: [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller

Em 30-12-2010 10:36, Andy Walls escreveu:

Quoted 141 lines · Mauro Carvalho Chehab
Quoted 21 lines

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver.
drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c:   /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410         7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010         8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC                 0x9005
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c:              0x6b,   /* Adaptec IR */
Quoted 8 lines

There are two Adaptec cards defined there, but only one has tuner. I never found any device without tuners, but with a remote controllers, so the logic at lirc_i2c seems to be for Adaptec AVC-2410.

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC2410.

Mauro,

This patch is missing a few things, so it won't work.
The required - and some desired - changes are in the comments below.

drivers/media/video/ivtv/ivtv-i2c.c line 97

Quoted 9 lines
drivers/media/video/ivtv/ivtv-i2c.c +1 -0
index 6817092..8d1b016 100644
@@ -94,6 +94,7 @@
 #define IVTV_HAUP_INT_IR_RX_I2C_ADDR 	0x18
 #define IVTV_Z8F0811_IR_TX_I2C_ADDR	0x70
 #define IVTV_Z8F0811_IR_RX_I2C_ADDR	0x71
+#define IVTV_ADAPTEC_IR			0x6b

For consistency with the other defines for I2C addresses, please rename this to "IVTV_ADAPTEC_IR_I2C_ADDR"

drivers/media/video/ivtv/ivtv-i2c.c static const u8 hw_addrs[] = { · line 123

Quoted 8 lines
drivers/media/video/ivtv/ivtv-i2c.c +1 -0
 /* This array should match the IVTV_HW_ defines */
 static const u8 hw_addrs[] = {
@@ -118,6 +119,7 @@ static const u8 hw_addrs[] = {
 	IVTV_HAUP_INT_IR_RX_I2C_ADDR,	/* IVTV_HW_I2C_IR_RX_HAUP_INT */
 	IVTV_Z8F0811_IR_TX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_TX_HAUP */
 	IVTV_Z8F0811_IR_RX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
+	IVTV_ADAPTEC_IR,
 };

Please add this comment to the right of the new entry: /* IVTV_HW_I2C_IR_RX_ADAPTEC */

You will need to add in ivtv-cards.h:

#define IVTV_HW_I2C_IR_RX_ADAPTEC (1 << 21)

and modify this define in ivtv-cards.h

#define IVTV_HW_IR_RX_ANY (IVTV_HW_I2C_IR_RX_AVER | \
                           IVTV_HW_I2C_IR_RX_HAUP_EXT | \
                           IVTV_HW_I2C_IR_RX_HAUP_INT | \
                           IVTV_HW_Z8F0811_IR_RX_HAUP | \
			   IVTV_HW_I2C_IR_RX_ADAPTEC)

In ivtv-cards.c, for the "ivtv_card_avc2410" entry, you must modify the ".hw_all" to be:

        .hw_all = IVTV_HW_MSP34XX | IVTV_HW_CS53L32A |
                  IVTV_HW_SAA7115 | IVTV_HW_TUNER |
		  IVTV_HW_I2C_IR_RX_ADAPTEC,

drivers/media/video/ivtv/ivtv-i2c.c static const char * const hw_devicenames[] = { · line 148

Quoted 4 lines
drivers/media/video/ivtv/ivtv-i2c.c +0 -0
 /* This array should match the IVTV_HW_ defines */
@@ -145,6 +147,31 @@ static const char * const hw_devicenames[] = {
 	"ir_rx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
 };

To avoid walking off the end of "hw_devicenames[]", you will need to add a new entry to the end of "hw_devicenames[]":

	"ir_video",	/* IVTV_HW_I2C_IR_RX_ADAPTEC */
Quoted 29 lines
drivers/media/video/ivtv/ivtv-i2c.c +25 -0
+static int get_key_adaptec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	unsigned char keybuf[4];
+
+	keybuf[0] = 0x00;
+	i2c_master_send(ir->c, keybuf, 1);
+	/* poll IR chip */
+	if (i2c_master_recv(ir->c, keybuf, sizeof(keybuf)) != sizeof(keybuf)) {
+		return 0;
+	}
+
+	/* key pressed ? */
+	if (keybuf[2] == 0xff)
+		return 0;
+
+	/* remove repeat bit */
+	keybuf[2] &= 0x7f;
+	keybuf[3] |= 0x80;
+
+	*ir_key = (u32) keybuf;
+	*ir_raw = (u32) keybuf;
+
+	return 1;
+}
+
 static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 {
 	struct i2c_board_info info;

drivers/media/video/ivtv/ivtv-i2c.c static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) · line 220

Quoted 4 lines
drivers/media/video/ivtv/ivtv-i2c.c +1 -0
@@ -190,6 +217,12 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 		init_data->type = RC_TYPE_RC5;
 		init_data->name = itv->card_name;
 		break;
+	case IVTV_CARD_AVC2410:

You are switching on a value from a different set. Instead use:

case IVTV_HW_I2C_IR_RX_ADAPTEC:

drivers/media/video/ivtv/ivtv-i2c.c static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) · line 225

Quoted 5 lines
drivers/media/video/ivtv/ivtv-i2c.c +5 -0
+		init_data->ir_codes = RC_MAP_EMPTY;
+		init_data->get_key = get_key_adaptec;
+		init_data->type = RC_TYPE_UNKNOWN;
+		init_data->name = itv->card_name;
+		break;

Please add a /*FIXME */ comment here, so that I will remember to figure out the default keymap and RC protocol type.

Quoted 2 lines

Regards,
Andy

Thanks for the review. Version 3 of the patch enclosed.

commit 8576bd14361ec75c91ddfb49cc2df389143cf06a

Author: Mauro Carvalho Chehab <[email protected]>
Date:   Thu Dec 30 09:31:10 2010 -0200

[media] ivtv: Add Adaptec Remote Controller

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver. drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c: /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c: { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c: .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c: { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c: .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410 7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010 8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC 0x9005
drivers/media/video/ivtv/ivtv-driver.c: "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c: "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c: 0x6b, /* Adaptec IR */

There are two Adaptec cards defined there, but AVC-2010 doesn't have a remote controller. So, the logic at lirc_i2c seems to be for Adaptec AVC-2410.

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC-2410.

drivers/media/video/ivtv/ivtv-cards.c +2 -1
index b6f2a2b..145e474 100644
@@ -405,7 +405,8 @@ static const struct ivtv_card ivtv_card_avc2410 = {
 	.hw_audio_ctrl = IVTV_HW_MSP34XX,
 	.hw_muxer = IVTV_HW_CS53L32A,
 	.hw_all = IVTV_HW_MSP34XX | IVTV_HW_CS53L32A |
-		  IVTV_HW_SAA7115 | IVTV_HW_TUNER,
+		  IVTV_HW_SAA7115 | IVTV_HW_TUNER |
+		  IVTV_HW_I2C_IR_RX_ADAPTEC,
 	.video_inputs = {
 		{ IVTV_CARD_INPUT_VID_TUNER,  0, IVTV_SAA71XX_COMPOSITE4 },
 		{ IVTV_CARD_INPUT_SVIDEO1,    1, IVTV_SAA71XX_SVIDEO0    },
drivers/media/video/ivtv/ivtv-cards.h +3 -1
index 78eca99..e6f5c02 100644
@@ -111,6 +111,7 @@
 #define IVTV_HW_I2C_IR_RX_HAUP_INT	(1 << 18)
 #define IVTV_HW_Z8F0811_IR_TX_HAUP	(1 << 19)
 #define IVTV_HW_Z8F0811_IR_RX_HAUP	(1 << 20)
+#define IVTV_HW_I2C_IR_RX_ADAPTEC	(1 << 21)
 
 #define IVTV_HW_Z8F0811_IR_HAUP	(IVTV_HW_Z8F0811_IR_RX_HAUP | \
 				 IVTV_HW_Z8F0811_IR_TX_HAUP)
@@ -120,7 +121,8 @@
 #define IVTV_HW_IR_RX_ANY (IVTV_HW_I2C_IR_RX_AVER | \
 			   IVTV_HW_I2C_IR_RX_HAUP_EXT | \
 			   IVTV_HW_I2C_IR_RX_HAUP_INT | \
-			   IVTV_HW_Z8F0811_IR_RX_HAUP)
+			   IVTV_HW_Z8F0811_IR_RX_HAUP | \
+			   IVTV_HW_I2C_IR_RX_ADAPTEC)
 
 #define IVTV_HW_IR_TX_ANY (IVTV_HW_Z8F0811_IR_TX_HAUP)
 
drivers/media/video/ivtv/ivtv-i2c.c +35 -1
index 6817092..fb0ac68 100644
@@ -94,6 +94,7 @@
 #define IVTV_HAUP_INT_IR_RX_I2C_ADDR 	0x18
 #define IVTV_Z8F0811_IR_TX_I2C_ADDR	0x70
 #define IVTV_Z8F0811_IR_RX_I2C_ADDR	0x71
+#define IVTV_ADAPTEC_IR_ADDR		0x6b
 
 /* This array should match the IVTV_HW_ defines */
 static const u8 hw_addrs[] = {
@@ -118,6 +119,7 @@ static const u8 hw_addrs[] = {
 	IVTV_HAUP_INT_IR_RX_I2C_ADDR,	/* IVTV_HW_I2C_IR_RX_HAUP_INT */
 	IVTV_Z8F0811_IR_TX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_TX_HAUP */
 	IVTV_Z8F0811_IR_RX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
+	IVTV_ADAPTEC_IR_ADDR,		/* IVTV_HW_I2C_IR_RX_ADAPTEC */
 };
 
 /* This array should match the IVTV_HW_ defines */
@@ -143,8 +145,34 @@ static const char * const hw_devicenames[] = {
 	"ir_video",		/* IVTV_HW_I2C_IR_RX_HAUP_INT */
 	"ir_tx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_TX_HAUP */
 	"ir_rx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
+	"ir_adaptec",		/* IVTV_HW_I2C_IR_RX_ADAPTEC */
 };
 
+static int get_key_adaptec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	unsigned char keybuf[4];
+
+	keybuf[0] = 0x00;
+	i2c_master_send(ir->c, keybuf, 1);
+	/* poll IR chip */
+	if (i2c_master_recv(ir->c, keybuf, sizeof(keybuf)) != sizeof(keybuf)) {
+		return 0;
+	}
+
+	/* key pressed ? */
+	if (keybuf[2] == 0xff)
+		return 0;
+
+	/* remove repeat bit */
+	keybuf[2] &= 0x7f;
+	keybuf[3] |= 0x80;
+
+	*ir_key = (u32) keybuf;
+	*ir_raw = (u32) keybuf;
+
+	return 1;
+}
+
 static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 {
 	struct i2c_board_info info;
@@ -190,6 +218,13 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 		init_data->type = RC_TYPE_RC5;
 		init_data->name = itv->card_name;
 		break;
+	case IVTV_HW_I2C_IR_RX_ADAPTEC:
+		init_data->get_key = get_key_adaptec;
+		init_data->name = itv->card_name;
+		/* FIXME: The protocol and RC_MAP needs to be corrected */
+		init_data->ir_codes = RC_MAP_EMPTY;
+		init_data->type = RC_TYPE_UNKNOWN;
+		break;
 	}
 
 	memset(&info, 0, sizeof(struct i2c_board_info));
@@ -219,7 +254,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 		0x1a,	/* Hauppauge IR external - collides with WM8739 */
 		0x18,	/* Hauppauge IR internal */
 		0x71,	/* Hauppauge IR (PVR150) */
-		0x6b,	/* Adaptec IR */
 		I2C_CLIENT_END
 	};
 
Reviewed-by Acked-by
#10 lore raw

Re: [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller

Quoted 4 lines · Mauro Carvalho Chehab

Em 30-12-2010 10:36, Andy Walls escreveu:

Thanks for the review. Version 3 of the patch enclosed.

Still one little mistake that matters, otherwise it looks good. See below...

Quoted 10 lines

commit 8576bd14361ec75c91ddfb49cc2df389143cf06a

Author: Mauro Carvalho Chehab <[email protected]>
Date:   Thu Dec 30 09:31:10 2010 -0200

[media] ivtv: Add Adaptec Remote Controller

/* This array should match the IVTV_HW_ defines */

drivers/media/video/ivtv/ivtv-i2c.c static const char * const hw_devicenames[] = { · line 149

Quoted 5 lines
drivers/media/video/ivtv/ivtv-i2c.c +1 -0
@@ -143,8 +145,34 @@ static const char * const hw_devicenames[] = {
 	"ir_video",		/* IVTV_HW_I2C_IR_RX_HAUP_INT */
 	"ir_tx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_TX_HAUP */
 	"ir_rx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
+	"ir_adaptec",		/* IVTV_HW_I2C_IR_RX_ADAPTEC */
 };

This either needs to be "ir_video", or you need to add "ir_adaptec" to the i2c_device_id[] array in ir-kbd-i2c.c. Otherwise ir-kbd-i2c.c won't claim the device and use it.

Upon fixing that

Regards,
Andy

#11 lore raw

Re: [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller

In reply to Mauro Carvalho Chehab
Quoted 13 lines · Mauro Carvalho Chehab

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC2410.

drivers/media/video/ivtv/ivtv-i2c.c +0 -0
index 6817092..8d1b016 100644
@@ -94,6 +94,7 @@
 #define IVTV_HAUP_INT_IR_RX_I2C_ADDR 	0x18
 #define IVTV_Z8F0811_IR_TX_I2C_ADDR	0x70
 #define IVTV_Z8F0811_IR_RX_I2C_ADDR	0x71

[snip]

drivers/media/video/ivtv/ivtv-i2c.c struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv) · line 254

Quoted 4 lines
drivers/media/video/ivtv/ivtv-i2c.c +0 -0
@@ -219,7 +252,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 		0x1a,	/* Hauppauge IR external - collides with WM8739 */
 		0x18,	/* Hauppauge IR internal */
 		0x71,	/* Hauppauge IR (PVR150) */
                  ^^^^

BTW, since

a. all ivtv cards that have an IR Rx chip at address 0x71 should be accounted for in ivtv-cards.c
b. lirc_i2c is going away
c. lirc_zilog should not be probing devices labeled "ir_video" d. ir-kbd-i2c doesn't have defaults for address 0x71

Can you remove the 0x71 case here while you are making changes?

Thanks,
Andy

#12 lore raw

Re: [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller

Em 30-12-2010 10:46, Andy Walls escreveu:

Quoted 26 lines · Mauro Carvalho Chehab
Quoted 16 lines

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC2410.

drivers/media/video/ivtv/ivtv-i2c.c +0 -0
index 6817092..8d1b016 100644
@@ -94,6 +94,7 @@
 #define IVTV_HAUP_INT_IR_RX_I2C_ADDR 	0x18
 #define IVTV_Z8F0811_IR_TX_I2C_ADDR	0x70
 #define IVTV_Z8F0811_IR_RX_I2C_ADDR	0x71

[snip]

drivers/media/video/ivtv/ivtv-i2c.c struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv) · line 254

Quoted 4 lines
drivers/media/video/ivtv/ivtv-i2c.c +0 -0
@@ -219,7 +252,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 		0x1a,	/* Hauppauge IR external - collides with WM8739 */
 		0x18,	/* Hauppauge IR internal */
 		0x71,	/* Hauppauge IR (PVR150) */
                  ^^^^

BTW, since

Quoted 7 lines

a. all ivtv cards that have an IR Rx chip at address 0x71 should be accounted for in ivtv-cards.c
b. lirc_i2c is going away
c. lirc_zilog should not be probing devices labeled "ir_video" d. ir-kbd-i2c doesn't have defaults for address 0x71

Can you remove the 0x71 case here while you are making changes?

Sure. Patch enclosed.

Btw, I think we should remove ivtv_i2c_new_ir_legacy, or rename it. The only remaining case there is the standard non-Z8 Hauppauge IR I2C decoder.

Thanks,
Mauro

-

commit 615a80d8f744677bc79b33811c5f671fa7fe1976

Author: Mauro Carvalho Chehab <[email protected]>
Date:   Thu Dec 30 11:25:12 2010 -0200

ivtv-i2c: Don't use IR legacy mode for Zilog IR

The Zilog IR entries are already handled by IR new code. So, remove its usage from the legacy IR support.

drivers/media/video/ivtv/ivtv-i2c.c +0 -1
index fb0ac68..d121389 100644
@@ -253,7 +253,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 	const unsigned short addr_list[] = {
 		0x1a,	/* Hauppauge IR external - collides with WM8739 */
 		0x18,	/* Hauppauge IR internal */
-		0x71,	/* Hauppauge IR (PVR150) */
 		I2C_CLIENT_END
 	};
 
Acked-by
#13 lore raw

Re: [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller

Quoted 33 lines · Mauro Carvalho Chehab

Em 30-12-2010 10:46, Andy Walls escreveu:

Quoted 32 lines · Mauro Carvalho Chehab
Quoted 16 lines

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC2410.

drivers/media/video/ivtv/ivtv-i2c.c +0 -0
index 6817092..8d1b016 100644
@@ -94,6 +94,7 @@
 #define IVTV_HAUP_INT_IR_RX_I2C_ADDR 	0x18
 #define IVTV_Z8F0811_IR_TX_I2C_ADDR	0x70
 #define IVTV_Z8F0811_IR_RX_I2C_ADDR	0x71

[snip]

drivers/media/video/ivtv/ivtv-i2c.c struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv) · line 254

Quoted 4 lines
drivers/media/video/ivtv/ivtv-i2c.c +0 -0
@@ -219,7 +252,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 		0x1a,	/* Hauppauge IR external - collides with WM8739 */
 		0x18,	/* Hauppauge IR internal */
 		0x71,	/* Hauppauge IR (PVR150) */
                  ^^^^

BTW, since

a. all ivtv cards that have an IR Rx chip at address 0x71 should be accounted for in ivtv-cards.c
b. lirc_i2c is going away
c. lirc_zilog should not be probing devices labeled "ir_video" d. ir-kbd-i2c doesn't have defaults for address 0x71

Quoted 7 lines
Quoted 1 line

Can you remove the 0x71 case here while you are making changes?

Sure. Patch enclosed.

Btw, I think we should remove ivtv_i2c_new_ir_legacy, or rename it. The only remaining case there is the standard non-Z8 Hauppauge IR I2C decoder.

The "i2c_new_ir" portion of the name means "register a new I2C connected IR controller".

The "_legacy" portion of the name means "probe for an IR device that might exist".

The ivtv driver only does it for ivtv-cards.c entries that don't mention any IR device.

I can't remove it, since some deployed cards models still might need it.

For a rename maybe "ivtv_i2c_probe_unlisted_ir()"?

Quoted 9 lines

Thanks,
Mauro

-

commit 615a80d8f744677bc79b33811c5f671fa7fe1976

Author: Mauro Carvalho Chehab <[email protected]>
Date:   Thu Dec 30 11:25:12 2010 -0200
Quoted 6 lines

ivtv-i2c: Don't use IR legacy mode for Zilog IR

The Zilog IR entries are already handled by IR new code. So, remove its usage from the legacy IR support.

Looks good.

Regards,
Andy

Quoted 12 lines
drivers/media/video/ivtv/ivtv-i2c.c +0 -1
index fb0ac68..d121389 100644
@@ -253,7 +253,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 	const unsigned short addr_list[] = {
 		0x1a,	/* Hauppauge IR external - collides with WM8739 */
 		0x18,	/* Hauppauge IR internal */
-		0x71,	/* Hauppauge IR (PVR150) */
 		I2C_CLIENT_END
 	};
 
#14 lore raw

PATCH v2 1/1 ivtv: Add Adaptec Remote Controller

In reply to Mauro Carvalho Chehab
Quoted 1 line

From f4b19dd8ac2d15666975f262cc1bdf461d48e687 Mon Sep 17 00:00:00 2001

From: Mauro Carvalho Chehab <[email protected]>
Date: Thu, 30 Dec 2010 09:31:10 -0200
Subject: [PATCH] [media] ivtv: Add Adaptec Remote Controller

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver.
drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c:   /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410         7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010         8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC                 0x9005
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c:              0x6b,   /* Adaptec IR */

There are two Adaptec cards defined there, but AVC-2010 doesn't have a remote controller. So, the logic at lirc_i2c seems to be for Adaptec AVC-2410.

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC-2410.

---

v2: Update comment and add a new entry at hw_devicenames table

drivers/media/video/ivtv/ivtv-i2c.c +34 -1
index 6817092..71912ec 100644
@@ -94,6 +94,7 @@
 #define IVTV_HAUP_INT_IR_RX_I2C_ADDR 	0x18
 #define IVTV_Z8F0811_IR_TX_I2C_ADDR	0x70
 #define IVTV_Z8F0811_IR_RX_I2C_ADDR	0x71
+#define IVTV_ADAPTEC_IR			0x6b
 
 /* This array should match the IVTV_HW_ defines */
 static const u8 hw_addrs[] = {
@@ -118,6 +119,7 @@ static const u8 hw_addrs[] = {
 	IVTV_HAUP_INT_IR_RX_I2C_ADDR,	/* IVTV_HW_I2C_IR_RX_HAUP_INT */
 	IVTV_Z8F0811_IR_TX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_TX_HAUP */
 	IVTV_Z8F0811_IR_RX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
+	IVTV_ADAPTEC_IR,
 };
 
 /* This array should match the IVTV_HW_ defines */
@@ -143,8 +145,34 @@ static const char * const hw_devicenames[] = {
 	"ir_video",		/* IVTV_HW_I2C_IR_RX_HAUP_INT */
 	"ir_tx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_TX_HAUP */
 	"ir_rx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
+	"ir_adaptec",
 };
 
+static int get_key_adaptec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	unsigned char keybuf[4];
+
+	keybuf[0] = 0x00;
+	i2c_master_send(ir->c, keybuf, 1);
+	/* poll IR chip */
+	if (i2c_master_recv(ir->c, keybuf, sizeof(keybuf)) != sizeof(keybuf)) {
+		return 0;
+	}
+
+	/* key pressed ? */
+	if (keybuf[2] == 0xff)
+		return 0;
+
+	/* remove repeat bit */
+	keybuf[2] &= 0x7f;
+	keybuf[3] |= 0x80;
+
+	*ir_key = (u32) keybuf;
+	*ir_raw = (u32) keybuf;
+
+	return 1;
+}
+
 static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 {
 	struct i2c_board_info info;
@@ -190,6 +218,12 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 		init_data->type = RC_TYPE_RC5;
 		init_data->name = itv->card_name;
 		break;
+	case IVTV_CARD_AVC2410:
+		init_data->ir_codes = RC_MAP_EMPTY;
+		init_data->get_key = get_key_adaptec;
+		init_data->type = RC_TYPE_UNKNOWN;
+		init_data->name = itv->card_name;
+		break;
 	}
 
 	memset(&info, 0, sizeof(struct i2c_board_info));
@@ -219,7 +253,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 		0x1a,	/* Hauppauge IR external - collides with WM8739 */
 		0x18,	/* Hauppauge IR internal */
 		0x71,	/* Hauppauge IR (PVR150) */
-		0x6b,	/* Adaptec IR */
 		I2C_CLIENT_END
 	};
 
#15 lore raw

Re: [PATCH v2] [media] ivtv: Add Adaptec Remote Controller

Quoted 26 lines · Mauro Carvalho Chehab
Quoted 1 line

From f4b19dd8ac2d15666975f262cc1bdf461d48e687 Mon Sep 17 00:00:00 2001

From: Mauro Carvalho Chehab <[email protected]>
Date: Thu, 30 Dec 2010 09:31:10 -0200
Subject: [PATCH] [media] ivtv: Add Adaptec Remote Controller

lirc-i2c implements a get key logic for the Adaptec Remote Controller, at address 0x6b. The only driver that seems to have an Adaptec device is ivtv:

$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver.
drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c:   /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c:    { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c:    .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410         7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010         8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC                 0x9005
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c:            "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c:              0x6b,   /* Adaptec IR */
Quoted 7 lines

There are two Adaptec cards defined there, but AVC-2010 doesn't have a remote controller. So, the logic at lirc_i2c seems to be for Adaptec AVC-2410.

As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and use it for AVC-2410.

Nak!

See below...

Quoted 26 lines

---

v2: Update comment and add a new entry at hw_devicenames table

drivers/media/video/ivtv/ivtv-i2c.c +2 -0
index 6817092..71912ec 100644
@@ -94,6 +94,7 @@
 #define IVTV_HAUP_INT_IR_RX_I2C_ADDR 	0x18
 #define IVTV_Z8F0811_IR_TX_I2C_ADDR	0x70
 #define IVTV_Z8F0811_IR_RX_I2C_ADDR	0x71
+#define IVTV_ADAPTEC_IR			0x6b
 
 /* This array should match the IVTV_HW_ defines */
 static const u8 hw_addrs[] = {
@@ -118,6 +119,7 @@ static const u8 hw_addrs[] = {
 	IVTV_HAUP_INT_IR_RX_I2C_ADDR,	/* IVTV_HW_I2C_IR_RX_HAUP_INT */
 	IVTV_Z8F0811_IR_TX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_TX_HAUP */
 	IVTV_Z8F0811_IR_RX_I2C_ADDR,	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
+	IVTV_ADAPTEC_IR,
 };
 
 /* This array should match the IVTV_HW_ defines */

drivers/media/video/ivtv/ivtv-i2c.c static const char * const hw_devicenames[] = { · line 149

Quoted 5 lines
drivers/media/video/ivtv/ivtv-i2c.c +1 -0
@@ -143,8 +145,34 @@ static const char * const hw_devicenames[] = {
 	"ir_video",		/* IVTV_HW_I2C_IR_RX_HAUP_INT */
 	"ir_tx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_TX_HAUP */
 	"ir_rx_z8f0811_haup",	/* IVTV_HW_Z8F0811_IR_RX_HAUP */
+	"ir_adaptec",
 };

That won't work. ir-kbd-i2c.c is only looking to bind with devices labeled "ir_video" or "ir_rx_z8f0811_haup".

Quoted 29 lines
drivers/media/video/ivtv/ivtv-i2c.c +25 -0
+static int get_key_adaptec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+	unsigned char keybuf[4];
+
+	keybuf[0] = 0x00;
+	i2c_master_send(ir->c, keybuf, 1);
+	/* poll IR chip */
+	if (i2c_master_recv(ir->c, keybuf, sizeof(keybuf)) != sizeof(keybuf)) {
+		return 0;
+	}
+
+	/* key pressed ? */
+	if (keybuf[2] == 0xff)
+		return 0;
+
+	/* remove repeat bit */
+	keybuf[2] &= 0x7f;
+	keybuf[3] |= 0x80;
+
+	*ir_key = (u32) keybuf;
+	*ir_raw = (u32) keybuf;
+
+	return 1;
+}
+
 static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 {
 	struct i2c_board_info info;

drivers/media/video/ivtv/ivtv-i2c.c static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) · line 221

Quoted 4 lines
drivers/media/video/ivtv/ivtv-i2c.c +1 -0
@@ -190,6 +218,12 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 		init_data->type = RC_TYPE_RC5;
 		init_data->name = itv->card_name;
 		break;
+	case IVTV_CARD_AVC2410:

As I mentioned before, that won't work. Following the function call chain:

	ivtv-driver.c:ivtv_probe()
		ivtv-driver.c:ivtv_load_and_init_modules()
			ivtv-i2c.c:ivtv_i2c_register(..., idx = i)
				ivtv-i2c.c:ivtv_i2c_new_ir(..., hw = 1 << idx, ...) /* Known card IR configurations */
			ivtv-i2c.c:ivtv_i2c_new_ir_legacy()			    /* Legacy probing for IR chips */

The switch on "hw" in ivtv_i2c_new_ir() is switching on these defines at ivtv-cards.h:

        #define IVTV_HW_I2C_IR_RX_AVER          (1 << 16)
        #define IVTV_HW_I2C_IR_RX_HAUP_EXT      (1 << 17) /* External before internal */
        #define IVTV_HW_I2C_IR_RX_HAUP_INT      (1 << 18)
        #define IVTV_HW_Z8F0811_IR_TX_HAUP      (1 << 19)
        #define IVTV_HW_Z8F0811_IR_RX_HAUP      (1 << 20)

You need to add a new one in ivtv-cards.h and fix the Adaptec card entry in ivtv-cards.c or no probe attempt will even be made for the IR unit on the Adaptec card.

The switch statement must operate on a bit flag that corresponds to an I2C device, not "IVTV_CARD_AVC2410", which is en enumerated value for a card model.

Regards,
Andy

Quoted 21 lines
drivers/media/video/ivtv/ivtv-i2c.c +5 -2
+		init_data->ir_codes = RC_MAP_EMPTY;
+		init_data->get_key = get_key_adaptec;
+		init_data->type = RC_TYPE_UNKNOWN;
+		init_data->name = itv->card_name;
+		break;
 	}
 
 	memset(&info, 0, sizeof(struct i2c_board_info));
@@ -219,7 +253,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 		0x1a,	/* Hauppauge IR external - collides with WM8739 */
 		0x18,	/* Hauppauge IR internal */
 		0x71,	/* Hauppauge IR (PVR150) */
-		0x6b,	/* Adaptec IR */
 		I2C_CLIENT_END
 	};
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

PATCH 4/4 Remove staging/lirc/lirc_i2c driver

In reply to a message not in the archive

This driver duplicates the same functionality found at ir-kbd-i2c. There were a few missing key parsers that were added by the previous patches. The only thing left on lirc_i2c driver is the IR parsing for Asus TV-Box and Creative/VisionTek BreakOut-Box. Those devices use pcf8574 chip for IR.

They are old video adapters with TV tuners. Their code were never merged upstream, and they are not chipped anymore. So, it is very unlikely that someone would have interests on porting them to the Linux Kernel.

Due to that, let's remove lirc_i2c, as all the remaining functionality are already mapped via ir-kbd-i2c.

 delete mode 100644 drivers/staging/lirc/lirc_i2c.c
drivers/staging/lirc/Kconfig +0 -7
index be97f7b..cdaff59 100644
@@ -18,13 +18,6 @@ config LIRC_BT829
 	help
 	  Driver for the IR interface on BT829-based hardware
 
-config LIRC_I2C
-	tristate "I2C Based IR Receivers"
-	depends on LIRC && I2C
-	help
-	  Driver for I2C-based IR receivers, such as those commonly
-	  found onboard Hauppauge PVR-150/250/350 video capture cards
-
 config LIRC_IGORPLUGUSB
 	tristate "Igor Cesko's USB IR Receiver"
 	depends on LIRC && USB
drivers/staging/lirc/Makefile +0 -1
index 4da1f33..94af218 100644
@@ -4,7 +4,6 @@
 # Each configuration option enables a list of files.
 
 obj-$(CONFIG_LIRC_BT829)	+= lirc_bt829.o
-obj-$(CONFIG_LIRC_I2C)		+= lirc_i2c.o
 obj-$(CONFIG_LIRC_IGORPLUGUSB)	+= lirc_igorplugusb.o
 obj-$(CONFIG_LIRC_IMON)		+= lirc_imon.o
 obj-$(CONFIG_LIRC_IT87)		+= lirc_it87.o
drivers/staging/lirc/lirc_i2c.c deleted +0 -536

536 lines not on this page · raw message

Signature · 1 line
1.7.3.4