diff options
author | Andy Walls <awalls@radix.net> | 2009-11-21 09:41:33 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:41:56 -0500 |
commit | bfbde8ee56d4a19e2d36a5a24b6dbfd298298bf1 (patch) | |
tree | a51cf805259a3c8661d6261657ed061dc1992d57 /drivers/media/video/ivtv | |
parent | f412d36a8c9f8e40e057b71e80d534ac388e903e (diff) |
V4L/DVB (13443): ivtv: Defer legacy I2C IR probing until after setup of known I2C devices
This avoids collisions of legacy IR controller probing with known I2C devices
in the card definitions in ivtv-cards.c. I2C driver modules for device listed
explicitly in a card definition should always take precedence over a probe
guessing where and IR controller may be.
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.c | 3 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-i2c.c | 58 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-i2c.h | 1 |
3 files changed, 35 insertions, 27 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index 8330fb5c7eb3..d14f94e254bb 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -884,6 +884,9 @@ static void ivtv_load_and_init_modules(struct ivtv *itv) | |||
884 | itv->hw_flags |= device; | 884 | itv->hw_flags |= device; |
885 | } | 885 | } |
886 | 886 | ||
887 | /* probe for legacy IR controllers that aren't in card definitions */ | ||
888 | ivtv_i2c_new_ir_legacy(itv); | ||
889 | |||
887 | if (itv->card->hw_all & IVTV_HW_CX25840) | 890 | if (itv->card->hw_all & IVTV_HW_CX25840) |
888 | itv->sd_video = ivtv_find_hw(itv, IVTV_HW_CX25840); | 891 | itv->sd_video = ivtv_find_hw(itv, IVTV_HW_CX25840); |
889 | else if (itv->card->hw_all & IVTV_HW_SAA717X) | 892 | else if (itv->card->hw_all & IVTV_HW_SAA717X) |
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index d4cc3365038e..71a8aa60b3fe 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -149,6 +149,36 @@ static const char * const hw_devicenames[] = { | |||
149 | "gpio", | 149 | "gpio", |
150 | }; | 150 | }; |
151 | 151 | ||
152 | /* Instantiate the IR receiver device using probing -- undesirable */ | ||
153 | struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv) | ||
154 | { | ||
155 | struct i2c_board_info info; | ||
156 | /* | ||
157 | * The external IR receiver is at i2c address 0x34. | ||
158 | * The internal IR receiver is at i2c address 0x30. | ||
159 | * | ||
160 | * In theory, both can be fitted, and Hauppauge suggests an external | ||
161 | * overrides an internal. That's why we probe 0x1a (~0x34) first. CB | ||
162 | * | ||
163 | * Some of these addresses we probe may collide with other i2c address | ||
164 | * allocations, so this function must be called after all other i2c | ||
165 | * devices we care about are registered. | ||
166 | */ | ||
167 | const unsigned short addr_list[] = { | ||
168 | 0x1a, /* Hauppauge IR external - collides with WM8739 */ | ||
169 | 0x18, /* Hauppauge IR internal */ | ||
170 | 0x71, /* Hauppauge IR (PVR150) */ | ||
171 | 0x64, /* Pixelview IR */ | ||
172 | 0x30, /* KNC ONE IR */ | ||
173 | 0x6b, /* Adaptec IR */ | ||
174 | I2C_CLIENT_END | ||
175 | }; | ||
176 | |||
177 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
178 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | ||
179 | return i2c_new_probed_device(&itv->i2c_adap, &info, addr_list); | ||
180 | } | ||
181 | |||
152 | int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | 182 | int ivtv_i2c_register(struct ivtv *itv, unsigned idx) |
153 | { | 183 | { |
154 | struct v4l2_subdev *sd; | 184 | struct v4l2_subdev *sd; |
@@ -579,7 +609,7 @@ static struct i2c_client ivtv_i2c_client_template = { | |||
579 | .name = "ivtv internal", | 609 | .name = "ivtv internal", |
580 | }; | 610 | }; |
581 | 611 | ||
582 | /* init + register i2c adapter + instantiate IR receiver */ | 612 | /* init + register i2c adapter */ |
583 | int init_ivtv_i2c(struct ivtv *itv) | 613 | int init_ivtv_i2c(struct ivtv *itv) |
584 | { | 614 | { |
585 | int retval; | 615 | int retval; |
@@ -626,32 +656,6 @@ int init_ivtv_i2c(struct ivtv *itv) | |||
626 | else | 656 | else |
627 | retval = i2c_bit_add_bus(&itv->i2c_adap); | 657 | retval = i2c_bit_add_bus(&itv->i2c_adap); |
628 | 658 | ||
629 | /* Instantiate the IR receiver device, if present */ | ||
630 | if (retval == 0) { | ||
631 | struct i2c_board_info info; | ||
632 | /* The external IR receiver is at i2c address 0x34 (0x35 for | ||
633 | reads). Future Hauppauge cards will have an internal | ||
634 | receiver at 0x30 (0x31 for reads). In theory, both can be | ||
635 | fitted, and Hauppauge suggest an external overrides an | ||
636 | internal. | ||
637 | |||
638 | That's why we probe 0x1a (~0x34) first. CB | ||
639 | */ | ||
640 | const unsigned short addr_list[] = { | ||
641 | 0x1a, /* Hauppauge IR external */ | ||
642 | 0x18, /* Hauppauge IR internal */ | ||
643 | 0x71, /* Hauppauge IR (PVR150) */ | ||
644 | 0x64, /* Pixelview IR */ | ||
645 | 0x30, /* KNC ONE IR */ | ||
646 | 0x6b, /* Adaptec IR */ | ||
647 | I2C_CLIENT_END | ||
648 | }; | ||
649 | |||
650 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
651 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | ||
652 | i2c_new_probed_device(&itv->i2c_adap, &info, addr_list); | ||
653 | } | ||
654 | |||
655 | return retval; | 659 | return retval; |
656 | } | 660 | } |
657 | 661 | ||
diff --git a/drivers/media/video/ivtv/ivtv-i2c.h b/drivers/media/video/ivtv/ivtv-i2c.h index 396928a06a54..9332920ca4ff 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.h +++ b/drivers/media/video/ivtv/ivtv-i2c.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #ifndef IVTV_I2C_H | 21 | #ifndef IVTV_I2C_H |
22 | #define IVTV_I2C_H | 22 | #define IVTV_I2C_H |
23 | 23 | ||
24 | struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv); | ||
24 | int ivtv_i2c_register(struct ivtv *itv, unsigned idx); | 25 | int ivtv_i2c_register(struct ivtv *itv, unsigned idx); |
25 | struct v4l2_subdev *ivtv_find_hw(struct ivtv *itv, u32 hw); | 26 | struct v4l2_subdev *ivtv_find_hw(struct ivtv *itv, u32 hw); |
26 | 27 | ||