]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
V4L/DVB (13443): ivtv: Defer legacy I2C IR probing until after setup of known I2C...
authorAndy Walls <awalls@radix.net>
Sat, 21 Nov 2009 14:41:33 +0000 (11:41 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Dec 2009 20:41:56 +0000 (18:41 -0200)
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>
drivers/media/video/ivtv/ivtv-driver.c
drivers/media/video/ivtv/ivtv-i2c.c
drivers/media/video/ivtv/ivtv-i2c.h

index 8330fb5c7eb33e05c02dad4587f950d4b937116c..d14f94e254bb773804f158b486748880fdae3b06 100644 (file)
@@ -884,6 +884,9 @@ static void ivtv_load_and_init_modules(struct ivtv *itv)
                        itv->hw_flags |= device;
        }
 
+       /* probe for legacy IR controllers that aren't in card definitions */
+       ivtv_i2c_new_ir_legacy(itv);
+
        if (itv->card->hw_all & IVTV_HW_CX25840)
                itv->sd_video = ivtv_find_hw(itv, IVTV_HW_CX25840);
        else if (itv->card->hw_all & IVTV_HW_SAA717X)
index d4cc3365038e8189ed7627edfff00088fd294785..71a8aa60b3fe5354eacf227dc370cc01be137946 100644 (file)
@@ -149,6 +149,36 @@ static const char * const hw_devicenames[] = {
        "gpio",
 };
 
+/* Instantiate the IR receiver device using probing -- undesirable */
+struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
+{
+       struct i2c_board_info info;
+       /*
+        * The external IR receiver is at i2c address 0x34.
+        * The internal IR receiver is at i2c address 0x30.
+        *
+        * In theory, both can be fitted, and Hauppauge suggests an external
+        * overrides an internal.  That's why we probe 0x1a (~0x34) first. CB
+        *
+        * Some of these addresses we probe may collide with other i2c address
+        * allocations, so this function must be called after all other i2c
+        * devices we care about are registered.
+        */
+       const unsigned short addr_list[] = {
+               0x1a,   /* Hauppauge IR external - collides with WM8739 */
+               0x18,   /* Hauppauge IR internal */
+               0x71,   /* Hauppauge IR (PVR150) */
+               0x64,   /* Pixelview IR */
+               0x30,   /* KNC ONE IR */
+               0x6b,   /* Adaptec IR */
+               I2C_CLIENT_END
+       };
+
+       memset(&info, 0, sizeof(struct i2c_board_info));
+       strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
+       return i2c_new_probed_device(&itv->i2c_adap, &info, addr_list);
+}
+
 int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
 {
        struct v4l2_subdev *sd;
@@ -579,7 +609,7 @@ static struct i2c_client ivtv_i2c_client_template = {
        .name = "ivtv internal",
 };
 
-/* init + register i2c adapter + instantiate IR receiver */
+/* init + register i2c adapter */
 int init_ivtv_i2c(struct ivtv *itv)
 {
        int retval;
@@ -626,32 +656,6 @@ int init_ivtv_i2c(struct ivtv *itv)
        else
                retval = i2c_bit_add_bus(&itv->i2c_adap);
 
-       /* Instantiate the IR receiver device, if present */
-       if (retval == 0) {
-               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,   /* Hauppauge IR external */
-                       0x18,   /* Hauppauge IR internal */
-                       0x71,   /* Hauppauge IR (PVR150) */
-                       0x64,   /* Pixelview IR */
-                       0x30,   /* KNC ONE IR */
-                       0x6b,   /* Adaptec IR */
-                       I2C_CLIENT_END
-               };
-
-               memset(&info, 0, sizeof(struct i2c_board_info));
-               strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
-               i2c_new_probed_device(&itv->i2c_adap, &info, addr_list);
-       }
-
        return retval;
 }
 
index 396928a06a54d1b4bd467b387df499a8a95149c5..9332920ca4ff9ff672fa486473a7a7042049f0bf 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef IVTV_I2C_H
 #define IVTV_I2C_H
 
+struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv);
 int ivtv_i2c_register(struct ivtv *itv, unsigned idx);
 struct v4l2_subdev *ivtv_find_hw(struct ivtv *itv, u32 hw);