From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 3/8] cpufreq: kirkwood: Remove use of the clk provider API
Date: Fri, 22 Aug 2014 22:27:18 +0200 [thread overview]
Message-ID: <20140822202718.GI17277@lunn.ch> (raw)
In-Reply-To: <20140822201112.GH17277@lunn.ch>
> It was clearer in earlier versions of the driver, but code has been
> refactored into the cpufreq core. The core should call
> kirkwood_cpufreq_get_cpu_frequency() in order to get the current
> frequency, and only perform a change if the requested frequency is
> different. In the current code, kirkwood_cpufreq_get_cpu_frequency()
> reads from the hardware what the current frequency is. So we are
> guaranteed to only call kirkwood_cpufreq_target() when there is a real
> change.
Hi Mike
I went looking at the core.
drivers/cpufreq/cpufreq.c:__cpufreq_add_dev() contains:
if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {
policy->cur = cpufreq_driver->get(policy->cpu);
if (!policy->cur) {
pr_err("%s: ->get() failed\n", __func__);
goto err_get_freq;
}
}
So this gets the current frequency from the driver, when the driver is
added. So for the current code, this gets the real state of the
hardware.
and
drivers/cpufreq/cpufreq.c:__cpufreq_driver_target() contains:
/*
* This might look like a redundant call as we are checking it again
* after finding index. But it is left intentionally for cases where
* exactly same freq is called again and so we can save on few function
* calls.
*/
if (target_freq == policy->cur)
return 0;
/* Save last value to restore later on errors */
policy->restore_freq = policy->cur;
if (cpufreq_driver->target)
retval = cpufreq_driver->target(policy, target_freq, relation);
and here it will only call the function to change the frequency, if it
is different from the current frequency.
Andrew
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Lunn <andrew@lunn.ch>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Mike Turquette <mturquette@linaro.org>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Peter De Schrijver <pdeschrijver@nvidia.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-kernel@vger.kernel.org, Rabin Vincent <rabin@rab.in>,
Tomasz Figa <t.figa@samsung.com>,
Thierry Reding <thierry.reding@gmail.com>,
Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v7 3/8] cpufreq: kirkwood: Remove use of the clk provider API
Date: Fri, 22 Aug 2014 22:27:18 +0200 [thread overview]
Message-ID: <20140822202718.GI17277@lunn.ch> (raw)
In-Reply-To: <20140822201112.GH17277@lunn.ch>
> It was clearer in earlier versions of the driver, but code has been
> refactored into the cpufreq core. The core should call
> kirkwood_cpufreq_get_cpu_frequency() in order to get the current
> frequency, and only perform a change if the requested frequency is
> different. In the current code, kirkwood_cpufreq_get_cpu_frequency()
> reads from the hardware what the current frequency is. So we are
> guaranteed to only call kirkwood_cpufreq_target() when there is a real
> change.
Hi Mike
I went looking at the core.
drivers/cpufreq/cpufreq.c:__cpufreq_add_dev() contains:
if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {
policy->cur = cpufreq_driver->get(policy->cpu);
if (!policy->cur) {
pr_err("%s: ->get() failed\n", __func__);
goto err_get_freq;
}
}
So this gets the current frequency from the driver, when the driver is
added. So for the current code, this gets the real state of the
hardware.
and
drivers/cpufreq/cpufreq.c:__cpufreq_driver_target() contains:
/*
* This might look like a redundant call as we are checking it again
* after finding index. But it is left intentionally for cases where
* exactly same freq is called again and so we can save on few function
* calls.
*/
if (target_freq == policy->cur)
return 0;
/* Save last value to restore later on errors */
policy->restore_freq = policy->cur;
if (cpufreq_driver->target)
retval = cpufreq_driver->target(policy, target_freq, relation);
and here it will only call the function to change the frequency, if it
is different from the current frequency.
Andrew
next prev parent reply other threads:[~2014-08-22 20:27 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-18 15:30 [PATCH v7 0/8] Per-user clock constraints Tomeu Vizoso
2014-08-18 15:30 ` Tomeu Vizoso
2014-08-18 15:30 ` [PATCH v7 1/8] clk: Add temporary mapping to the existing API Tomeu Vizoso
2014-08-18 15:30 ` Tomeu Vizoso
2014-08-20 14:50 ` Mike Turquette
2014-08-21 18:04 ` Tony Lindgren
2014-08-21 18:04 ` Tony Lindgren
2014-08-21 18:10 ` Jason Cooper
2014-08-21 18:10 ` Jason Cooper
2014-08-22 3:49 ` Simon Horman
2014-08-22 3:49 ` Simon Horman
2014-08-25 9:18 ` Sebastian Hesselbarth
2014-08-25 9:18 ` Sebastian Hesselbarth
2014-08-18 15:30 ` [PATCH v7 2/8] clk: provide public clk_is_enabled function Tomeu Vizoso
2014-08-18 15:30 ` Tomeu Vizoso
2014-08-18 15:30 ` [PATCH v7 3/8] cpufreq: kirkwood: Remove use of the clk provider API Tomeu Vizoso
2014-08-18 15:30 ` Tomeu Vizoso
[not found] ` <20140820225513.5251.284@quantum>
2014-08-21 7:53 ` Tomeu Vizoso
2014-08-21 7:53 ` Tomeu Vizoso
2014-08-21 13:38 ` Andrew Lunn
2014-08-21 13:38 ` Andrew Lunn
2014-08-22 19:29 ` Mike Turquette
2014-08-22 19:29 ` Mike Turquette
2014-08-22 20:11 ` Andrew Lunn
2014-08-22 20:11 ` Andrew Lunn
2014-08-22 20:27 ` Andrew Lunn [this message]
2014-08-22 20:27 ` Andrew Lunn
2014-08-26 21:46 ` Mike Turquette
2014-08-26 22:36 ` Andrew Lunn
2014-08-26 22:36 ` Andrew Lunn
2014-08-26 23:30 ` Mike Turquette
2014-08-27 0:35 ` Andrew Lunn
2014-08-27 0:35 ` Andrew Lunn
2014-08-27 5:04 ` Mike Turquette
2014-08-27 5:04 ` Mike Turquette
2014-08-27 15:58 ` Jason Gunthorpe
2014-08-27 15:58 ` Jason Gunthorpe
2014-08-18 15:30 ` [PATCH v7 4/8] ASoC: mxs-saif: fix mixed use of public and provider clk API Tomeu Vizoso
2014-08-18 15:30 ` Tomeu Vizoso
2014-08-18 15:30 ` [PATCH v7 6/8] clk: use struct clk only for external API Tomeu Vizoso
2014-08-18 15:30 ` Tomeu Vizoso
2014-08-18 15:30 ` [PATCH v7 7/8] clk: per-user clock accounting for debug Tomeu Vizoso
2014-08-18 15:30 ` Tomeu Vizoso
2014-08-27 20:54 ` Mike Turquette
2014-08-18 15:30 ` [PATCH v7 8/8] clk: Add floor and ceiling constraints to clock rates Tomeu Vizoso
2014-08-18 15:30 ` Tomeu Vizoso
2014-08-21 2:12 ` [PATCH v7 0/8] Per-user clock constraints Andrew Lunn
2014-08-21 2:12 ` Andrew Lunn
2014-08-21 7:10 ` Tomeu Vizoso
2014-08-21 7:10 ` Tomeu Vizoso
2014-08-26 13:20 ` Heiko Stübner
2014-08-26 13:20 ` Heiko Stübner
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=20140822202718.GI17277@lunn.ch \
--to=andrew@lunn.ch \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.