public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Bingbu Cao <bingbu.cao@linux.intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Daniel Scally <dan.scally@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Andy Shevchenko <andy@kernel.org>, Kate Hsuan <hpa@redhat.com>,
	Bingbu Cao <bingbu.cao@intel.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 11/12] media: intel-cio2-bridge: Add a runtime-pm device-link between VCM and sensor
Date: Mon, 30 Oct 2023 09:58:09 +0100	[thread overview]
Message-ID: <8ec5d2b6-8f35-48dd-bb09-4e214415d643@redhat.com> (raw)
In-Reply-To: <ZT9vfSpEyVk_pO0H@kekkonen.localdomain>

Hi,

On 10/30/23 09:55, Sakari Ailus wrote:
> Hi Bingbu,
> 
> On Mon, Oct 30, 2023 at 04:30:39PM +0800, Bingbu Cao wrote:
>>> +static void intel_cio2_bridge_instantiate_vcm_work(struct work_struct *_work)
>>> +{
>>> +	struct intel_cio2_bridge_instantiate_vcm_work_data *work =
>>> +		container_of(_work,
>>> +			     struct intel_cio2_bridge_instantiate_vcm_work_data,
>>> +			     work);
>>> +	struct acpi_device *adev = ACPI_COMPANION(work->sensor);
>>> +	struct i2c_client *vcm_client;
>>> +	bool put_fwnode = true;
>>> +	int ret;
>>>  
>>> -	snprintf(name, sizeof(name), "%s-VCM", acpi_dev_name(sensor->adev));
>>> -	board_info.dev_name = name;
>>> -	strscpy(board_info.type, sensor->vcm_type, ARRAY_SIZE(board_info.type));
>>> -	board_info.swnode = &sensor->swnodes[SWNODE_VCM];
>>> -
>>> -	sensor->vcm_i2c_client =
>>> -		i2c_acpi_new_device_by_fwnode(acpi_fwnode_handle(sensor->adev),
>>> -					      1, &board_info);
>>> -	if (IS_ERR(sensor->vcm_i2c_client)) {
>>> -		dev_warn(&sensor->adev->dev, "Error instantiation VCM i2c-client: %ld\n",
>>> -			 PTR_ERR(sensor->vcm_i2c_client));
>>> -		sensor->vcm_i2c_client = NULL;
>>> +	/*
>>> +	 * The client may get probed before the device_link gets added below
>>> +	 * make sure the sensor is powered-up during probe.
>>> +	 */
>>> +	ret = pm_runtime_get_sync(work->sensor);
>>> +	if (ret < 0) {
>>> +		dev_err(work->sensor, "Error %d runtime-resuming sensor, cannot instantiate VCM\n",
>>> +			ret);
>>> +		goto out;
>>>  	}
>>
>> One question here: how do we make sure that the runtime PM of the sensor
>> is enabled during the .bound callback? Or is it a mandatory requirement
>> of driver of such camera sensors?
> 
> The sensor driver needs to enable runtime PM in probe, otherwise this won't
> work. But I don't see why a driver wouldn't? Of course otherwise it
> wouldn't be a hard requirement.

Right. I believe that having runtime pm support is more or less a hard
requirement for sensor drivers used on x86. This is also necessary in
cases where the power on/off sequence is (partially) implemented in
ACPI AML code in the _PS0 and _PS3 methods of the sensor's ACPI device.

This happens on [atom]ISP2 based devices and AFAIK also on ChromeOS
devices.

So I think it is safe to assume that sensor drivers implement runtime
pm support and in cases where the driver does not we need to fix the driver.

Regards,

Hans


  reply	other threads:[~2023-10-30  8:59 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 17:56 [PATCH 00/12] media: intel-cio2-bridge: Add shared intel-cio2-bridge code, rework VCM instantiation Hans de Goede
2023-06-27 17:56 ` [PATCH 01/12] media: ipu3-cio2: Do not use on stack memory for software_node.name field Hans de Goede
2023-06-27 17:56 ` [PATCH 02/12] media: ipu3-cio2: Move initialization of node_names.vcm to cio2_bridge_init_swnode_names() Hans de Goede
2023-06-27 17:56 ` [PATCH 03/12] media: ipu3-cio2: Make cio2_bridge_init() take a regular struct device as argument Hans de Goede
2023-06-27 17:56 ` [PATCH 04/12] media: ipu3-cio2: Store dev pointer in struct cio2_bridge Hans de Goede
2023-06-27 17:56 ` [PATCH 05/12] media: ipu3-cio2: Only keep PLD around while parsing Hans de Goede
2023-06-27 17:56 ` [PATCH 06/12] media: ipu3-cio2: Add a cio2_bridge_parse_sensor_fwnode() helper function Hans de Goede
2023-06-27 20:39   ` Andy Shevchenko
2023-06-27 17:56 ` [PATCH 07/12] media: ipu3-cio2: Add a parse_sensor_fwnode callback to cio2_bridge_init() Hans de Goede
2023-06-27 17:56 ` [PATCH 08/12] media: ipu3-cio2: Add supported_sensors parameter " Hans de Goede
2023-06-27 17:56 ` [PATCH 09/12] media: ipu3-cio2: Move cio2_bridge_init() code into a new shared intel-cio2-bridge.ko Hans de Goede
2023-06-27 20:55   ` Andy Shevchenko
2023-06-28 12:53     ` Dan Scally
2023-06-27 17:56 ` [PATCH 10/12] media: atomisp: csi2-bridge: Switch to new common cio2_bridge_init() Hans de Goede
2023-06-27 17:56 ` [PATCH 11/12] media: intel-cio2-bridge: Add a runtime-pm device-link between VCM and sensor Hans de Goede
2023-06-27 21:03   ` Andy Shevchenko
2023-10-30  8:30   ` Bingbu Cao
2023-10-30  8:55     ` Sakari Ailus
2023-10-30  8:58       ` Hans de Goede [this message]
2023-10-30  9:23         ` Sakari Ailus
2023-11-01  6:26           ` Cao, Bingbu
2023-11-01  7:12             ` Sakari Ailus
2023-11-01  7:38               ` Cao, Bingbu
2023-11-02 13:35                 ` Andy Shevchenko
2023-11-02 13:54                   ` Hans de Goede
2023-11-03  2:01                     ` Bingbu Cao
2023-06-27 17:56 ` [PATCH 12/12] [RFC] media: dw9719: Drop hack to enable "vsio" regulator Hans de Goede
2023-06-27 21:04 ` [PATCH 00/12] media: intel-cio2-bridge: Add shared intel-cio2-bridge code, rework VCM instantiation Andy Shevchenko
2023-06-28  1:19 ` Cao, Bingbu
2023-06-28 13:57   ` Hans de Goede
2023-06-29  8:22     ` Cao, Bingbu
2023-06-29 20:45       ` Hans de Goede
2023-06-30  9:07 ` 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=8ec5d2b6-8f35-48dd-bb09-4e214415d643@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy@kernel.org \
    --cc=bingbu.cao@intel.com \
    --cc=bingbu.cao@linux.intel.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=hpa@redhat.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox