linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 1/4] cpufreq: add arm soc generic cpufreq driver
Date: Sat, 17 Dec 2011 10:29:29 +0100	[thread overview]
Message-ID: <1771359.4jv0xX1vFp@wuerfel> (raw)
In-Reply-To: <20111217080001.GC2010@richard-laptop>

On Saturday 17 December 2011 16:00:03 Richard Zhao wrote:
> On Fri, Dec 16, 2011 at 08:32:35AM -0600, Rob Herring wrote:
> > On 12/16/2011 04:30 AM, Richard Zhao wrote:
> > > It support single core and multi-core ARM SoCs. But it assume
> > > all cores share the same frequency and voltage.
> > > 
> > > Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> > > ---
> > >  drivers/cpufreq/Kconfig.arm   |    8 ++
> > >  drivers/cpufreq/Makefile      |    1 +
> > >  drivers/cpufreq/arm-cpufreq.c |  269 +++++++++++++++++++++++++++++++++++++++++
> > >  3 files changed, 278 insertions(+), 0 deletions(-)
> > >  create mode 100644 drivers/cpufreq/arm-cpufreq.c
> > > 
> > 
> > What makes this specific to ARM and not a generic DT + clk api +
> > regulator api driver?
>
> smp loops_per_jiffy update needs arm header <asm/cpu.h>.

I would suggest to instead change the definition of adjust_jiffies in the
core so it can be overridden by the architecture, like this

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 987a165..174584d 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -189,6 +189,7 @@ EXPORT_SYMBOL_GPL(cpufreq_cpu_put);
  * systems as each CPU might be scaled differently. So, use the arch
  * per-CPU loops_per_jiffy value wherever possible.
  */
+#ifndef adjust_jiffies
 #ifndef CONFIG_SMP
 static unsigned long l_p_j_ref;
 static unsigned int  l_p_j_ref_freq;
@@ -218,7 +219,8 @@ static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
 {
        return;
 }
-#endif
+#endif /* CONFIG_SMP */
+#endif /* adjust_jiffies */
 
 
 /**


Then ARM (and any others that want the driver) can provide their own
implementation and set 

#define adjust_jiffies(val, ci) adjust_jiffies((val), (ci))

to let the core use that instead of the generic UP version.


While we're there, we should probably try to fix drivers that use loops_per_jiffy,
because that is not what they think it is on SMP.

	Arnd

  reply	other threads:[~2011-12-17  9:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-16 10:30 [PATCH V2 0/4] add arm soc generic cpufreq driver Richard Zhao
2011-12-16 10:30 ` [PATCH V2 1/4] cpufreq: " Richard Zhao
2011-12-16 10:52   ` Jamie Iles
2011-12-16 19:59     ` Bryan Huntsman
2011-12-17  8:39       ` Richard Zhao
2011-12-19  1:03       ` Richard Zhao
2011-12-19 17:42         ` Stephen Boyd
2011-12-17  8:29     ` Richard Zhao
2011-12-16 11:26   ` Heiko Stübner
2011-12-17  7:57     ` Richard Zhao
2011-12-16 14:32   ` Rob Herring
2011-12-17  8:00     ` Richard Zhao
2011-12-17  9:29       ` Arnd Bergmann [this message]
2011-12-18 12:34         ` Richard Zhao
2011-12-20 14:41   ` Mark Brown
2012-01-18 11:39   ` Mark Brown
2012-01-18 11:42     ` Mark Brown
2012-01-18 20:51       ` Grant Likely
2011-12-16 10:31 ` [PATCH V2 2/4] dts/imx6q: add cpufreq property Richard Zhao
2011-12-16 10:31 ` [PATCH V2 3/4] arm/imx6q: register arm_clk as cpu to clkdev Richard Zhao
2011-12-16 16:35   ` Mark Langsdorf
2011-12-17  7:56     ` Richard Zhao
2011-12-16 10:31 ` [PATCH V2 4/4] arm/imx6q: select ARCH_HAS_CPUFREQ Richard Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1771359.4jv0xX1vFp@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).