diff mbox

[1/2] cpufreq: cpu0: Improve debug about matching OPP

Message ID 1412454365-17804-2-git-send-email-stefan.wahren@i2se.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Stefan Wahren Oct. 4, 2014, 8:26 p.m. UTC
During test of new DT OPPs it's very helpful to print the matching
OPP in case of frequency change. So it will be easier to find frequency
rounding issues in the dts file.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/cpufreq/cpufreq-cpu0.c |    5 +++++
 1 file changed, 5 insertions(+)

Comments

Viresh Kumar Oct. 6, 2014, 5:13 a.m. UTC | #1
On 5 October 2014 01:56, Stefan Wahren <stefan.wahren@i2se.com> wrote:
> During test of new DT OPPs it's very helpful to print the matching
> OPP in case of frequency change. So it will be easier to find frequency
> rounding issues in the dts file.
>
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> ---
>  drivers/cpufreq/cpufreq-cpu0.c |    5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index a5f8c5f..ef3d618 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -57,6 +57,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index)
>         old_freq = clk_get_rate(cpu_clk) / 1000;
>
>         if (!IS_ERR(cpu_reg)) {
> +               unsigned long opp_freq;
> +
>                 rcu_read_lock();
>                 opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_Hz);
>                 if (IS_ERR(opp)) {
> @@ -66,9 +68,12 @@ static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index)
>                         return PTR_ERR(opp);
>                 }
>                 volt = dev_pm_opp_get_voltage(opp);
> +               opp_freq = dev_pm_opp_get_freq(opp);
>                 rcu_read_unlock();
>                 tol = volt * priv->voltage_tolerance / 100;
>                 volt_old = regulator_get_voltage(cpu_reg);
> +               dev_dbg(cpu_dev, "Found OPP: %ld kHz, %ld uV\n",
> +                       opp_freq / 1000, volt);

What about using dev_pm_opp_get_freq() directly in dev_dbg() instead of
creating a separate variable?

>         }
>
>         dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n",
> --
> 1.7.9.5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stefan Wahren Oct. 6, 2014, 6:50 a.m. UTC | #2
Am 06.10.2014 um 07:13 schrieb Viresh Kumar:
> On 5 October 2014 01:56, Stefan Wahren <stefan.wahren@i2se.com> wrote:
>> During test of new DT OPPs it's very helpful to print the matching
>> OPP in case of frequency change. So it will be easier to find frequency
>> rounding issues in the dts file.
>>
>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
>> ---
>>  drivers/cpufreq/cpufreq-cpu0.c |    5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
>> index a5f8c5f..ef3d618 100644
>> --- a/drivers/cpufreq/cpufreq-cpu0.c
>> +++ b/drivers/cpufreq/cpufreq-cpu0.c
>> @@ -57,6 +57,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index)
>>         old_freq = clk_get_rate(cpu_clk) / 1000;
>>
>>         if (!IS_ERR(cpu_reg)) {
>> +               unsigned long opp_freq;
>> +
>>                 rcu_read_lock();
>>                 opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_Hz);
>>                 if (IS_ERR(opp)) {
>> @@ -66,9 +68,12 @@ static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index)
>>                         return PTR_ERR(opp);
>>                 }
>>                 volt = dev_pm_opp_get_voltage(opp);
>> +               opp_freq = dev_pm_opp_get_freq(opp);
>>                 rcu_read_unlock();
>>                 tol = volt * priv->voltage_tolerance / 100;
>>                 volt_old = regulator_get_voltage(cpu_reg);
>> +               dev_dbg(cpu_dev, "Found OPP: %ld kHz, %ld uV\n",
>> +                       opp_freq / 1000, volt);
> What about using dev_pm_opp_get_freq() directly in dev_dbg() instead of
> creating a separate variable?

I wasn't sure because of the read lock and wanted to avoid any delays.
If it's okay i will change it.

>
>>         }
>>
>>         dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n",
>> --
>> 1.7.9.5
>>


--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Viresh Kumar Oct. 6, 2014, 8:47 a.m. UTC | #3
On 5 October 2014 01:56, Stefan Wahren <stefan.wahren@i2se.com> wrote:
> During test of new DT OPPs it's very helpful to print the matching
> OPP in case of frequency change. So it will be easier to find frequency
> rounding issues in the dts file.
>
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> ---
>  drivers/cpufreq/cpufreq-cpu0.c |    5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index a5f8c5f..ef3d618 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -57,6 +57,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index)
>         old_freq = clk_get_rate(cpu_clk) / 1000;
>
>         if (!IS_ERR(cpu_reg)) {
> +               unsigned long opp_freq;
> +
>                 rcu_read_lock();
>                 opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_Hz);
>                 if (IS_ERR(opp)) {
> @@ -66,9 +68,12 @@ static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index)
>                         return PTR_ERR(opp);
>                 }
>                 volt = dev_pm_opp_get_voltage(opp);
> +               opp_freq = dev_pm_opp_get_freq(opp);
>                 rcu_read_unlock();
>                 tol = volt * priv->voltage_tolerance / 100;
>                 volt_old = regulator_get_voltage(cpu_reg);
> +               dev_dbg(cpu_dev, "Found OPP: %ld kHz, %ld uV\n",
> +                       opp_freq / 1000, volt);
>         }
>
>         dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n",

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index a5f8c5f..ef3d618 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -57,6 +57,8 @@  static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index)
 	old_freq = clk_get_rate(cpu_clk) / 1000;
 
 	if (!IS_ERR(cpu_reg)) {
+		unsigned long opp_freq;
+
 		rcu_read_lock();
 		opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_Hz);
 		if (IS_ERR(opp)) {
@@ -66,9 +68,12 @@  static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index)
 			return PTR_ERR(opp);
 		}
 		volt = dev_pm_opp_get_voltage(opp);
+		opp_freq = dev_pm_opp_get_freq(opp);
 		rcu_read_unlock();
 		tol = volt * priv->voltage_tolerance / 100;
 		volt_old = regulator_get_voltage(cpu_reg);
+		dev_dbg(cpu_dev, "Found OPP: %ld kHz, %ld uV\n",
+			opp_freq / 1000, volt);
 	}
 
 	dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n",