Skip to content

Commit a99a041

Browse files
jwrdegoedemchehab
authored andcommitted
media: ov2680: Read and log sensor revision during probe
Read and log sensor revision during probe. Since this means that the driver will now already log a message on successful probe drop the "ov2680 init correctly" log message. Acked-by: Rui Miguel Silva <[email protected]> Reviewed-by: Daniel Scally <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 1259259 commit a99a041

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/media/i2c/ov2680.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define OV2680_REG_SOFT_RESET CCI_REG8(0x0103)
3434

3535
#define OV2680_REG_CHIP_ID CCI_REG16(0x300a)
36+
#define OV2680_REG_SC_CMMN_SUB_ID CCI_REG8(0x302a)
3637
#define OV2680_REG_PLL_MULTIPLIER CCI_REG16(0x3081)
3738

3839
#define OV2680_REG_EXPOSURE_PK CCI_REG24(0x3500)
@@ -966,13 +967,14 @@ static int ov2680_get_regulators(struct ov2680_dev *sensor)
966967

967968
static int ov2680_check_id(struct ov2680_dev *sensor)
968969
{
969-
u64 chip_id;
970-
int ret;
970+
u64 chip_id, rev;
971+
int ret = 0;
971972

972-
ret = cci_read(sensor->regmap, OV2680_REG_CHIP_ID, &chip_id, NULL);
973+
cci_read(sensor->regmap, OV2680_REG_CHIP_ID, &chip_id, &ret);
974+
cci_read(sensor->regmap, OV2680_REG_SC_CMMN_SUB_ID, &rev, &ret);
973975
if (ret < 0) {
974976
dev_err(sensor->dev, "failed to read chip id\n");
975-
return -ENODEV;
977+
return ret;
976978
}
977979

978980
if (chip_id != OV2680_CHIP_ID) {
@@ -981,6 +983,9 @@ static int ov2680_check_id(struct ov2680_dev *sensor)
981983
return -ENODEV;
982984
}
983985

986+
dev_info(sensor->dev, "sensor_revision id = 0x%llx, rev= %lld\n",
987+
chip_id, rev & 0x0f);
988+
984989
return 0;
985990
}
986991

@@ -1121,8 +1126,6 @@ static int ov2680_probe(struct i2c_client *client)
11211126
pm_runtime_use_autosuspend(&client->dev);
11221127
pm_runtime_put_autosuspend(&client->dev);
11231128

1124-
dev_info(dev, "ov2680 init correctly\n");
1125-
11261129
return 0;
11271130

11281131
err_pm_runtime:

0 commit comments

Comments
 (0)