Skip to content

Commit

Permalink
V4L/DVB (9883): gspca - ov534: Show sensor ID.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Antonio Ospite authored and Mauro Carvalho Chehab committed Dec 30, 2008
1 parent 15e3209 commit e6e4837
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions drivers/media/video/gspca/ov534.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,20 @@ static void sccb_reg_write(struct usb_device *udev, u16 reg, u8 val)
PDEBUG(D_ERR, "sccb_reg_write failed");
}

static u8 sccb_reg_read(struct usb_device *udev, u16 reg)
{
ov534_reg_write(udev, OV534_REG_SUBADDR, reg);
ov534_reg_write(udev, OV534_REG_OPERATION, OV534_OP_WRITE_2);
if (!sccb_check_status(udev))
PDEBUG(D_ERR, "sccb_reg_read failed 1");

ov534_reg_write(udev, OV534_REG_OPERATION, OV534_OP_READ_2);
if (!sccb_check_status(udev))
PDEBUG(D_ERR, "sccb_reg_read failed 2");

return ov534_reg_read(udev, OV534_REG_READ);
}

static const __u8 ov534_reg_initdata[][2] = {
{ 0xe7, 0x3a },

Expand Down Expand Up @@ -339,6 +353,9 @@ static void ov534_setup(struct usb_device *udev)
ov534_reg_write(udev, ov534_reg_initdata[i][0],
ov534_reg_initdata[i][1]);

PDEBUG(D_PROBE, "sensor is ov%02x%02x",
sccb_reg_read(udev, 0x0a), sccb_reg_read(udev, 0x0b));

ov534_set_led(udev, 1);

/* Initialize sensor */
Expand Down

0 comments on commit e6e4837

Please sign in to comment.