devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 4/5] soc: samsung: pm_domains: Read domain name from the new label property
       [not found] ` <CGME20170130121915eucas1p23aa4f4be912bcd64f9521f6e6b51132f@eucas1p2.samsung.com>
@ 2017-01-30 12:18   ` Marek Szyprowski
  2017-01-31 19:40     ` Krzysztof Kozlowski
  2017-02-01 16:25     ` Rob Herring
  0 siblings, 2 replies; 4+ messages in thread
From: Marek Szyprowski @ 2017-01-30 12:18 UTC (permalink / raw)
  To: linux-samsung-soc, linux-pm
  Cc: Marek Szyprowski, Sylwester Nawrocki, Krzysztof Kozlowski,
	Javier Martinez Canillas, Bartlomiej Zolnierkiewicz, Chanwoo Choi,
	Inki Dae, devicetree, Rob Herring

Device tree nodes for each power domain should use generic "power-domain"
name, so using it as a domain name doesn't give much benefits. This patch
adds support for human readable names defined in 'label' property. Such
names are visible to userspace and makes debugging much easier. When no
'label' property is found, driver keeps using the name constructed from
full node name.

Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 Documentation/devicetree/bindings/power/pd-samsung.txt |  4 ++++
 drivers/soc/samsung/pm_domains.c                       | 12 ++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/power/pd-samsung.txt b/Documentation/devicetree/bindings/power/pd-samsung.txt
index fb08c8d62733..549f7dee9b9d 100644
--- a/Documentation/devicetree/bindings/power/pd-samsung.txt
+++ b/Documentation/devicetree/bindings/power/pd-samsung.txt
@@ -13,6 +13,8 @@ Required Properties:
     must be 0.
 
 Optional Properties:
+- label: Human readable string with domain name. Will be visible in userspace
+	to let user to distinguish between multiple domains in SoC.
 - clocks: List of clock handles. The parent clocks of the input clocks to the
 	devices in this power domain are set to oscclk before power gating
 	and restored back after powering on a domain. This is required for
@@ -39,6 +41,7 @@ Example:
 		compatible = "samsung,exynos4210-pd";
 		reg = <0x10023C00 0x10>;
 		#power-domain-cells = <0>;
+		label = "LCD0";
 	};
 
 	mfc_pd: power-domain@10044060 {
@@ -47,6 +50,7 @@ Example:
 		clocks = <&clock CLK_FIN_PLL>, <&clock CLK_MOUT_USER_ACLK333>;
 		clock-names = "oscclk", "clk0";
 		#power-domain-cells = <0>;
+		label = "MFC";
 	};
 
 See Documentation/devicetree/bindings/power/power_domain.txt for description
diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c
index 5a0a46bcbe18..a6a5d807cc2b 100644
--- a/drivers/soc/samsung/pm_domains.c
+++ b/drivers/soc/samsung/pm_domains.c
@@ -142,6 +142,15 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain)
 	{ },
 };
 
+static __init const char *exynos_get_domain_name(struct device_node *node)
+{
+	const char *name;
+
+	if (of_property_read_string(node, "label", &name) < 0)
+		name = strrchr(node->full_name, '/') + 1;
+	return kstrdup_const(name, GFP_KERNEL);
+}
+
 static __init int exynos4_pm_init_power_domain(void)
 {
 	struct device_node *np;
@@ -159,8 +168,7 @@ static __init int exynos4_pm_init_power_domain(void)
 			of_node_put(np);
 			return -ENOMEM;
 		}
-		pd->pd.name = kstrdup_const(strrchr(np->full_name, '/') + 1,
-					    GFP_KERNEL);
+		pd->pd.name = exynos_get_domain_name(np);
 		if (!pd->pd.name) {
 			kfree(pd);
 			of_node_put(np);
-- 
1.9.1


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

* Re: [PATCH v3 4/5] soc: samsung: pm_domains: Read domain name from the new label property
  2017-01-30 12:18   ` [PATCH v3 4/5] soc: samsung: pm_domains: Read domain name from the new label property Marek Szyprowski
@ 2017-01-31 19:40     ` Krzysztof Kozlowski
  2017-02-01 16:25     ` Rob Herring
  1 sibling, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2017-01-31 19:40 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-samsung-soc, linux-pm, Sylwester Nawrocki,
	Javier Martinez Canillas, Bartlomiej Zolnierkiewicz, Chanwoo Choi,
	Inki Dae, devicetree, Rob Herring

On Mon, Jan 30, 2017 at 01:18:59PM +0100, Marek Szyprowski wrote:
> Device tree nodes for each power domain should use generic "power-domain"
> name, so using it as a domain name doesn't give much benefits. This patch
> adds support for human readable names defined in 'label' property. Such
> names are visible to userspace and makes debugging much easier. When no
> 'label' property is found, driver keeps using the name constructed from
> full node name.
> 
> Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  Documentation/devicetree/bindings/power/pd-samsung.txt |  4 ++++
>  drivers/soc/samsung/pm_domains.c                       | 12 ++++++++++--
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 

Thanks, applied.

Best regards,
Krzysztof


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

* Re: [PATCH v3 4/5] soc: samsung: pm_domains: Read domain name from the new label property
  2017-01-30 12:18   ` [PATCH v3 4/5] soc: samsung: pm_domains: Read domain name from the new label property Marek Szyprowski
  2017-01-31 19:40     ` Krzysztof Kozlowski
@ 2017-02-01 16:25     ` Rob Herring
  2017-02-04 15:46       ` Krzysztof Kozlowski
  1 sibling, 1 reply; 4+ messages in thread
From: Rob Herring @ 2017-02-01 16:25 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-samsung-soc, linux-pm, Sylwester Nawrocki,
	Krzysztof Kozlowski, Javier Martinez Canillas,
	Bartlomiej Zolnierkiewicz, Chanwoo Choi, Inki Dae, devicetree

On Mon, Jan 30, 2017 at 01:18:59PM +0100, Marek Szyprowski wrote:
> Device tree nodes for each power domain should use generic "power-domain"
> name, so using it as a domain name doesn't give much benefits. This patch
> adds support for human readable names defined in 'label' property. Such
> names are visible to userspace and makes debugging much easier. When no
> 'label' property is found, driver keeps using the name constructed from
> full node name.

I'm not sure this is really a good use of label. label is intended for 
end user visible things like ports/connectors on a board. It's fine 
here, but I wouldn't want to see it used everywhere.

> 
> Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  Documentation/devicetree/bindings/power/pd-samsung.txt |  4 ++++
>  drivers/soc/samsung/pm_domains.c                       | 12 ++++++++++--
>  2 files changed, 14 insertions(+), 2 deletions(-)

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

* Re: [PATCH v3 4/5] soc: samsung: pm_domains: Read domain name from the new label property
  2017-02-01 16:25     ` Rob Herring
@ 2017-02-04 15:46       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-04 15:46 UTC (permalink / raw)
  To: Rob Herring
  Cc: Marek Szyprowski, linux-samsung-soc, linux-pm, Sylwester Nawrocki,
	Javier Martinez Canillas, Bartlomiej Zolnierkiewicz, Chanwoo Choi,
	Inki Dae, devicetree

On Wed, Feb 01, 2017 at 10:25:54AM -0600, Rob Herring wrote:
> On Mon, Jan 30, 2017 at 01:18:59PM +0100, Marek Szyprowski wrote:
> > Device tree nodes for each power domain should use generic "power-domain"
> > name, so using it as a domain name doesn't give much benefits. This patch
> > adds support for human readable names defined in 'label' property. Such
> > names are visible to userspace and makes debugging much easier. When no
> > 'label' property is found, driver keeps using the name constructed from
> > full node name.
> 
> I'm not sure this is really a good use of label. label is intended for 
> end user visible things like ports/connectors on a board. It's fine 
> here, but I wouldn't want to see it used everywhere.
>

Thanks for comments. We want to use the label here for user visible
output - through dmesg or debugfs. Otherwise, we would have to stick
(always) to more descriptive node names, like "lcd-power-domain@xxxxx".

Best regards,
Krzysztof

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

end of thread, other threads:[~2017-02-04 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1485778740-30337-1-git-send-email-m.szyprowski@samsung.com>
     [not found] ` <CGME20170130121915eucas1p23aa4f4be912bcd64f9521f6e6b51132f@eucas1p2.samsung.com>
2017-01-30 12:18   ` [PATCH v3 4/5] soc: samsung: pm_domains: Read domain name from the new label property Marek Szyprowski
2017-01-31 19:40     ` Krzysztof Kozlowski
2017-02-01 16:25     ` Rob Herring
2017-02-04 15:46       ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).