diff --git a/Documentation/devicetree/bindings/arm/msm/msm_core.txt b/Documentation/devicetree/bindings/arm/msm/msm_core.txt index 19e4dfb2f70..79dd5a32a1e 100644 --- a/Documentation/devicetree/bindings/arm/msm/msm_core.txt +++ b/Documentation/devicetree/bindings/arm/msm/msm_core.txt @@ -28,10 +28,6 @@ Optional properties: is no change in threshold. If this property is not present, the power is recalculated only on temperature threshold notifications. --qcom,throttling-temp: Temperature threshold for cpu frequency mitigation. - The value should be set same as the threshold temperature - in thermal module - 5 C, such that there is a bandwidth to - control the cores before frequency mitigation happens. [Second level nodes] Required properties to define per core characteristics: diff --git a/drivers/power/qcom/msm-core.c b/drivers/power/qcom/msm-core.c index 510c049251a..ba5210d8611 100644 --- a/drivers/power/qcom/msm-core.c +++ b/drivers/power/qcom/msm-core.c @@ -98,6 +98,7 @@ struct cpu_static_info { static DEFINE_MUTEX(policy_update_mutex); static DEFINE_MUTEX(kthread_update_mutex); +static DEFINE_SPINLOCK(update_lock); static struct delayed_work sampling_work; static struct completion sampling_completion; static struct task_struct *sampling_task; @@ -118,9 +119,6 @@ module_param_named(disabled, disabled, int, S_IRUGO | S_IWUSR | S_IWGRP); static bool in_suspend; static bool activate_power_table; -static int max_throttling_temp = 80; /* in C */ -module_param_named(throttling_temp, max_throttling_temp, int, - S_IRUGO | S_IWUSR | S_IWGRP); /* * Cannot be called from an interrupt context @@ -195,8 +193,6 @@ static void repopulate_stats(int cpu) temp_point = (cpu_node->temp - TEMP_BASE_POINT) / 5; cpu_stats[cpu].temp = cpu_node->temp; - cpu_stats[cpu].throttling = cpu_node->temp >= max_throttling_temp ? - true : false; for (i = 0; i < cpu_node->sp->num_of_freqs; i++) pt[i].power = cpu_node->sp->power[temp_point][i]; @@ -208,7 +204,6 @@ void trigger_cpu_pwr_stats_calc(void) { int cpu; static long prev_temp[NR_CPUS]; - static DEFINE_SPINLOCK(update_lock); struct cpu_activity_info *cpu_node; if (disabled) @@ -232,6 +227,20 @@ void trigger_cpu_pwr_stats_calc(void) } EXPORT_SYMBOL(trigger_cpu_pwr_stats_calc); +void set_cpu_throttled(cpumask_t *mask, bool throttling) +{ + int cpu; + + if (!mask) + return; + + spin_lock(&update_lock); + for_each_cpu(cpu, mask) + cpu_stats[cpu].throttling = throttling; + spin_unlock(&update_lock); +} +EXPORT_SYMBOL(set_cpu_throttled); + static void update_related_freq_table(struct cpufreq_policy *policy) { int cpu, num_of_freqs; @@ -508,8 +517,7 @@ static int msm_core_stats_init(struct device *dev, int cpu) cpu_node = &activity[cpu]; cpu_stats[cpu].cpu = cpu; cpu_stats[cpu].temp = cpu_node->temp; - cpu_stats[cpu].throttling = cpu_node->temp >= max_throttling_temp ? - true : false; + cpu_stats[cpu].throttling = false; cpu_stats[cpu].len = cpu_node->sp->num_of_freqs; pstate = devm_kzalloc(dev, @@ -980,8 +988,6 @@ static int msm_core_dev_probe(struct platform_device *pdev) if (ret) pr_info("msm-core initialized without polling period\n"); - key = "qcom,throttling-temp"; - ret = of_property_read_u32(node, key, &max_throttling_temp); ret = uio_init(pdev); if (ret) diff --git a/include/soc/qcom/msm-core.h b/include/soc/qcom/msm-core.h new file mode 100644 index 00000000000..26aa9b20f92 --- /dev/null +++ b/include/soc/qcom/msm-core.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __ARCH_ARM_MACH_MSM_CORE_H +#define __ARCH_ARM_MACH_MSM_CORE_H +#ifdef CONFIG_APSS_CORE_EA +void set_cpu_throttled(struct cpumask *mask, bool throttling); +#else +static inline void set_cpu_throttled(struct cpumask *mask, bool throttling) {} +#endif +#endif +