All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] PM / Domains: Enable name based lookup at attach
@ 2018-06-29 11:04 ` Ulf Hansson
  0 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-06-29 11:04 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm
  Cc: Ulf Hansson, Lucas Stach, Geert Uytterhoeven, Kevin Hilman,
	Viresh Kumar, Jon Hunter, Todor Tomov, linux-arm-msm,
	linux-tegra, Rajendra Nayak, linux-arm-kernel

Recently we added support to manage multiple PM domains per device. Consumer
drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
device with one of its PM domain, by using an index.

Let's extend this to allow the association to be done using a name based
lookup, which follows the similar concept as for other resource types, such as
clocks for example.

Ulf Hansson (3):
  PM / Domains: dt: Add a power-domain-names property
  PM / Domains: Introduce option to attach a device by name to genpd
  PM / Domains: Introduce dev_pm_domain_attach_by_name()

 .../bindings/power/power_domain.txt           |  8 +++++++
 drivers/base/power/common.c                   | 17 +++++++++++++
 drivers/base/power/domain.c                   | 24 +++++++++++++++++++
 include/linux/pm_domain.h                     | 15 ++++++++++++
 4 files changed, 64 insertions(+)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 0/3] PM / Domains: Enable name based lookup at attach
@ 2018-06-29 11:04 ` Ulf Hansson
  0 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-06-29 11:04 UTC (permalink / raw)
  To: linux-arm-kernel

Recently we added support to manage multiple PM domains per device. Consumer
drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
device with one of its PM domain, by using an index.

Let's extend this to allow the association to be done using a name based
lookup, which follows the similar concept as for other resource types, such as
clocks for example.

Ulf Hansson (3):
  PM / Domains: dt: Add a power-domain-names property
  PM / Domains: Introduce option to attach a device by name to genpd
  PM / Domains: Introduce dev_pm_domain_attach_by_name()

 .../bindings/power/power_domain.txt           |  8 +++++++
 drivers/base/power/common.c                   | 17 +++++++++++++
 drivers/base/power/domain.c                   | 24 +++++++++++++++++++
 include/linux/pm_domain.h                     | 15 ++++++++++++
 4 files changed, 64 insertions(+)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/3] PM / Domains: dt: Add a power-domain-names property
  2018-06-29 11:04 ` Ulf Hansson
@ 2018-06-29 11:04   ` Ulf Hansson
  -1 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-06-29 11:04 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm
  Cc: Ulf Hansson, Lucas Stach, Geert Uytterhoeven, Kevin Hilman,
	Viresh Kumar, Jon Hunter, Todor Tomov, linux-arm-msm,
	linux-tegra, Rajendra Nayak, linux-arm-kernel

Let's add a power-domain-names property, to allow consumer drivers to match
the power-domains specifiers via a list of power domain names. This follows
the same concept as for other similar DT bindings.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 Documentation/devicetree/bindings/power/power_domain.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 9b387f861aed..4d6bc8829468 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -114,18 +114,26 @@ Required properties:
  - power-domains : A list of PM domain specifiers, as defined by bindings of
 		the power controller that is the PM domain provider.
 
+Optional properties:
+ - power-domain-names : A list of power domain name strings sorted in the same
+		order as the power-domains property. Consumers drivers will use
+		power-domain-names to match power domains with power-domains
+		specifiers.
+
 Example:
 
 	leaky-device@12350000 {
 		compatible = "foo,i-leak-current";
 		reg = <0x12350000 0x1000>;
 		power-domains = <&power 0>;
+		power-domain-names = "io";
 	};
 
 	leaky-device@12351000 {
 		compatible = "foo,i-leak-current";
 		reg = <0x12351000 0x1000>;
 		power-domains = <&power 0>, <&power 1> ;
+		power-domain-names = "io", "clk";
 	};
 
 The first example above defines a typical PM domain consumer device, which is
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 1/3] PM / Domains: dt: Add a power-domain-names property
@ 2018-06-29 11:04   ` Ulf Hansson
  0 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-06-29 11:04 UTC (permalink / raw)
  To: linux-arm-kernel

Let's add a power-domain-names property, to allow consumer drivers to match
the power-domains specifiers via a list of power domain names. This follows
the same concept as for other similar DT bindings.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 Documentation/devicetree/bindings/power/power_domain.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 9b387f861aed..4d6bc8829468 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -114,18 +114,26 @@ Required properties:
  - power-domains : A list of PM domain specifiers, as defined by bindings of
 		the power controller that is the PM domain provider.
 
+Optional properties:
+ - power-domain-names : A list of power domain name strings sorted in the same
+		order as the power-domains property. Consumers drivers will use
+		power-domain-names to match power domains with power-domains
+		specifiers.
+
 Example:
 
 	leaky-device at 12350000 {
 		compatible = "foo,i-leak-current";
 		reg = <0x12350000 0x1000>;
 		power-domains = <&power 0>;
+		power-domain-names = "io";
 	};
 
 	leaky-device at 12351000 {
 		compatible = "foo,i-leak-current";
 		reg = <0x12351000 0x1000>;
 		power-domains = <&power 0>, <&power 1> ;
+		power-domain-names = "io", "clk";
 	};
 
 The first example above defines a typical PM domain consumer device, which is
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/3] PM / Domains: Introduce option to attach a device by name to genpd
  2018-06-29 11:04 ` Ulf Hansson
@ 2018-06-29 11:04   ` Ulf Hansson
  -1 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-06-29 11:04 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm
  Cc: Ulf Hansson, Lucas Stach, Geert Uytterhoeven, Kevin Hilman,
	Viresh Kumar, Jon Hunter, Todor Tomov, linux-arm-msm,
	linux-tegra, Rajendra Nayak, linux-arm-kernel

For the multiple PM domain case, let's introduce a new function called
genpd_dev_pm_attach_by_name(). This allows a device to be associated with
its PM domain through genpd, by using a name based lookup.

Note that, genpd_dev_pm_attach_by_name() shall only be called by the driver
core / PM core, similar to how the existing dev_pm_domain_attach_by_id()
makes use of genpd_dev_pm_attach_by_id(). However, this is implemented by
following changes on top.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/base/power/domain.c | 24 ++++++++++++++++++++++++
 include/linux/pm_domain.h   |  8 ++++++++
 2 files changed, 32 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index c298de8a8308..a70e4b7a3b14 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2372,6 +2372,30 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(genpd_dev_pm_attach_by_id);
 
+/**
+ * genpd_dev_pm_attach_by_name - Associate a device with one of its PM domains.
+ * @dev: The device used to lookup the PM domain.
+ * @name: The name of the PM domain.
+ *
+ * Parse device's OF node to find a PM domain specifier using the
+ * power-domain-names DT property. For further description see
+ * genpd_dev_pm_attach_by_id().
+ */
+struct device *genpd_dev_pm_attach_by_name(struct device *dev, char *name)
+{
+	int index;
+
+	if (!dev->of_node)
+		return NULL;
+
+	index = of_property_match_string(dev->of_node, "power-domain-names",
+					 name);
+	if (index < 0)
+		return NULL;
+
+	return genpd_dev_pm_attach_by_id(dev, index);
+}
+
 static const struct of_device_id idle_state_match[] = {
 	{ .compatible = "domain-idle-state", },
 	{ }
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index cb8d84090cfb..03e14a38462d 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -239,6 +239,8 @@ unsigned int of_genpd_opp_to_performance_state(struct device *dev,
 int genpd_dev_pm_attach(struct device *dev);
 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,
+					   char *name);
 #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
 static inline int of_genpd_add_provider_simple(struct device_node *np,
 					struct generic_pm_domain *genpd)
@@ -290,6 +292,12 @@ static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev,
 	return NULL;
 }
 
+static inline struct device *genpd_dev_pm_attach_by_name(struct device *dev,
+							 char *name)
+{
+	return NULL;
+}
+
 static inline
 struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
 {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/3] PM / Domains: Introduce option to attach a device by name to genpd
@ 2018-06-29 11:04   ` Ulf Hansson
  0 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-06-29 11:04 UTC (permalink / raw)
  To: linux-arm-kernel

For the multiple PM domain case, let's introduce a new function called
genpd_dev_pm_attach_by_name(). This allows a device to be associated with
its PM domain through genpd, by using a name based lookup.

Note that, genpd_dev_pm_attach_by_name() shall only be called by the driver
core / PM core, similar to how the existing dev_pm_domain_attach_by_id()
makes use of genpd_dev_pm_attach_by_id(). However, this is implemented by
following changes on top.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/base/power/domain.c | 24 ++++++++++++++++++++++++
 include/linux/pm_domain.h   |  8 ++++++++
 2 files changed, 32 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index c298de8a8308..a70e4b7a3b14 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2372,6 +2372,30 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(genpd_dev_pm_attach_by_id);
 
+/**
+ * genpd_dev_pm_attach_by_name - Associate a device with one of its PM domains.
+ * @dev: The device used to lookup the PM domain.
+ * @name: The name of the PM domain.
+ *
+ * Parse device's OF node to find a PM domain specifier using the
+ * power-domain-names DT property. For further description see
+ * genpd_dev_pm_attach_by_id().
+ */
+struct device *genpd_dev_pm_attach_by_name(struct device *dev, char *name)
+{
+	int index;
+
+	if (!dev->of_node)
+		return NULL;
+
+	index = of_property_match_string(dev->of_node, "power-domain-names",
+					 name);
+	if (index < 0)
+		return NULL;
+
+	return genpd_dev_pm_attach_by_id(dev, index);
+}
+
 static const struct of_device_id idle_state_match[] = {
 	{ .compatible = "domain-idle-state", },
 	{ }
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index cb8d84090cfb..03e14a38462d 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -239,6 +239,8 @@ unsigned int of_genpd_opp_to_performance_state(struct device *dev,
 int genpd_dev_pm_attach(struct device *dev);
 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,
+					   char *name);
 #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
 static inline int of_genpd_add_provider_simple(struct device_node *np,
 					struct generic_pm_domain *genpd)
@@ -290,6 +292,12 @@ static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev,
 	return NULL;
 }
 
+static inline struct device *genpd_dev_pm_attach_by_name(struct device *dev,
+							 char *name)
+{
+	return NULL;
+}
+
 static inline
 struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
 {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/3] PM / Domains: Introduce dev_pm_domain_attach_by_name()
  2018-06-29 11:04 ` Ulf Hansson
@ 2018-06-29 11:04   ` Ulf Hansson
  -1 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-06-29 11:04 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm
  Cc: Ulf Hansson, Lucas Stach, Geert Uytterhoeven, Kevin Hilman,
	Viresh Kumar, Jon Hunter, Todor Tomov, linux-arm-msm,
	linux-tegra, Rajendra Nayak, linux-arm-kernel

For the multiple PM domain case, let's introduce a new API called
dev_pm_domain_attach_by_name(). This allows a consumer driver to associate
its device with one of its PM domains, by using a name based lookup.

Do note that, currently it's only genpd that supports multiple PM domains
per device, but dev_pm_domain_attach_by_name() can easily by extended to
cover other PM domain types, if/when needed.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/base/power/common.c | 17 +++++++++++++++++
 include/linux/pm_domain.h   |  7 +++++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index df41b4780b3b..b413951c6abc 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -152,6 +152,23 @@ struct device *dev_pm_domain_attach_by_id(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_id);
 
+/**
+ * dev_pm_domain_attach_by_name - Associate a device with one of its PM domains.
+ * @dev: The device used to lookup the PM domain.
+ * @name: The name of the PM domain.
+ *
+ * For a detailed function description, see dev_pm_domain_attach_by_id().
+ */
+struct device *dev_pm_domain_attach_by_name(struct device *dev,
+					    char *name)
+{
+	if (dev->pm_domain)
+		return ERR_PTR(-EEXIST);
+
+	return genpd_dev_pm_attach_by_name(dev, name);
+}
+EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_name);
+
 /**
  * dev_pm_domain_detach - Detach a device from its PM domain.
  * @dev: Device to detach.
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 03e14a38462d..776c546d581a 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -309,6 +309,8 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
 int dev_pm_domain_attach(struct device *dev, bool power_on);
 struct device *dev_pm_domain_attach_by_id(struct device *dev,
 					  unsigned int index);
+struct device *dev_pm_domain_attach_by_name(struct device *dev,
+					    char *name);
 void dev_pm_domain_detach(struct device *dev, bool power_off);
 void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd);
 #else
@@ -321,6 +323,11 @@ static inline struct device *dev_pm_domain_attach_by_id(struct device *dev,
 {
 	return NULL;
 }
+static inline struct device *dev_pm_domain_attach_by_name(struct device *dev,
+							  char *name)
+{
+	return NULL;
+}
 static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
 static inline void dev_pm_domain_set(struct device *dev,
 				     struct dev_pm_domain *pd) {}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/3] PM / Domains: Introduce dev_pm_domain_attach_by_name()
@ 2018-06-29 11:04   ` Ulf Hansson
  0 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-06-29 11:04 UTC (permalink / raw)
  To: linux-arm-kernel

For the multiple PM domain case, let's introduce a new API called
dev_pm_domain_attach_by_name(). This allows a consumer driver to associate
its device with one of its PM domains, by using a name based lookup.

Do note that, currently it's only genpd that supports multiple PM domains
per device, but dev_pm_domain_attach_by_name() can easily by extended to
cover other PM domain types, if/when needed.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/base/power/common.c | 17 +++++++++++++++++
 include/linux/pm_domain.h   |  7 +++++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index df41b4780b3b..b413951c6abc 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -152,6 +152,23 @@ struct device *dev_pm_domain_attach_by_id(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_id);
 
+/**
+ * dev_pm_domain_attach_by_name - Associate a device with one of its PM domains.
+ * @dev: The device used to lookup the PM domain.
+ * @name: The name of the PM domain.
+ *
+ * For a detailed function description, see dev_pm_domain_attach_by_id().
+ */
+struct device *dev_pm_domain_attach_by_name(struct device *dev,
+					    char *name)
+{
+	if (dev->pm_domain)
+		return ERR_PTR(-EEXIST);
+
+	return genpd_dev_pm_attach_by_name(dev, name);
+}
+EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_name);
+
 /**
  * dev_pm_domain_detach - Detach a device from its PM domain.
  * @dev: Device to detach.
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 03e14a38462d..776c546d581a 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -309,6 +309,8 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
 int dev_pm_domain_attach(struct device *dev, bool power_on);
 struct device *dev_pm_domain_attach_by_id(struct device *dev,
 					  unsigned int index);
+struct device *dev_pm_domain_attach_by_name(struct device *dev,
+					    char *name);
 void dev_pm_domain_detach(struct device *dev, bool power_off);
 void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd);
 #else
@@ -321,6 +323,11 @@ static inline struct device *dev_pm_domain_attach_by_id(struct device *dev,
 {
 	return NULL;
 }
+static inline struct device *dev_pm_domain_attach_by_name(struct device *dev,
+							  char *name)
+{
+	return NULL;
+}
 static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
 static inline void dev_pm_domain_set(struct device *dev,
 				     struct dev_pm_domain *pd) {}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/3] PM / Domains: dt: Add a power-domain-names property
  2018-06-29 11:04   ` Ulf Hansson
@ 2018-06-29 11:07     ` Ulf Hansson
  -1 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-06-29 11:07 UTC (permalink / raw)
  To: Rob Herring, devicetree
  Cc: Ulf Hansson, Rajendra Nayak, Geert Uytterhoeven, Linux PM,
	Viresh Kumar, Kevin Hilman, Rafael J . Wysocki, Jon Hunter,
	Todor Tomov, linux-arm-msm, linux-tegra, Lucas Stach, Linux ARM

+devicetree list, Rob

On 29 June 2018 at 13:04, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> Let's add a power-domain-names property, to allow consumer drivers to match
> the power-domains specifiers via a list of power domain names. This follows
> the same concept as for other similar DT bindings.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  Documentation/devicetree/bindings/power/power_domain.txt | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 9b387f861aed..4d6bc8829468 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -114,18 +114,26 @@ Required properties:
>   - power-domains : A list of PM domain specifiers, as defined by bindings of
>                 the power controller that is the PM domain provider.
>
> +Optional properties:
> + - power-domain-names : A list of power domain name strings sorted in the same
> +               order as the power-domains property. Consumers drivers will use
> +               power-domain-names to match power domains with power-domains
> +               specifiers.
> +
>  Example:
>
>         leaky-device@12350000 {
>                 compatible = "foo,i-leak-current";
>                 reg = <0x12350000 0x1000>;
>                 power-domains = <&power 0>;
> +               power-domain-names = "io";
>         };
>
>         leaky-device@12351000 {
>                 compatible = "foo,i-leak-current";
>                 reg = <0x12351000 0x1000>;
>                 power-domains = <&power 0>, <&power 1> ;
> +               power-domain-names = "io", "clk";
>         };
>
>  The first example above defines a typical PM domain consumer device, which is
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/3] PM / Domains: dt: Add a power-domain-names property
@ 2018-06-29 11:07     ` Ulf Hansson
  0 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-06-29 11:07 UTC (permalink / raw)
  To: linux-arm-kernel

+devicetree list, Rob

On 29 June 2018 at 13:04, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> Let's add a power-domain-names property, to allow consumer drivers to match
> the power-domains specifiers via a list of power domain names. This follows
> the same concept as for other similar DT bindings.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  Documentation/devicetree/bindings/power/power_domain.txt | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 9b387f861aed..4d6bc8829468 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -114,18 +114,26 @@ Required properties:
>   - power-domains : A list of PM domain specifiers, as defined by bindings of
>                 the power controller that is the PM domain provider.
>
> +Optional properties:
> + - power-domain-names : A list of power domain name strings sorted in the same
> +               order as the power-domains property. Consumers drivers will use
> +               power-domain-names to match power domains with power-domains
> +               specifiers.
> +
>  Example:
>
>         leaky-device at 12350000 {
>                 compatible = "foo,i-leak-current";
>                 reg = <0x12350000 0x1000>;
>                 power-domains = <&power 0>;
> +               power-domain-names = "io";
>         };
>
>         leaky-device at 12351000 {
>                 compatible = "foo,i-leak-current";
>                 reg = <0x12351000 0x1000>;
>                 power-domains = <&power 0>, <&power 1> ;
> +               power-domain-names = "io", "clk";
>         };
>
>  The first example above defines a typical PM domain consumer device, which is
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 0/3] PM / Domains: Enable name based lookup at attach
  2018-06-29 11:04 ` Ulf Hansson
@ 2018-07-02  6:20   ` Rajendra Nayak
  -1 siblings, 0 replies; 20+ messages in thread
From: Rajendra Nayak @ 2018-07-02  6:20 UTC (permalink / raw)
  To: Ulf Hansson, Rafael J . Wysocki, linux-pm
  Cc: Lucas Stach, Geert Uytterhoeven, Kevin Hilman, Viresh Kumar,
	Jon Hunter, Todor Tomov, linux-arm-msm, linux-tegra,
	linux-arm-kernel



On 06/29/2018 04:34 PM, Ulf Hansson wrote:
> Recently we added support to manage multiple PM domains per device. Consumer
> drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
> device with one of its PM domain, by using an index.
> 
> Let's extend this to allow the association to be done using a name based
> lookup, which follows the similar concept as for other resource types, such as
> clocks for example.

Updated [1] to use dev_pm_domain_attach_by_name() instead of dev_pm_domain_attach_by_id()
Everything works as expected.

Tested-by: Rajendra Nayak <rnayak@codeaurora.org>

[1] https://patchwork.kernel.org/patch/10496107/
 
> 
> Ulf Hansson (3):
>   PM / Domains: dt: Add a power-domain-names property
>   PM / Domains: Introduce option to attach a device by name to genpd
>   PM / Domains: Introduce dev_pm_domain_attach_by_name()
> 
>  .../bindings/power/power_domain.txt           |  8 +++++++
>  drivers/base/power/common.c                   | 17 +++++++++++++
>  drivers/base/power/domain.c                   | 24 +++++++++++++++++++
>  include/linux/pm_domain.h                     | 15 ++++++++++++
>  4 files changed, 64 insertions(+)
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 0/3] PM / Domains: Enable name based lookup at attach
@ 2018-07-02  6:20   ` Rajendra Nayak
  0 siblings, 0 replies; 20+ messages in thread
From: Rajendra Nayak @ 2018-07-02  6:20 UTC (permalink / raw)
  To: linux-arm-kernel



On 06/29/2018 04:34 PM, Ulf Hansson wrote:
> Recently we added support to manage multiple PM domains per device. Consumer
> drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
> device with one of its PM domain, by using an index.
> 
> Let's extend this to allow the association to be done using a name based
> lookup, which follows the similar concept as for other resource types, such as
> clocks for example.

Updated [1] to use dev_pm_domain_attach_by_name() instead of dev_pm_domain_attach_by_id()
Everything works as expected.

Tested-by: Rajendra Nayak <rnayak@codeaurora.org>

[1] https://patchwork.kernel.org/patch/10496107/
 
> 
> Ulf Hansson (3):
>   PM / Domains: dt: Add a power-domain-names property
>   PM / Domains: Introduce option to attach a device by name to genpd
>   PM / Domains: Introduce dev_pm_domain_attach_by_name()
> 
>  .../bindings/power/power_domain.txt           |  8 +++++++
>  drivers/base/power/common.c                   | 17 +++++++++++++
>  drivers/base/power/domain.c                   | 24 +++++++++++++++++++
>  include/linux/pm_domain.h                     | 15 ++++++++++++
>  4 files changed, 64 insertions(+)
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 0/3] PM / Domains: Enable name based lookup at attach
  2018-06-29 11:04 ` Ulf Hansson
@ 2018-07-02  7:08   ` Viresh Kumar
  -1 siblings, 0 replies; 20+ messages in thread
From: Viresh Kumar @ 2018-07-02  7:08 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Rajendra Nayak, Geert Uytterhoeven, linux-pm, linux-arm-msm,
	Kevin Hilman, Rafael J . Wysocki, Jon Hunter, Todor Tomov,
	linux-tegra, Lucas Stach, linux-arm-kernel

On 29-06-18, 13:04, Ulf Hansson wrote:
> Recently we added support to manage multiple PM domains per device. Consumer
> drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
> device with one of its PM domain, by using an index.
> 
> Let's extend this to allow the association to be done using a name based
> lookup, which follows the similar concept as for other resource types, such as
> clocks for example.
> 
> Ulf Hansson (3):
>   PM / Domains: dt: Add a power-domain-names property
>   PM / Domains: Introduce option to attach a device by name to genpd
>   PM / Domains: Introduce dev_pm_domain_attach_by_name()

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 0/3] PM / Domains: Enable name based lookup at attach
@ 2018-07-02  7:08   ` Viresh Kumar
  0 siblings, 0 replies; 20+ messages in thread
From: Viresh Kumar @ 2018-07-02  7:08 UTC (permalink / raw)
  To: linux-arm-kernel

On 29-06-18, 13:04, Ulf Hansson wrote:
> Recently we added support to manage multiple PM domains per device. Consumer
> drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
> device with one of its PM domain, by using an index.
> 
> Let's extend this to allow the association to be done using a name based
> lookup, which follows the similar concept as for other resource types, such as
> clocks for example.
> 
> Ulf Hansson (3):
>   PM / Domains: dt: Add a power-domain-names property
>   PM / Domains: Introduce option to attach a device by name to genpd
>   PM / Domains: Introduce dev_pm_domain_attach_by_name()

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 0/3] PM / Domains: Enable name based lookup at attach
  2018-07-02  7:08   ` Viresh Kumar
@ 2018-07-09 10:06     ` Rafael J. Wysocki
  -1 siblings, 0 replies; 20+ messages in thread
From: Rafael J. Wysocki @ 2018-07-09 10:06 UTC (permalink / raw)
  To: Viresh Kumar, Ulf Hansson
  Cc: Rob Herring, Lucas Stach, Geert Uytterhoeven, linux-pm,
	linux-arm-msm, Kevin Hilman, Jon Hunter, Todor Tomov,
	linux-tegra, Rajendra Nayak, linux-arm-kernel

On Monday, July 2, 2018 9:08:06 AM CEST Viresh Kumar wrote:
> On 29-06-18, 13:04, Ulf Hansson wrote:
> > Recently we added support to manage multiple PM domains per device. Consumer
> > drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
> > device with one of its PM domain, by using an index.
> > 
> > Let's extend this to allow the association to be done using a name based
> > lookup, which follows the similar concept as for other resource types, such as
> > clocks for example.
> > 
> > Ulf Hansson (3):
> >   PM / Domains: dt: Add a power-domain-names property
> >   PM / Domains: Introduce option to attach a device by name to genpd
> >   PM / Domains: Introduce dev_pm_domain_attach_by_name()
> 
> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
> 
> 

Do we need Rob to ACK the binding change?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 0/3] PM / Domains: Enable name based lookup at attach
@ 2018-07-09 10:06     ` Rafael J. Wysocki
  0 siblings, 0 replies; 20+ messages in thread
From: Rafael J. Wysocki @ 2018-07-09 10:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday, July 2, 2018 9:08:06 AM CEST Viresh Kumar wrote:
> On 29-06-18, 13:04, Ulf Hansson wrote:
> > Recently we added support to manage multiple PM domains per device. Consumer
> > drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
> > device with one of its PM domain, by using an index.
> > 
> > Let's extend this to allow the association to be done using a name based
> > lookup, which follows the similar concept as for other resource types, such as
> > clocks for example.
> > 
> > Ulf Hansson (3):
> >   PM / Domains: dt: Add a power-domain-names property
> >   PM / Domains: Introduce option to attach a device by name to genpd
> >   PM / Domains: Introduce dev_pm_domain_attach_by_name()
> 
> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
> 
> 

Do we need Rob to ACK the binding change?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 0/3] PM / Domains: Enable name based lookup at attach
  2018-07-09 10:06     ` Rafael J. Wysocki
@ 2018-07-09 11:38       ` Ulf Hansson
  -1 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-07-09 11:38 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Rob Herring, Rajendra Nayak, Geert Uytterhoeven, Linux PM,
	Viresh Kumar, Kevin Hilman, Jon Hunter, Todor Tomov,
	linux-arm-msm, linux-tegra, Lucas Stach, Linux ARM

On 9 July 2018 at 12:06, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Monday, July 2, 2018 9:08:06 AM CEST Viresh Kumar wrote:
>> On 29-06-18, 13:04, Ulf Hansson wrote:
>> > Recently we added support to manage multiple PM domains per device. Consumer
>> > drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
>> > device with one of its PM domain, by using an index.
>> >
>> > Let's extend this to allow the association to be done using a name based
>> > lookup, which follows the similar concept as for other resource types, such as
>> > clocks for example.
>> >
>> > Ulf Hansson (3):
>> >   PM / Domains: dt: Add a power-domain-names property
>> >   PM / Domains: Introduce option to attach a device by name to genpd
>> >   PM / Domains: Introduce dev_pm_domain_attach_by_name()
>>
>> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
>>
>>
>
> Do we need Rob to ACK the binding change?
>

Normally, yes, however, the change to binding is trivial and the
concept of using a names property isn't something new. I would be
highly surprised if he would object.

I say apply it.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 0/3] PM / Domains: Enable name based lookup at attach
@ 2018-07-09 11:38       ` Ulf Hansson
  0 siblings, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2018-07-09 11:38 UTC (permalink / raw)
  To: linux-arm-kernel

On 9 July 2018 at 12:06, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Monday, July 2, 2018 9:08:06 AM CEST Viresh Kumar wrote:
>> On 29-06-18, 13:04, Ulf Hansson wrote:
>> > Recently we added support to manage multiple PM domains per device. Consumer
>> > drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
>> > device with one of its PM domain, by using an index.
>> >
>> > Let's extend this to allow the association to be done using a name based
>> > lookup, which follows the similar concept as for other resource types, such as
>> > clocks for example.
>> >
>> > Ulf Hansson (3):
>> >   PM / Domains: dt: Add a power-domain-names property
>> >   PM / Domains: Introduce option to attach a device by name to genpd
>> >   PM / Domains: Introduce dev_pm_domain_attach_by_name()
>>
>> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
>>
>>
>
> Do we need Rob to ACK the binding change?
>

Normally, yes, however, the change to binding is trivial and the
concept of using a names property isn't something new. I would be
highly surprised if he would object.

I say apply it.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 0/3] PM / Domains: Enable name based lookup at attach
  2018-07-09 11:38       ` Ulf Hansson
@ 2018-07-11  9:43         ` Rafael J. Wysocki
  -1 siblings, 0 replies; 20+ messages in thread
From: Rafael J. Wysocki @ 2018-07-11  9:43 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Rob Herring, Rajendra Nayak, Geert Uytterhoeven, Linux PM,
	Viresh Kumar, Kevin Hilman, Jon Hunter, Todor Tomov,
	linux-arm-msm, linux-tegra, Lucas Stach, Linux ARM

On Monday, July 9, 2018 1:38:38 PM CEST Ulf Hansson wrote:
> On 9 July 2018 at 12:06, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > On Monday, July 2, 2018 9:08:06 AM CEST Viresh Kumar wrote:
> >> On 29-06-18, 13:04, Ulf Hansson wrote:
> >> > Recently we added support to manage multiple PM domains per device. Consumer
> >> > drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
> >> > device with one of its PM domain, by using an index.
> >> >
> >> > Let's extend this to allow the association to be done using a name based
> >> > lookup, which follows the similar concept as for other resource types, such as
> >> > clocks for example.
> >> >
> >> > Ulf Hansson (3):
> >> >   PM / Domains: dt: Add a power-domain-names property
> >> >   PM / Domains: Introduce option to attach a device by name to genpd
> >> >   PM / Domains: Introduce dev_pm_domain_attach_by_name()
> >>
> >> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
> >>
> >>
> >
> > Do we need Rob to ACK the binding change?
> >
> 
> Normally, yes, however, the change to binding is trivial and the
> concept of using a names property isn't something new. I would be
> highly surprised if he would object.
> 
> I say apply it.

OK, applied along with the other two.

Thanks!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 0/3] PM / Domains: Enable name based lookup at attach
@ 2018-07-11  9:43         ` Rafael J. Wysocki
  0 siblings, 0 replies; 20+ messages in thread
From: Rafael J. Wysocki @ 2018-07-11  9:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday, July 9, 2018 1:38:38 PM CEST Ulf Hansson wrote:
> On 9 July 2018 at 12:06, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > On Monday, July 2, 2018 9:08:06 AM CEST Viresh Kumar wrote:
> >> On 29-06-18, 13:04, Ulf Hansson wrote:
> >> > Recently we added support to manage multiple PM domains per device. Consumer
> >> > drivers were provided an API, dev_pm_domain_attach_by_id() to associate its
> >> > device with one of its PM domain, by using an index.
> >> >
> >> > Let's extend this to allow the association to be done using a name based
> >> > lookup, which follows the similar concept as for other resource types, such as
> >> > clocks for example.
> >> >
> >> > Ulf Hansson (3):
> >> >   PM / Domains: dt: Add a power-domain-names property
> >> >   PM / Domains: Introduce option to attach a device by name to genpd
> >> >   PM / Domains: Introduce dev_pm_domain_attach_by_name()
> >>
> >> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
> >>
> >>
> >
> > Do we need Rob to ACK the binding change?
> >
> 
> Normally, yes, however, the change to binding is trivial and the
> concept of using a names property isn't something new. I would be
> highly surprised if he would object.
> 
> I say apply it.

OK, applied along with the other two.

Thanks!

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2018-07-11  9:43 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-29 11:04 [PATCH 0/3] PM / Domains: Enable name based lookup at attach Ulf Hansson
2018-06-29 11:04 ` Ulf Hansson
2018-06-29 11:04 ` [PATCH 1/3] PM / Domains: dt: Add a power-domain-names property Ulf Hansson
2018-06-29 11:04   ` Ulf Hansson
2018-06-29 11:07   ` Ulf Hansson
2018-06-29 11:07     ` Ulf Hansson
2018-06-29 11:04 ` [PATCH 2/3] PM / Domains: Introduce option to attach a device by name to genpd Ulf Hansson
2018-06-29 11:04   ` Ulf Hansson
2018-06-29 11:04 ` [PATCH 3/3] PM / Domains: Introduce dev_pm_domain_attach_by_name() Ulf Hansson
2018-06-29 11:04   ` Ulf Hansson
2018-07-02  6:20 ` [PATCH 0/3] PM / Domains: Enable name based lookup at attach Rajendra Nayak
2018-07-02  6:20   ` Rajendra Nayak
2018-07-02  7:08 ` Viresh Kumar
2018-07-02  7:08   ` Viresh Kumar
2018-07-09 10:06   ` Rafael J. Wysocki
2018-07-09 10:06     ` Rafael J. Wysocki
2018-07-09 11:38     ` Ulf Hansson
2018-07-09 11:38       ` Ulf Hansson
2018-07-11  9:43       ` Rafael J. Wysocki
2018-07-11  9:43         ` Rafael J. Wysocki

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.