lkml.org 
[lkml]   [2013]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/5] cpufreq:exynos:Extend exynos cpufreq driver to support boost
Date
New structure - exynos_boost has been created to embrace the information
related to boost support.

The CONFIG_CPU_FREQ_BOOST flag is responsible for attaching the boost structure
to the cpufreq driver.
Setting exynos cpufreq driver .boost field to NULL, indicates that boost is
not supported.
Moreover device tree attribute "boost_mode" defines if exynos platform
support frequency overclocking (boost).

Moreover new attribute structure describing extra CPU features supported when boost
is enabled is also provided.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
---
drivers/cpufreq/exynos-cpufreq.c | 48 ++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)

diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index 3197d88..0b6fdf6 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -267,6 +267,38 @@ static struct freq_attr *exynos_cpufreq_attr[] = {
NULL,
};

+/* per CPU boost attributes to be exported to sysfs */
+static struct freq_attr *exynos_cpufreq_boost_attr[] = {
+ &cpufreq_freq_attr_boost_available_freqs,
+ NULL,
+};
+
+/* low level code to enable/disable boost */
+static int
+exynos_cpufreq_boost_trigger(struct cpufreq_policy *policy, int state)
+{
+
+ if (!policy || !policy->boost)
+ return -ENODEV;
+
+ if (state) {
+ policy->boost->max_normal_freq = policy->max;
+ policy->max = policy->boost->max_boost_freq;
+ policy->cpuinfo.max_freq = policy->max;
+ } else {
+ policy->max = policy->boost->max_normal_freq;
+ policy->cpuinfo.max_freq = policy->max;
+ }
+
+ return 0;
+}
+
+static struct cpufreq_boost exynos_boost = {
+ .attr = exynos_cpufreq_boost_attr,
+ .low_level_boost = exynos_cpufreq_boost_trigger,
+ .policies = LIST_HEAD_INIT(exynos_boost.policies),
+};
+
static struct cpufreq_driver exynos_driver = {
.flags = CPUFREQ_STICKY,
.verify = exynos_verify_speed,
@@ -276,6 +308,9 @@ static struct cpufreq_driver exynos_driver = {
.exit = exynos_cpufreq_cpu_exit,
.name = "exynos_cpufreq",
.attr = exynos_cpufreq_attr,
+#ifdef CONFIG_CPU_FREQ_BOOST
+ .boost = &exynos_boost,
+#endif
#ifdef CONFIG_PM
.suspend = exynos_cpufreq_suspend,
.resume = exynos_cpufreq_resume,
@@ -359,6 +394,8 @@ static struct of_device_id exynos_cpufreq_of_match[] __initconst = {

static int __init exynos_cpufreq_probe(struct platform_device *pdev)
{
+ struct device_node *node = pdev->dev.of_node;
+
int ret = -EINVAL;

exynos_info = kzalloc(sizeof(struct exynos_dvfs_info), GFP_KERNEL);
@@ -390,6 +427,17 @@ static int __init exynos_cpufreq_probe(struct platform_device *pdev)
goto err_vdd_arm;
}

+ /* If boost_mode property not available - then NULL out the boost
+ pointer to indicate thst boost is not supported*/
+ if (exynos_driver.boost) {
+ if (of_property_read_bool(node, "boost_mode"))
+ exynos_boost.max_boost_freq =
+ cpufreq_frequency_table_boost_max(
+ exynos_info->freq_table);
+ else
+ exynos_driver.boost = NULL;
+ }
+
locking_frequency = exynos_getspeed(0);

register_pm_notifier(&exynos_cpufreq_nb);
--
1.7.10.4


\
 
 \ /
  Last update: 2013-06-06 09:41    [W:1.095 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site