media: i2c: ov4689: Enable runtime PM before registering sub-device

As the sensor may be accessible right after its async sub-device is
registered, enable runtime PM before doing so.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Mikhail Rudenko 2024-04-16 23:45:16 +01:00 committed by Mauro Carvalho Chehab
parent 5e2974acd9
commit 48f3197a21

View File

@ -875,19 +875,21 @@ static int ov4689_probe(struct i2c_client *client)
goto err_clean_entity;
}
ret = v4l2_async_register_subdev_sensor(sd);
if (ret) {
dev_err(dev, "v4l2 async register subdev failed\n");
goto err_clean_subdev;
}
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
pm_runtime_idle(dev);
ret = v4l2_async_register_subdev_sensor(sd);
if (ret) {
dev_err(dev, "v4l2 async register subdev failed\n");
goto err_clean_subdev_pm;
}
return 0;
err_clean_subdev:
err_clean_subdev_pm:
pm_runtime_disable(dev);
pm_runtime_set_suspended(dev);
v4l2_subdev_cleanup(sd);
err_clean_entity:
media_entity_cleanup(&sd->entity);