1 From 18e32b190c3e58cba734073706d5ff0fcd7cbba3 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Mon, 6 Jul 2020 17:51:32 +0100
4 Subject: [PATCH] media: i2c: ov9281: Read chip ID via 2 reads
6 Vision Components have made an OV9281 module which blocks reading
7 back the majority of registers to comply with NDAs, and in doing
8 so doesn't allow auto-increment register reading as used when
11 Use two reads and manually combine the results.
13 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
15 drivers/media/i2c/ov9281.c | 14 +++++++++-----
16 1 file changed, 9 insertions(+), 5 deletions(-)
18 --- a/drivers/media/i2c/ov9281.c
19 +++ b/drivers/media/i2c/ov9281.c
20 @@ -904,13 +904,17 @@ static int ov9281_check_sensor_id(struct
21 struct i2c_client *client)
23 struct device *dev = &ov9281->client->dev;
28 - ret = ov9281_read_reg(client, OV9281_REG_CHIP_ID,
29 - OV9281_REG_VALUE_16BIT, &id);
30 - if (id != CHIP_ID) {
31 - dev_err(dev, "Unexpected sensor id(%06x), ret(%d)\n", id, ret);
32 + ret = ov9281_read_reg(client, OV9281_REG_CHIP_ID + 1,
33 + OV9281_REG_VALUE_08BIT, &id);
35 + ret = ov9281_read_reg(client, OV9281_REG_CHIP_ID,
36 + OV9281_REG_VALUE_08BIT, &id_msb);
37 + id |= (id_msb << 8);
38 + if (ret || id != CHIP_ID) {
39 + dev_err(dev, "Unexpected sensor id(%04x), ret(%d)\n", id, ret);