power: domain: add dev_power_domain_on
PATCH v2 1/2 power: domain: add dev_power_domain_on
Add this new API to power on multiple domains attached to a device.
---
V2:
New patch
drivers/power/domain/power-domain-uclass.c | 19 +++++++++++++++++++ include/power-domain.h | 17 +++++++++++++++++ 2 files changed, 36 insertions(+)
drivers/power/domain/power-domain-uclass.c +19 -0
@@ -107,6 +107,25 @@ int power_domain_off(struct power_domain *power_domain)return ops->off (power_domain); } +int dev_power_domain_on (struct udevice *dev) +{ +struct power_domain pd; +int i, count, ret; + + count =dev_count_phandle_with_args (dev,"power-domains" , +"#power-domain-cells" ); +for (i =0 ; i < count; i++) { + ret =power_domain_get_by_index (dev, &pd, i); +if (ret) +return ret; + ret =power_domain_on (&pd); +if (ret) +return ret; + } + +return 0 ; +} +UCLASS_DRIVER (power_domain) = { .id =UCLASS_POWER_DOMAIN , .name ="power_domain" ,
include/power-domain.h +17 -0
@@ -155,4 +155,21 @@ static inline int power_domain_off(struct power_domain *power_domain) }#endif +/** +* dev_power_domain_on - Enable power domains for a device . +* +* @dev: The client device. +* +* @return 0 if OK, or a negative error code. +*/ +#if (CONFIG_IS_ENABLED (OF_CONTROL ) && !CONFIG_IS_ENABLED (OF_PLATDATA )) && \ +CONFIG_IS_ENABLED (POWER_DOMAIN ) +int dev_power_domain_on (struct udevice *dev); +#else +int dev_power_domain_on (struct udevice *dev) +{ +return 0 ; +} +#endif +#endif
Signature · 1 line
2.16.4
PATCH v2 2/2 core: device: use dev_power_domain_on
When multiple power domains attached to a device, need power on them all, so use dev_power_domain_on to do that.
---
V2:
use dev_power_domain_on in patch 1/2
drivers/core/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/core/device.c +3 -3
@@ -307,7 +307,6 @@ static void *alloc_priv(int size, uint flags)int device_probe (struct udevice *dev) { -struct power_domain pd;const struct driver *drv;int size =0 ;int ret;
@@ -390,8 +389,9 @@ int device_probe(struct udevice *dev)if (CONFIG_IS_ENABLED (POWER_DOMAIN ) && dev->parent &&device_get_uclass_id (dev) !=UCLASS_POWER_DOMAIN ) { -if (!power_domain_get (dev, &pd)) -power_domain_on (&pd); + ret =dev_power_domain_on (dev); +if (ret) + goto fail; } ret =uclass_pre_probe_device (dev);
Signature · 1 line
2.16.4
PATCH v2 2/2 core: device: use dev_power_domain_on
Quoted 25 lines · Peng Fan
When multiple power domains attached to a device, need power on them all, so use
dev_power_domain_onto do that.Signed-off-by Peng Fan <[email protected]>---
V2:
usedev_power_domain_onin patch 1/2drivers/core/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/core/device.c +0
-1@@ -307,7 +307,6 @@ static void *alloc_priv(int size, uint flags)int device_probe (struct udevice *dev) { -struct power_domain pd;const struct driver *drv;int size =0 ;int ret;
drivers/core/device.c int device_probe(struct udevice *dev) · line 391
Quoted 3 lines
drivers/core/device.c +0
-0@@ -390,8 +389,9 @@ int device_probe(struct udevice *dev)if (CONFIG_IS_ENABLED (POWER_DOMAIN ) && dev->parent &&device_get_uclass_id (dev) !=UCLASS_POWER_DOMAIN ) {
I guess we can drop the if condition all together and can directly call dev_power_domain_on(). Rest looks good to me.
Thanks and regards,
Lokesh
Quoted 9 lines
drivers/core/device.c +3
-2-if (!power_domain_get (dev, &pd)) -power_domain_on (&pd); + ret =dev_power_domain_on (dev); +if (ret) + goto fail; } ret =uclass_pre_probe_device (dev);
PATCH v2 2/2 core: device: use dev_power_domain_on
In reply to Peng FanQuoted 25 lines · Peng Fan
When multiple power domains attached to a device, need power on them all, so use
dev_power_domain_onto do that.Signed-off-by Peng Fan <[email protected]>---
V2:
usedev_power_domain_onin patch 1/2drivers/core/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/core/device.c +0
-1@@ -307,7 +307,6 @@ static void *alloc_priv(int size, uint flags)int device_probe (struct udevice *dev) { -struct power_domain pd;const struct driver *drv;int size =0 ;int ret;
drivers/core/device.c int device_probe(struct udevice *dev) · line 394
Quoted 8 lines
drivers/core/device.c +3
-2@@ -390,8 +389,9 @@ int device_probe(struct udevice *dev)if (CONFIG_IS_ENABLED (POWER_DOMAIN ) && dev->parent &&device_get_uclass_id (dev) !=UCLASS_POWER_DOMAIN ) { -if (!power_domain_get (dev, &pd)) -power_domain_on (&pd); + ret =dev_power_domain_on (dev); +if (ret) + goto fail;
Also can you not return here in case of failure? It might be the case that power_domain driver might not be available yet.
Thanks and regards,
Lokesh
Quoted 4 lines
drivers/core/device.c +0
-0} ret =uclass_pre_probe_device (dev);
PATCH v2 2/2 core: device: use dev_power_domain_on
Hi Lokesh,
Quoted 30 lines
Subject: Re: [PATCH V2 2/2] core: device: use
dev_power_domain_onQuoted 25 lines · Peng Fan
When multiple power domains attached to a device, need power on them all, so use
dev_power_domain_onto do that.Signed-off-by Peng Fan <[email protected]>---
V2:
usedev_power_domain_onin patch 1/2drivers/core/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/core/device.c index renamed from drivers/core/device.c +0
-0
05dadf98f9..f4d7140698100644drivers/core/device.c +0
-1@@ -307,7 +307,6 @@ static void *alloc_priv(int size, uint flags)int device_probe (struct udevice *dev) { -struct power_domain pd;const struct driver *drv;int size =0 ;int ret;@@ -390,8 +389,9 @@ int device_probe(struct udevice *dev)
Quoted 10 lines
drivers/core/device.c int device_probe(struct udevice *dev) · line 394
Quoted 7 lines
drivers/core/device.c +3
-2if (CONFIG_IS_ENABLED (POWER_DOMAIN ) && dev->parent &&device_get_uclass_id (dev) !=UCLASS_POWER_DOMAIN ) { -if (!power_domain_get (dev, &pd)) -power_domain_on (&pd); + ret =dev_power_domain_on (dev); +if (ret) + goto fail;Also can you not return here in case of failure? It might be the case that
power_domaindriver might not be available yet
Only when POWER_DOMAIN is enabled, dev_power_domain_on will be called. I not follow you not available yet.
Thanks,
Peng.
Quoted 8 lines
Thanks and regards,
LokeshQuoted 4 lines
drivers/core/device.c +0
-0} ret =uclass_pre_probe_device (dev);
PATCH v2 2/2 core: device: use dev_power_domain_on
Hi Peng,
Quoted 43 lines · Peng Fan
Hi Lokesh,
Quoted 30 lines
Subject: Re: [PATCH V2 2/2] core: device: use
dev_power_domain_onQuoted 25 lines · Peng Fan
When multiple power domains attached to a device, need power on them all, so use
dev_power_domain_onto do that.Signed-off-by Peng Fan <[email protected]>---
V2:
usedev_power_domain_onin patch 1/2drivers/core/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/core/device.c index renamed from drivers/core/device.c +0
-0
05dadf98f9..f4d7140698100644drivers/core/device.c +0
-1@@ -307,7 +307,6 @@ static void *alloc_priv(int size, uint flags)int device_probe (struct udevice *dev) { -struct power_domain pd;const struct driver *drv;int size =0 ;int ret;@@ -390,8 +389,9 @@ int device_probe(struct udevice *dev)Quoted 10 lines
drivers/core/device.c int device_probe(struct udevice *dev) · line 394
Quoted 7 lines
drivers/core/device.c +3
-2if (CONFIG_IS_ENABLED (POWER_DOMAIN ) && dev->parent &&device_get_uclass_id (dev) !=UCLASS_POWER_DOMAIN ) { -if (!power_domain_get (dev, &pd)) -power_domain_on (&pd); + ret =dev_power_domain_on (dev); +if (ret) + goto fail;Also can you not return here in case of failure? It might be the case that
power_domaindriver might not be available yet
Quoted 2 lines
Only when
POWER_DOMAINis enabled,dev_power_domain_onwill be called. I not follow you not available yet.
Never mind, it is an issue with enabling power domain on my end. Ill take back my comment, Sorry for the noise.
Thanks and regards,
Lokesh
Quoted 12 lines
Thanks,
Peng.Quoted 8 lines
Thanks and regards,
LokeshQuoted 4 lines
drivers/core/device.c +0
-0} ret =uclass_pre_probe_device (dev);
PATCH v2 2/2 core: device: use dev_power_domain_on
Quoted 47 lines · Lokesh Vutla
Hi Peng,
Quoted 43 lines · Peng Fan
Hi Lokesh,
Quoted 40 lines
Subject: Re: [PATCH V2 2/2] core: device: use
dev_power_domain_onQuoted 24 lines · Peng Fan
When multiple power domains attached to a device, need power on them all, so use
dev_power_domain_onto do that.Signed-off-by Peng Fan <[email protected]>---
V2:
usedev_power_domain_onin patch 1/2drivers/core/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/core/device.c index renamed from drivers/core/device.c +0
-0
05dadf98f9..f4d7140698100644drivers/core/device.c +0
-1@@ -307,7 +307,6 @@ static void *alloc_priv(int size, uint flags)int device_probe (struct udevice *dev) { -struct power_domain pd;const struct driver *drv;int size =0 ;int ret;drivers/core/device.c int device_probe(struct udevice *dev) · line 394
Quoted 8 lines
drivers/core/device.c +3
-2@@ -390,8 +389,9 @@ int device_probe(struct udevice *dev)if (CONFIG_IS_ENABLED (POWER_DOMAIN ) && dev->parent &&device_get_uclass_id (dev) !=UCLASS_POWER_DOMAIN ) { -if (!power_domain_get (dev, &pd)) -power_domain_on (&pd); + ret =dev_power_domain_on (dev); +if (ret) + goto fail;Also can you not return here in case of failure? It might be the case that
power_domaindriver might not be available yet
Quoted 5 lines
Quoted 2 lines
Only when
POWER_DOMAINis enabled,dev_power_domain_onwill be called. I not follow you not available yet.Never mind, it is an issue with enabling power domain on my end. Ill take back my comment, Sorry for the noise.
PATCH v2 1/2 power: domain: add dev_power_domain_on
In reply to Peng FanQuoted 4 lines · Peng Fan
Add this new API to power on multiple domains attached to a device.
Signed-off-by Peng Fan <[email protected]>
Thanks and regards,
Lokesh
Quoted 66 lines
---
V2:
New patchdrivers/power/domain/power-domain-uclass.c | 19 +++++++++++++++++++ include/power-domain.h | 17 +++++++++++++++++ 2 files changed, 36 insertions(+)drivers/power/domain/power-domain-uclass.c +19
-0@@ -107,6 +107,25 @@ int power_domain_off(struct power_domain *power_domain)return ops->off (power_domain); } +int dev_power_domain_on (struct udevice *dev) +{ +struct power_domain pd; +int i, count, ret; + + count =dev_count_phandle_with_args (dev,"power-domains" , +"#power-domain-cells" ); +for (i =0 ; i < count; i++) { + ret =power_domain_get_by_index (dev, &pd, i); +if (ret) +return ret; + ret =power_domain_on (&pd); +if (ret) +return ret; + } + +return 0 ; +} +UCLASS_DRIVER (power_domain) = { .id =UCLASS_POWER_DOMAIN , .name ="power_domain" ,include/power-domain.h +17
-0@@ -155,4 +155,21 @@ static inline int power_domain_off(struct power_domain *power_domain) }#endif +/** +* dev_power_domain_on - Enable power domains for a device . +* +* @dev: The client device. +* +* @return 0 if OK, or a negative error code. +*/ +#if (CONFIG_IS_ENABLED (OF_CONTROL ) && !CONFIG_IS_ENABLED (OF_PLATDATA )) && \ +CONFIG_IS_ENABLED (POWER_DOMAIN ) +int dev_power_domain_on (struct udevice *dev); +#else +int dev_power_domain_on (struct udevice *dev) +{ +return 0 ; +} +#endif +#endif
PATCH v2 1/2 power: domain: add dev_power_domain_on
In reply to Peng FanQuoted 6 lines · Peng Fan
Add this new API to power on multiple domains attached to a device.
Signed-off-by Peng Fan <[email protected]>---
[..snip..]
include/power-domain.h static inline int power_domain_off(struct power_domain *power_domain) · line 169
Quoted 6 lines
+ */
include/power-domain.h +5
-0+#if (CONFIG_IS_ENABLED (OF_CONTROL ) && !CONFIG_IS_ENABLED (OF_PLATDATA )) && \ +CONFIG_IS_ENABLED (POWER_DOMAIN ) +int dev_power_domain_on (struct udevice *dev); +#else +int dev_power_domain_on (struct udevice *dev)
static inline
Thanks and regards,
Lokesh
Quoted 7 lines
include/power-domain.h +5
-0+{ +return 0 ; +} +#endif +#endif
PATCH v2 1/2 power: domain: add dev_power_domain_on
Quoted 13 lines · Lokesh Vutla
Quoted 6 lines · Peng Fan
Add this new API to power on multiple domains attached to a device.
Signed-off-by Peng Fan <[email protected]>---
[..snip..]
Quoted 8 lines
include/power-domain.h static inline int power_domain_off(struct power_domain *power_domain) · line 169
Quoted 6 lines
+ */
include/power-domain.h +5
-0+#if (CONFIG_IS_ENABLED (OF_CONTROL ) && !CONFIG_IS_ENABLED (OF_PLATDATA )) && \ +CONFIG_IS_ENABLED (POWER_DOMAIN ) +int dev_power_domain_on (struct udevice *dev); +#else +int dev_power_domain_on (struct udevice *dev)static inline
Fixed this, added a condition to the .c file, and:
Quoted 11 lines
Thanks and regards,
LokeshQuoted 7 lines
include/power-domain.h +5
-0+{ +return 0 ; +} +#endif +#endif