Linux driver-core infrastructure
 help / color / mirror / Atom feed
From: Beleswar Prasad Padhi <b-padhi@ti.com>
To: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
Cc: <gregkh@linuxfoundation.org>, <rafael@kernel.org>,
	<dakr@kernel.org>, <johan@kernel.org>, <pavel@kernel.org>,
	<lenb@kernel.org>, <ulfh@kernel.org>, <sid9.karanam@gmail.com>,
	<afd@ti.com>, <nm@ti.com>, <vigneshr@ti.com>, <u-kumar1@ti.com>,
	<driver-core@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<linux-pm@vger.kernel.org>
Subject: Re: [PATCH 2/2] driver core: platform: Allow drivers to skip PM domain power-on at probe
Date: Thu, 26 Nov 2026 14:25:29 +0530	[thread overview]
Message-ID: <4b4ebff0-9c30-4541-94fb-4e49edf2bd55@ti.com> (raw)
In-Reply-To: <CAPx+jO9LhihGLHYSFR4Wd8GhOu_AC7tE49OJxrVEVAJyEDHhiw@mail.gmail.com>


On 25/11/26 20:58, Ulf Hansson wrote:
> On Mon, Nov 23, 2026 at 9:43 AM Beleswar Padhi <b-padhi@ti.com> wrote:
>> Currently, platform_probe() attaches the PM domain to the device and
>> powers the domain on before calling the driver's probe. This works for
>> most cases, but would be erroneous for devices that must be configured
>> before they can be powered on.
>>
>> One example is the C66x/C7x remote processors on TI K3 SoCs like AM62A.
>> Such a remote core's local reset must be asserted before the device is
>> powered on, otherwise the core can start running bogus instructions
>> whatever happens to be in its memories at that point.
>>
>> dev_pm_domain_attach() lets its caller skip the power-on by not passing
>> PD_FLAG_ATTACH_POWER_ON. So, add a pm_domain_no_power_on flag to struct
>> platform_driver by which platform drivers can opt out of the power-on
>> at attach. Drivers that set it must power on the PM domain themselves.
>>
>> Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
>> ---
>> No changes since RFC.
>>
>> Link to RFC:
>> https://lore.kernel.org/all/20261027140751.2465743-3-b-padhi@ti.com/
>>
>>  drivers/base/platform.c         | 7 +++++--
>>  include/linux/platform_device.h | 8 ++++++++
>>  2 files changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
>> index 979593e5cca15..6e7b803a50ab2 100644
>> --- a/drivers/base/platform.c
>> +++ b/drivers/base/platform.c
>> @@ -1482,6 +1482,7 @@ static int platform_probe(struct device *_dev)
>>  {
>>         struct platform_driver *drv = to_platform_driver(_dev->driver);
>>         struct platform_device *dev = to_platform_device(_dev);
>> +       u32 pd_flags = PD_FLAG_DETACH_POWER_OFF;
>>         int ret;
>>
>>         /*
>> @@ -1498,8 +1499,10 @@ static int platform_probe(struct device *_dev)
>>         if (ret < 0)
>>                 return ret;
>>
>> -       ret = dev_pm_domain_attach(_dev, PD_FLAG_ATTACH_POWER_ON |
>> -                                        PD_FLAG_DETACH_POWER_OFF);
>> +       if (!drv->pm_domain_no_power_on)
>> +               pd_flags |= PD_FLAG_ATTACH_POWER_ON;
>> +
>> +       ret = dev_pm_domain_attach(_dev, pd_flags);
>>         if (ret)
>>                 goto out;
>>
>> diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
>> index 3bd0f1f0d8704..4d1679c4ea78e 100644
>> --- a/include/linux/platform_device.h
>> +++ b/include/linux/platform_device.h
>> @@ -292,6 +292,14 @@ struct platform_driver {
>>          * to setup and manage their own I/O address space.
>>          */
>>         bool driver_managed_dma;
>> +       /*
>> +        * By default the PM domain of a platform device is powered on before
>> +        * the driver's probe is invoked. Drivers that need to configure the
>> +        * device (e.g. hold it in reset) before its PM domain can be powered
>> +        * on must set this flag, and are then responsible for powering on the
>> +        * PM domain themselves.
>> +        */
> I would appreciate it if we could be more to the point. We should not
> need an entire book to explain what one variable is for. :-)


That's fair, I can do it in v2 :)

I was trying to follow the comment style for "driver_managed_dma" variable.

Thanks,
Beleswar

>
>> +       bool pm_domain_no_power_on;
>>  };
>>
>>  #define to_platform_driver(drv)        (container_of((drv), struct platform_driver, \
>> --
>> 2.34.1
>>
> Kind regards
> Uffe

  reply	other threads:[~2026-11-26  8:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  8:42 [PATCH 0/2] Allow platform drivers to skip PM domain power-on at probe Beleswar Padhi
2026-11-23  8:42 ` [PATCH 1/2] PM: domains: Honour PD_FLAG_ATTACH_POWER_ON for genpd Beleswar Padhi
2026-11-25 12:42   ` Rafael J. Wysocki (Intel)
2026-11-23  8:42 ` [PATCH 2/2] driver core: platform: Allow drivers to skip PM domain power-on at probe Beleswar Padhi
2026-11-25 15:28   ` Ulf Hansson
2026-11-26  8:55     ` Beleswar Prasad Padhi [this message]
2026-11-26 16:03     ` Danilo Krummrich

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=4b4ebff0-9c30-4541-94fb-4e49edf2bd55@ti.com \
    --to=b-padhi@ti.com \
    --cc=afd@ti.com \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=sid9.karanam@gmail.com \
    --cc=u-kumar1@ti.com \
    --cc=ulf.hansson@oss.qualcomm.com \
    --cc=ulfh@kernel.org \
    --cc=vigneshr@ti.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