All of lore.kernel.org
 help / color / mirror / Atom feed
From: bingbu.cao@intel.com
To: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com
Cc: hdegoede@redhat.com, bingbu.cao@intel.com, bingbu.cao@linux.intel.com
Subject: [PATCH 2/4] media: ov01a10: Enable runtime PM before registering async sub-device
Date: Mon,  6 Nov 2023 16:35:14 +0800	[thread overview]
Message-ID: <20231106083516.763184-3-bingbu.cao@intel.com> (raw)
In-Reply-To: <20231106083516.763184-1-bingbu.cao@intel.com>

From: Bingbu Cao <bingbu.cao@intel.com>

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.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
---
 drivers/media/i2c/ov01a10.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ov01a10.c b/drivers/media/i2c/ov01a10.c
index 2b9e1b3a3bf4..07691c8ac842 100644
--- a/drivers/media/i2c/ov01a10.c
+++ b/drivers/media/i2c/ov01a10.c
@@ -953,17 +953,20 @@ static int ov01a10_probe(struct i2c_client *client)
 		goto err_media_entity_cleanup;
 	}
 
+	pm_runtime_enable(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);
+
 err_media_entity_cleanup:
 	media_entity_cleanup(&ov01a10->sd.entity);
 
-- 
2.42.0


  parent reply	other threads:[~2023-11-06  8:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06  8:35 [PATCH 0/4] Enable sensor's runtime PM before registering async sub-dev bingbu.cao
2023-11-06  8:35 ` [PATCH 1/4] media: imx355: Enable runtime PM before registering async sub-device bingbu.cao
2023-11-06  8:35 ` bingbu.cao [this message]
2023-11-06  8:35 ` [PATCH 3/4] media: ov13b10: " bingbu.cao
2023-11-06  8:35 ` [PATCH 4/4] media: ov9734: " bingbu.cao
2023-11-20  4:14 ` [PATCH 0/4] Enable sensor's runtime PM before registering async sub-dev Bingbu Cao
2023-11-20  6:35   ` Sakari Ailus
2023-11-21  3:03     ` Bingbu Cao
2023-11-21  6:49       ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231106083516.763184-3-bingbu.cao@intel.com \
    --to=bingbu.cao@intel.com \
    --cc=bingbu.cao@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.