Hi Rafael,
This is based of my opp-v2 series and so is sent as reply to that one.
Bartlomiej had few patches that he wanted to get into 4.3. I have picked two of those and dropped one (the one that adds another field to platform data). The dropped one is replaced with two patches from me. There are minor modifications done in first two patches, based on the review comments I gave to him earlier.
Completely Untested.
@Bartlomiej: Can you please give them some testing ?
Bartlomiej Zolnierkiewicz (2): opp: add dev_pm_opp_is_turbo() helper cpufreq: Update boost flag while initializing freq table from OPPs
Viresh Kumar (2): cpufreq: Allow drivers to enable boost support after registering driver cpufreq: dt: Add support for turbo/boost mode
drivers/base/power/opp.c | 30 ++++++++++++++++++++ drivers/cpufreq/cpufreq-dt.c | 8 ++++++ drivers/cpufreq/cpufreq.c | 66 ++++++++++++++++++++++++++++++------------- drivers/cpufreq/cpufreq_opp.c | 4 +++ drivers/cpufreq/freq_table.c | 15 ++++++++++ include/linux/cpufreq.h | 12 ++++++++ include/linux/pm_opp.h | 7 +++++ 7 files changed, 122 insertions(+), 20 deletions(-)
From: Bartlomiej Zolnierkiewicz b.zolnierkie@samsung.com
Add dev_pm_opp_is_turbo() helper to verify if an opp is to be used only for turbo mode or not.
Cc: Tomasz Figa tomasz.figa@gmail.com Cc: Michael Turquette mturquette@baylibre.com Cc: Javier Martinez Canillas javier@dowhile0.org Cc: Thomas Abraham thomas.ab@samsung.com Signed-off-by: Bartlomiej Zolnierkiewicz b.zolnierkie@samsung.com Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- drivers/base/power/opp.c | 30 ++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 7 +++++++ 2 files changed, 37 insertions(+)
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index b38f2600d797..a0c54058c4dd 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -281,6 +281,36 @@ unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq);
/** + * dev_pm_opp_is_turbo() - Returns true if opp was trubo OPP + * @opp: opp for which turbo mode is being verified + * + * Return: true if opp is turbo opp, else false. + * + * Locking: This function must be called under rcu_read_lock(). opp is a rcu + * protected pointer. This means that opp which could have been fetched by + * opp_find_freq_{exact,ceil,floor} functions is valid as long as we are + * under RCU lock. The pointer returned by the opp_find_freq family must be + * used in the same section as the usage of this function with the pointer + * prior to unlocking with rcu_read_unlock() to maintain the integrity of the + * pointer. + */ +bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp) +{ + struct dev_pm_opp *tmp_opp; + + opp_rcu_lockdep_assert(); + + tmp_opp = rcu_dereference(opp); + if (unlikely(IS_ERR_OR_NULL(tmp_opp)) || !tmp_opp->available) { + pr_err("%s: Invalid parameters\n", __func__); + return false; + } + + return tmp_opp->turbo; +} +EXPORT_SYMBOL_GPL(dev_pm_opp_is_turbo); + +/** * dev_pm_opp_get_max_clock_latency() - Get max clock latency in nanoseconds * @dev: device for which we do this operation * diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index bb52fae5b921..cab7ba55bedb 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -30,6 +30,8 @@ unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
+bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp); + int dev_pm_opp_get_opp_count(struct device *dev); unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev);
@@ -63,6 +65,11 @@ static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) return 0; }
+static inline bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp) +{ + return false; +} + static inline int dev_pm_opp_get_opp_count(struct device *dev) { return 0;
On Tue 2015-07-28 16:50:00, Viresh Kumar wrote:
From: Bartlomiej Zolnierkiewicz b.zolnierkie@samsung.com
Add dev_pm_opp_is_turbo() helper to verify if an opp is to be used only for turbo mode or not.
Cc: Tomasz Figa tomasz.figa@gmail.com Cc: Michael Turquette mturquette@baylibre.com Cc: Javier Martinez Canillas javier@dowhile0.org Cc: Thomas Abraham thomas.ab@samsung.com Signed-off-by: Bartlomiej Zolnierkiewicz b.zolnierkie@samsung.com Signed-off-by: Viresh Kumar viresh.kumar@linaro.org
drivers/base/power/opp.c | 30 ++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 7 +++++++ 2 files changed, 37 insertions(+)
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index b38f2600d797..a0c54058c4dd 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -281,6 +281,36 @@ unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq); /**
- dev_pm_opp_is_turbo() - Returns true if opp was trubo OPP
Typo.
And this is not exactly most helpful comment. opp is turbo... returns if opp was turbo. Explanation what "turbo" means in this context would be nice. I'm pretty sure it is not about air compression :-).
- Return: true if opp is turbo opp, else false.
Duplicate from above.
Best regards, Pavel
On 28-07-15, 16:27, Pavel Machek wrote:
Typo.
And this is not exactly most helpful comment. opp is turbo... returns if opp was turbo. Explanation what "turbo" means in this context would be nice. I'm pretty sure it is not about air compression :-).
Does this make it any better:
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index e039cf024a6c..da8ec7f824d5 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -281,9 +281,13 @@ unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq);
/** - * dev_pm_opp_is_turbo() - Returns true if opp was trubo OPP + * dev_pm_opp_is_turbo() - Returns if opp is turbo OPP or not * @opp: opp for which turbo mode is being verified * + * Turbo OPPs are not for normal use, and can be enabled (under certain + * conditions) for short duration of times to finish high throughput work + * quickly. Running on them for longer times may overheat the chip. + * * Return: true if opp is turbo opp, else false. * * Locking: This function must be called under rcu_read_lock(). opp is a rcu
On Wed 2015-07-29 15:54:35, Viresh Kumar wrote:
On 28-07-15, 16:27, Pavel Machek wrote:
Typo.
And this is not exactly most helpful comment. opp is turbo... returns if opp was turbo. Explanation what "turbo" means in this context would be nice. I'm pretty sure it is not about air compression :-).
Does this make it any better:
Yes.
So any combination of normal OPPs can be sustained for arbitrary time within the temperature range?
And as soon as any turbo OPP is enabled, we produce more heat than TDP?
Thanks, Pavel
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index e039cf024a6c..da8ec7f824d5 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -281,9 +281,13 @@ unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq); /**
- dev_pm_opp_is_turbo() - Returns true if opp was trubo OPP
- dev_pm_opp_is_turbo() - Returns if opp is turbo OPP or not
- @opp: opp for which turbo mode is being verified
- Turbo OPPs are not for normal use, and can be enabled (under certain
- conditions) for short duration of times to finish high throughput work
- quickly. Running on them for longer times may overheat the chip.
- Return: true if opp is turbo opp, else false.
- Locking: This function must be called under rcu_read_lock(). opp is a rcu
On 29-07-15, 12:53, Pavel Machek wrote:
So any combination of normal OPPs can be sustained for arbitrary time within the temperature range?
Maybe not. That's why we user thermal framework to sense such situations and react accordingly.
And as soon as any turbo OPP is enabled, we produce more heat than TDP?
But yeah, this will cross all limits. Shall generate more heat or may consume lots of power for very small benefit in performance. And so very short duration bursts of this are used by very few platforms.
From: Bartlomiej Zolnierkiewicz b.zolnierkie@samsung.com
cpufreq table entries for OPPs with turbo modes enabled, should be marked with CPUFREQ_BOOST_FREQ flag. This ensures that these states are only used while operating in boost or turbo mode.
Cc: Tomasz Figa tomasz.figa@gmail.com Cc: Michael Turquette mturquette@baylibre.com Cc: Javier Martinez Canillas javier@dowhile0.org Cc: Thomas Abraham thomas.ab@samsung.com Signed-off-by: Bartlomiej Zolnierkiewicz b.zolnierkie@samsung.com Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- drivers/cpufreq/cpufreq_opp.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c index 773bcde893c0..0f5e6d5f6da0 100644 --- a/drivers/cpufreq/cpufreq_opp.c +++ b/drivers/cpufreq/cpufreq_opp.c @@ -75,6 +75,10 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, } freq_table[i].driver_data = i; freq_table[i].frequency = rate / 1000; + + /* Is Boost/turbo opp ? */ + if (dev_pm_opp_is_turbo(opp)) + freq_table[i].flags = CPUFREQ_BOOST_FREQ; }
freq_table[i].driver_data = i;
In some cases it wouldn't be known at time of driver registration, if the driver needs to support boost/turbo frequencies.
For example, while getting boost information from DT with opp-v2 bindings, we need to parse the bindings for all the CPUs to know if turbo/boost OPPs are supported or not.
One way out to do that efficiently is to delay supporting boost mode (i.e. creating /sys/devices/system/cpu/cpufreq/boost file), until the time OPP bindings are parsed.
At that point, the driver can enable boost support. This can be done at ->init(), where the frequency table is created.
To do that, the driver requires few APIs from cpufreq core. This patch provides these APIs.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- drivers/cpufreq/cpufreq.c | 66 ++++++++++++++++++++++++++++++-------------- drivers/cpufreq/freq_table.c | 15 ++++++++++ include/linux/cpufreq.h | 12 ++++++++ 3 files changed, 73 insertions(+), 20 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 46251e8d30f2..217928de2f0e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2459,6 +2459,47 @@ int cpufreq_boost_supported(void) } EXPORT_SYMBOL_GPL(cpufreq_boost_supported);
+static int create_boost_sysfs_file(void) +{ + int ret; + + if (!cpufreq_boost_supported()) + return 0; + + /* + * Check if driver provides function to enable boost - + * if not, use cpufreq_boost_set_sw as default + */ + if (!cpufreq_driver->set_boost) + cpufreq_driver->set_boost = cpufreq_boost_set_sw; + + ret = cpufreq_sysfs_create_file(&boost.attr); + if (ret) + pr_err("%s: cannot register global BOOST sysfs file\n", + __func__); + + return ret; +} + +static void remove_boost_sysfs_file(void) +{ + if (cpufreq_boost_supported()) + cpufreq_sysfs_remove_file(&boost.attr); +} + +int cpufreq_enable_boost_support(void) +{ + if (!cpufreq_driver) + return -EINVAL; + + if (cpufreq_boost_supported()) + return 0; + + /* This will get removed on driver unregister */ + return create_boost_sysfs_file(); +} +EXPORT_SYMBOL_GPL(cpufreq_enable_boost_support); + int cpufreq_boost_enabled(void) { return cpufreq_driver->boost_enabled; @@ -2508,21 +2549,9 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) if (driver_data->setpolicy) driver_data->flags |= CPUFREQ_CONST_LOOPS;
- if (cpufreq_boost_supported()) { - /* - * Check if driver provides function to enable boost - - * if not, use cpufreq_boost_set_sw as default - */ - if (!cpufreq_driver->set_boost) - cpufreq_driver->set_boost = cpufreq_boost_set_sw; - - ret = cpufreq_sysfs_create_file(&boost.attr); - if (ret) { - pr_err("%s: cannot register global BOOST sysfs file\n", - __func__); - goto err_null_driver; - } - } + ret = create_boost_sysfs_file(); + if (ret) + goto err_null_driver;
ret = subsys_interface_register(&cpufreq_interface); if (ret) @@ -2543,8 +2572,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) err_if_unreg: subsys_interface_unregister(&cpufreq_interface); err_boost_unreg: - if (cpufreq_boost_supported()) - cpufreq_sysfs_remove_file(&boost.attr); + remove_boost_sysfs_file(); err_null_driver: write_lock_irqsave(&cpufreq_driver_lock, flags); cpufreq_driver = NULL; @@ -2573,9 +2601,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) /* Protect against concurrent cpu hotplug */ get_online_cpus(); subsys_interface_unregister(&cpufreq_interface); - if (cpufreq_boost_supported()) - cpufreq_sysfs_remove_file(&boost.attr); - + remove_boost_sysfs_file(); unregister_hotcpu_notifier(&cpufreq_cpu_notifier);
write_lock_irqsave(&cpufreq_driver_lock, flags); diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index dfbbf981ed56..a8f1daffc9bc 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -18,6 +18,21 @@ * FREQUENCY TABLE HELPERS * *********************************************************************/
+bool policy_has_boost_freq(struct cpufreq_policy *policy) +{ + struct cpufreq_frequency_table *pos, *table = policy->freq_table; + + if (!table) + return false; + + cpufreq_for_each_valid_entry(pos, table) + if (pos->flags & CPUFREQ_BOOST_FREQ) + return true; + + return false; +} +EXPORT_SYMBOL_GPL(policy_has_boost_freq); + int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, struct cpufreq_frequency_table *table) { diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index bde1e567b3a9..95f018649abf 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -578,6 +578,8 @@ ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf); int cpufreq_boost_trigger_state(int state); int cpufreq_boost_supported(void); int cpufreq_boost_enabled(void); +int cpufreq_enable_boost_support(void); +bool policy_has_boost_freq(struct cpufreq_policy *policy); #else static inline int cpufreq_boost_trigger_state(int state) { @@ -591,6 +593,16 @@ static inline int cpufreq_boost_enabled(void) { return 0; } + +static inline int cpufreq_enable_boost_support(void) +{ + return -EINVAL; +} + +static inline bool policy_has_boost_freq(struct cpufreq_policy *policy) +{ + return false; +} #endif /* the following funtion is for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
On 28-07-15, 16:50, Viresh Kumar wrote:
In some cases it wouldn't be known at time of driver registration, if the driver needs to support boost/turbo frequencies.
For example, while getting boost information from DT with opp-v2 bindings, we need to parse the bindings for all the CPUs to know if turbo/boost OPPs are supported or not.
One way out to do that efficiently is to delay supporting boost mode (i.e. creating /sys/devices/system/cpu/cpufreq/boost file), until the time OPP bindings are parsed.
At that point, the driver can enable boost support. This can be done at ->init(), where the frequency table is created.
To do that, the driver requires few APIs from cpufreq core. This patch provides these APIs.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org
drivers/cpufreq/cpufreq.c | 66 ++++++++++++++++++++++++++++++-------------- drivers/cpufreq/freq_table.c | 15 ++++++++++ include/linux/cpufreq.h | 12 ++++++++ 3 files changed, 73 insertions(+), 20 deletions(-)
Minor update that will make this patch work again :)
----------------------8<------------------------ Message-Id: 6c5b3d3f93adf53e5ba83e94fcc3df5b1abfc132.1438091239.git.viresh.kumar@linaro.org From: Viresh Kumar viresh.kumar@linaro.org Date: Tue, 28 Jul 2015 16:14:02 +0530 Subject: [PATCH] cpufreq: Allow drivers to enable boost support after registering driver
In some cases it wouldn't be known at time of driver registration, if the driver needs to support boost frequencies.
For example, while getting boost information from DT with opp-v2 bindings, we need to parse the bindings for all the CPUs to know if turbo/boost OPPs are supported or not.
One way out to do that efficiently is to delay supporting boost mode (i.e. creating /sys/devices/system/cpu/cpufreq/boost file), until the time OPP bindings are parsed.
At that point, the driver can enable boost support. This can be done at ->init(), where the frequency table is created.
To do that, the driver requires few APIs from cpufreq core that let him do this. This patch provides these APIs.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- drivers/cpufreq/cpufreq.c | 68 +++++++++++++++++++++++++++++++------------- drivers/cpufreq/freq_table.c | 15 ++++++++++ include/linux/cpufreq.h | 12 ++++++++ 3 files changed, 75 insertions(+), 20 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 46251e8d30f2..db4390ca5243 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2459,6 +2459,49 @@ int cpufreq_boost_supported(void) } EXPORT_SYMBOL_GPL(cpufreq_boost_supported);
+static int create_boost_sysfs_file(void) +{ + int ret; + + if (!cpufreq_boost_supported()) + return 0; + + /* + * Check if driver provides function to enable boost - + * if not, use cpufreq_boost_set_sw as default + */ + if (!cpufreq_driver->set_boost) + cpufreq_driver->set_boost = cpufreq_boost_set_sw; + + ret = cpufreq_sysfs_create_file(&boost.attr); + if (ret) + pr_err("%s: cannot register global BOOST sysfs file\n", + __func__); + + return ret; +} + +static void remove_boost_sysfs_file(void) +{ + if (cpufreq_boost_supported()) + cpufreq_sysfs_remove_file(&boost.attr); +} + +int cpufreq_enable_boost_support(void) +{ + if (!cpufreq_driver) + return -EINVAL; + + if (cpufreq_boost_supported()) + return 0; + + cpufreq_driver->boost_supported = true; + + /* This will get removed on driver unregister */ + return create_boost_sysfs_file(); +} +EXPORT_SYMBOL_GPL(cpufreq_enable_boost_support); + int cpufreq_boost_enabled(void) { return cpufreq_driver->boost_enabled; @@ -2508,21 +2551,9 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) if (driver_data->setpolicy) driver_data->flags |= CPUFREQ_CONST_LOOPS;
- if (cpufreq_boost_supported()) { - /* - * Check if driver provides function to enable boost - - * if not, use cpufreq_boost_set_sw as default - */ - if (!cpufreq_driver->set_boost) - cpufreq_driver->set_boost = cpufreq_boost_set_sw; - - ret = cpufreq_sysfs_create_file(&boost.attr); - if (ret) { - pr_err("%s: cannot register global BOOST sysfs file\n", - __func__); - goto err_null_driver; - } - } + ret = create_boost_sysfs_file(); + if (ret) + goto err_null_driver;
ret = subsys_interface_register(&cpufreq_interface); if (ret) @@ -2543,8 +2574,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) err_if_unreg: subsys_interface_unregister(&cpufreq_interface); err_boost_unreg: - if (cpufreq_boost_supported()) - cpufreq_sysfs_remove_file(&boost.attr); + remove_boost_sysfs_file(); err_null_driver: write_lock_irqsave(&cpufreq_driver_lock, flags); cpufreq_driver = NULL; @@ -2573,9 +2603,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) /* Protect against concurrent cpu hotplug */ get_online_cpus(); subsys_interface_unregister(&cpufreq_interface); - if (cpufreq_boost_supported()) - cpufreq_sysfs_remove_file(&boost.attr); - + remove_boost_sysfs_file(); unregister_hotcpu_notifier(&cpufreq_cpu_notifier);
write_lock_irqsave(&cpufreq_driver_lock, flags); diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index dfbbf981ed56..a8f1daffc9bc 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -18,6 +18,21 @@ * FREQUENCY TABLE HELPERS * *********************************************************************/
+bool policy_has_boost_freq(struct cpufreq_policy *policy) +{ + struct cpufreq_frequency_table *pos, *table = policy->freq_table; + + if (!table) + return false; + + cpufreq_for_each_valid_entry(pos, table) + if (pos->flags & CPUFREQ_BOOST_FREQ) + return true; + + return false; +} +EXPORT_SYMBOL_GPL(policy_has_boost_freq); + int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, struct cpufreq_frequency_table *table) { diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index bde1e567b3a9..95f018649abf 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -578,6 +578,8 @@ ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf); int cpufreq_boost_trigger_state(int state); int cpufreq_boost_supported(void); int cpufreq_boost_enabled(void); +int cpufreq_enable_boost_support(void); +bool policy_has_boost_freq(struct cpufreq_policy *policy); #else static inline int cpufreq_boost_trigger_state(int state) { @@ -591,6 +593,16 @@ static inline int cpufreq_boost_enabled(void) { return 0; } + +static inline int cpufreq_enable_boost_support(void) +{ + return -EINVAL; +} + +static inline bool policy_has_boost_freq(struct cpufreq_policy *policy) +{ + return false; +} #endif /* the following funtion is for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
With opp-v2 DT bindings, few OPPs can be used only for the boost mode. But using such OPPs require the boost mode to be supported by cpufreq driver.
We will parse DT bindings only during ->init() and so can enable boost support only after registering cpufreq driver.
This enables boost support as soon as any policy has boost/turbo OPPs for its CPUs.
We don't need to disable boost support as that is done by the core, when the driver is unregistered.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- drivers/cpufreq/cpufreq-dt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index c6e7033076de..b9259abd25d4 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -330,6 +330,14 @@ static int cpufreq_init(struct cpufreq_policy *policy) goto out_free_cpufreq_table; }
+ /* Support turbo/boost mode */ + if (policy_has_boost_freq(policy)) { + /* This gets disabled by core on driver unregister */ + ret = cpufreq_enable_boost_support(); + if (ret) + goto out_free_cpufreq_table; + } + policy->cpuinfo.transition_latency = transition_latency;
of_node_put(np);
On 28-07-15, 16:49, Viresh Kumar wrote:
Hi Rafael,
This is based of my opp-v2 series and so is sent as reply to that one.
Forgot to add --in-reply-to, here is the series I was talking about:
http://marc.info/?l=linux-pm&m=143797340316115&w=2
Hi,
On Tuesday, July 28, 2015 04:49:59 PM Viresh Kumar wrote:
Hi Rafael,
This is based of my opp-v2 series and so is sent as reply to that one.
Bartlomiej had few patches that he wanted to get into 4.3. I have picked two of those and dropped one (the one that adds another field to platform data). The dropped one is replaced with two patches from me. There are minor modifications done in first two patches, based on the review comments I gave to him earlier.
Thanks for working on this.
Completely Untested.
@Bartlomiej: Can you please give them some testing ?
Could you please tell me first how do you want me to fix the issue with setting boost_supported flag in cpufreq driver structure?
For exynos-cpufreq driver we currently have:
#ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW .boost_supported = true, #endif
With my original patches the config option stayed the same and the flag was enabled if necessary in Exynos platform code and passed through platform data to cpufreq-dt driver. This is no longer possible with your changes.
Should I enable it unconditionally in cpufreq-dt driver or add new config option for cpufreq-dt driver (CONFIG_CPUFREQ_DT_BOOST_SW?) for enabling boost_supported flag if necessary?
Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics
Bartlomiej Zolnierkiewicz (2): opp: add dev_pm_opp_is_turbo() helper cpufreq: Update boost flag while initializing freq table from OPPs
Viresh Kumar (2): cpufreq: Allow drivers to enable boost support after registering driver cpufreq: dt: Add support for turbo/boost mode
drivers/base/power/opp.c | 30 ++++++++++++++++++++ drivers/cpufreq/cpufreq-dt.c | 8 ++++++ drivers/cpufreq/cpufreq.c | 66 ++++++++++++++++++++++++++++++------------- drivers/cpufreq/cpufreq_opp.c | 4 +++ drivers/cpufreq/freq_table.c | 15 ++++++++++ include/linux/cpufreq.h | 12 ++++++++ include/linux/pm_opp.h | 7 +++++ 7 files changed, 122 insertions(+), 20 deletions(-)
On 28-07-15, 13:55, Bartlomiej Zolnierkiewicz wrote:
Could you please tell me first how do you want me to fix the issue with setting boost_supported flag in cpufreq driver structure?
For exynos-cpufreq driver we currently have:
#ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW .boost_supported = true, #endif
With my original patches the config option stayed the same and the flag was enabled if necessary in Exynos platform code and passed through platform data to cpufreq-dt driver. This is no longer possible with your changes.
Should I enable it unconditionally in cpufreq-dt driver or add new config option for cpufreq-dt driver (CONFIG_CPUFREQ_DT_BOOST_SW?) for enabling boost_supported flag if necessary?
Look at my implementation, last two patches are already doing that. You don't need another change to get this working for you, neither are those config options required. Get rid of them :)
On Tuesday, July 28, 2015 05:48:43 PM Viresh Kumar wrote:
On 28-07-15, 13:55, Bartlomiej Zolnierkiewicz wrote:
Could you please tell me first how do you want me to fix the issue with setting boost_supported flag in cpufreq driver structure?
For exynos-cpufreq driver we currently have:
#ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW .boost_supported = true, #endif
With my original patches the config option stayed the same and the flag was enabled if necessary in Exynos platform code and passed through platform data to cpufreq-dt driver. This is no longer possible with your changes.
Should I enable it unconditionally in cpufreq-dt driver or add new config option for cpufreq-dt driver (CONFIG_CPUFREQ_DT_BOOST_SW?) for enabling boost_supported flag if necessary?
Look at my implementation, last two patches are already doing that. You don't need another change to get this working for you, neither are
I did look a them and they are lacking enabling of boost support flag in cpufreq_dt driver structure.
There is also CONFIG_CPU_FREQ_BOOST_SW which needs to be enabled to have boost frequencies in sysfs (code for that is in freq_table.c).
those config options required. Get rid of them :)
Do you mean that we should now depend only on dts info for enabling boost support and that CONFIG_CPU_FREQ_BOOST_SW should be removed (together with CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW)?
Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics
On 28-07-15, 15:38, Bartlomiej Zolnierkiewicz wrote:
I did look a them and they are lacking enabling of boost support flag in cpufreq_dt driver structure.
That's insulting now, I forgot to add this:
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 217928de2f0e..db4390ca5243 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2495,6 +2495,8 @@ int cpufreq_enable_boost_support(void) if (cpufreq_boost_supported()) return 0;
+ cpufreq_driver->boost_supported = true; + /* This will get removed on driver unregister */ return create_boost_sysfs_file(); }
So that is done from the above routine now.
There is also CONFIG_CPU_FREQ_BOOST_SW which needs to be enabled to have boost frequencies in sysfs (code for that is in freq_table.c).
Yeah, we should get rid of that as well..
those config options required. Get rid of them :)
Do you mean that we should now depend only on dts info for enabling boost support and that CONFIG_CPU_FREQ_BOOST_SW should be removed (together with CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW)?
Yes.
linaro-kernel@lists.linaro.org