diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-05-18 14:49:40 -0400 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2008-05-18 14:49:40 -0400 |
commit | af294867a52bf718df835a688e8c786d550bee26 (patch) | |
tree | 9800d202fd40ba2f8978d3138e28319460038802 /drivers/media/video/saa7115.c | |
parent | 238a871e41ffbd9ba6608cac7c8b74549ac3bb9b (diff) |
i2c: Convert remaining new-style drivers to use module aliasing
Update all the remaining new-style i2c drivers to use standard module
aliasing instead of the old driver_name/type driver matching scheme.
Note that the tuner driver is a bit quirky at the moment, as it
overwrites i2c_client.name with arbitrary strings. We write "tuner"
back on remove, to make sure that driver cycling will work properly,
but there may still be troublesome corner cases.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/media/video/saa7115.c')
-rw-r--r-- | drivers/media/video/saa7115.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index e684108637ad..435c083cc542 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1456,14 +1456,13 @@ static int saa7115_probe(struct i2c_client *client, | |||
1456 | struct saa711x_state *state; | 1456 | struct saa711x_state *state; |
1457 | int i; | 1457 | int i; |
1458 | char name[17]; | 1458 | char name[17]; |
1459 | u8 chip_id; | 1459 | char chip_id; |
1460 | int autodetect = !id || id->driver_data == 1; | ||
1460 | 1461 | ||
1461 | /* Check if the adapter supports the needed features */ | 1462 | /* Check if the adapter supports the needed features */ |
1462 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 1463 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
1463 | return -EIO; | 1464 | return -EIO; |
1464 | 1465 | ||
1465 | snprintf(client->name, sizeof(client->name) - 1, "saa7115"); | ||
1466 | |||
1467 | for (i = 0; i < 0x0f; i++) { | 1466 | for (i = 0; i < 0x0f; i++) { |
1468 | saa711x_write(client, 0, i); | 1467 | saa711x_write(client, 0, i); |
1469 | name[i] = (saa711x_read(client, 0) & 0x0f) + '0'; | 1468 | name[i] = (saa711x_read(client, 0) & 0x0f) + '0'; |
@@ -1472,8 +1471,7 @@ static int saa7115_probe(struct i2c_client *client, | |||
1472 | } | 1471 | } |
1473 | name[i] = '\0'; | 1472 | name[i] = '\0'; |
1474 | 1473 | ||
1475 | saa711x_write(client, 0, 5); | 1474 | chip_id = name[5]; |
1476 | chip_id = saa711x_read(client, 0) & 0x0f; | ||
1477 | 1475 | ||
1478 | /* Check whether this chip is part of the saa711x series */ | 1476 | /* Check whether this chip is part of the saa711x series */ |
1479 | if (memcmp(name, "1f711", 5)) { | 1477 | if (memcmp(name, "1f711", 5)) { |
@@ -1482,8 +1480,14 @@ static int saa7115_probe(struct i2c_client *client, | |||
1482 | return -ENODEV; | 1480 | return -ENODEV; |
1483 | } | 1481 | } |
1484 | 1482 | ||
1485 | snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); | 1483 | /* Safety check */ |
1486 | v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, client->addr << 1, client->adapter->name); | 1484 | if (!autodetect && id->name[6] != chip_id) { |
1485 | v4l_warn(client, "found saa711%c while %s was expected\n", | ||
1486 | chip_id, id->name); | ||
1487 | } | ||
1488 | snprintf(client->name, sizeof(client->name), "saa711%c", chip_id); | ||
1489 | v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name, | ||
1490 | client->addr << 1, client->adapter->name); | ||
1487 | 1491 | ||
1488 | state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); | 1492 | state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); |
1489 | i2c_set_clientdata(client, state); | 1493 | i2c_set_clientdata(client, state); |
@@ -1499,19 +1503,19 @@ static int saa7115_probe(struct i2c_client *client, | |||
1499 | state->hue = 0; | 1503 | state->hue = 0; |
1500 | state->sat = 64; | 1504 | state->sat = 64; |
1501 | switch (chip_id) { | 1505 | switch (chip_id) { |
1502 | case 1: | 1506 | case '1': |
1503 | state->ident = V4L2_IDENT_SAA7111; | 1507 | state->ident = V4L2_IDENT_SAA7111; |
1504 | break; | 1508 | break; |
1505 | case 3: | 1509 | case '3': |
1506 | state->ident = V4L2_IDENT_SAA7113; | 1510 | state->ident = V4L2_IDENT_SAA7113; |
1507 | break; | 1511 | break; |
1508 | case 4: | 1512 | case '4': |
1509 | state->ident = V4L2_IDENT_SAA7114; | 1513 | state->ident = V4L2_IDENT_SAA7114; |
1510 | break; | 1514 | break; |
1511 | case 5: | 1515 | case '5': |
1512 | state->ident = V4L2_IDENT_SAA7115; | 1516 | state->ident = V4L2_IDENT_SAA7115; |
1513 | break; | 1517 | break; |
1514 | case 8: | 1518 | case '8': |
1515 | state->ident = V4L2_IDENT_SAA7118; | 1519 | state->ident = V4L2_IDENT_SAA7118; |
1516 | break; | 1520 | break; |
1517 | default: | 1521 | default: |
@@ -1553,6 +1557,17 @@ static int saa7115_remove(struct i2c_client *client) | |||
1553 | return 0; | 1557 | return 0; |
1554 | } | 1558 | } |
1555 | 1559 | ||
1560 | static const struct i2c_device_id saa7115_id[] = { | ||
1561 | { "saa711x", 1 }, /* autodetect */ | ||
1562 | { "saa7111", 0 }, | ||
1563 | { "saa7113", 0 }, | ||
1564 | { "saa7114", 0 }, | ||
1565 | { "saa7115", 0 }, | ||
1566 | { "saa7118", 0 }, | ||
1567 | { } | ||
1568 | }; | ||
1569 | MODULE_DEVICE_TABLE(i2c, saa7115_id); | ||
1570 | |||
1556 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1571 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1557 | .name = "saa7115", | 1572 | .name = "saa7115", |
1558 | .driverid = I2C_DRIVERID_SAA711X, | 1573 | .driverid = I2C_DRIVERID_SAA711X, |
@@ -1560,5 +1575,6 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
1560 | .probe = saa7115_probe, | 1575 | .probe = saa7115_probe, |
1561 | .remove = saa7115_remove, | 1576 | .remove = saa7115_remove, |
1562 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, | 1577 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, |
1578 | .id_table = saa7115_id, | ||
1563 | }; | 1579 | }; |
1564 | 1580 | ||