Thread (9 messages) flat view 9 messages, 1 author, 2015-09-16
DORMANTno replies REVIEWED: 1 (0M)

Revision v6 of 6 in this series; 1 review trailer.

Revisions (6)
  1. v2 [diff vs current]
  2. v3 [diff vs current]
  3. v4 [diff vs current]
  4. v5 [diff vs current]
  5. v6 [diff vs current]
  6. v6 current

[PATCH REPOST v6 4/8] clk: scpi: add support for cpufreq virtual device

From: Sudeep Holla <hidden>
Date: 2015-09-16 17:19:38
Also in: linux-clk, lkml
Subsystem: common clk framework, system control & power/management interface (scpi/scmi) message protocol drivers, the rest · Maintainers: Stephen Boyd, Brian Masney, Jerome Brunet, Sudeep Holla, Linus Torvalds

The clocks for the CPUs are provided by SCP and are managed by this
clock driver. So the cpufreq device needs to be added only after the
clock get registered and removed when this driver is unloaded.

This patch manages the cpufreq virtual device based on the clock
availability.

Signed-off-by: Sudeep Holla <redacted>
Acked-by: Stephen Boyd <redacted>
Cc: Mike Turquette <redacted>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: Lorenzo Pieralisi <redacted>
Cc: Jon Medhurst (Tixy) <redacted>
Cc: linux-clk at vger.kernel.org
---
 drivers/clk/clk-scpi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff --git a/drivers/clk/clk-scpi.c b/drivers/clk/clk-scpi.c
index e8323db300e2..a201781287b3 100644
--- a/drivers/clk/clk-scpi.c
+++ b/drivers/clk/clk-scpi.c
@@ -34,6 +34,8 @@ struct scpi_clk {
 
 #define to_scpi_clk(clk) container_of(clk, struct scpi_clk, hw)
 
+static struct platform_device *cpufreq_dev;
+
 static unsigned long scpi_clk_recalc_rate(struct clk_hw *hw,
 					  unsigned long parent_rate)
 {
@@ -263,6 +265,11 @@ static int scpi_clocks_remove(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *child, *np = dev->of_node;
 
+	if (cpufreq_dev) {
+		platform_device_unregister(cpufreq_dev);
+		cpufreq_dev = NULL;
+	}
+
 	for_each_available_child_of_node(np, child)
 		of_clk_del_provider(np);
 	return 0;
@@ -288,6 +295,12 @@ static int scpi_clocks_probe(struct platform_device *pdev)
 			return ret;
 		}
 	}
+	/* Add the virtual cpufreq device */
+	cpufreq_dev = platform_device_register_simple("scpi-cpufreq",
+						      -1, NULL, 0);
+	if (!cpufreq_dev)
+		pr_warn("unable to register cpufreq device");
+
 	return 0;
 }
 
-- 
1.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help