diff mbox

[1/2] cpufreq: arm_big_little: check if the frequency is set correctly

Message ID 1430128266-15012-1-git-send-email-sudeep.holla@arm.com (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show

Commit Message

Sudeep Holla April 27, 2015, 9:51 a.m. UTC
The actual frequency is set through "clk_change_rate" which is void
function. If the underlying hardware fails and returns error, the error
is lost in the clk layer. In order to track such failures, we need to
read back the frequency(just the cached value as clk_recalc called after
clk->ops->set_rate gets the frequency)

This patch adds check to see if the frequency is set correctly or if
they were any hardware failures and sends the appropriate errors to the
cpufreq core.

Cc: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Michael Turquette <mike.turquette@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/cpufreq/arm_big_little.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Viresh Kumar April 27, 2015, 10:26 a.m. UTC | #1
On 27 April 2015 at 15:21, Sudeep Holla <sudeep.holla@arm.com> wrote:
> The actual frequency is set through "clk_change_rate" which is void
> function. If the underlying hardware fails and returns error, the error
> is lost in the clk layer. In order to track such failures, we need to
> read back the frequency(just the cached value as clk_recalc called after
> clk->ops->set_rate gets the frequency)
>
> This patch adds check to see if the frequency is set correctly or if
> they were any hardware failures and sends the appropriate errors to the
> cpufreq core.
>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Reviewed-by: Michael Turquette <mike.turquette@linaro.org>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/cpufreq/arm_big_little.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
> index e1a6ba66a7f5..f65e19f340d0 100644
> --- a/drivers/cpufreq/arm_big_little.c
> +++ b/drivers/cpufreq/arm_big_little.c
> @@ -186,6 +186,15 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)
>                 mutex_unlock(&cluster_lock[old_cluster]);
>         }
>
> +       /*
> +        * FIXME: clk_set_rate has to handle the case where clk_change_rate
> +        * can fail due to hardware or firmware issues. Until the clk core
> +        * layer is fixed, we can check here. In most of the cases we will
> +        * be reading only the cached value anyway. This needs to  be removed
> +        * once clk core is fixed.
> +        */
> +       if (bL_cpufreq_get_rate(cpu) != new_rate)
> +               return -EIO;
>         return 0;
>  }

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
Rafael J. Wysocki May 15, 2015, 12:20 a.m. UTC | #2
On Monday, April 27, 2015 03:56:18 PM Viresh Kumar wrote:
> On 27 April 2015 at 15:21, Sudeep Holla <sudeep.holla@arm.com> wrote:
> > The actual frequency is set through "clk_change_rate" which is void
> > function. If the underlying hardware fails and returns error, the error
> > is lost in the clk layer. In order to track such failures, we need to
> > read back the frequency(just the cached value as clk_recalc called after
> > clk->ops->set_rate gets the frequency)
> >
> > This patch adds check to see if the frequency is set correctly or if
> > they were any hardware failures and sends the appropriate errors to the
> > cpufreq core.
> >
> > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> > Reviewed-by: Michael Turquette <mike.turquette@linaro.org>
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> >  drivers/cpufreq/arm_big_little.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
> > index e1a6ba66a7f5..f65e19f340d0 100644
> > --- a/drivers/cpufreq/arm_big_little.c
> > +++ b/drivers/cpufreq/arm_big_little.c
> > @@ -186,6 +186,15 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)
> >                 mutex_unlock(&cluster_lock[old_cluster]);
> >         }
> >
> > +       /*
> > +        * FIXME: clk_set_rate has to handle the case where clk_change_rate
> > +        * can fail due to hardware or firmware issues. Until the clk core
> > +        * layer is fixed, we can check here. In most of the cases we will
> > +        * be reading only the cached value anyway. This needs to  be removed
> > +        * once clk core is fixed.
> > +        */
> > +       if (bL_cpufreq_get_rate(cpu) != new_rate)
> > +               return -EIO;
> >         return 0;
> >  }
> 
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Both queued up for 4.2, thanks!
diff mbox

Patch

diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index e1a6ba66a7f5..f65e19f340d0 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -186,6 +186,15 @@  bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)
 		mutex_unlock(&cluster_lock[old_cluster]);
 	}
 
+	/*
+	 * FIXME: clk_set_rate has to handle the case where clk_change_rate
+	 * can fail due to hardware or firmware issues. Until the clk core
+	 * layer is fixed, we can check here. In most of the cases we will
+	 * be reading only the cached value anyway. This needs to  be removed
+	 * once clk core is fixed.
+	 */
+	if (bL_cpufreq_get_rate(cpu) != new_rate)
+		return -EIO;
 	return 0;
 }