All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node
@ 2014-11-28 10:38 ` Ulf Hansson
  0 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2014-11-28 10:38 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown, Pavel Machek, Kevin Hilman, linux-pm
  Cc: Geert Uytterhoeven, Dmitry Torokhov, Sylwester Nawrocki,
	Amit Daniel Kachhap, linux-arm-kernel, linux-samsung-soc,
	Ulf Hansson

In a step to move away from using genpd's name based APIs, such as the
pm_genpd_add_subdomain_names(), provide an API to lookup an already
initialized generic PM domain by its firmware node.

This API would typically be a called from SOC specific code, to fetch a
handle to the domain. Especially convenient to configure subdomains and
when the hierarchy of the domains are described in DT.

Do note, before pm_genpd_init() is invoked to initialize a generic PM
domain, it's the callers responsibility to assign the new ->fwnode
pointer in the struct generic_pm_domain, to enable pm_genpd_lookup() to
find the domain.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---

Changes in v2:
	Change from using struct device_node to struct fwnode_handle.
	Updated commit header accordingly.

---
 drivers/base/power/domain.c | 27 +++++++++++++++++++++++++++
 include/linux/pm_domain.h   |  4 ++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 735c473..2d881d5 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -75,6 +75,33 @@ struct generic_pm_domain *dev_to_genpd(struct device *dev)
 	return pd_to_genpd(dev->pm_domain);
 }
 
+/**
+ * pm_genpd_lookup - Fetch a generic PM domain object by firmware node.
+ * @node: Firmware node to a corresponding genpd.
+ *
+ * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
+ * on failure.
+ */
+struct generic_pm_domain *pm_genpd_lookup(struct fwnode_handle *node)
+{
+	struct generic_pm_domain *genpd = ERR_PTR(-ENOENT), *gpd;
+
+	if (IS_ERR_OR_NULL(node))
+		return ERR_PTR(-EINVAL);
+
+	mutex_lock(&gpd_list_lock);
+	list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
+		if (gpd->fwnode == node) {
+			genpd = gpd;
+			break;
+		}
+	}
+	mutex_unlock(&gpd_list_lock);
+
+	return genpd;
+}
+EXPORT_SYMBOL_GPL(pm_genpd_lookup);
+
 static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
 {
 	return GENPD_DEV_TIMED_CALLBACK(genpd, int, stop, dev,
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 8cbd32e..aa01050 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -43,6 +43,8 @@ struct gpd_cpuidle_data {
 	struct cpuidle_state *idle_state;
 };
 
+struct fwnode_handle;
+
 struct generic_pm_domain {
 	struct dev_pm_domain domain;	/* PM domain operations */
 	struct list_head gpd_list_node;	/* Node in the global PM domains list */
@@ -53,6 +55,7 @@ struct generic_pm_domain {
 	struct dev_power_governor *gov;
 	struct work_struct power_off_work;
 	const char *name;
+	struct fwnode_handle *fwnode;	/* Firware node for the PM domain */
 	unsigned int in_progress;	/* Number of devices being suspended now */
 	atomic_t sd_count;	/* Number of subdomains with power "on" */
 	enum gpd_status status;	/* Current state of the domain */
@@ -126,6 +129,7 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
 }
 
 extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
+extern struct generic_pm_domain *pm_genpd_lookup(struct fwnode_handle *node);
 extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
 				 struct device *dev,
 				 struct gpd_timing_data *td);
-- 
1.9.1

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

* [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node
@ 2014-11-28 10:38 ` Ulf Hansson
  0 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2014-11-28 10:38 UTC (permalink / raw)
  To: linux-arm-kernel

In a step to move away from using genpd's name based APIs, such as the
pm_genpd_add_subdomain_names(), provide an API to lookup an already
initialized generic PM domain by its firmware node.

This API would typically be a called from SOC specific code, to fetch a
handle to the domain. Especially convenient to configure subdomains and
when the hierarchy of the domains are described in DT.

Do note, before pm_genpd_init() is invoked to initialize a generic PM
domain, it's the callers responsibility to assign the new ->fwnode
pointer in the struct generic_pm_domain, to enable pm_genpd_lookup() to
find the domain.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---

Changes in v2:
	Change from using struct device_node to struct fwnode_handle.
	Updated commit header accordingly.

---
 drivers/base/power/domain.c | 27 +++++++++++++++++++++++++++
 include/linux/pm_domain.h   |  4 ++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 735c473..2d881d5 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -75,6 +75,33 @@ struct generic_pm_domain *dev_to_genpd(struct device *dev)
 	return pd_to_genpd(dev->pm_domain);
 }
 
+/**
+ * pm_genpd_lookup - Fetch a generic PM domain object by firmware node.
+ * @node: Firmware node to a corresponding genpd.
+ *
+ * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
+ * on failure.
+ */
+struct generic_pm_domain *pm_genpd_lookup(struct fwnode_handle *node)
+{
+	struct generic_pm_domain *genpd = ERR_PTR(-ENOENT), *gpd;
+
+	if (IS_ERR_OR_NULL(node))
+		return ERR_PTR(-EINVAL);
+
+	mutex_lock(&gpd_list_lock);
+	list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
+		if (gpd->fwnode == node) {
+			genpd = gpd;
+			break;
+		}
+	}
+	mutex_unlock(&gpd_list_lock);
+
+	return genpd;
+}
+EXPORT_SYMBOL_GPL(pm_genpd_lookup);
+
 static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
 {
 	return GENPD_DEV_TIMED_CALLBACK(genpd, int, stop, dev,
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 8cbd32e..aa01050 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -43,6 +43,8 @@ struct gpd_cpuidle_data {
 	struct cpuidle_state *idle_state;
 };
 
+struct fwnode_handle;
+
 struct generic_pm_domain {
 	struct dev_pm_domain domain;	/* PM domain operations */
 	struct list_head gpd_list_node;	/* Node in the global PM domains list */
@@ -53,6 +55,7 @@ struct generic_pm_domain {
 	struct dev_power_governor *gov;
 	struct work_struct power_off_work;
 	const char *name;
+	struct fwnode_handle *fwnode;	/* Firware node for the PM domain */
 	unsigned int in_progress;	/* Number of devices being suspended now */
 	atomic_t sd_count;	/* Number of subdomains with power "on" */
 	enum gpd_status status;	/* Current state of the domain */
@@ -126,6 +129,7 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
 }
 
 extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
+extern struct generic_pm_domain *pm_genpd_lookup(struct fwnode_handle *node);
 extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
 				 struct device *dev,
 				 struct gpd_timing_data *td);
-- 
1.9.1

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

* Re: [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node
  2014-11-28 10:38 ` Ulf Hansson
@ 2014-11-29  0:30   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 18+ messages in thread
From: Rafael J. Wysocki @ 2014-11-29  0:30 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Len Brown, Pavel Machek, Kevin Hilman, linux-pm,
	Geert Uytterhoeven, Dmitry Torokhov, Sylwester Nawrocki,
	Amit Daniel Kachhap, linux-arm-kernel, linux-samsung-soc

On Friday, November 28, 2014 11:38:35 AM Ulf Hansson wrote:
> In a step to move away from using genpd's name based APIs, such as the
> pm_genpd_add_subdomain_names(), provide an API to lookup an already
> initialized generic PM domain by its firmware node.
> 
> This API would typically be a called from SOC specific code, to fetch a
> handle to the domain. Especially convenient to configure subdomains and
> when the hierarchy of the domains are described in DT.
> 
> Do note, before pm_genpd_init() is invoked to initialize a generic PM
> domain, it's the callers responsibility to assign the new ->fwnode
> pointer in the struct generic_pm_domain, to enable pm_genpd_lookup() to
> find the domain.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

I have no problems with that, but do you have a user for it?

> ---
> 
> Changes in v2:
> 	Change from using struct device_node to struct fwnode_handle.
> 	Updated commit header accordingly.
> 
> ---
>  drivers/base/power/domain.c | 27 +++++++++++++++++++++++++++
>  include/linux/pm_domain.h   |  4 ++++
>  2 files changed, 31 insertions(+)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 735c473..2d881d5 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -75,6 +75,33 @@ struct generic_pm_domain *dev_to_genpd(struct device *dev)
>  	return pd_to_genpd(dev->pm_domain);
>  }
>  
> +/**
> + * pm_genpd_lookup - Fetch a generic PM domain object by firmware node.
> + * @node: Firmware node to a corresponding genpd.
> + *
> + * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
> + * on failure.
> + */
> +struct generic_pm_domain *pm_genpd_lookup(struct fwnode_handle *node)
> +{
> +	struct generic_pm_domain *genpd = ERR_PTR(-ENOENT), *gpd;
> +
> +	if (IS_ERR_OR_NULL(node))
> +		return ERR_PTR(-EINVAL);
> +
> +	mutex_lock(&gpd_list_lock);
> +	list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
> +		if (gpd->fwnode == node) {
> +			genpd = gpd;
> +			break;
> +		}
> +	}
> +	mutex_unlock(&gpd_list_lock);
> +
> +	return genpd;
> +}
> +EXPORT_SYMBOL_GPL(pm_genpd_lookup);
> +
>  static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
>  {
>  	return GENPD_DEV_TIMED_CALLBACK(genpd, int, stop, dev,
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 8cbd32e..aa01050 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -43,6 +43,8 @@ struct gpd_cpuidle_data {
>  	struct cpuidle_state *idle_state;
>  };
>  
> +struct fwnode_handle;
> +
>  struct generic_pm_domain {
>  	struct dev_pm_domain domain;	/* PM domain operations */
>  	struct list_head gpd_list_node;	/* Node in the global PM domains list */
> @@ -53,6 +55,7 @@ struct generic_pm_domain {
>  	struct dev_power_governor *gov;
>  	struct work_struct power_off_work;
>  	const char *name;
> +	struct fwnode_handle *fwnode;	/* Firware node for the PM domain */
>  	unsigned int in_progress;	/* Number of devices being suspended now */
>  	atomic_t sd_count;	/* Number of subdomains with power "on" */
>  	enum gpd_status status;	/* Current state of the domain */
> @@ -126,6 +129,7 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
>  }
>  
>  extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
> +extern struct generic_pm_domain *pm_genpd_lookup(struct fwnode_handle *node);
>  extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
>  				 struct device *dev,
>  				 struct gpd_timing_data *td);
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node
@ 2014-11-29  0:30   ` Rafael J. Wysocki
  0 siblings, 0 replies; 18+ messages in thread
From: Rafael J. Wysocki @ 2014-11-29  0:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday, November 28, 2014 11:38:35 AM Ulf Hansson wrote:
> In a step to move away from using genpd's name based APIs, such as the
> pm_genpd_add_subdomain_names(), provide an API to lookup an already
> initialized generic PM domain by its firmware node.
> 
> This API would typically be a called from SOC specific code, to fetch a
> handle to the domain. Especially convenient to configure subdomains and
> when the hierarchy of the domains are described in DT.
> 
> Do note, before pm_genpd_init() is invoked to initialize a generic PM
> domain, it's the callers responsibility to assign the new ->fwnode
> pointer in the struct generic_pm_domain, to enable pm_genpd_lookup() to
> find the domain.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

I have no problems with that, but do you have a user for it?

> ---
> 
> Changes in v2:
> 	Change from using struct device_node to struct fwnode_handle.
> 	Updated commit header accordingly.
> 
> ---
>  drivers/base/power/domain.c | 27 +++++++++++++++++++++++++++
>  include/linux/pm_domain.h   |  4 ++++
>  2 files changed, 31 insertions(+)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 735c473..2d881d5 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -75,6 +75,33 @@ struct generic_pm_domain *dev_to_genpd(struct device *dev)
>  	return pd_to_genpd(dev->pm_domain);
>  }
>  
> +/**
> + * pm_genpd_lookup - Fetch a generic PM domain object by firmware node.
> + * @node: Firmware node to a corresponding genpd.
> + *
> + * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
> + * on failure.
> + */
> +struct generic_pm_domain *pm_genpd_lookup(struct fwnode_handle *node)
> +{
> +	struct generic_pm_domain *genpd = ERR_PTR(-ENOENT), *gpd;
> +
> +	if (IS_ERR_OR_NULL(node))
> +		return ERR_PTR(-EINVAL);
> +
> +	mutex_lock(&gpd_list_lock);
> +	list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
> +		if (gpd->fwnode == node) {
> +			genpd = gpd;
> +			break;
> +		}
> +	}
> +	mutex_unlock(&gpd_list_lock);
> +
> +	return genpd;
> +}
> +EXPORT_SYMBOL_GPL(pm_genpd_lookup);
> +
>  static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
>  {
>  	return GENPD_DEV_TIMED_CALLBACK(genpd, int, stop, dev,
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 8cbd32e..aa01050 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -43,6 +43,8 @@ struct gpd_cpuidle_data {
>  	struct cpuidle_state *idle_state;
>  };
>  
> +struct fwnode_handle;
> +
>  struct generic_pm_domain {
>  	struct dev_pm_domain domain;	/* PM domain operations */
>  	struct list_head gpd_list_node;	/* Node in the global PM domains list */
> @@ -53,6 +55,7 @@ struct generic_pm_domain {
>  	struct dev_power_governor *gov;
>  	struct work_struct power_off_work;
>  	const char *name;
> +	struct fwnode_handle *fwnode;	/* Firware node for the PM domain */
>  	unsigned int in_progress;	/* Number of devices being suspended now */
>  	atomic_t sd_count;	/* Number of subdomains with power "on" */
>  	enum gpd_status status;	/* Current state of the domain */
> @@ -126,6 +129,7 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
>  }
>  
>  extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
> +extern struct generic_pm_domain *pm_genpd_lookup(struct fwnode_handle *node);
>  extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
>  				 struct device *dev,
>  				 struct gpd_timing_data *td);
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node
  2014-11-29  0:30   ` Rafael J. Wysocki
@ 2014-12-01 10:26     ` Ulf Hansson
  -1 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2014-12-01 10:26 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, Pavel Machek, Kevin Hilman, linux-pm,
	Geert Uytterhoeven, Dmitry Torokhov, Sylwester Nawrocki,
	Amit Daniel Kachhap, linux-arm-kernel, linux-samsung-soc

On 29 November 2014 at 01:30, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Friday, November 28, 2014 11:38:35 AM Ulf Hansson wrote:
>> In a step to move away from using genpd's name based APIs, such as the
>> pm_genpd_add_subdomain_names(), provide an API to lookup an already
>> initialized generic PM domain by its firmware node.
>>
>> This API would typically be a called from SOC specific code, to fetch a
>> handle to the domain. Especially convenient to configure subdomains and
>> when the hierarchy of the domains are described in DT.
>>
>> Do note, before pm_genpd_init() is invoked to initialize a generic PM
>> domain, it's the callers responsibility to assign the new ->fwnode
>> pointer in the struct generic_pm_domain, to enable pm_genpd_lookup() to
>> find the domain.
>>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> I have no problems with that, but do you have a user for it?

Amit Daniel Kachhap, posted a patchset which is adding subdomains
configured from DT for Exynos. It's from there the idea to this patch
comes from. Amit is about to post a new version, based on this patch.

https://lkml.org/lkml/2014/11/24/290

Kind regards
Uffe

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

* [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node
@ 2014-12-01 10:26     ` Ulf Hansson
  0 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2014-12-01 10:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 29 November 2014 at 01:30, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Friday, November 28, 2014 11:38:35 AM Ulf Hansson wrote:
>> In a step to move away from using genpd's name based APIs, such as the
>> pm_genpd_add_subdomain_names(), provide an API to lookup an already
>> initialized generic PM domain by its firmware node.
>>
>> This API would typically be a called from SOC specific code, to fetch a
>> handle to the domain. Especially convenient to configure subdomains and
>> when the hierarchy of the domains are described in DT.
>>
>> Do note, before pm_genpd_init() is invoked to initialize a generic PM
>> domain, it's the callers responsibility to assign the new ->fwnode
>> pointer in the struct generic_pm_domain, to enable pm_genpd_lookup() to
>> find the domain.
>>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> I have no problems with that, but do you have a user for it?

Amit Daniel Kachhap, posted a patchset which is adding subdomains
configured from DT for Exynos. It's from there the idea to this patch
comes from. Amit is about to post a new version, based on this patch.

https://lkml.org/lkml/2014/11/24/290

Kind regards
Uffe

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

* [PATCH] PM/ Domains: Export of_genpd_get_from_provider function.
  2014-12-01 10:26     ` Ulf Hansson
@ 2014-12-01 11:41       ` Amit Daniel Kachhap
  -1 siblings, 0 replies; 18+ messages in thread
From: Amit Daniel Kachhap @ 2014-12-01 11:41 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, linux-kernel, ulf.hansson, rjw, len.brown,
	gregkh, khilman, Amit Daniel Kachhap

This function looks up a PM domain form the provider. This will be
useful to add parent/child domain relationship from the SoC specific
code. The caller of the function must make sure that PM domain provider
is already registered.

Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
---
This patch may solve the same purpose which is done by earlier posts
1) https://lkml.org/lkml/2014/11/24/319 - In this there were comments
for not using the PM domain name.

2) Ulf Hansson posted a patch 
http://www.spinics.net/lists/linux-samsung-soc/msg39745.html which also solves
similar purpose but I feel this is slightly complex and involves changing
the genpd structure.


 drivers/base/power/domain.c |    3 ++-
 include/linux/pm_domain.h   |    8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index d822753..5d7a2c1 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2129,7 +2129,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider);
  * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
  * on failure.
  */
-static struct generic_pm_domain *of_genpd_get_from_provider(
+struct generic_pm_domain *of_genpd_get_from_provider(
 					struct of_phandle_args *genpdspec)
 {
 	struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
@@ -2149,6 +2149,7 @@ static struct generic_pm_domain *of_genpd_get_from_provider(
 
 	return genpd;
 }
+EXPORT_SYMBOL_GPL(of_genpd_get_from_provider);
 
 /**
  * genpd_dev_pm_detach - Detach a device from its PM domain.
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 9690827..4954e24 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -282,6 +282,8 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
 int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
 			void *data);
 void of_genpd_del_provider(struct device_node *np);
+struct generic_pm_domain *of_genpd_get_from_provider(
+			struct of_phandle_args *genpdspec);
 
 struct generic_pm_domain *__of_genpd_xlate_simple(
 					struct of_phandle_args *genpdspec,
@@ -299,6 +301,12 @@ static inline int __of_genpd_add_provider(struct device_node *np,
 }
 static inline void of_genpd_del_provider(struct device_node *np) {}
 
+static inline struct generic_pm_domain *of_genpd_get_from_provider(
+			struct of_phandle_args *genpdspec)
+{
+	return NULL;
+}
+
 #define __of_genpd_xlate_simple		NULL
 #define __of_genpd_xlate_onecell	NULL
 
-- 
1.7.9.5


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

* [PATCH] PM/ Domains: Export of_genpd_get_from_provider function.
@ 2014-12-01 11:41       ` Amit Daniel Kachhap
  0 siblings, 0 replies; 18+ messages in thread
From: Amit Daniel Kachhap @ 2014-12-01 11:41 UTC (permalink / raw)
  To: linux-arm-kernel

This function looks up a PM domain form the provider. This will be
useful to add parent/child domain relationship from the SoC specific
code. The caller of the function must make sure that PM domain provider
is already registered.

Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
---
This patch may solve the same purpose which is done by earlier posts
1) https://lkml.org/lkml/2014/11/24/319 - In this there were comments
for not using the PM domain name.

2) Ulf Hansson posted a patch 
http://www.spinics.net/lists/linux-samsung-soc/msg39745.html which also solves
similar purpose but I feel this is slightly complex and involves changing
the genpd structure.


 drivers/base/power/domain.c |    3 ++-
 include/linux/pm_domain.h   |    8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index d822753..5d7a2c1 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2129,7 +2129,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider);
  * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
  * on failure.
  */
-static struct generic_pm_domain *of_genpd_get_from_provider(
+struct generic_pm_domain *of_genpd_get_from_provider(
 					struct of_phandle_args *genpdspec)
 {
 	struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
@@ -2149,6 +2149,7 @@ static struct generic_pm_domain *of_genpd_get_from_provider(
 
 	return genpd;
 }
+EXPORT_SYMBOL_GPL(of_genpd_get_from_provider);
 
 /**
  * genpd_dev_pm_detach - Detach a device from its PM domain.
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 9690827..4954e24 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -282,6 +282,8 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
 int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
 			void *data);
 void of_genpd_del_provider(struct device_node *np);
+struct generic_pm_domain *of_genpd_get_from_provider(
+			struct of_phandle_args *genpdspec);
 
 struct generic_pm_domain *__of_genpd_xlate_simple(
 					struct of_phandle_args *genpdspec,
@@ -299,6 +301,12 @@ static inline int __of_genpd_add_provider(struct device_node *np,
 }
 static inline void of_genpd_del_provider(struct device_node *np) {}
 
+static inline struct generic_pm_domain *of_genpd_get_from_provider(
+			struct of_phandle_args *genpdspec)
+{
+	return NULL;
+}
+
 #define __of_genpd_xlate_simple		NULL
 #define __of_genpd_xlate_onecell	NULL
 
-- 
1.7.9.5

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

* Re: [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node
  2014-12-01 10:26     ` Ulf Hansson
@ 2014-12-01 11:57       ` amit daniel kachhap
  -1 siblings, 0 replies; 18+ messages in thread
From: amit daniel kachhap @ 2014-12-01 11:57 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Kevin Hilman,
	linux-pm, Geert Uytterhoeven, Dmitry Torokhov,
	Sylwester Nawrocki, linux-arm-kernel, linux-samsung-soc

On Mon, Dec 1, 2014 at 3:56 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 29 November 2014 at 01:30, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>> On Friday, November 28, 2014 11:38:35 AM Ulf Hansson wrote:
>>> In a step to move away from using genpd's name based APIs, such as the
>>> pm_genpd_add_subdomain_names(), provide an API to lookup an already
>>> initialized generic PM domain by its firmware node.
>>>
>>> This API would typically be a called from SOC specific code, to fetch a
>>> handle to the domain. Especially convenient to configure subdomains and
>>> when the hierarchy of the domains are described in DT.
>>>
>>> Do note, before pm_genpd_init() is invoked to initialize a generic PM
>>> domain, it's the callers responsibility to assign the new ->fwnode
>>> pointer in the struct generic_pm_domain, to enable pm_genpd_lookup() to
>>> find the domain.
>>>
>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>
>> I have no problems with that, but do you have a user for it?
>
> Amit Daniel Kachhap, posted a patchset which is adding subdomains
> configured from DT for Exynos. It's from there the idea to this patch
> comes from. Amit is about to post a new version, based on this patch.

Hi Ulf,

I was trying to use this API but i felt there is a better way of just exporting
of_genpd_get_from_provider as a similar API is used to register the
power domain.

Check if this make sense www.spinics.net/lists/arm-kernel/msg382665.html.

Regards,
Amit


>
> https://lkml.org/lkml/2014/11/24/290
>
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node
@ 2014-12-01 11:57       ` amit daniel kachhap
  0 siblings, 0 replies; 18+ messages in thread
From: amit daniel kachhap @ 2014-12-01 11:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Dec 1, 2014 at 3:56 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 29 November 2014 at 01:30, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>> On Friday, November 28, 2014 11:38:35 AM Ulf Hansson wrote:
>>> In a step to move away from using genpd's name based APIs, such as the
>>> pm_genpd_add_subdomain_names(), provide an API to lookup an already
>>> initialized generic PM domain by its firmware node.
>>>
>>> This API would typically be a called from SOC specific code, to fetch a
>>> handle to the domain. Especially convenient to configure subdomains and
>>> when the hierarchy of the domains are described in DT.
>>>
>>> Do note, before pm_genpd_init() is invoked to initialize a generic PM
>>> domain, it's the callers responsibility to assign the new ->fwnode
>>> pointer in the struct generic_pm_domain, to enable pm_genpd_lookup() to
>>> find the domain.
>>>
>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>
>> I have no problems with that, but do you have a user for it?
>
> Amit Daniel Kachhap, posted a patchset which is adding subdomains
> configured from DT for Exynos. It's from there the idea to this patch
> comes from. Amit is about to post a new version, based on this patch.

Hi Ulf,

I was trying to use this API but i felt there is a better way of just exporting
of_genpd_get_from_provider as a similar API is used to register the
power domain.

Check if this make sense www.spinics.net/lists/arm-kernel/msg382665.html.

Regards,
Amit


>
> https://lkml.org/lkml/2014/11/24/290
>
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] PM/ Domains: Export of_genpd_get_from_provider function.
  2014-12-01 11:41       ` Amit Daniel Kachhap
  (?)
@ 2014-12-04 15:39         ` Ulf Hansson
  -1 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2014-12-04 15:39 UTC (permalink / raw)
  To: Amit Daniel Kachhap
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman, Kevin Hilman

On 1 December 2014 at 12:41, Amit Daniel Kachhap
<amit.daniel@samsung.com> wrote:
> This function looks up a PM domain form the provider. This will be
> useful to add parent/child domain relationship from the SoC specific
> code. The caller of the function must make sure that PM domain provider
> is already registered.
>
> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> ---
> This patch may solve the same purpose which is done by earlier posts
> 1) https://lkml.org/lkml/2014/11/24/319 - In this there were comments
> for not using the PM domain name.
>
> 2) Ulf Hansson posted a patch
> http://www.spinics.net/lists/linux-samsung-soc/msg39745.html which also solves
> similar purpose but I feel this is slightly complex and involves changing
> the genpd structure.
>
>
>  drivers/base/power/domain.c |    3 ++-
>  include/linux/pm_domain.h   |    8 ++++++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index d822753..5d7a2c1 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2129,7 +2129,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider);
>   * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
>   * on failure.
>   */
> -static struct generic_pm_domain *of_genpd_get_from_provider(
> +struct generic_pm_domain *of_genpd_get_from_provider(
>                                         struct of_phandle_args *genpdspec)
>  {
>         struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
> @@ -2149,6 +2149,7 @@ static struct generic_pm_domain *of_genpd_get_from_provider(
>
>         return genpd;
>  }
> +EXPORT_SYMBOL_GPL(of_genpd_get_from_provider);
>
>  /**
>   * genpd_dev_pm_detach - Detach a device from its PM domain.
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 9690827..4954e24 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -282,6 +282,8 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
>  int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
>                         void *data);
>  void of_genpd_del_provider(struct device_node *np);
> +struct generic_pm_domain *of_genpd_get_from_provider(
> +                       struct of_phandle_args *genpdspec);
>
>  struct generic_pm_domain *__of_genpd_xlate_simple(
>                                         struct of_phandle_args *genpdspec,
> @@ -299,6 +301,12 @@ static inline int __of_genpd_add_provider(struct device_node *np,
>  }
>  static inline void of_genpd_del_provider(struct device_node *np) {}
>
> +static inline struct generic_pm_domain *of_genpd_get_from_provider(
> +                       struct of_phandle_args *genpdspec)
> +{
> +       return NULL;
> +}
> +
>  #define __of_genpd_xlate_simple                NULL
>  #define __of_genpd_xlate_onecell       NULL
>
> --
> 1.7.9.5
>

This seems like a good approach!

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Do, note that you will have to resend the patch to linux-pm list as
well. Unless Rafael is happy to pick it up from here.

Kind regards
Uffe

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

* Re: [PATCH] PM/ Domains: Export of_genpd_get_from_provider function.
@ 2014-12-04 15:39         ` Ulf Hansson
  0 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2014-12-04 15:39 UTC (permalink / raw)
  To: Amit Daniel Kachhap
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman, Kevin Hilman

On 1 December 2014 at 12:41, Amit Daniel Kachhap
<amit.daniel@samsung.com> wrote:
> This function looks up a PM domain form the provider. This will be
> useful to add parent/child domain relationship from the SoC specific
> code. The caller of the function must make sure that PM domain provider
> is already registered.
>
> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> ---
> This patch may solve the same purpose which is done by earlier posts
> 1) https://lkml.org/lkml/2014/11/24/319 - In this there were comments
> for not using the PM domain name.
>
> 2) Ulf Hansson posted a patch
> http://www.spinics.net/lists/linux-samsung-soc/msg39745.html which also solves
> similar purpose but I feel this is slightly complex and involves changing
> the genpd structure.
>
>
>  drivers/base/power/domain.c |    3 ++-
>  include/linux/pm_domain.h   |    8 ++++++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index d822753..5d7a2c1 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2129,7 +2129,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider);
>   * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
>   * on failure.
>   */
> -static struct generic_pm_domain *of_genpd_get_from_provider(
> +struct generic_pm_domain *of_genpd_get_from_provider(
>                                         struct of_phandle_args *genpdspec)
>  {
>         struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
> @@ -2149,6 +2149,7 @@ static struct generic_pm_domain *of_genpd_get_from_provider(
>
>         return genpd;
>  }
> +EXPORT_SYMBOL_GPL(of_genpd_get_from_provider);
>
>  /**
>   * genpd_dev_pm_detach - Detach a device from its PM domain.
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 9690827..4954e24 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -282,6 +282,8 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
>  int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
>                         void *data);
>  void of_genpd_del_provider(struct device_node *np);
> +struct generic_pm_domain *of_genpd_get_from_provider(
> +                       struct of_phandle_args *genpdspec);
>
>  struct generic_pm_domain *__of_genpd_xlate_simple(
>                                         struct of_phandle_args *genpdspec,
> @@ -299,6 +301,12 @@ static inline int __of_genpd_add_provider(struct device_node *np,
>  }
>  static inline void of_genpd_del_provider(struct device_node *np) {}
>
> +static inline struct generic_pm_domain *of_genpd_get_from_provider(
> +                       struct of_phandle_args *genpdspec)
> +{
> +       return NULL;
> +}
> +
>  #define __of_genpd_xlate_simple                NULL
>  #define __of_genpd_xlate_onecell       NULL
>
> --
> 1.7.9.5
>

This seems like a good approach!

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Do, note that you will have to resend the patch to linux-pm list as
well. Unless Rafael is happy to pick it up from here.

Kind regards
Uffe

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

* [PATCH] PM/ Domains: Export of_genpd_get_from_provider function.
@ 2014-12-04 15:39         ` Ulf Hansson
  0 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2014-12-04 15:39 UTC (permalink / raw)
  To: linux-arm-kernel

On 1 December 2014 at 12:41, Amit Daniel Kachhap
<amit.daniel@samsung.com> wrote:
> This function looks up a PM domain form the provider. This will be
> useful to add parent/child domain relationship from the SoC specific
> code. The caller of the function must make sure that PM domain provider
> is already registered.
>
> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> ---
> This patch may solve the same purpose which is done by earlier posts
> 1) https://lkml.org/lkml/2014/11/24/319 - In this there were comments
> for not using the PM domain name.
>
> 2) Ulf Hansson posted a patch
> http://www.spinics.net/lists/linux-samsung-soc/msg39745.html which also solves
> similar purpose but I feel this is slightly complex and involves changing
> the genpd structure.
>
>
>  drivers/base/power/domain.c |    3 ++-
>  include/linux/pm_domain.h   |    8 ++++++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index d822753..5d7a2c1 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2129,7 +2129,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider);
>   * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
>   * on failure.
>   */
> -static struct generic_pm_domain *of_genpd_get_from_provider(
> +struct generic_pm_domain *of_genpd_get_from_provider(
>                                         struct of_phandle_args *genpdspec)
>  {
>         struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
> @@ -2149,6 +2149,7 @@ static struct generic_pm_domain *of_genpd_get_from_provider(
>
>         return genpd;
>  }
> +EXPORT_SYMBOL_GPL(of_genpd_get_from_provider);
>
>  /**
>   * genpd_dev_pm_detach - Detach a device from its PM domain.
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 9690827..4954e24 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -282,6 +282,8 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
>  int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
>                         void *data);
>  void of_genpd_del_provider(struct device_node *np);
> +struct generic_pm_domain *of_genpd_get_from_provider(
> +                       struct of_phandle_args *genpdspec);
>
>  struct generic_pm_domain *__of_genpd_xlate_simple(
>                                         struct of_phandle_args *genpdspec,
> @@ -299,6 +301,12 @@ static inline int __of_genpd_add_provider(struct device_node *np,
>  }
>  static inline void of_genpd_del_provider(struct device_node *np) {}
>
> +static inline struct generic_pm_domain *of_genpd_get_from_provider(
> +                       struct of_phandle_args *genpdspec)
> +{
> +       return NULL;
> +}
> +
>  #define __of_genpd_xlate_simple                NULL
>  #define __of_genpd_xlate_onecell       NULL
>
> --
> 1.7.9.5
>

This seems like a good approach!

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Do, note that you will have to resend the patch to linux-pm list as
well. Unless Rafael is happy to pick it up from here.

Kind regards
Uffe

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

* Re: [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node
  2014-12-01 11:57       ` amit daniel kachhap
@ 2014-12-04 15:42         ` Ulf Hansson
  -1 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2014-12-04 15:42 UTC (permalink / raw)
  To: amit daniel kachhap
  Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Kevin Hilman,
	linux-pm, Geert Uytterhoeven, Dmitry Torokhov,
	Sylwester Nawrocki, linux-arm-kernel, linux-samsung-soc

On 1 December 2014 at 12:57, amit daniel kachhap
<amit.daniel@samsung.com> wrote:
> On Mon, Dec 1, 2014 at 3:56 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> On 29 November 2014 at 01:30, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>>> On Friday, November 28, 2014 11:38:35 AM Ulf Hansson wrote:
>>>> In a step to move away from using genpd's name based APIs, such as the
>>>> pm_genpd_add_subdomain_names(), provide an API to lookup an already
>>>> initialized generic PM domain by its firmware node.
>>>>
>>>> This API would typically be a called from SOC specific code, to fetch a
>>>> handle to the domain. Especially convenient to configure subdomains and
>>>> when the hierarchy of the domains are described in DT.
>>>>
>>>> Do note, before pm_genpd_init() is invoked to initialize a generic PM
>>>> domain, it's the callers responsibility to assign the new ->fwnode
>>>> pointer in the struct generic_pm_domain, to enable pm_genpd_lookup() to
>>>> find the domain.
>>>>
>>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>>
>>> I have no problems with that, but do you have a user for it?
>>
>> Amit Daniel Kachhap, posted a patchset which is adding subdomains
>> configured from DT for Exynos. It's from there the idea to this patch
>> comes from. Amit is about to post a new version, based on this patch.
>
> Hi Ulf,
>
> I was trying to use this API but i felt there is a better way of just exporting
> of_genpd_get_from_provider as a similar API is used to register the
> power domain.
>
> Check if this make sense www.spinics.net/lists/arm-kernel/msg382665.html.
>

That makes sense!

So, let's drop $subject patch.

Kind regards
Uffe

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

* [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node
@ 2014-12-04 15:42         ` Ulf Hansson
  0 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2014-12-04 15:42 UTC (permalink / raw)
  To: linux-arm-kernel

On 1 December 2014 at 12:57, amit daniel kachhap
<amit.daniel@samsung.com> wrote:
> On Mon, Dec 1, 2014 at 3:56 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> On 29 November 2014 at 01:30, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>>> On Friday, November 28, 2014 11:38:35 AM Ulf Hansson wrote:
>>>> In a step to move away from using genpd's name based APIs, such as the
>>>> pm_genpd_add_subdomain_names(), provide an API to lookup an already
>>>> initialized generic PM domain by its firmware node.
>>>>
>>>> This API would typically be a called from SOC specific code, to fetch a
>>>> handle to the domain. Especially convenient to configure subdomains and
>>>> when the hierarchy of the domains are described in DT.
>>>>
>>>> Do note, before pm_genpd_init() is invoked to initialize a generic PM
>>>> domain, it's the callers responsibility to assign the new ->fwnode
>>>> pointer in the struct generic_pm_domain, to enable pm_genpd_lookup() to
>>>> find the domain.
>>>>
>>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>>
>>> I have no problems with that, but do you have a user for it?
>>
>> Amit Daniel Kachhap, posted a patchset which is adding subdomains
>> configured from DT for Exynos. It's from there the idea to this patch
>> comes from. Amit is about to post a new version, based on this patch.
>
> Hi Ulf,
>
> I was trying to use this API but i felt there is a better way of just exporting
> of_genpd_get_from_provider as a similar API is used to register the
> power domain.
>
> Check if this make sense www.spinics.net/lists/arm-kernel/msg382665.html.
>

That makes sense!

So, let's drop $subject patch.

Kind regards
Uffe

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

* Re: [PATCH] PM/ Domains: Export of_genpd_get_from_provider function.
  2014-12-04 15:39         ` Ulf Hansson
  (?)
@ 2014-12-05  8:25           ` amit daniel kachhap
  -1 siblings, 0 replies; 18+ messages in thread
From: amit daniel kachhap @ 2014-12-05  8:25 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman, Kevin Hilman

On Thu, Dec 4, 2014 at 9:09 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 1 December 2014 at 12:41, Amit Daniel Kachhap
> <amit.daniel@samsung.com> wrote:
>> This function looks up a PM domain form the provider. This will be
>> useful to add parent/child domain relationship from the SoC specific
>> code. The caller of the function must make sure that PM domain provider
>> is already registered.
>>
>> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
>> ---
>> This patch may solve the same purpose which is done by earlier posts
>> 1) https://lkml.org/lkml/2014/11/24/319 - In this there were comments
>> for not using the PM domain name.
>>
>> 2) Ulf Hansson posted a patch
>> http://www.spinics.net/lists/linux-samsung-soc/msg39745.html which also solves
>> similar purpose but I feel this is slightly complex and involves changing
>> the genpd structure.
>>
>>
>>  drivers/base/power/domain.c |    3 ++-
>>  include/linux/pm_domain.h   |    8 ++++++++
>>  2 files changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>> index d822753..5d7a2c1 100644
>> --- a/drivers/base/power/domain.c
>> +++ b/drivers/base/power/domain.c
>> @@ -2129,7 +2129,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider);
>>   * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
>>   * on failure.
>>   */
>> -static struct generic_pm_domain *of_genpd_get_from_provider(
>> +struct generic_pm_domain *of_genpd_get_from_provider(
>>                                         struct of_phandle_args *genpdspec)
>>  {
>>         struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
>> @@ -2149,6 +2149,7 @@ static struct generic_pm_domain *of_genpd_get_from_provider(
>>
>>         return genpd;
>>  }
>> +EXPORT_SYMBOL_GPL(of_genpd_get_from_provider);
>>
>>  /**
>>   * genpd_dev_pm_detach - Detach a device from its PM domain.
>> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
>> index 9690827..4954e24 100644
>> --- a/include/linux/pm_domain.h
>> +++ b/include/linux/pm_domain.h
>> @@ -282,6 +282,8 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
>>  int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
>>                         void *data);
>>  void of_genpd_del_provider(struct device_node *np);
>> +struct generic_pm_domain *of_genpd_get_from_provider(
>> +                       struct of_phandle_args *genpdspec);
>>
>>  struct generic_pm_domain *__of_genpd_xlate_simple(
>>                                         struct of_phandle_args *genpdspec,
>> @@ -299,6 +301,12 @@ static inline int __of_genpd_add_provider(struct device_node *np,
>>  }
>>  static inline void of_genpd_del_provider(struct device_node *np) {}
>>
>> +static inline struct generic_pm_domain *of_genpd_get_from_provider(
>> +                       struct of_phandle_args *genpdspec)
>> +{
>> +       return NULL;
>> +}
>> +
>>  #define __of_genpd_xlate_simple                NULL
>>  #define __of_genpd_xlate_onecell       NULL
>>
>> --
>> 1.7.9.5
>>
>
> This seems like a good approach!
>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Thanks.
>
> Do, note that you will have to resend the patch to linux-pm list as
> well. Unless Rafael is happy to pick it up from here.
Sure. My fault.

Regards,
Amit
>
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [PATCH] PM/ Domains: Export of_genpd_get_from_provider function.
@ 2014-12-05  8:25           ` amit daniel kachhap
  0 siblings, 0 replies; 18+ messages in thread
From: amit daniel kachhap @ 2014-12-05  8:25 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman, Kevin Hilman

On Thu, Dec 4, 2014 at 9:09 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 1 December 2014 at 12:41, Amit Daniel Kachhap
> <amit.daniel@samsung.com> wrote:
>> This function looks up a PM domain form the provider. This will be
>> useful to add parent/child domain relationship from the SoC specific
>> code. The caller of the function must make sure that PM domain provider
>> is already registered.
>>
>> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
>> ---
>> This patch may solve the same purpose which is done by earlier posts
>> 1) https://lkml.org/lkml/2014/11/24/319 - In this there were comments
>> for not using the PM domain name.
>>
>> 2) Ulf Hansson posted a patch
>> http://www.spinics.net/lists/linux-samsung-soc/msg39745.html which also solves
>> similar purpose but I feel this is slightly complex and involves changing
>> the genpd structure.
>>
>>
>>  drivers/base/power/domain.c |    3 ++-
>>  include/linux/pm_domain.h   |    8 ++++++++
>>  2 files changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>> index d822753..5d7a2c1 100644
>> --- a/drivers/base/power/domain.c
>> +++ b/drivers/base/power/domain.c
>> @@ -2129,7 +2129,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider);
>>   * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
>>   * on failure.
>>   */
>> -static struct generic_pm_domain *of_genpd_get_from_provider(
>> +struct generic_pm_domain *of_genpd_get_from_provider(
>>                                         struct of_phandle_args *genpdspec)
>>  {
>>         struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
>> @@ -2149,6 +2149,7 @@ static struct generic_pm_domain *of_genpd_get_from_provider(
>>
>>         return genpd;
>>  }
>> +EXPORT_SYMBOL_GPL(of_genpd_get_from_provider);
>>
>>  /**
>>   * genpd_dev_pm_detach - Detach a device from its PM domain.
>> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
>> index 9690827..4954e24 100644
>> --- a/include/linux/pm_domain.h
>> +++ b/include/linux/pm_domain.h
>> @@ -282,6 +282,8 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
>>  int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
>>                         void *data);
>>  void of_genpd_del_provider(struct device_node *np);
>> +struct generic_pm_domain *of_genpd_get_from_provider(
>> +                       struct of_phandle_args *genpdspec);
>>
>>  struct generic_pm_domain *__of_genpd_xlate_simple(
>>                                         struct of_phandle_args *genpdspec,
>> @@ -299,6 +301,12 @@ static inline int __of_genpd_add_provider(struct device_node *np,
>>  }
>>  static inline void of_genpd_del_provider(struct device_node *np) {}
>>
>> +static inline struct generic_pm_domain *of_genpd_get_from_provider(
>> +                       struct of_phandle_args *genpdspec)
>> +{
>> +       return NULL;
>> +}
>> +
>>  #define __of_genpd_xlate_simple                NULL
>>  #define __of_genpd_xlate_onecell       NULL
>>
>> --
>> 1.7.9.5
>>
>
> This seems like a good approach!
>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Thanks.
>
> Do, note that you will have to resend the patch to linux-pm list as
> well. Unless Rafael is happy to pick it up from here.
Sure. My fault.

Regards,
Amit
>
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* [PATCH] PM/ Domains: Export of_genpd_get_from_provider function.
@ 2014-12-05  8:25           ` amit daniel kachhap
  0 siblings, 0 replies; 18+ messages in thread
From: amit daniel kachhap @ 2014-12-05  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Dec 4, 2014 at 9:09 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 1 December 2014 at 12:41, Amit Daniel Kachhap
> <amit.daniel@samsung.com> wrote:
>> This function looks up a PM domain form the provider. This will be
>> useful to add parent/child domain relationship from the SoC specific
>> code. The caller of the function must make sure that PM domain provider
>> is already registered.
>>
>> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
>> ---
>> This patch may solve the same purpose which is done by earlier posts
>> 1) https://lkml.org/lkml/2014/11/24/319 - In this there were comments
>> for not using the PM domain name.
>>
>> 2) Ulf Hansson posted a patch
>> http://www.spinics.net/lists/linux-samsung-soc/msg39745.html which also solves
>> similar purpose but I feel this is slightly complex and involves changing
>> the genpd structure.
>>
>>
>>  drivers/base/power/domain.c |    3 ++-
>>  include/linux/pm_domain.h   |    8 ++++++++
>>  2 files changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>> index d822753..5d7a2c1 100644
>> --- a/drivers/base/power/domain.c
>> +++ b/drivers/base/power/domain.c
>> @@ -2129,7 +2129,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider);
>>   * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR()
>>   * on failure.
>>   */
>> -static struct generic_pm_domain *of_genpd_get_from_provider(
>> +struct generic_pm_domain *of_genpd_get_from_provider(
>>                                         struct of_phandle_args *genpdspec)
>>  {
>>         struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
>> @@ -2149,6 +2149,7 @@ static struct generic_pm_domain *of_genpd_get_from_provider(
>>
>>         return genpd;
>>  }
>> +EXPORT_SYMBOL_GPL(of_genpd_get_from_provider);
>>
>>  /**
>>   * genpd_dev_pm_detach - Detach a device from its PM domain.
>> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
>> index 9690827..4954e24 100644
>> --- a/include/linux/pm_domain.h
>> +++ b/include/linux/pm_domain.h
>> @@ -282,6 +282,8 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
>>  int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
>>                         void *data);
>>  void of_genpd_del_provider(struct device_node *np);
>> +struct generic_pm_domain *of_genpd_get_from_provider(
>> +                       struct of_phandle_args *genpdspec);
>>
>>  struct generic_pm_domain *__of_genpd_xlate_simple(
>>                                         struct of_phandle_args *genpdspec,
>> @@ -299,6 +301,12 @@ static inline int __of_genpd_add_provider(struct device_node *np,
>>  }
>>  static inline void of_genpd_del_provider(struct device_node *np) {}
>>
>> +static inline struct generic_pm_domain *of_genpd_get_from_provider(
>> +                       struct of_phandle_args *genpdspec)
>> +{
>> +       return NULL;
>> +}
>> +
>>  #define __of_genpd_xlate_simple                NULL
>>  #define __of_genpd_xlate_onecell       NULL
>>
>> --
>> 1.7.9.5
>>
>
> This seems like a good approach!
>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Thanks.
>
> Do, note that you will have to resend the patch to linux-pm list as
> well. Unless Rafael is happy to pick it up from here.
Sure. My fault.

Regards,
Amit
>
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

end of thread, other threads:[~2014-12-05  8:25 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-28 10:38 [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node Ulf Hansson
2014-11-28 10:38 ` Ulf Hansson
2014-11-29  0:30 ` Rafael J. Wysocki
2014-11-29  0:30   ` Rafael J. Wysocki
2014-12-01 10:26   ` Ulf Hansson
2014-12-01 10:26     ` Ulf Hansson
2014-12-01 11:41     ` [PATCH] PM/ Domains: Export of_genpd_get_from_provider function Amit Daniel Kachhap
2014-12-01 11:41       ` Amit Daniel Kachhap
2014-12-04 15:39       ` Ulf Hansson
2014-12-04 15:39         ` Ulf Hansson
2014-12-04 15:39         ` Ulf Hansson
2014-12-05  8:25         ` amit daniel kachhap
2014-12-05  8:25           ` amit daniel kachhap
2014-12-05  8:25           ` amit daniel kachhap
2014-12-01 11:57     ` [PATCH V2] PM / Domains: Add pm_genpd_lookup() API to lookup domain by firmware node amit daniel kachhap
2014-12-01 11:57       ` amit daniel kachhap
2014-12-04 15:42       ` Ulf Hansson
2014-12-04 15:42         ` Ulf Hansson

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.