* [PATCH 0/3] cpufreq: dt: Minor fixes for 4.3
@ 2015-09-02 9:06 Viresh Kumar
2015-09-02 9:06 ` [PATCH 1/3] cpufreq: dt: Check OPP count before marking them shared Viresh Kumar
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Viresh Kumar @ 2015-09-02 9:06 UTC (permalink / raw)
To: Rafael Wysocki; +Cc: linaro-kernel, linux-pm, Viresh Kumar
Hi Rafael,
These are minor fixes for cpufreq-dt driver.
--
viresh
Viresh Kumar (3):
cpufreq: dt: Check OPP count before marking them shared
cpufreq: dt: Print error on failing to mark OPPs as shared
cpufreq: dt: Tolerance applies on both sides of target voltage
drivers/cpufreq/cpufreq-dt.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
--
2.4.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] cpufreq: dt: Check OPP count before marking them shared
2015-09-02 9:06 [PATCH 0/3] cpufreq: dt: Minor fixes for 4.3 Viresh Kumar
@ 2015-09-02 9:06 ` Viresh Kumar
2015-09-02 9:06 ` [PATCH 2/3] cpufreq: dt: Print error on failing to mark OPPs as shared Viresh Kumar
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Viresh Kumar @ 2015-09-02 9:06 UTC (permalink / raw)
To: Rafael Wysocki; +Cc: linaro-kernel, linux-pm, Viresh Kumar, open list
We need to explicitly mark OPPs as shared, when they are not defined
with OPP-v2 bindings. But this isn't required to be done if we failed to
initialize OPP table.
Reorder code to verify OPP count before marking them shared.
Fixes: 2e02d8723edf ("cpufreq: dt: Add support for operating-points-v2 bindings")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq-dt.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index c3583cdfadbd..8c38b5192baa 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -239,6 +239,17 @@ static int cpufreq_init(struct cpufreq_policy *policy)
*/
of_cpumask_init_opp_table(policy->cpus);
+ /*
+ * But we need OPP table to function so if it is not there let's
+ * give platform code chance to provide it for us.
+ */
+ ret = dev_pm_opp_get_opp_count(cpu_dev);
+ if (ret <= 0) {
+ pr_debug("OPP table is not ready, deferring probe\n");
+ ret = -EPROBE_DEFER;
+ goto out_free_opp;
+ }
+
if (need_update) {
struct cpufreq_dt_platform_data *pd = cpufreq_get_driver_data();
@@ -256,17 +267,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
transition_latency = dev_pm_opp_get_max_clock_latency(cpu_dev);
}
- /*
- * But we need OPP table to function so if it is not there let's
- * give platform code chance to provide it for us.
- */
- ret = dev_pm_opp_get_opp_count(cpu_dev);
- if (ret <= 0) {
- pr_debug("OPP table is not ready, deferring probe\n");
- ret = -EPROBE_DEFER;
- goto out_free_opp;
- }
-
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) {
ret = -ENOMEM;
--
2.4.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] cpufreq: dt: Print error on failing to mark OPPs as shared
2015-09-02 9:06 [PATCH 0/3] cpufreq: dt: Minor fixes for 4.3 Viresh Kumar
2015-09-02 9:06 ` [PATCH 1/3] cpufreq: dt: Check OPP count before marking them shared Viresh Kumar
@ 2015-09-02 9:06 ` Viresh Kumar
2015-09-02 9:06 ` [PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage Viresh Kumar
2015-09-03 1:14 ` [PATCH 0/3] cpufreq: dt: Minor fixes for 4.3 Rafael J. Wysocki
3 siblings, 0 replies; 7+ messages in thread
From: Viresh Kumar @ 2015-09-02 9:06 UTC (permalink / raw)
To: Rafael Wysocki; +Cc: linaro-kernel, linux-pm, Viresh Kumar, open list
We need to explicitly mark OPPs as shared, when they are not defined
with OPP-v2 bindings. This operation can potentially fail, and in that
case we should at least print an error message.
Fixes: 2e02d8723edf ("cpufreq: dt: Add support for operating-points-v2 bindings")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq-dt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 8c38b5192baa..b1131cf89757 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -260,7 +260,10 @@ static int cpufreq_init(struct cpufreq_policy *policy)
* OPP tables are initialized only for policy->cpu, do it for
* others as well.
*/
- set_cpus_sharing_opps(cpu_dev, policy->cpus);
+ ret = set_cpus_sharing_opps(cpu_dev, policy->cpus);
+ if (ret)
+ dev_err(cpu_dev, "%s: failed to mark OPPs as shared: %d\n",
+ __func__, ret);
of_property_read_u32(np, "clock-latency", &transition_latency);
} else {
--
2.4.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage
2015-09-02 9:06 [PATCH 0/3] cpufreq: dt: Minor fixes for 4.3 Viresh Kumar
2015-09-02 9:06 ` [PATCH 1/3] cpufreq: dt: Check OPP count before marking them shared Viresh Kumar
2015-09-02 9:06 ` [PATCH 2/3] cpufreq: dt: Print error on failing to mark OPPs as shared Viresh Kumar
@ 2015-09-02 9:06 ` Viresh Kumar
2015-09-02 9:39 ` Lucas Stach
2015-09-03 1:14 ` [PATCH 0/3] cpufreq: dt: Minor fixes for 4.3 Rafael J. Wysocki
3 siblings, 1 reply; 7+ messages in thread
From: Viresh Kumar @ 2015-09-02 9:06 UTC (permalink / raw)
To: Rafael Wysocki
Cc: linaro-kernel, linux-pm, Viresh Kumar, Lucas Stach, open list
Tolerance applies on both sides of the target voltage, i.e. both min and
max sides. But while checking if a voltage is supported by the regulator
or not, we haven't taken care of tolerance on the lower side. Fix that.
Cc: Lucas Stach <l.stach@pengutronix.de>
Fixes: 045ee45c4ff2 ("cpufreq: cpufreq-dt: disable unsupported OPPs")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq-dt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index b1131cf89757..3b64c203bf99 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -303,7 +303,8 @@ static int cpufreq_init(struct cpufreq_policy *policy)
rcu_read_unlock();
tol_uV = opp_uV * priv->voltage_tolerance / 100;
- if (regulator_is_supported_voltage(cpu_reg, opp_uV,
+ if (regulator_is_supported_voltage(cpu_reg,
+ opp_uV - tol_uV,
opp_uV + tol_uV)) {
if (opp_uV < min_uV)
min_uV = opp_uV;
--
2.4.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage
2015-09-02 9:06 ` [PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage Viresh Kumar
@ 2015-09-02 9:39 ` Lucas Stach
2015-09-02 9:44 ` Viresh Kumar
0 siblings, 1 reply; 7+ messages in thread
From: Lucas Stach @ 2015-09-02 9:39 UTC (permalink / raw)
To: Viresh Kumar; +Cc: Rafael Wysocki, linaro-kernel, linux-pm, open list
Am Mittwoch, den 02.09.2015, 14:36 +0530 schrieb Viresh Kumar:
> Tolerance applies on both sides of the target voltage, i.e. both min and
> max sides.
While I'm not really comfortable with the above, it is exactly how OPPv1
and the voltage tolerance property are specified.
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> But while checking if a voltage is supported by the regulator
> or not, we haven't taken care of tolerance on the lower side. Fix that.
>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Fixes: 045ee45c4ff2 ("cpufreq: cpufreq-dt: disable unsupported OPPs")
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> drivers/cpufreq/cpufreq-dt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
> index b1131cf89757..3b64c203bf99 100644
> --- a/drivers/cpufreq/cpufreq-dt.c
> +++ b/drivers/cpufreq/cpufreq-dt.c
> @@ -303,7 +303,8 @@ static int cpufreq_init(struct cpufreq_policy *policy)
> rcu_read_unlock();
>
> tol_uV = opp_uV * priv->voltage_tolerance / 100;
> - if (regulator_is_supported_voltage(cpu_reg, opp_uV,
> + if (regulator_is_supported_voltage(cpu_reg,
> + opp_uV - tol_uV,
> opp_uV + tol_uV)) {
> if (opp_uV < min_uV)
> min_uV = opp_uV;
--
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage
2015-09-02 9:39 ` Lucas Stach
@ 2015-09-02 9:44 ` Viresh Kumar
0 siblings, 0 replies; 7+ messages in thread
From: Viresh Kumar @ 2015-09-02 9:44 UTC (permalink / raw)
To: Lucas Stach; +Cc: Rafael Wysocki, linaro-kernel, linux-pm, open list
On 02-09-15, 11:39, Lucas Stach wrote:
> Am Mittwoch, den 02.09.2015, 14:36 +0530 schrieb Viresh Kumar:
> > Tolerance applies on both sides of the target voltage, i.e. both min and
> > max sides.
>
> While I'm not really comfortable with the above, it is exactly how OPPv1
> and the voltage tolerance property are specified.
>
> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Thanks.
And this is exactly how the regulator API work:
static inline int regulator_set_voltage_tol(struct regulator *regulator,
int new_uV, int tol_uV)
{
if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0)
return 0;
else
return regulator_set_voltage(regulator,
new_uV - tol_uV, new_uV + tol_uV);
}
But yeah, OPP-v2 is going to take care of this with target/min/max
values..
--
viresh
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] cpufreq: dt: Minor fixes for 4.3
2015-09-02 9:06 [PATCH 0/3] cpufreq: dt: Minor fixes for 4.3 Viresh Kumar
` (2 preceding siblings ...)
2015-09-02 9:06 ` [PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage Viresh Kumar
@ 2015-09-03 1:14 ` Rafael J. Wysocki
3 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2015-09-03 1:14 UTC (permalink / raw)
To: Viresh Kumar; +Cc: linaro-kernel, linux-pm
On Wednesday, September 02, 2015 02:36:47 PM Viresh Kumar wrote:
> Hi Rafael,
>
> These are minor fixes for cpufreq-dt driver.
>
> --
> viresh
>
> Viresh Kumar (3):
> cpufreq: dt: Check OPP count before marking them shared
> cpufreq: dt: Print error on failing to mark OPPs as shared
> cpufreq: dt: Tolerance applies on both sides of target voltage
>
> drivers/cpufreq/cpufreq-dt.c | 30 +++++++++++++++++-------------
> 1 file changed, 17 insertions(+), 13 deletions(-)
I'm queuing this one up for the next PM pull request.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-09-03 0:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-02 9:06 [PATCH 0/3] cpufreq: dt: Minor fixes for 4.3 Viresh Kumar
2015-09-02 9:06 ` [PATCH 1/3] cpufreq: dt: Check OPP count before marking them shared Viresh Kumar
2015-09-02 9:06 ` [PATCH 2/3] cpufreq: dt: Print error on failing to mark OPPs as shared Viresh Kumar
2015-09-02 9:06 ` [PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage Viresh Kumar
2015-09-02 9:39 ` Lucas Stach
2015-09-02 9:44 ` Viresh Kumar
2015-09-03 1:14 ` [PATCH 0/3] cpufreq: dt: Minor fixes for 4.3 Rafael J. Wysocki
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).