From 985ed1d7432eb0a28be190e2b855050cf1f926fd Mon Sep 17 00:00:00 2001 From: Benjamin Mugnier Date: Wed, 1 Feb 2023 15:04:15 +0100 Subject: [PATCH] media: i2c: st-vgxy61: Move 'detect' call to 'power_on' Previously the device detection was performed after patching. Move it right after the reset to make sure we have the correct sensor before trying to patch it. Signed-off-by: Benjamin Mugnier Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/st-vgxy61.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/st-vgxy61.c b/drivers/media/i2c/st-vgxy61.c index 9c0284f..60f7974 100644 --- a/drivers/media/i2c/st-vgxy61.c +++ b/drivers/media/i2c/st-vgxy61.c @@ -1734,6 +1734,12 @@ static int vgxy61_power_on(struct device *dev) } } + ret = vgxy61_detect(sensor); + if (ret) { + dev_err(&client->dev, "sensor detect failed %d\n", ret); + goto disable_clock; + } + ret = vgxy61_patch(sensor); if (ret) { dev_err(&client->dev, "sensor patch failed %d\n", ret); @@ -1860,12 +1866,6 @@ static int vgxy61_probe(struct i2c_client *client) if (ret) return ret; - ret = vgxy61_detect(sensor); - if (ret) { - dev_err(&client->dev, "sensor detect failed %d\n", ret); - return ret; - } - vgxy61_fill_sensor_param(sensor); vgxy61_fill_framefmt(sensor, sensor->current_mode, &sensor->fmt, VGXY61_MEDIA_BUS_FMT_DEF); -- 2.7.4