aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-07-17 12:18:31 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:28:17 -0400
commit5daed07401ed27bb2684e803f3f01e3a424ea282 (patch)
tree662980d51a0866a6d5640e7106427376e8466f66
parent03b52c36a38eb72548b9408c497ffabd1519eabe (diff)
V4L/DVB (8379): saa7127: Make device detection optional
The saa7127 driver supports all of SAA7126, SAA7127, SAA7128 and SAA1729 devices. Declare all these devices, so that board drivers can tell which device is present, instead of always relying on auto-detection (which needs to write to the chip, eek!). We still need the detection for ivtv, so a special device name "saa7127_auto" can be used when the caller doesn't know exactly which device is present. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c2
-rw-r--r--drivers/media/video/saa7127.c42
2 files changed, 28 insertions, 16 deletions
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index a1b37ff8669c..af154238fb9a 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -135,7 +135,7 @@ static const u8 hw_addrs[] = {
135static const char * const hw_devicenames[] = { 135static const char * const hw_devicenames[] = {
136 "cx25840", 136 "cx25840",
137 "saa7115", 137 "saa7115",
138 "saa7127", 138 "saa7127_auto", /* saa7127 or saa7129 */
139 "msp3400", 139 "msp3400",
140 "tuner", 140 "tuner",
141 "wm8775", 141 "wm8775",
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index 7ba10e56c609..d0e83fe0ff51 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -666,7 +666,6 @@ static int saa7127_probe(struct i2c_client *client,
666{ 666{
667 struct saa7127_state *state; 667 struct saa7127_state *state;
668 struct v4l2_sliced_vbi_data vbi = { 0, 0, 0, 0 }; /* set to disabled */ 668 struct v4l2_sliced_vbi_data vbi = { 0, 0, 0, 0 }; /* set to disabled */
669 int read_result = 0;
670 669
671 /* Check if the adapter supports the needed features */ 670 /* Check if the adapter supports the needed features */
672 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 671 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -710,20 +709,29 @@ static int saa7127_probe(struct i2c_client *client,
710 saa7127_set_input_type(client, SAA7127_INPUT_TYPE_NORMAL); 709 saa7127_set_input_type(client, SAA7127_INPUT_TYPE_NORMAL);
711 saa7127_set_video_enable(client, 1); 710 saa7127_set_video_enable(client, 1);
712 711
713 /* Detect if it's an saa7129 */ 712 if (id->driver_data) { /* Chip type is already known */
714 read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2); 713 state->ident = id->driver_data;
715 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa); 714 } else { /* Needs detection */
716 if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) { 715 int read_result;
717 v4l_info(client, "saa7129 found @ 0x%x (%s)\n", 716
718 client->addr << 1, client->adapter->name); 717 /* Detect if it's an saa7129 */
719 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result); 718 read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2);
720 saa7127_write_inittab(client, saa7129_init_config_extra); 719 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa);
721 state->ident = V4L2_IDENT_SAA7129; 720 if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) {
722 } else { 721 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2,
723 v4l_info(client, "saa7127 found @ 0x%x (%s)\n", 722 read_result);
724 client->addr << 1, client->adapter->name); 723 state->ident = V4L2_IDENT_SAA7129;
725 state->ident = V4L2_IDENT_SAA7127; 724 strlcpy(client->name, "saa7129", I2C_NAME_SIZE);
725 } else {
726 state->ident = V4L2_IDENT_SAA7127;
727 strlcpy(client->name, "saa7127", I2C_NAME_SIZE);
728 }
726 } 729 }
730
731 v4l_info(client, "%s found @ 0x%x (%s)\n", client->name,
732 client->addr << 1, client->adapter->name);
733 if (state->ident == V4L2_IDENT_SAA7129)
734 saa7127_write_inittab(client, saa7129_init_config_extra);
727 return 0; 735 return 0;
728} 736}
729 737
@@ -740,7 +748,11 @@ static int saa7127_remove(struct i2c_client *client)
740/* ----------------------------------------------------------------------- */ 748/* ----------------------------------------------------------------------- */
741 749
742static struct i2c_device_id saa7127_id[] = { 750static struct i2c_device_id saa7127_id[] = {
743 { "saa7127", 0 }, 751 { "saa7127_auto", 0 }, /* auto-detection */
752 { "saa7126", V4L2_IDENT_SAA7127 },
753 { "saa7127", V4L2_IDENT_SAA7127 },
754 { "saa7128", V4L2_IDENT_SAA7129 },
755 { "saa7129", V4L2_IDENT_SAA7129 },
744 { } 756 { }
745}; 757};
746MODULE_DEVICE_TABLE(i2c, saa7127_id); 758MODULE_DEVICE_TABLE(i2c, saa7127_id);