Skip to content

Commit

Permalink
media: i2c: ov9282: Read chip ID via 2 reads
Browse files Browse the repository at this point in the history
Vision Components have made an OV9281 module which blocks reading
back the majority of registers to comply with NDAs, and in doing
so doesn't allow auto-increment register reading as used when
reading the chip ID.

Use two reads and manually combine the results.

Signed-off-by: Dave Stevenson <[email protected]>
  • Loading branch information
6by9 authored and pelwell committed Oct 11, 2023
1 parent b9d35ab commit 57b2721
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/media/i2c/ov9282.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,12 +1078,16 @@ static int ov9282_set_stream(struct v4l2_subdev *sd, int enable)
static int ov9282_detect(struct ov9282 *ov9282)
{
int ret;
u32 val;
u32 val, msb;

ret = ov9282_read_reg(ov9282, OV9282_REG_ID, 2, &val);
ret = ov9282_read_reg(ov9282, OV9282_REG_ID + 1, 1, &val);
if (ret)
return ret;
ret = ov9282_read_reg(ov9282, OV9282_REG_ID, 1, &msb);
if (ret)
return ret;

val |= (msb << 8);
if (val != OV9282_ID) {
dev_err(ov9282->dev, "chip id mismatch: %x!=%x",
OV9282_ID, val);
Expand Down

0 comments on commit 57b2721

Please sign in to comment.