diff options
author | Antonio Ospite <ospite@studenti.unina.it> | 2008-12-14 03:48:07 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:39:04 -0500 |
commit | e6e483782772994fe42ef9e8b5b4d6f6376b3d45 (patch) | |
tree | a80a4b28b22d3695cc008c081b89ef2fe3f36478 /drivers/media/video/gspca/ov534.c | |
parent | 15e3209a30c1b4dd52e937388fb3969d06dc33ec (diff) |
V4L/DVB (9883): gspca - ov534: Show sensor ID.
The original version of sccb_read_reg() is from Jim Paris.
NOTE: as it is now reading sensor ID won't work for sensors on different
i2c slave address.
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/ov534.c')
-rw-r--r-- | drivers/media/video/gspca/ov534.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index edcd92557c87..ad97b0be5f39 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c | |||
@@ -149,6 +149,20 @@ static void sccb_reg_write(struct usb_device *udev, u16 reg, u8 val) | |||
149 | PDEBUG(D_ERR, "sccb_reg_write failed"); | 149 | PDEBUG(D_ERR, "sccb_reg_write failed"); |
150 | } | 150 | } |
151 | 151 | ||
152 | static u8 sccb_reg_read(struct usb_device *udev, u16 reg) | ||
153 | { | ||
154 | ov534_reg_write(udev, OV534_REG_SUBADDR, reg); | ||
155 | ov534_reg_write(udev, OV534_REG_OPERATION, OV534_OP_WRITE_2); | ||
156 | if (!sccb_check_status(udev)) | ||
157 | PDEBUG(D_ERR, "sccb_reg_read failed 1"); | ||
158 | |||
159 | ov534_reg_write(udev, OV534_REG_OPERATION, OV534_OP_READ_2); | ||
160 | if (!sccb_check_status(udev)) | ||
161 | PDEBUG(D_ERR, "sccb_reg_read failed 2"); | ||
162 | |||
163 | return ov534_reg_read(udev, OV534_REG_READ); | ||
164 | } | ||
165 | |||
152 | static const __u8 ov534_reg_initdata[][2] = { | 166 | static const __u8 ov534_reg_initdata[][2] = { |
153 | { 0xe7, 0x3a }, | 167 | { 0xe7, 0x3a }, |
154 | 168 | ||
@@ -339,6 +353,9 @@ static void ov534_setup(struct usb_device *udev) | |||
339 | ov534_reg_write(udev, ov534_reg_initdata[i][0], | 353 | ov534_reg_write(udev, ov534_reg_initdata[i][0], |
340 | ov534_reg_initdata[i][1]); | 354 | ov534_reg_initdata[i][1]); |
341 | 355 | ||
356 | PDEBUG(D_PROBE, "sensor is ov%02x%02x", | ||
357 | sccb_reg_read(udev, 0x0a), sccb_reg_read(udev, 0x0b)); | ||
358 | |||
342 | ov534_set_led(udev, 1); | 359 | ov534_set_led(udev, 1); |
343 | 360 | ||
344 | /* Initialize sensor */ | 361 | /* Initialize sensor */ |