Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c668f32d authored by Jean Delvare's avatar Jean Delvare Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (11844): ir-kbd-i2c: Switch to the new-style device binding model



Let card drivers probe for IR receiver devices and instantiate them if
found. Ultimately it would be better if we could stop probing
completely, but I suspect this won't be possible for all card types.

There's certainly room for cleanups. For example, some drivers are
sharing I2C adapter IDs, so they also had to share the list of I2C
addresses being probed for an IR receiver. Now that each driver
explicitly says which addresses should be probed, maybe some addresses
can be dropped from some drivers.

Also, the special cases in saa7134-i2c should probably be handled on a
per-board basis. This would be more efficient and less risky than always
probing extra addresses on all boards. I'll give it a try later.

Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 1df8e986
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -389,6 +389,27 @@ int __devinit init_bttv_i2c(struct bttv *btv)
	}
	if (0 == btv->i2c_rc && i2c_scan)
		do_i2c_scan(btv->c.v4l2_dev.name, &btv->i2c_client);

	/* Instantiate the IR receiver device, if present */
	if (0 == btv->i2c_rc) {
		struct i2c_board_info info;
		/* The external IR receiver is at i2c address 0x34 (0x35 for
		   reads).  Future Hauppauge cards will have an internal
		   receiver at 0x30 (0x31 for reads).  In theory, both can be
		   fitted, and Hauppauge suggest an external overrides an
		   internal.

		   That's why we probe 0x1a (~0x34) first. CB
		*/
		const unsigned short addr_list[] = {
			0x1a, 0x18, 0x4b, 0x64, 0x30,
			I2C_CLIENT_END
		};

		memset(&info, 0, sizeof(struct i2c_board_info));
		strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
		i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list);
	}
	return btv->i2c_rc;
}

+7 −4
Original line number Diff line number Diff line
@@ -281,13 +281,16 @@ static void cx231xx_config_tuner(struct cx231xx *dev)
}

/* ----------------------------------------------------------------------- */
void cx231xx_set_ir(struct cx231xx *dev, struct IR_i2c *ir)
void cx231xx_register_i2c_ir(struct cx231xx *dev)
{
	if (disable_ir) {
		ir->get_key = NULL;
	if (disable_ir)
		return;

	/* REVISIT: instantiate IR device */
}

void cx231xx_set_ir(struct cx231xx *dev, struct IR_i2c *ir)
{
	/* detect & configure */
	switch (dev->model) {

+3 −0
Original line number Diff line number Diff line
@@ -537,6 +537,9 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)
	if (0 == bus->i2c_rc) {
		if (i2c_scan)
			cx231xx_do_i2c_scan(dev, &bus->i2c_client);

		/* Instantiate the IR receiver device, if present */
		cx231xx_register_i2c_ir(dev);
	} else
		cx231xx_warn("%s: i2c bus %d register FAILED\n",
			     dev->name, bus->nr);
+1 −0
Original line number Diff line number Diff line
@@ -738,6 +738,7 @@ extern void cx231xx_card_setup(struct cx231xx *dev);
extern struct cx231xx_board cx231xx_boards[];
extern struct usb_device_id cx231xx_id_table[];
extern const unsigned int cx231xx_bcount;
void cx231xx_register_i2c_ir(struct cx231xx *dev);
void cx231xx_set_ir(struct cx231xx *dev, struct IR_i2c *ir);
int cx231xx_tuner_callback(void *ptr, int component, int command, int arg);

+12 −0
Original line number Diff line number Diff line
@@ -357,6 +357,18 @@ int cx23885_i2c_register(struct cx23885_i2c *bus)
		printk(KERN_WARNING "%s: i2c bus %d register FAILED\n",
			dev->name, bus->nr);

	/* Instantiate the IR receiver device, if present */
	if (0 == bus->i2c_rc) {
		struct i2c_board_info info;
		const unsigned short addr_list[] = {
			0x6b, I2C_CLIENT_END
		};

		memset(&info, 0, sizeof(struct i2c_board_info));
		strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
		i2c_new_probed_device(&bus->i2c_adap, &info, addr_list);
	}

	return bus->i2c_rc;
}

Loading