aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-05-13 15:48:50 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:21:11 -0400
commitc668f32dca105d876e51862a003a302fa61e4ae4 (patch)
tree5a71742ecd4e6a1c48f77977e5e2f6d129ffb566 /drivers/media/video/em28xx
parent1df8e9861cf9fac5737ccb61c7f7fefa77711d40 (diff)
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: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c20
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c3
-rw-r--r--drivers/media/video/em28xx/em28xx-input.c6
-rw-r--r--drivers/media/video/em28xx/em28xx.h1
4 files changed, 22 insertions, 8 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index b2aed29e2d74..edba71115a94 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -1912,13 +1912,23 @@ static int em28xx_hint_board(struct em28xx *dev)
1912} 1912}
1913 1913
1914/* ----------------------------------------------------------------------- */ 1914/* ----------------------------------------------------------------------- */
1915void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir) 1915void em28xx_register_i2c_ir(struct em28xx *dev)
1916{ 1916{
1917 if (disable_ir) { 1917 struct i2c_board_info info;
1918 ir->get_key = NULL; 1918 const unsigned short addr_list[] = {
1919 return ; 1919 0x30, 0x47, I2C_CLIENT_END
1920 } 1920 };
1921
1922 if (disable_ir)
1923 return;
1921 1924
1925 memset(&info, 0, sizeof(struct i2c_board_info));
1926 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
1927 i2c_new_probed_device(&dev->i2c_adap, &info, addr_list);
1928}
1929
1930void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir)
1931{
1922 /* detect & configure */ 1932 /* detect & configure */
1923 switch (dev->model) { 1933 switch (dev->model) {
1924 case (EM2800_BOARD_UNKNOWN): 1934 case (EM2800_BOARD_UNKNOWN):
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index f0bf1d960c75..d90294cbb70d 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -575,6 +575,9 @@ int em28xx_i2c_register(struct em28xx *dev)
575 if (i2c_scan) 575 if (i2c_scan)
576 em28xx_do_i2c_scan(dev); 576 em28xx_do_i2c_scan(dev);
577 577
578 /* Instantiate the IR receiver device, if present */
579 em28xx_register_i2c_ir(dev);
580
578 return 0; 581 return 0;
579} 582}
580 583
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index 7450ba7dee83..7a0fe3816e3d 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -85,7 +85,7 @@ int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
85 unsigned char b; 85 unsigned char b;
86 86
87 /* poll IR chip */ 87 /* poll IR chip */
88 if (1 != i2c_master_recv(&ir->c, &b, 1)) { 88 if (1 != i2c_master_recv(ir->c, &b, 1)) {
89 i2cdprintk("read error\n"); 89 i2cdprintk("read error\n");
90 return -EIO; 90 return -EIO;
91 } 91 }
@@ -114,7 +114,7 @@ int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
114 unsigned char code; 114 unsigned char code;
115 115
116 /* poll IR chip */ 116 /* poll IR chip */
117 if (2 != i2c_master_recv(&ir->c, buf, 2)) 117 if (2 != i2c_master_recv(ir->c, buf, 2))
118 return -EIO; 118 return -EIO;
119 119
120 /* Does eliminate repeated parity code */ 120 /* Does eliminate repeated parity code */
@@ -147,7 +147,7 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
147 147
148 /* poll IR chip */ 148 /* poll IR chip */
149 149
150 if (3 != i2c_master_recv(&ir->c, buf, 3)) { 150 if (3 != i2c_master_recv(ir->c, buf, 3)) {
151 i2cdprintk("read error\n"); 151 i2cdprintk("read error\n");
152 return -EIO; 152 return -EIO;
153 } 153 }
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 58c0ef4a2dce..9c632541df10 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -643,6 +643,7 @@ extern void em28xx_card_setup(struct em28xx *dev);
643extern struct em28xx_board em28xx_boards[]; 643extern struct em28xx_board em28xx_boards[];
644extern struct usb_device_id em28xx_id_table[]; 644extern struct usb_device_id em28xx_id_table[];
645extern const unsigned int em28xx_bcount; 645extern const unsigned int em28xx_bcount;
646void em28xx_register_i2c_ir(struct em28xx *dev);
646void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir); 647void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir);
647int em28xx_tuner_callback(void *ptr, int component, int command, int arg); 648int em28xx_tuner_callback(void *ptr, int component, int command, int arg);
648void em28xx_release_resources(struct em28xx *dev); 649void em28xx_release_resources(struct em28xx *dev);