This is a note to let you know that I've just added the patch titled media: ov01a10: Enable runtime PM before registering async sub-device to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: media-ov01a10-enable-runtime-pm-before-registering-async-sub-device.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 47a78052db51b16e8045524fbf33373b58f1323b Mon Sep 17 00:00:00 2001 From: Bingbu Cao <bingbu.cao@xxxxxxxxx> Date: Wed, 22 Nov 2023 17:46:07 +0800 Subject: media: ov01a10: Enable runtime PM before registering async sub-device From: Bingbu Cao <bingbu.cao@xxxxxxxxx> commit 47a78052db51b16e8045524fbf33373b58f1323b upstream. As the sensor device maybe accessible right after its async sub-device is registered, such as ipu-bridge will try to power up sensor by sensor's client device's runtime PM from the async notifier callback, if runtime PM is not enabled, it will fail. So runtime PM should be ready before its async sub-device is registered and accessible by others. It also sets the runtime PM status to active as the sensor was turned on by i2c-core. Fixes: 0827b58dabff ("media: i2c: add ov01a10 image sensor driver") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Bingbu Cao <bingbu.cao@xxxxxxxxx> Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/media/i2c/ov01a10.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) --- a/drivers/media/i2c/ov01a10.c +++ b/drivers/media/i2c/ov01a10.c @@ -907,6 +907,7 @@ static void ov01a10_remove(struct i2c_cl v4l2_ctrl_handler_free(sd->ctrl_handler); pm_runtime_disable(&client->dev); + pm_runtime_set_suspended(&client->dev); } static int ov01a10_probe(struct i2c_client *client) @@ -953,17 +954,26 @@ static int ov01a10_probe(struct i2c_clie goto err_media_entity_cleanup; } + /* + * Device is already turned on by i2c-core with ACPI domain PM. + * Enable runtime PM and turn off the device. + */ + pm_runtime_set_active(&client->dev); + pm_runtime_enable(dev); + pm_runtime_idle(dev); + ret = v4l2_async_register_subdev_sensor(&ov01a10->sd); if (ret < 0) { dev_err(dev, "Failed to register subdev: %d\n", ret); - goto err_media_entity_cleanup; + goto err_pm_disable; } - pm_runtime_enable(dev); - pm_runtime_idle(dev); - return 0; +err_pm_disable: + pm_runtime_disable(dev); + pm_runtime_set_suspended(&client->dev); + err_media_entity_cleanup: media_entity_cleanup(&ov01a10->sd.entity); Patches currently in stable-queue which might be from bingbu.cao@xxxxxxxxx are queue-6.6/media-ov13b10-enable-runtime-pm-before-registering-async-sub-device.patch queue-6.6/media-imx355-enable-runtime-pm-before-registering-async-sub-device.patch queue-6.6/media-ov01a10-enable-runtime-pm-before-registering-async-sub-device.patch queue-6.6/media-ov9734-enable-runtime-pm-before-registering-async-sub-device.patch