All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firmware: arm_scmi: add clock management to the SCMI power domain
@ 2021-05-07 20:20 ` Nicolas Pitre
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Pitre @ 2021-05-07 20:20 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi
  Cc: Dien Pham, Gaku Inami, linux-arm-kernel, linux-kernel

Clocks requiring non-atomic contexts are supported by the generic clock
PM layer since commit 0bfa0820c274 ("PM: clk: make PM clock layer
compatible with clocks that must sleep"). That means we can have
SCMI-based clocks be managed by the SCMI power domain now.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Tested-by: Dien Pham <dien.pham.ry@renesas.com>
Reviewed-by: Gaku Inami <gaku.inami.xh@renesas.com>

diff --git a/drivers/firmware/arm_scmi/scmi_pm_domain.c b/drivers/firmware/arm_scmi/scmi_pm_domain.c
index 9d36d5c062..4371fdcd5a 100644
--- a/drivers/firmware/arm_scmi/scmi_pm_domain.c
+++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c
@@ -8,6 +8,7 @@
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/pm_clock.h>
 #include <linux/pm_domain.h>
 #include <linux/scmi_protocol.h>
 
@@ -52,6 +53,27 @@ static int scmi_pd_power_off(struct generic_pm_domain *domain)
 	return scmi_pd_power(domain, false);
 }
 
+static int scmi_pd_attach_dev(struct generic_pm_domain *pd, struct device *dev)
+{
+	int ret;
+
+	ret = pm_clk_create(dev);
+	if (ret)
+		return ret;
+
+	ret = of_pm_clk_add_clks(dev);
+	if (ret >= 0)
+		return 0;
+
+	pm_clk_destroy(dev);
+	return ret;
+}
+
+static void scmi_pd_detach_dev(struct generic_pm_domain *pd, struct device *dev)
+{
+	pm_clk_destroy(dev);
+}
+
 static int scmi_pm_domain_probe(struct scmi_device *sdev)
 {
 	int num_domains, i;
@@ -102,6 +124,10 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
 		scmi_pd->genpd.name = scmi_pd->name;
 		scmi_pd->genpd.power_off = scmi_pd_power_off;
 		scmi_pd->genpd.power_on = scmi_pd_power_on;
+		scmi_pd->genpd.attach_dev = scmi_pd_attach_dev;
+		scmi_pd->genpd.detach_dev = scmi_pd_detach_dev;
+		scmi_pd->genpd.flags = GENPD_FLAG_PM_CLK |
+				       GENPD_FLAG_ACTIVE_WAKEUP;
 
 		pm_genpd_init(&scmi_pd->genpd, NULL,
 			      state == SCMI_POWER_STATE_GENERIC_OFF);

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

* [PATCH] firmware: arm_scmi: add clock management to the SCMI power domain
@ 2021-05-07 20:20 ` Nicolas Pitre
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Pitre @ 2021-05-07 20:20 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi
  Cc: Dien Pham, Gaku Inami, linux-arm-kernel, linux-kernel

Clocks requiring non-atomic contexts are supported by the generic clock
PM layer since commit 0bfa0820c274 ("PM: clk: make PM clock layer
compatible with clocks that must sleep"). That means we can have
SCMI-based clocks be managed by the SCMI power domain now.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Tested-by: Dien Pham <dien.pham.ry@renesas.com>
Reviewed-by: Gaku Inami <gaku.inami.xh@renesas.com>

diff --git a/drivers/firmware/arm_scmi/scmi_pm_domain.c b/drivers/firmware/arm_scmi/scmi_pm_domain.c
index 9d36d5c062..4371fdcd5a 100644
--- a/drivers/firmware/arm_scmi/scmi_pm_domain.c
+++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c
@@ -8,6 +8,7 @@
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/pm_clock.h>
 #include <linux/pm_domain.h>
 #include <linux/scmi_protocol.h>
 
@@ -52,6 +53,27 @@ static int scmi_pd_power_off(struct generic_pm_domain *domain)
 	return scmi_pd_power(domain, false);
 }
 
+static int scmi_pd_attach_dev(struct generic_pm_domain *pd, struct device *dev)
+{
+	int ret;
+
+	ret = pm_clk_create(dev);
+	if (ret)
+		return ret;
+
+	ret = of_pm_clk_add_clks(dev);
+	if (ret >= 0)
+		return 0;
+
+	pm_clk_destroy(dev);
+	return ret;
+}
+
+static void scmi_pd_detach_dev(struct generic_pm_domain *pd, struct device *dev)
+{
+	pm_clk_destroy(dev);
+}
+
 static int scmi_pm_domain_probe(struct scmi_device *sdev)
 {
 	int num_domains, i;
@@ -102,6 +124,10 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
 		scmi_pd->genpd.name = scmi_pd->name;
 		scmi_pd->genpd.power_off = scmi_pd_power_off;
 		scmi_pd->genpd.power_on = scmi_pd_power_on;
+		scmi_pd->genpd.attach_dev = scmi_pd_attach_dev;
+		scmi_pd->genpd.detach_dev = scmi_pd_detach_dev;
+		scmi_pd->genpd.flags = GENPD_FLAG_PM_CLK |
+				       GENPD_FLAG_ACTIVE_WAKEUP;
 
 		pm_genpd_init(&scmi_pd->genpd, NULL,
 			      state == SCMI_POWER_STATE_GENERIC_OFF);

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] firmware: arm_scmi: add clock management to the SCMI power domain
  2021-05-07 20:20 ` Nicolas Pitre
@ 2021-05-11 14:53   ` Sudeep Holla
  -1 siblings, 0 replies; 8+ messages in thread
From: Sudeep Holla @ 2021-05-11 14:53 UTC (permalink / raw)
  To: Nicolas Pitre
  Cc: Cristian Marussi, Sudeep Holla, Dien Pham, Gaku Inami,
	linux-arm-kernel, linux-kernel

Hi Nico,

On Fri, May 07, 2021 at 04:20:36PM -0400, Nicolas Pitre wrote:
> Clocks requiring non-atomic contexts are supported by the generic clock
> PM layer since commit 0bfa0820c274 ("PM: clk: make PM clock layer
> compatible with clocks that must sleep"). That means we can have
> SCMI-based clocks be managed by the SCMI power domain now.
>

Looks good to me, I will apply this soon for v5.14.
I will reply with details once it is applied.

--
Regards,
Sudeep

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

* Re: [PATCH] firmware: arm_scmi: add clock management to the SCMI power domain
@ 2021-05-11 14:53   ` Sudeep Holla
  0 siblings, 0 replies; 8+ messages in thread
From: Sudeep Holla @ 2021-05-11 14:53 UTC (permalink / raw)
  To: Nicolas Pitre
  Cc: Cristian Marussi, Sudeep Holla, Dien Pham, Gaku Inami,
	linux-arm-kernel, linux-kernel

Hi Nico,

On Fri, May 07, 2021 at 04:20:36PM -0400, Nicolas Pitre wrote:
> Clocks requiring non-atomic contexts are supported by the generic clock
> PM layer since commit 0bfa0820c274 ("PM: clk: make PM clock layer
> compatible with clocks that must sleep"). That means we can have
> SCMI-based clocks be managed by the SCMI power domain now.
>

Looks good to me, I will apply this soon for v5.14.
I will reply with details once it is applied.

--
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] firmware: arm_scmi: add clock management to the SCMI power domain
  2021-05-11 14:53   ` Sudeep Holla
@ 2021-05-11 15:05     ` Nicolas Pitre
  -1 siblings, 0 replies; 8+ messages in thread
From: Nicolas Pitre @ 2021-05-11 15:05 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Cristian Marussi, Dien Pham, Gaku Inami, linux-arm-kernel, linux-kernel

On Tue, 11 May 2021, Sudeep Holla wrote:

> Hi Nico,
> 
> On Fri, May 07, 2021 at 04:20:36PM -0400, Nicolas Pitre wrote:
> > Clocks requiring non-atomic contexts are supported by the generic clock
> > PM layer since commit 0bfa0820c274 ("PM: clk: make PM clock layer
> > compatible with clocks that must sleep"). That means we can have
> > SCMI-based clocks be managed by the SCMI power domain now.
> >
> 
> Looks good to me, I will apply this soon for v5.14.
> I will reply with details once it is applied.

Excellent!
Thanks.


Nicolas

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

* Re: [PATCH] firmware: arm_scmi: add clock management to the SCMI power domain
@ 2021-05-11 15:05     ` Nicolas Pitre
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Pitre @ 2021-05-11 15:05 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Cristian Marussi, Dien Pham, Gaku Inami, linux-arm-kernel, linux-kernel

On Tue, 11 May 2021, Sudeep Holla wrote:

> Hi Nico,
> 
> On Fri, May 07, 2021 at 04:20:36PM -0400, Nicolas Pitre wrote:
> > Clocks requiring non-atomic contexts are supported by the generic clock
> > PM layer since commit 0bfa0820c274 ("PM: clk: make PM clock layer
> > compatible with clocks that must sleep"). That means we can have
> > SCMI-based clocks be managed by the SCMI power domain now.
> >
> 
> Looks good to me, I will apply this soon for v5.14.
> I will reply with details once it is applied.

Excellent!
Thanks.


Nicolas

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] firmware: arm_scmi: add clock management to the SCMI power domain
  2021-05-07 20:20 ` Nicolas Pitre
@ 2021-05-24 14:40   ` Sudeep Holla
  -1 siblings, 0 replies; 8+ messages in thread
From: Sudeep Holla @ 2021-05-24 14:40 UTC (permalink / raw)
  To: Cristian Marussi, Nicolas Pitre
  Cc: Sudeep Holla, Gaku Inami, Dien Pham, linux-kernel, linux-arm-kernel

On Fri, 7 May 2021 16:20:36 -0400 (EDT), Nicolas Pitre wrote:
> Clocks requiring non-atomic contexts are supported by the generic clock
> PM layer since commit 0bfa0820c274 ("PM: clk: make PM clock layer
> compatible with clocks that must sleep"). That means we can have
> SCMI-based clocks be managed by the SCMI power domain now.


Applied to sudeep.holla/linux (for-next/scmi), thanks!

[1/1] firmware: arm_scmi: add clock management to the SCMI power domain
      https://git.kernel.org/sudeep.holla/c/a3b884cef8

--
Regards,
Sudeep


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

* Re: [PATCH] firmware: arm_scmi: add clock management to the SCMI power domain
@ 2021-05-24 14:40   ` Sudeep Holla
  0 siblings, 0 replies; 8+ messages in thread
From: Sudeep Holla @ 2021-05-24 14:40 UTC (permalink / raw)
  To: Cristian Marussi, Nicolas Pitre
  Cc: Sudeep Holla, Gaku Inami, Dien Pham, linux-kernel, linux-arm-kernel

On Fri, 7 May 2021 16:20:36 -0400 (EDT), Nicolas Pitre wrote:
> Clocks requiring non-atomic contexts are supported by the generic clock
> PM layer since commit 0bfa0820c274 ("PM: clk: make PM clock layer
> compatible with clocks that must sleep"). That means we can have
> SCMI-based clocks be managed by the SCMI power domain now.


Applied to sudeep.holla/linux (for-next/scmi), thanks!

[1/1] firmware: arm_scmi: add clock management to the SCMI power domain
      https://git.kernel.org/sudeep.holla/c/a3b884cef8

--
Regards,
Sudeep


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-05-24 16:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 20:20 [PATCH] firmware: arm_scmi: add clock management to the SCMI power domain Nicolas Pitre
2021-05-07 20:20 ` Nicolas Pitre
2021-05-11 14:53 ` Sudeep Holla
2021-05-11 14:53   ` Sudeep Holla
2021-05-11 15:05   ` Nicolas Pitre
2021-05-11 15:05     ` Nicolas Pitre
2021-05-24 14:40 ` Sudeep Holla
2021-05-24 14:40   ` Sudeep Holla

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.