diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-05 10:06:53 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-05 10:06:53 -0300 |
commit | 9da10a20ba6b92d9756eeaaad204e108b2b214af (patch) | |
tree | cc6367dcee752a561862d059a82e5b8af3a8cf86 | |
parent | 0f339fedba49b4571e77a6e9eada52f4101750a2 (diff) | |
download | mediapointer-dvb-s2-9da10a20ba6b92d9756eeaaad204e108b2b214af.tar.gz mediapointer-dvb-s2-9da10a20ba6b92d9756eeaaad204e108b2b214af.tar.bz2 |
backport I2C changes on several files
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Some I2C API change patches were committed at kernel. Backport those changes to
V4L/DVB tree.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
21 files changed, 286 insertions, 38 deletions
diff --git a/linux/drivers/media/video/cs5345.c b/linux/drivers/media/video/cs5345.c index d7bcb6d9e..d0bdc009d 100644 --- a/linux/drivers/media/video/cs5345.c +++ b/linux/drivers/media/video/cs5345.c @@ -174,11 +174,22 @@ static int cs5345_probe(struct i2c_client *client, /* ----------------------------------------------------------------------- */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id cs5345_id[] = { + { "cs5345", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, cs5345_id); + +#endif static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "cs5345", .driverid = I2C_DRIVERID_CS5345, .command = cs5345_command, .probe = cs5345_probe, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = cs5345_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) diff --git a/linux/drivers/media/video/cs53l32a.c b/linux/drivers/media/video/cs53l32a.c index e98574f42..7c0761e21 100644 --- a/linux/drivers/media/video/cs53l32a.c +++ b/linux/drivers/media/video/cs53l32a.c @@ -156,7 +156,12 @@ static int cs53l32a_probe(struct i2c_client *client, if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); +#else + if (!id) + strlcpy(client->name, "cs53l32a", sizeof(client->name)); +#endif v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); @@ -187,11 +192,22 @@ static int cs53l32a_probe(struct i2c_client *client, return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id cs53l32a_id[] = { + { "cs53l32a", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, cs53l32a_id); + +#endif static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "cs53l32a", .driverid = I2C_DRIVERID_CS53L32A, .command = cs53l32a_command, .probe = cs53l32a_probe, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = cs53l32a_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) diff --git a/linux/drivers/media/video/cx18/cx18-i2c.c b/linux/drivers/media/video/cx18/cx18-i2c.c index 940e3718d..30ec26a61 100644 --- a/linux/drivers/media/video/cx18/cx18-i2c.c +++ b/linux/drivers/media/video/cx18/cx18-i2c.c @@ -74,7 +74,7 @@ static const u8 hw_bus[] = { }; /* This array should match the CX18_HW_ defines */ -static const char * const hw_drivernames[] = { +static const char * const hw_devicenames[] = { "tuner", "tveeprom", "cs5345", @@ -96,8 +96,12 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) id = hw_driverids[idx]; bus = hw_bus[idx]; memset(&info, 0, sizeof(info)); - strlcpy(info.driver_name, hw_drivernames[idx], +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) + strlcpy(info.driver_name, hw_devicenames[idx], sizeof(info.driver_name)); +#else + strlcpy(info.type, hw_devicenames[idx], sizeof(info.type)); +#endif info.addr = hw_addrs[idx]; for (i = 0; i < I2C_CLIENTS_MAX; i++) if (cx->i2c_clients[i] == NULL) @@ -302,7 +306,7 @@ static const char *cx18_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"; } @@ -313,7 +317,7 @@ static const char *cx18_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"; } diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c index e4a25d7cc..e388ca8e8 100644 --- a/linux/drivers/media/video/cx25840/cx25840-core.c +++ b/linux/drivers/media/video/cx25840/cx25840-core.c @@ -1313,10 +1313,21 @@ static int cx25840_remove(struct i2c_client *client) return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id cx25840_id[] = { + { "cx25840", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, cx25840_id); + +#endif static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "cx25840", .driverid = I2C_DRIVERID_CX25840, .command = cx25840_command, .probe = cx25840_probe, .remove = cx25840_remove, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = cx25840_id, +#endif }; diff --git a/linux/drivers/media/video/ivtv/ivtv-i2c.c b/linux/drivers/media/video/ivtv/ivtv-i2c.c index db9243b08..17afb3659 100644 --- a/linux/drivers/media/video/ivtv/ivtv-i2c.c +++ b/linux/drivers/media/video/ivtv/ivtv-i2c.c @@ -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", @@ -168,8 +168,12 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) return -1; id = hw_driverids[idx]; memset(&info, 0, sizeof(info)); - strlcpy(info.driver_name, hw_drivernames[idx], +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) + strlcpy(info.driver_name, hw_devicenames[idx], sizeof(info.driver_name)); +#else + strlcpy(info.type, hw_devicenames[idx], sizeof(info.type)); +#endif info.addr = hw_addrs[idx]; for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {} @@ -686,7 +690,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"; } @@ -697,7 +701,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"; } @@ -799,7 +803,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"); diff --git a/linux/drivers/media/video/m52790.c b/linux/drivers/media/video/m52790.c index 6cca77680..77536ccfc 100644 --- a/linux/drivers/media/video/m52790.c +++ b/linux/drivers/media/video/m52790.c @@ -149,8 +149,10 @@ static int m52790_probe(struct i2c_client *client, if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) snprintf(client->name, sizeof(client->name) - 1, "m52790"); +#endif v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); @@ -173,12 +175,23 @@ static int m52790_remove(struct i2c_client *client) /* ----------------------------------------------------------------------- */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id m52790_id[] = { + { "m52790", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, m52790_id); + +#endif static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "m52790", .driverid = I2C_DRIVERID_M52790, .command = m52790_command, .probe = m52790_probe, .remove = m52790_remove, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = m52790_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c index 4ae9a5acf..5ea4fd801 100644 --- a/linux/drivers/media/video/msp3400-driver.c +++ b/linux/drivers/media/video/msp3400-driver.c @@ -859,7 +859,12 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) int msp_product, msp_prod_hi, msp_prod_lo; int msp_rom; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) snprintf(client->name, sizeof(client->name) - 1, "msp3400"); +#else + if (!id) + strlcpy(client->name, "msp3400", sizeof(client->name)); +#endif if (msp_reset(client) == -1) { v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); @@ -912,9 +917,11 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) msp_revision = (state->rev1 & 0x0f) + '@'; msp_hard = ((state->rev1 >> 8) & 0xff) + '@'; msp_rom = state->rev2 & 0x1f; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d", msp_family, msp_product, msp_revision, msp_hard, msp_rom); +#endif /* Rev B=2, C=3, D=4, G=7 */ state->ident = msp_family * 10000 + 4000 + msp_product * 10 + msp_revision - '@'; @@ -979,7 +986,9 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) } /* hello world :-) */ - v4l_info(client, "%s found @ 0x%x (%s)\n", client->name, + v4l_info(client, "MSP%d4%02d%c-%c%d found @ 0x%x (%s)\n", + msp_family, msp_product, + msp_revision, msp_hard, msp_rom, client->addr << 1, client->adapter->name); v4l_info(client, "%s ", client->name); if (state->has_nicam && state->has_radio) @@ -1057,6 +1066,14 @@ static int msp_remove(struct i2c_client *client) /* ----------------------------------------------------------------------- */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id msp_id[] = { + { "msp3400", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, msp_id); + +#endif static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "msp3400", .driverid = I2C_DRIVERID_MSP3400, @@ -1065,6 +1082,9 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { .remove = msp_remove, .suspend = msp_suspend, .resume = msp_resume, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = msp_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) diff --git a/linux/drivers/media/video/saa7115.c b/linux/drivers/media/video/saa7115.c index b02c43278..fc4c17bbd 100644 --- a/linux/drivers/media/video/saa7115.c +++ b/linux/drivers/media/video/saa7115.c @@ -1467,14 +1467,19 @@ static int saa7115_probe(struct i2c_client *client, struct saa711x_state *state; int i; char name[17]; - u8 chip_id; + char chip_id; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + int autodetect = !id || id->driver_data == 1; +#endif /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) snprintf(client->name, sizeof(client->name) - 1, "saa7115"); +#endif for (i = 0; i < 0x0f; i++) { saa711x_write(client, 0, i); name[i] = (saa711x_read(client, 0) & 0x0f) + '0'; @@ -1483,8 +1488,7 @@ static int saa7115_probe(struct i2c_client *client, } name[i] = '\0'; - saa711x_write(client, 0, 5); - chip_id = saa711x_read(client, 0) & 0x0f; + chip_id = name[5]; /* Check whether this chip is part of the saa711x series */ if (memcmp(name, "1f711", 5)) { @@ -1493,8 +1497,16 @@ static int saa7115_probe(struct i2c_client *client, return -ENODEV; } - snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); - v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, client->addr << 1, client->adapter->name); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + /* Safety check */ + if (!autodetect && id->name[6] != chip_id) { + v4l_warn(client, "found saa711%c while %s was expected\n", + chip_id, id->name); + } +#endif + snprintf(client->name, sizeof(client->name), "saa711%c", chip_id); + v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name, + client->addr << 1, client->adapter->name); state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); i2c_set_clientdata(client, state); @@ -1510,19 +1522,19 @@ static int saa7115_probe(struct i2c_client *client, state->hue = 0; state->sat = 64; switch (chip_id) { - case 1: + case '1': state->ident = V4L2_IDENT_SAA7111; break; - case 3: + case '3': state->ident = V4L2_IDENT_SAA7113; break; - case 4: + case '4': state->ident = V4L2_IDENT_SAA7114; break; - case 5: + case '5': state->ident = V4L2_IDENT_SAA7115; break; - case 8: + case '8': state->ident = V4L2_IDENT_SAA7118; break; default: @@ -1564,6 +1576,19 @@ static int saa7115_remove(struct i2c_client *client) return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id saa7115_id[] = { + { "saa711x", 1 }, /* autodetect */ + { "saa7111", 0 }, + { "saa7113", 0 }, + { "saa7114", 0 }, + { "saa7115", 0 }, + { "saa7118", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, saa7115_id); + +#endif static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "saa7115", .driverid = I2C_DRIVERID_SAA711X, @@ -1573,6 +1598,9 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { #ifdef I2C_CLASS_TV_ANALOG .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = saa7115_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) diff --git a/linux/drivers/media/video/saa7127.c b/linux/drivers/media/video/saa7127.c index 3acc869b7..a73ae00af 100644 --- a/linux/drivers/media/video/saa7127.c +++ b/linux/drivers/media/video/saa7127.c @@ -690,8 +690,10 @@ static int saa7127_probe(struct i2c_client *client, if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) snprintf(client->name, sizeof(client->name) - 1, "saa7127"); +#endif v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", client->addr << 1); @@ -759,12 +761,23 @@ static int saa7127_remove(struct i2c_client *client) /* ----------------------------------------------------------------------- */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static struct i2c_device_id saa7127_id[] = { + { "saa7127", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, saa7127_id); + +#endif static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "saa7127", .driverid = I2C_DRIVERID_SAA7127, .command = saa7127_command, .probe = saa7127_probe, .remove = saa7127_remove, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = saa7127_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) diff --git a/linux/drivers/media/video/saa717x.c b/linux/drivers/media/video/saa717x.c index 98e0ec245..adcc7adc5 100644 --- a/linux/drivers/media/video/saa717x.c +++ b/linux/drivers/media/video/saa717x.c @@ -1442,8 +1442,9 @@ static int saa717x_probe(struct i2c_client *client, if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) snprintf(client->name, sizeof(client->name) - 1, "saa717x"); - +#endif if (saa717x_write(client, 0x5a4, 0xfe) && saa717x_write(client, 0x5a5, 0x0f) && saa717x_write(client, 0x5a6, 0x00) && @@ -1520,6 +1521,14 @@ static int saa717x_remove(struct i2c_client *client) /* ----------------------------------------------------------------------- */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id saa717x_id[] = { + { "saa717x", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, saa717x_id); + +#endif static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "saa717x", .driverid = I2C_DRIVERID_SAA717X, @@ -1529,6 +1538,9 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { #ifdef I2C_CLASS_TV_ANALOG .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = saa717x_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) EXPORT_NO_SYMBOLS; diff --git a/linux/drivers/media/video/tcm825x.c b/linux/drivers/media/video/tcm825x.c index 216638e00..08c7888e5 100644 --- a/linux/drivers/media/video/tcm825x.c +++ b/linux/drivers/media/video/tcm825x.c @@ -891,12 +891,23 @@ static int __exit tcm825x_remove(struct i2c_client *client) return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id tcm825x_id[] = { + { "tcm825x", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, tcm825x_id); +#endif + static struct i2c_driver tcm825x_i2c_driver = { .driver = { .name = TCM825X_NAME, }, .probe = tcm825x_probe, .remove = __exit_p(tcm825x_remove), +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = tcm825x_id, +#endif }; static struct tcm825x_sensor tcm825x = { diff --git a/linux/drivers/media/video/tlv320aic23b.c b/linux/drivers/media/video/tlv320aic23b.c index a7453ed6d..9f96e200c 100644 --- a/linux/drivers/media/video/tlv320aic23b.c +++ b/linux/drivers/media/video/tlv320aic23b.c @@ -175,15 +175,25 @@ static int tlv320aic23b_remove(struct i2c_client *client) } /* ----------------------------------------------------------------------- */ - #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) EXPORT_NO_SYMBOLS; #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id tlv320aic23b_id[] = { + { "tlv320aic23b", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, tlv320aic23b_id); +#endif + static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "tlv320aic23b", .driverid = I2C_DRIVERID_TLV320AIC23B, .command = tlv320aic23b_command, .probe = tlv320aic23b_probe, .remove = tlv320aic23b_remove, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = tlv320aic23b_id, +#endif }; diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 314d89cef..e0228b865 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -100,6 +100,7 @@ struct tuner { unsigned int type; /* chip type id */ unsigned int config; int (*tuner_callback) (void *dev, int command, int arg); + const char *name; }; /* standard i2c insmod options */ @@ -359,13 +360,13 @@ static void tuner_i2c_address_check(struct tuner *t) tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n"); tuner_warn("will soon be dropped. This message indicates that your\n"); tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n", - t->i2c->name, t->i2c->addr); + t->name, t->i2c->addr); tuner_warn("To ensure continued support for your device, please\n"); tuner_warn("send a copy of this message, along with full dmesg\n"); tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n"); tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n"); tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n", - t->i2c->adapter->name, t->i2c->addr, t->type, t->i2c->name); + t->i2c->adapter->name, t->i2c->addr, t->type, t->name); tuner_warn("====================== WARNING! ======================\n"); } @@ -499,19 +500,17 @@ static void set_type(struct i2c_client *c, unsigned int type, if ((NULL == analog_ops->set_params) && (fe_tuner_ops->set_analog_params)) { - strlcpy(t->i2c->name, fe_tuner_ops->info.name, - sizeof(t->i2c->name)); + t->name = fe_tuner_ops->info.name; t->fe.analog_demod_priv = t; memcpy(analog_ops, &tuner_core_ops, sizeof(struct analog_demod_ops)); } else { - strlcpy(t->i2c->name, analog_ops->info.name, - sizeof(t->i2c->name)); + t->name = analog_ops->info.name; } - tuner_dbg("type set to %s\n", t->i2c->name); + tuner_dbg("type set to %s\n", t->name); if (t->mode_mask == T_UNINITIALIZED) t->mode_mask = new_mode_mask; @@ -1159,7 +1158,7 @@ static int tuner_probe(struct i2c_client *client, if (NULL == t) return -ENOMEM; t->i2c = client; - strlcpy(client->name, "(tuner unset)", sizeof(client->name)); + t->name = "(tuner unset)"; i2c_set_clientdata(client, t); t->type = UNSET; t->audmode = V4L2_TUNER_MODE_STEREO; @@ -1326,6 +1325,17 @@ static int tuner_remove(struct i2c_client *client) /* ----------------------------------------------------------------------- */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +/* This driver supports many devices and the idea is to let the driver + detect which device is present. So rather than listing all supported + devices here, we pretend to support a single, fake device type. */ +static const struct i2c_device_id tuner_id[] = { + { "tuner", }, /* autodetect */ + { } +}; +MODULE_DEVICE_TABLE(i2c, tuner_id); +#endif + static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "tuner", .driverid = I2C_DRIVERID_TUNER, @@ -1335,6 +1345,9 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { .suspend = tuner_suspend, .resume = tuner_resume, .legacy_probe = tuner_legacy_probe, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = tuner_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) diff --git a/linux/drivers/media/video/tvaudio.c b/linux/drivers/media/video/tvaudio.c index 7b7cfa3b6..830dbe8db 100644 --- a/linux/drivers/media/video/tvaudio.c +++ b/linux/drivers/media/video/tvaudio.c @@ -1522,7 +1522,12 @@ static int chip_probe(struct i2c_client *client, const struct i2c_device_id *id) } /* fill required data structures */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) strcpy(client->name, desc->name); +#else + if (!id) + strlcpy(client->name, desc->name, I2C_NAME_SIZE); +#endif chip->type = desc-chiplist; chip->shadow.count = desc->registers+1; chip->prevmode = -1; @@ -1858,6 +1863,17 @@ static int chip_legacy_probe(struct i2c_adapter *adap) return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +/* This driver supports many devices and the idea is to let the driver + detect which device is present. So rather than listing all supported + devices here, we pretend to support a single, fake device type. */ +static const struct i2c_device_id chip_id[] = { + { "tvaudio", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, chip_id); +#endif + static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "tvaudio", .driverid = I2C_DRIVERID_TVAUDIO, @@ -1865,6 +1881,9 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { .probe = chip_probe, .remove = chip_remove, .legacy_probe = chip_legacy_probe, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = chip_id, +#endif }; /* diff --git a/linux/drivers/media/video/upd64031a.c b/linux/drivers/media/video/upd64031a.c index 5408309cb..c59944d72 100644 --- a/linux/drivers/media/video/upd64031a.c +++ b/linux/drivers/media/video/upd64031a.c @@ -241,15 +241,25 @@ static int upd64031a_remove(struct i2c_client *client) } /* ----------------------------------------------------------------------- */ - #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) EXPORT_NO_SYMBOLS; #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id upd64031a_id[] = { + { "upd64031a", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, upd64031a_id); +#endif + static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "upd64031a", .driverid = I2C_DRIVERID_UPD64031A, .command = upd64031a_command, .probe = upd64031a_probe, .remove = upd64031a_remove, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = upd64031a_id, +#endif }; diff --git a/linux/drivers/media/video/upd64083.c b/linux/drivers/media/video/upd64083.c index e43cc103f..3dcc5a293 100644 --- a/linux/drivers/media/video/upd64083.c +++ b/linux/drivers/media/video/upd64083.c @@ -218,15 +218,25 @@ static int upd64083_remove(struct i2c_client *client) } /* ----------------------------------------------------------------------- */ - #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) EXPORT_NO_SYMBOLS; #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id upd64083_id[] = { + { "upd64083", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, upd64083_id); +#endif + static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "upd64083", .driverid = I2C_DRIVERID_UPD64083, .command = upd64083_command, .probe = upd64083_probe, .remove = upd64083_remove, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = upd64083_id, +#endif }; diff --git a/linux/drivers/media/video/vp27smpx.c b/linux/drivers/media/video/vp27smpx.c index 28f0cd162..25a69c7f5 100644 --- a/linux/drivers/media/video/vp27smpx.c +++ b/linux/drivers/media/video/vp27smpx.c @@ -144,8 +144,9 @@ static int vp27smpx_probe(struct i2c_client *client, if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) snprintf(client->name, sizeof(client->name) - 1, "vp27smpx"); - +#endif v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); @@ -168,6 +169,14 @@ static int vp27smpx_remove(struct i2c_client *client) /* ----------------------------------------------------------------------- */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id vp27smpx_id[] = { + { "vp27smpx", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, vp27smpx_id); +#endif + static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "vp27smpx", .driverid = I2C_DRIVERID_VP27SMPX, @@ -177,6 +186,9 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { #ifndef I2C_CLASS_TV_ANALOG .legacy_id = I2C_HW_B_CX2341X, #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = vp27smpx_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) diff --git a/linux/drivers/media/video/wm8739.c b/linux/drivers/media/video/wm8739.c index 838444ece..d448dcf6e 100644 --- a/linux/drivers/media/video/wm8739.c +++ b/linux/drivers/media/video/wm8739.c @@ -331,6 +331,14 @@ static int wm8739_remove(struct i2c_client *client) return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id wm8739_id[] = { + { "wm8739", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, wm8739_id); +#endif + static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "wm8739", .driverid = I2C_DRIVERID_WM8739, @@ -340,6 +348,9 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { #ifndef I2C_CLASS_TV_ANALOG .legacy_id = I2C_HW_B_CX2341X, #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = wm8739_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) diff --git a/linux/drivers/media/video/wm8775.c b/linux/drivers/media/video/wm8775.c index d0e47fb22..81a08d674 100644 --- a/linux/drivers/media/video/wm8775.c +++ b/linux/drivers/media/video/wm8775.c @@ -224,12 +224,23 @@ static int wm8775_remove(struct i2c_client *client) return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +static const struct i2c_device_id wm8775_id[] = { + { "wm8775", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, wm8775_id); + +#endif static struct v4l2_i2c_driver_data v4l2_i2c_data = { .name = "wm8775", .driverid = I2C_DRIVERID_WM8775, .command = wm8775_command, .probe = wm8775_probe, .remove = wm8775_remove, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + .id_table = wm8775_id, +#endif }; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) diff --git a/linux/include/media/v4l2-i2c-drv-legacy.h b/linux/include/media/v4l2-i2c-drv-legacy.h index 7494bdcc3..e95e2a072 100644 --- a/linux/include/media/v4l2-i2c-drv-legacy.h +++ b/linux/include/media/v4l2-i2c-drv-legacy.h @@ -35,6 +35,9 @@ struct v4l2_i2c_driver_data { #else int legacy_id; #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + const struct i2c_device_id *id_table; +#endif }; static struct v4l2_i2c_driver_data v4l2_i2c_data; @@ -167,9 +170,7 @@ static struct i2c_driver v4l2_i2c_driver = { .resume = v4l2_i2c_drv_resume_helper, }; #endif - - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) static int compat_legacy_probe(struct i2c_client *client) { return v4l2_i2c_data.probe(client, NULL); @@ -212,6 +213,9 @@ static int __init v4l2_i2c_drv_init(void) v4l2_i2c_driver.probe = compat_legacy_probe; #endif v4l2_i2c_driver.remove = v4l2_i2c_data.remove; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + v4l2_i2c_driver.id_table = v4l2_i2c_data.id_table; +#endif err = i2c_add_driver(&v4l2_i2c_driver); if (err) i2c_del_driver(&v4l2_i2c_driver_legacy); diff --git a/linux/include/media/v4l2-i2c-drv.h b/linux/include/media/v4l2-i2c-drv.h index 5b4959620..73d713f07 100644 --- a/linux/include/media/v4l2-i2c-drv.h +++ b/linux/include/media/v4l2-i2c-drv.h @@ -40,18 +40,20 @@ struct v4l2_i2c_driver_data { #else int legacy_id; #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + const struct i2c_device_id *id_table; +#endif }; static struct v4l2_i2c_driver_data v4l2_i2c_data; static struct i2c_driver v4l2_i2c_driver; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) static int compat_legacy_probe(struct i2c_client *client) { return v4l2_i2c_data.probe(client, NULL); } #endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) /* Bus-based I2C implementation for kernels >= 2.6.22 */ @@ -69,6 +71,9 @@ static int __init v4l2_i2c_drv_init(void) v4l2_i2c_driver.remove = v4l2_i2c_data.remove; v4l2_i2c_driver.suspend = v4l2_i2c_data.suspend; v4l2_i2c_driver.resume = v4l2_i2c_data.resume; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + v4l2_i2c_driver.id_table = v4l2_i2c_data.id_table; +#endif return i2c_add_driver(&v4l2_i2c_driver); } |