Linux Power Management development
 help / color / mirror / Atom feed
From: Beleswar Padhi <b-padhi@ti.com>
To: <gregkh@linuxfoundation.org>, <rafael@kernel.org>,
	<dakr@kernel.org>, <johan@kernel.org>, <pavel@kernel.org>,
	<lenb@kernel.org>, <ulfh@kernel.org>
Cc: <sid9.karanam@gmail.com>, <afd@ti.com>, <nm@ti.com>,
	<vigneshr@ti.com>, <u-kumar1@ti.com>, <b-padhi@ti.com>,
	<driver-core@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<linux-pm@vger.kernel.org>
Subject: [RFC PATCH 1/2] PM: domains: Honour PD_FLAG_ATTACH_POWER_ON for genpd
Date: Tue, 27 Oct 2026 19:37:50 +0530	[thread overview]
Message-ID: <20261027140751.2465743-2-b-padhi@ti.com> (raw)
In-Reply-To: <20261027140751.2465743-1-b-padhi@ti.com>

dev_pm_domain_attach() takes PD_FLAG_ATTACH_POWER_ON to let the caller
decide whether the PM domain is powered on during attach. But, only the
ACPI path honours it today. genpd_dev_pm_attach() takes no flags and
always powers on the domain, so a DT based device cannot be attached to
its PM domain without powering it on.

Add a power_on argument to genpd_dev_pm_attach() and pass it on to
__genpd_dev_pm_attach(), which already supports it for the multiple PM
domains case.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
 drivers/base/power/common.c | 5 +++--
 drivers/pmdomain/core.c     | 5 +++--
 include/linux/pm_domain.h   | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index 9bef9248a7052..3263659c58dc8 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -102,14 +102,15 @@ EXPORT_SYMBOL_GPL(dev_pm_put_subsys_data);
  */
 int dev_pm_domain_attach(struct device *dev, u32 flags)
 {
+	bool power_on = !!(flags & PD_FLAG_ATTACH_POWER_ON);
 	int ret;
 
 	if (dev->pm_domain)
 		return 0;
 
-	ret = acpi_dev_pm_attach(dev, !!(flags & PD_FLAG_ATTACH_POWER_ON));
+	ret = acpi_dev_pm_attach(dev, power_on);
 	if (!ret)
-		ret = genpd_dev_pm_attach(dev);
+		ret = genpd_dev_pm_attach(dev, power_on);
 
 	if (dev->pm_domain)
 		dev->power.detach_power_off = !!(flags & PD_FLAG_DETACH_POWER_OFF);
diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index 964e44c2f78f1..785c27491aad5 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -3553,6 +3553,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
 /**
  * genpd_dev_pm_attach - Attach a device to its PM domain using DT.
  * @dev: Device to attach.
+ * @power_on: Whether to power on the PM domain during attach.
  *
  * Parse device's OF node to find a PM domain specifier. If such is found,
  * attaches the device to retrieved pm_domain ops.
@@ -3563,7 +3564,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
  * found or turned on, then return -EPROBE_DEFER to ensure that the device is
  * not probed and to re-try again later.
  */
-int genpd_dev_pm_attach(struct device *dev)
+int genpd_dev_pm_attach(struct device *dev, bool power_on)
 {
 	if (!dev->of_node)
 		return 0;
@@ -3576,7 +3577,7 @@ int genpd_dev_pm_attach(struct device *dev)
 				       "#power-domain-cells") != 1)
 		return 0;
 
-	return __genpd_dev_pm_attach(dev, dev, 0, 1, true);
+	return __genpd_dev_pm_attach(dev, dev, 0, 1, power_on);
 }
 EXPORT_SYMBOL_GPL(genpd_dev_pm_attach);
 
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 14e0e346c610a..010fbfffee39d 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -481,7 +481,7 @@ int of_genpd_add_child_ids(struct device_node *np,
 int of_genpd_remove_child_ids(struct device_node *np,
 			      struct genpd_onecell_data *data);
 
-int genpd_dev_pm_attach(struct device *dev);
+int genpd_dev_pm_attach(struct device *dev, bool power_on);
 struct device *genpd_dev_pm_attach_by_id(struct device *dev,
 					 unsigned int index);
 struct device *genpd_dev_pm_attach_by_name(struct device *dev,
@@ -527,7 +527,7 @@ static inline int of_genpd_parse_idle_states(struct device_node *dn,
 
 static inline void of_genpd_sync_state(struct device_node *np) {}
 
-static inline int genpd_dev_pm_attach(struct device *dev)
+static inline int genpd_dev_pm_attach(struct device *dev, bool power_on)
 {
 	return 0;
 }
-- 
2.34.1


  reply	other threads:[~2026-10-27 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 14:07 [RFC PATCH 0/2] Allow platform drivers to skip PM domain power-on at probe Beleswar Padhi
2026-10-27 14:07 ` Beleswar Padhi [this message]
2026-10-27 14:07 ` [RFC PATCH 2/2] driver core: platform: Allow " Beleswar Padhi

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=20261027140751.2465743-2-b-padhi@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=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