Skip to contentSkip to conversation

ARM: imx6sl: Add cpu frequency scaling support

PATCH In review John Tobias 2 participants 4 messages Dec 20, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 ARM: imx6sl: Add cpu frequency scaling support

Re-use imx6q cpufreq driver to support cpu
frequency scaling on imx6sl.

---
 arch/arm/mach-imx/mach-imx6sl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/mach-imx/mach-imx6sl.c +8 -0
index 2f952e3..3072e15 100644
@@ -34,6 +34,13 @@ static void __init imx6sl_fec_init(void)
 	}
 }
 
+static void __init imx6sl_init_late(void)
+{
+	/* imx6sl reuses imx6q cpufreq driver */
+	if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
+		platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
+}
+
 static void __init imx6sl_init_machine(void)
 {
 	struct device *parent;
@@ -70,6 +77,7 @@ DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)")
 	.map_io		= debug_ll_io_init,
 	.init_irq	= imx6sl_init_irq,
 	.init_machine	= imx6sl_init_machine,
+	.init_late      = imx6sl_init_late,
 	.dt_compat	= imx6sl_dt_compat,
 	.restart	= mxc_restart,
 MACHINE_END
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v3 2/2 cpufreq: imx6q: add of_init_opp_table

Add a routine check to see if the platform supplied the OPP table. Incase there's not OPP table exist, it will try to get it.

---
 drivers/cpufreq/imx6q-cpufreq.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/cpufreq/imx6q-cpufreq.c +17 -4
index 4b3f18e..f261a88 100644
@@ -187,12 +187,25 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 		goto put_node;
 	}
 
-	/* We expect an OPP table supplied by platform */
+	/* We expect an OPP table supplied by platform.
+	 * Just, incase the platform did not supply the OPP
+	 * table, it will try to get it.
+	 */
 	num = dev_pm_opp_get_opp_count(cpu_dev);
 	if (num < 0) {
-		ret = num;
-		dev_err(cpu_dev, "no OPP table is found: %d\n", ret);
-		goto put_node;
+		ret = of_init_opp_table(cpu_dev);
+		if (ret < 0) {
+			dev_err(cpu_dev, "failed to init OPP table\n");
+			ret = -ENODEV;
+			goto put_node;
+		}
+
+		num = dev_pm_opp_get_opp_count(cpu_dev);
+		if (num < 0) {
+			ret = num;
+			dev_err(cpu_dev, "no OPP table is found: %d\n", ret);
+			goto put_node;
+		}
 	}
 
 	ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
Signature · 1 line
1.8.3.2
#2 lore raw

Re: [PATCH v3 2/2] cpufreq: imx6q: add of_init_opp_table

Quoted 13 lines · John Tobias

Add a routine check to see if the platform supplied the OPP table. Incase there's not OPP table exist, it will try to get it.

---
 drivers/cpufreq/imx6q-cpufreq.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/cpufreq/imx6q-cpufreq.c +0 -0
index 4b3f18e..f261a88 100644

drivers/cpufreq/imx6q-cpufreq.c static int imx6q_cpufreq_probe(struct platform_device *pdev) · line 193

Quoted 8 lines
drivers/cpufreq/imx6q-cpufreq.c +4 -1
@@ -187,12 +187,25 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 		goto put_node;
 	}
 
-	/* We expect an OPP table supplied by platform */
+	/* We expect an OPP table supplied by platform.
+	 * Just, incase the platform did not supply the OPP
+	 * table, it will try to get it.
+	 */
	/*
	 * Multi-lines comment
	 */

drivers/cpufreq/imx6q-cpufreq.c static int imx6q_cpufreq_probe(struct platform_device *pdev) · line 198

Quoted 8 lines
drivers/cpufreq/imx6q-cpufreq.c +3 -3
 	num = dev_pm_opp_get_opp_count(cpu_dev);
 	if (num < 0) {
-		ret = num;
-		dev_err(cpu_dev, "no OPP table is found: %d\n", ret);
-		goto put_node;
+		ret = of_init_opp_table(cpu_dev);
+		if (ret < 0) {
+			dev_err(cpu_dev, "failed to init OPP table\n");

It should be good to print the error code, i.e. 'ret', here.

drivers/cpufreq/imx6q-cpufreq.c static int imx6q_cpufreq_probe(struct platform_device *pdev) · line 199

Quoted 1 line
drivers/cpufreq/imx6q-cpufreq.c +1 -0
+			ret = -ENODEV;

There is no need to make up an error code, and just return what you get from of_init_opp_table().

Shawn

Quoted 15 lines
drivers/cpufreq/imx6q-cpufreq.c +9 -0
+			goto put_node;
+		}
+
+		num = dev_pm_opp_get_opp_count(cpu_dev);
+		if (num < 0) {
+			ret = num;
+			dev_err(cpu_dev, "no OPP table is found: %d\n", ret);
+			goto put_node;
+		}
 	}
 
 	ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
Signature · 1 line
1.8.3.2
#3 lore raw
In reply to John Tobias
Quoted 4 lines · John Tobias

Re-use imx6q cpufreq driver to support cpu
frequency scaling on imx6sl.

This one is already applied, so you do not have to resend.

Shawn

Quoted 33 lines
---
 arch/arm/mach-imx/mach-imx6sl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/mach-imx/mach-imx6sl.c +8 -0
index 2f952e3..3072e15 100644
@@ -34,6 +34,13 @@ static void __init imx6sl_fec_init(void)
 	}
 }
 
+static void __init imx6sl_init_late(void)
+{
+	/* imx6sl reuses imx6q cpufreq driver */
+	if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
+		platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
+}
+
 static void __init imx6sl_init_machine(void)
 {
 	struct device *parent;
@@ -70,6 +77,7 @@ DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)")
 	.map_io		= debug_ll_io_init,
 	.init_irq	= imx6sl_init_irq,
 	.init_machine	= imx6sl_init_machine,
+	.init_late      = imx6sl_init_late,
 	.dt_compat	= imx6sl_dt_compat,
 	.restart	= mxc_restart,
 MACHINE_END
Signature · 1 line
1.8.3.2