diff mbox

[v2,3/3] cpufreq: imx6q: add of_init_opp_table

Message ID 1387485338-21225-3-git-send-email-john.tobias.ph@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

John Tobias Dec. 19, 2013, 8:35 p.m. UTC
Add a routine check to see if the platform supplied the OPP table.
Incase there's no OPP table exist, it will try to initialise it.

It's been tested on iMX6SL board where the platform doesn't have
an OPP table.

Signed-off-by: John Tobias <john.tobias.ph@gmail.com>
---
 drivers/cpufreq/imx6q-cpufreq.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Shawn Guo Dec. 20, 2013, 1:55 a.m. UTC | #1
On Thu, Dec 19, 2013 at 12:35:38PM -0800, John Tobias wrote:
> Add a routine check to see if the platform supplied the OPP table.
> Incase there's no OPP table exist, it will try to initialise it.
> 
> It's been tested on iMX6SL board where the platform doesn't have
> an OPP table.
> 
> Signed-off-by: John Tobias <john.tobias.ph@gmail.com>
> ---
>  drivers/cpufreq/imx6q-cpufreq.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
> index 4b3f18e..8c56898 100644
> --- a/drivers/cpufreq/imx6q-cpufreq.c
> +++ b/drivers/cpufreq/imx6q-cpufreq.c
> @@ -166,6 +166,17 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
>  		return -ENOENT;
>  	}
>  
> +	/* Get the OPP table, if the platform did not supply it. */
> +	num = dev_pm_opp_get_opp_count(cpu_dev);
> +	if (num < 0) {
> +		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;
> +		}
> +	}
> +

Oh, no.  dev_pm_opp_get_opp_count() is already being called in
imx6q_cpufreq_probe().  Why don't you just plug your code into there?

Shawn

>  	arm_clk = devm_clk_get(cpu_dev, "arm");
>  	pll1_sys_clk = devm_clk_get(cpu_dev, "pll1_sys");
>  	pll1_sw_clk = devm_clk_get(cpu_dev, "pll1_sw");
> -- 
> 1.8.3.2
>
Shawn Guo Dec. 20, 2013, 2:10 a.m. UTC | #2
On Thu, Dec 19, 2013 at 12:35:38PM -0800, John Tobias wrote:
> Add a routine check to see if the platform supplied the OPP table.
> Incase there's no OPP table exist, it will try to initialise it.
> 
> It's been tested on iMX6SL board where the platform doesn't have
> an OPP table.
> 
> Signed-off-by: John Tobias <john.tobias.ph@gmail.com>
> ---
>  drivers/cpufreq/imx6q-cpufreq.c | 11 +++++++++++

Running get_maintainer.pl on the patch, you will see you should copy the
following person and lists on the patch.

 "Rafael J. Wysocki" <rjw@rjwysocki.net>
 Viresh Kumar <viresh.kumar@linaro.org>
 cpufreq@vger.kernel.org
 linux-pm@vger.kernel.org

This can also be found in file MAINTAINERS.

CPU FREQUENCY DRIVERS
M:      Rafael J. Wysocki <rjw@rjwysocki.net>
M:      Viresh Kumar <viresh.kumar@linaro.org>
L:      cpufreq@vger.kernel.org
L:      linux-pm@vger.kernel.org
S:      Maintained
T:      git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
T:      git git://git.linaro.org/people/vireshk/linux.git (For ARM Updates)
F:      drivers/cpufreq/
F:      include/linux/cpufreq.h

Shawn

>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
> index 4b3f18e..8c56898 100644
> --- a/drivers/cpufreq/imx6q-cpufreq.c
> +++ b/drivers/cpufreq/imx6q-cpufreq.c
> @@ -166,6 +166,17 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
>  		return -ENOENT;
>  	}
>  
> +	/* Get the OPP table, if the platform did not supply it. */
> +	num = dev_pm_opp_get_opp_count(cpu_dev);
> +	if (num < 0) {
> +		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;
> +		}
> +	}
> +
>  	arm_clk = devm_clk_get(cpu_dev, "arm");
>  	pll1_sys_clk = devm_clk_get(cpu_dev, "pll1_sys");
>  	pll1_sw_clk = devm_clk_get(cpu_dev, "pll1_sw");
> -- 
> 1.8.3.2
>
John Tobias Dec. 20, 2013, 2:41 a.m. UTC | #3
That's correct. I tested it. I will send another patch.



On Thu, Dec 19, 2013 at 5:55 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Thu, Dec 19, 2013 at 12:35:38PM -0800, John Tobias wrote:
>> Add a routine check to see if the platform supplied the OPP table.
>> Incase there's no OPP table exist, it will try to initialise it.
>>
>> It's been tested on iMX6SL board where the platform doesn't have
>> an OPP table.
>>
>> Signed-off-by: John Tobias <john.tobias.ph@gmail.com>
>> ---
>>  drivers/cpufreq/imx6q-cpufreq.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
>> index 4b3f18e..8c56898 100644
>> --- a/drivers/cpufreq/imx6q-cpufreq.c
>> +++ b/drivers/cpufreq/imx6q-cpufreq.c
>> @@ -166,6 +166,17 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
>>               return -ENOENT;
>>       }
>>
>> +     /* Get the OPP table, if the platform did not supply it. */
>> +     num = dev_pm_opp_get_opp_count(cpu_dev);
>> +     if (num < 0) {
>> +             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;
>> +             }
>> +     }
>> +
>
> Oh, no.  dev_pm_opp_get_opp_count() is already being called in
> imx6q_cpufreq_probe().  Why don't you just plug your code into there?
>
> Shawn
>
>>       arm_clk = devm_clk_get(cpu_dev, "arm");
>>       pll1_sys_clk = devm_clk_get(cpu_dev, "pll1_sys");
>>       pll1_sw_clk = devm_clk_get(cpu_dev, "pll1_sw");
>> --
>> 1.8.3.2
>>
>
diff mbox

Patch

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index 4b3f18e..8c56898 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -166,6 +166,17 @@  static int imx6q_cpufreq_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
+	/* Get the OPP table, if the platform did not supply it. */
+	num = dev_pm_opp_get_opp_count(cpu_dev);
+	if (num < 0) {
+		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;
+		}
+	}
+
 	arm_clk = devm_clk_get(cpu_dev, "arm");
 	pll1_sys_clk = devm_clk_get(cpu_dev, "pll1_sys");
 	pll1_sw_clk = devm_clk_get(cpu_dev, "pll1_sw");