diff mbox

[RFC,v2,07/12] PM / Domains: export pm_genpd_lookup_name

Message ID 1416834256-11225-7-git-send-email-amit.daniel@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Amit Kachhap Nov. 24, 2014, 1:04 p.m. UTC
This API may be needed to set the power domain parent/child relationship
in the power domain platform driver. The parent relationship is
generally set after the child power domain is registered with the power
domain subsystem. In this case, pm_genpd_lookup_name API might be
useful.

Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
---
 drivers/base/power/domain.c |    3 ++-
 include/linux/pm_domain.h   |    7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Ulf Hansson Nov. 25, 2014, 7:35 a.m. UTC | #1
On 24 November 2014 at 14:04, Amit Daniel Kachhap
<amit.daniel@samsung.com> wrote:
> This API may be needed to set the power domain parent/child relationship
> in the power domain platform driver. The parent relationship is
> generally set after the child power domain is registered with the power
> domain subsystem. In this case, pm_genpd_lookup_name API might be
> useful.

I think this is a step in the wrong direction. Instead we should be
working on removing the "name" based APIs from genpd.

The proper way should be to pass the PM domain as a parameter to the
APIs instead.

Kind regards
Uffe

>
> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> ---
>  drivers/base/power/domain.c |    3 ++-
>  include/linux/pm_domain.h   |    7 +++++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index fb83d4a..b0e1c2f 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -49,7 +49,7 @@
>  static LIST_HEAD(gpd_list);
>  static DEFINE_MUTEX(gpd_list_lock);
>
> -static struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
> +struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
>  {
>         struct generic_pm_domain *genpd = NULL, *gpd;
>
> @@ -66,6 +66,7 @@ static struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
>         mutex_unlock(&gpd_list_lock);
>         return genpd;
>  }
> +EXPORT_SYMBOL_GPL(pm_genpd_lookup_name);
>
>  struct generic_pm_domain *dev_to_genpd(struct device *dev)
>  {
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 2e0e06d..aedcec3 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -150,6 +150,8 @@ extern int pm_genpd_name_poweron(const char *domain_name);
>
>  extern struct dev_power_governor simple_qos_governor;
>  extern struct dev_power_governor pm_domain_always_on_gov;
> +
> +extern struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name);
>  #else
>
>  static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
> @@ -221,6 +223,11 @@ static inline int pm_genpd_name_poweron(const char *domain_name)
>  {
>         return -ENOSYS;
>  }
> +static inline
> +struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
> +{
> +       return NULL;
> +}
>  #define simple_qos_governor NULL
>  #define pm_domain_always_on_gov NULL
>  #endif
> --
> 1.7.9.5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Amit Kachhap Nov. 25, 2014, 8:48 a.m. UTC | #2
On Tue, Nov 25, 2014 at 1:05 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 24 November 2014 at 14:04, Amit Daniel Kachhap
> <amit.daniel@samsung.com> wrote:
>> This API may be needed to set the power domain parent/child relationship
>> in the power domain platform driver. The parent relationship is
>> generally set after the child power domain is registered with the power
>> domain subsystem. In this case, pm_genpd_lookup_name API might be
>> useful.
>
> I think this is a step in the wrong direction. Instead we should be
> working on removing the "name" based APIs from genpd.
>
> The proper way should be to pass the PM domain as a parameter to the
> APIs instead.
Yes i understand but i had a special requirement for using this API
during pd probe.
 I cannot use hierarchy to represent parent/child pd nodes as it will
break the existing SoC's. In my case all the PD nodes are linear. The
parent/child relationship are established in the second pass after all
the PD entries are registered with the help of this API.
Although there a way that i can always keep parent PD's before the
child PD's in DT in linear order. Will check this approach.

Regards,
Amit
>
> Kind regards
> Uffe
>
>>
>> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
>> ---
>>  drivers/base/power/domain.c |    3 ++-
>>  include/linux/pm_domain.h   |    7 +++++++
>>  2 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>> index fb83d4a..b0e1c2f 100644
>> --- a/drivers/base/power/domain.c
>> +++ b/drivers/base/power/domain.c
>> @@ -49,7 +49,7 @@
>>  static LIST_HEAD(gpd_list);
>>  static DEFINE_MUTEX(gpd_list_lock);
>>
>> -static struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
>> +struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
>>  {
>>         struct generic_pm_domain *genpd = NULL, *gpd;
>>
>> @@ -66,6 +66,7 @@ static struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
>>         mutex_unlock(&gpd_list_lock);
>>         return genpd;
>>  }
>> +EXPORT_SYMBOL_GPL(pm_genpd_lookup_name);
>>
>>  struct generic_pm_domain *dev_to_genpd(struct device *dev)
>>  {
>> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
>> index 2e0e06d..aedcec3 100644
>> --- a/include/linux/pm_domain.h
>> +++ b/include/linux/pm_domain.h
>> @@ -150,6 +150,8 @@ extern int pm_genpd_name_poweron(const char *domain_name);
>>
>>  extern struct dev_power_governor simple_qos_governor;
>>  extern struct dev_power_governor pm_domain_always_on_gov;
>> +
>> +extern struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name);
>>  #else
>>
>>  static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
>> @@ -221,6 +223,11 @@ static inline int pm_genpd_name_poweron(const char *domain_name)
>>  {
>>         return -ENOSYS;
>>  }
>> +static inline
>> +struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
>> +{
>> +       return NULL;
>> +}
>>  #define simple_qos_governor NULL
>>  #define pm_domain_always_on_gov NULL
>>  #endif
>> --
>> 1.7.9.5
>>
> --
> 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/
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Nov. 27, 2014, 2:20 p.m. UTC | #3
On 25 November 2014 at 09:48, amit daniel kachhap
<amit.daniel@samsung.com> wrote:
> On Tue, Nov 25, 2014 at 1:05 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> On 24 November 2014 at 14:04, Amit Daniel Kachhap
>> <amit.daniel@samsung.com> wrote:
>>> This API may be needed to set the power domain parent/child relationship
>>> in the power domain platform driver. The parent relationship is
>>> generally set after the child power domain is registered with the power
>>> domain subsystem. In this case, pm_genpd_lookup_name API might be
>>> useful.
>>
>> I think this is a step in the wrong direction. Instead we should be
>> working on removing the "name" based APIs from genpd.
>>
>> The proper way should be to pass the PM domain as a parameter to the
>> APIs instead.
> Yes i understand but i had a special requirement for using this API
> during pd probe.
>  I cannot use hierarchy to represent parent/child pd nodes as it will
> break the existing SoC's. In my case all the PD nodes are linear. The
> parent/child relationship are established in the second pass after all
> the PD entries are registered with the help of this API.
> Although there a way that i can always keep parent PD's before the
> child PD's in DT in linear order. Will check this approach.

I had some thinking around this, could the below approach work?

I just posted a patch[1] adding a new pm_genpd_lookup() API, which is
using a "DT device node" to fetch the genpd. The idea is to use that
API to get the genpd handle which is needed to configure a subdomain
through pm_genpd_add_subdomain() API.

In principle you will have to walk through the DT a couple of times,
initialize those domains (and subdomains) which either don't have a
parent domain or which parent domain already has been initialized. I
guess you need a somewhat clever loop to do that, but I think it's
doable.

Obviously we also need to have a generic binding for a "parent
domain". I like Geert's proposal from the other patch, which means
using "power-domains = <&pd_xyz>".

Kind regards
Uffe

[1]
http://marc.info/?l=linux-pm&m=141709766008458&w=2
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Amit Kachhap Nov. 28, 2014, 8:52 a.m. UTC | #4
On Thu, Nov 27, 2014 at 7:50 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 25 November 2014 at 09:48, amit daniel kachhap
> <amit.daniel@samsung.com> wrote:
>> On Tue, Nov 25, 2014 at 1:05 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>>> On 24 November 2014 at 14:04, Amit Daniel Kachhap
>>> <amit.daniel@samsung.com> wrote:
>>>> This API may be needed to set the power domain parent/child relationship
>>>> in the power domain platform driver. The parent relationship is
>>>> generally set after the child power domain is registered with the power
>>>> domain subsystem. In this case, pm_genpd_lookup_name API might be
>>>> useful.
>>>
>>> I think this is a step in the wrong direction. Instead we should be
>>> working on removing the "name" based APIs from genpd.
>>>
>>> The proper way should be to pass the PM domain as a parameter to the
>>> APIs instead.
>> Yes i understand but i had a special requirement for using this API
>> during pd probe.
>>  I cannot use hierarchy to represent parent/child pd nodes as it will
>> break the existing SoC's. In my case all the PD nodes are linear. The
>> parent/child relationship are established in the second pass after all
>> the PD entries are registered with the help of this API.
>> Although there a way that i can always keep parent PD's before the
>> child PD's in DT in linear order. Will check this approach.
>
> I had some thinking around this, could the below approach work?
>
> I just posted a patch[1] adding a new pm_genpd_lookup() API, which is
> using a "DT device node" to fetch the genpd. The idea is to use that
> API to get the genpd handle which is needed to configure a subdomain
> through pm_genpd_add_subdomain() API.
I looked at your patch. I seems fine. i will test them and post the
new version of my series.

Regards,
Amit D
>
> In principle you will have to walk through the DT a couple of times,
> initialize those domains (and subdomains) which either don't have a
> parent domain or which parent domain already has been initialized. I
> guess you need a somewhat clever loop to do that, but I think it's
> doable.
>
> Obviously we also need to have a generic binding for a "parent
> domain". I like Geert's proposal from the other patch, which means
> using "power-domains = <&pd_xyz>".
>
> Kind regards
> Uffe
>
> [1]
> http://marc.info/?l=linux-pm&m=141709766008458&w=2
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index fb83d4a..b0e1c2f 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -49,7 +49,7 @@ 
 static LIST_HEAD(gpd_list);
 static DEFINE_MUTEX(gpd_list_lock);
 
-static struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
+struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
 {
 	struct generic_pm_domain *genpd = NULL, *gpd;
 
@@ -66,6 +66,7 @@  static struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
 	mutex_unlock(&gpd_list_lock);
 	return genpd;
 }
+EXPORT_SYMBOL_GPL(pm_genpd_lookup_name);
 
 struct generic_pm_domain *dev_to_genpd(struct device *dev)
 {
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 2e0e06d..aedcec3 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -150,6 +150,8 @@  extern int pm_genpd_name_poweron(const char *domain_name);
 
 extern struct dev_power_governor simple_qos_governor;
 extern struct dev_power_governor pm_domain_always_on_gov;
+
+extern struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name);
 #else
 
 static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
@@ -221,6 +223,11 @@  static inline int pm_genpd_name_poweron(const char *domain_name)
 {
 	return -ENOSYS;
 }
+static inline
+struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
+{
+	return NULL;
+}
 #define simple_qos_governor NULL
 #define pm_domain_always_on_gov NULL
 #endif