Commit f7668162 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (4885): Improve saa711x check

The old code would accept any device on the same i2c address as the
saa711x chips as an saa711x. However, this fails with saa717x chips,
which use that same address and so are misdetected as a saa7111. Now
check whether the chip is really a saa711x model.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 5718bbd2
...@@ -1464,8 +1464,6 @@ static int saa711x_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -1464,8 +1464,6 @@ static int saa711x_attach(struct i2c_adapter *adapter, int address, int kind)
client->driver = &i2c_driver_saa711x; client->driver = &i2c_driver_saa711x;
snprintf(client->name, sizeof(client->name) - 1, "saa7115"); snprintf(client->name, sizeof(client->name) - 1, "saa7115");
v4l_dbg(1, debug, client, "detecting saa7115 client on address 0x%x\n", address << 1);
for (i=0;i<0x0f;i++) { for (i=0;i<0x0f;i++) {
saa711x_write(client, 0, i); saa711x_write(client, 0, i);
name[i] = (saa711x_read(client, 0) &0x0f) +'0'; name[i] = (saa711x_read(client, 0) &0x0f) +'0';
...@@ -1477,6 +1475,13 @@ static int saa711x_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -1477,6 +1475,13 @@ static int saa711x_attach(struct i2c_adapter *adapter, int address, int kind)
saa711x_write(client, 0, 5); saa711x_write(client, 0, 5);
chip_id = saa711x_read(client, 0) & 0x0f; chip_id = saa711x_read(client, 0) & 0x0f;
/* Check whether this chip is part of the saa711x series */
if (memcmp(name, "1f711", 5)) {
v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n",
address << 1, name);
return 0;
}
snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); 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, address << 1, adapter->name); v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, address << 1, adapter->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment