diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-06 04:53:05 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-29 05:16:59 -0500 |
commit | e78567d227ecd40543508342ba39a3dfba5af14f (patch) | |
tree | 9820a8394c1bbf0857794e295b225ea5fbc63fdf /drivers/media/video/gspca/sn9c20x.c | |
parent | dd89aec47325a251eeaf39ee4b84adb521270cba (diff) |
[media] gspca/sn9c20x: Test if sensor is a OV sensor
Instead of just assuming a ov9650 sensor based on USB ID,
double-check it, by reading the sensor ID.
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/sn9c20x.c')
-rw-r--r-- | drivers/media/video/gspca/sn9c20x.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 6b155ae3a746..1e0f219188ac 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -1224,8 +1224,17 @@ static int i2c_r2(struct gspca_dev *gspca_dev, u8 reg, u16 *val) | |||
1224 | static int ov9650_init_sensor(struct gspca_dev *gspca_dev) | 1224 | static int ov9650_init_sensor(struct gspca_dev *gspca_dev) |
1225 | { | 1225 | { |
1226 | int i; | 1226 | int i; |
1227 | u16 id; | ||
1227 | struct sd *sd = (struct sd *) gspca_dev; | 1228 | struct sd *sd = (struct sd *) gspca_dev; |
1228 | 1229 | ||
1230 | if (i2c_r2(gspca_dev, 0x1c, &id) < 0) | ||
1231 | return -EINVAL; | ||
1232 | |||
1233 | if (id != 0x7fa2) { | ||
1234 | err("sensor id for ov9650 doesn't match (0x%04x)", id); | ||
1235 | return -ENODEV; | ||
1236 | } | ||
1237 | |||
1229 | for (i = 0; i < ARRAY_SIZE(ov9650_init); i++) { | 1238 | for (i = 0; i < ARRAY_SIZE(ov9650_init); i++) { |
1230 | if (i2c_w1(gspca_dev, ov9650_init[i].reg, | 1239 | if (i2c_w1(gspca_dev, ov9650_init[i].reg, |
1231 | ov9650_init[i].val) < 0) { | 1240 | ov9650_init[i].val) < 0) { |