]> err.no Git - linux-2.6/blobdiff - drivers/media/video/ivtv/ivtv-i2c.c
Merge branches 'at91', 'dyntick', 'ep93xx', 'iop', 'ixp', 'misc', 'orion', 'omap...
[linux-2.6] / drivers / media / video / ivtv / ivtv-i2c.c
index fa5ab1eb180005049db0412df19b8279303b7aec..32129f3ea836630e3388ba1ade85b92ee0257b68 100644 (file)
@@ -136,7 +136,7 @@ static const u8 hw_addrs[] = {
 };
 
 /* This array should match the IVTV_HW_ defines */
-static const char * const hw_drivernames[] = {
+static const char * const hw_devicenames[] = {
        "cx25840",
        "saa7115",
        "saa7127",
@@ -145,7 +145,7 @@ static const char * const hw_drivernames[] = {
        "wm8775",
        "cs53l32a",
        "tveeprom",
-       "saa7115",
+       "saa7114",
        "upd64031a",
        "upd64083",
        "saa717x",
@@ -167,7 +167,7 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
                return -1;
        id = hw_driverids[idx];
        memset(&info, 0, sizeof(info));
-       strcpy(info.driver_name, hw_drivernames[idx]);
+       strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
        info.addr = hw_addrs[idx];
        for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {}
 
@@ -177,10 +177,16 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
        }
 
        if (id != I2C_DRIVERID_TUNER) {
-               c = i2c_new_device(&itv->i2c_adap, &info);
-               if (c->driver == NULL)
+               if (id == I2C_DRIVERID_UPD64031A ||
+                   id == I2C_DRIVERID_UPD64083) {
+                       unsigned short addrs[2] = { info.addr, I2C_CLIENT_END };
+
+                       c = i2c_new_probed_device(&itv->i2c_adap, &info, addrs);
+               } else
+                       c = i2c_new_device(&itv->i2c_adap, &info);
+               if (c && c->driver == NULL)
                        i2c_unregister_device(c);
-               else
+               else if (c)
                        itv->i2c_clients[i] = c;
                return itv->i2c_clients[i] ? 0 : -ENODEV;
        }
@@ -650,7 +656,7 @@ static const char *ivtv_i2c_id_name(u32 id)
 
        for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
                if (hw_driverids[i] == id)
-                       return hw_drivernames[i];
+                       return hw_devicenames[i];
        return "unknown device";
 }
 
@@ -661,7 +667,7 @@ static const char *ivtv_i2c_hw_name(u32 hw)
 
        for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
                if (1 << i == hw)
-                       return hw_drivernames[i];
+                       return hw_devicenames[i];
        return "unknown device";
 }
 
@@ -763,7 +769,7 @@ int init_ivtv_i2c(struct ivtv *itv)
         * same size and GPIO must be the last entry.
         */
        if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) ||
-           ARRAY_SIZE(hw_drivernames) != ARRAY_SIZE(hw_addrs) ||
+           ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs) ||
            IVTV_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 1)) ||
            hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) {
                IVTV_ERR("Mismatched I2C hardware arrays\n");