summaryrefslogtreecommitdiffstats
path: root/drivers/thermal/cpu_cooling.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* thermal: cpu_cooling: fix typo highjack -> hijackJavi Merino2014-07-221-1/+1
| | | | | | | Cc: Eduardo Valentin <eduardo.valentin@ti.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: Use cpufreq_for_each_valid_entry macro for iterationStratos Karafotis2014-04-301-20/+13
| | | | | | | | | | | | | The cpufreq core now supports the cpufreq_for_each_valid_entry macro helper for iteration over the cpufreq_frequency_table, so use it. Also remove the redundant !! operator. It should have no functional changes. Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
*-. Merge branches 'misc', 'soc', 'soc-eduardo' and 'int3404-thermal' of .git ↵Zhang Rui2014-01-021-6/+50
|\ \ | | | | | | | | | into next
| | * thermal: cpu_cooling: introduce of_cpufreq_cooling_registerEduardo Valentin2013-12-041-6/+50
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces an API to register cpufreq cooling device based on device tree node. The registration via device tree node differs from normal registration due to the fact that it is needed to fill the device_node structure in order to be able to match the cooling devices with trip points. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
* | Thermal cpu cooling: return error if no valid cpu frequency entryZhang Rui2014-01-021-0/+5
| | | | | | | | Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* | thermal: fix cpu_cooling max_level behaviorEduardo Valentin2014-01-021-2/+4
|/ | | | | | | | | | | | | | As per Documentation/thermal/sysfs-api.txt, max_level is an index, not a counter. Thus, in case a CPU has 3 valid frequencies, max_level is expected to be 2, for instance. The current code makes max_level == number of valid frequencies, which is bogus. This patch fix the cpu_cooling device by ranging max_level properly. Reported-by: Carlos Hernandez <ceh@ti.com> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: fix return value check in cpufreq_cooling_register()Wei Yongjun2013-11-061-2/+2
| | | | | | | | | In case of error, the function thermal_cooling_device_register() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* drivers: thermal: add check when unregistering cpu coolingEduardo Valentin2013-09-031-1/+5
| | | | | | | | | | This patch avoids NULL pointer accesses while unregistering cpu cooling devices, in case a NULL pointer is received. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
* Thermal/cpu_cooling: Return directly for the cpu out of allowed_cpus in the ↵Lan Tianyu2013-08-151-0/+2
| | | | | | | | | | | | | | | | | | | cpufreq_thermal_notifier() cpufreq_thermal_notifier() is to change the cpu's cpufreq in the allowed_cpus mask when associated thermal-cpufreq cdev's cooling state is changed. It's a cpufreq policy notifier handler and it will be triggered even if those cpus out of allowed_cpus has changed freq policy. cpufreq_thermal_notifier() checks the policy->cpu. If it belongs to allowed_cpus, change max_freq(default to 0) to the desire cpufreq value and pass 0 and max_freq to cpufreq_verify_within_limits() as cpufreq scope. But if not, do nothing and max_freq will remain 0. This will cause the cpufreq scope to become 0~0. This is not right. This patch is to return directly after finding cpu not belonging to allowed_cpus. Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: fix 'descend' check in get_property()Shawn Guo2013-05-281-1/+1
| | | | | | | | | | | | | | | The variable 'descend' is initialized as -1 in function get_property(), and will never get any chance to be updated by the following code. if (freq != CPUFREQ_ENTRY_INVALID && descend != -1) descend = !!(freq > table[i].frequency); This makes function get_property() return the wrong frequency for given cooling level if the frequency table is sorted in ascending. Fix it by correcting the 'descend' check in if-condition to 'descend == -1'. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: alignment improvementsEduardo Valentin2013-04-271-10/+9
| | | | | | | | | Improve code readiness by changing alignments so that they match open parenthesis, like checkpatch.pl --strict suggests. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: remove checkpatch.pl warningEduardo Valentin2013-04-271-1/+1
| | | | | | | Simple code style fix. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: remove trailing blank lineEduardo Valentin2013-04-271-1/+0
| | | | | | | Remove unnecessary blank line. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: align on open parenthesisEduardo Valentin2013-04-271-1/+2
| | | | | | | | Improve code readiness by remove checkpatch.pl warnings on get_property function. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: standardize comment styleEduardo Valentin2013-04-271-6/+4
| | | | | | | | There are at least three patterns for oneline comments in this file. This patch changes them to one single pattern Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: standardize end of functionEduardo Valentin2013-04-271-0/+12
| | | | | | | | | | | Just for code readiness, this patch makes all functions on this file to have a blank line before their returns. Now, some functions follow this pattern, and others will not have a blank line. So, this patch makes it a single pattern. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: remove trailing white spacesEduardo Valentin2013-04-271-2/+1
| | | | | | | Remove unnecessary white spaces. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: remove unused symbolsEduardo Valentin2013-04-241-5/+1
| | | | | | | | The list is not needed so far. Thus removing it. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: remove not needed curl bracketsEduardo Valentin2013-04-241-2/+2
| | | | | | | | Just for style purposes, remove extra curl brackets. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: use snprintf instead of sprintfEduardo Valentin2013-04-241-1/+2
| | | | | | | | | Limit the amount of bytes written to dev_name by secure writing with snprintf. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: update kernel-doc comment for cpufreq_cooling_unregisterEduardo Valentin2013-04-241-0/+2
| | | | | | | | Update comments for this exported function. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: update kernel-doc for cpufreq_cooling_registerEduardo Valentin2013-04-241-0/+7
| | | | | | | | Add proper documentation for exported function cpufreq_cooling_register. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: update documentation for cpufreq_set_cur_stateEduardo Valentin2013-04-241-0/+5
| | | | | | | | Update documentation for cpufreq_set_cur_state callback. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: update documentation for cpufreq_get_cur_stateEduardo Valentin2013-04-241-0/+5
| | | | | | | | Update documentation for cpufreq_get_cur_state callback. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: update documentation for cpufreq_get_max_stateEduardo Valentin2013-04-241-0/+5
| | | | | | | | Update documentation for cpufreq_get_max_state callback. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: update documentation for cpufreq_thermal_notifierEduardo Valentin2013-04-241-0/+6
| | | | | | | | Update kernel-doc comment and documentation for cpufreq_thermal_notifier. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: update documentation for cpufreq_apply_coolingEduardo Valentin2013-04-241-0/+6
| | | | | | | | Update kernel-doc comments for cpufreq_apply_cooling function. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: improve documentation for get_cpu_frequencyEduardo Valentin2013-04-241-1/+7
| | | | | | | | | Fix kernel-doc warning on get_cpu_frequency and improve documentation comments. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: document cpufreq_get_cooling_levelEduardo Valentin2013-04-241-0/+11
| | | | | | | | | Add documentation for cpufreq_get_cooling_level. As this is an exported function, it has to be documented. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: add documentation for get_propertyEduardo Valentin2013-04-241-3/+11
| | | | | | | | | | As this is one of the central functions of this file, it deserves a proper documentation. This patch improves the existing comment to format it as a kernel-doc style. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: fix kernel doc for is_cpufreq_validEduardo Valentin2013-04-241-1/+7
| | | | | | | | | Update documentation for is_cpufreq_valid function so that kernel-doc does not complain about return value. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: remove compiler warningEduardo Valentin2013-04-241-1/+1
| | | | | | | | | | | level will be used only if GET_FREQ mode is requested. There is no potential harm with current code. But for cleaning the compilation log, this patch initializes level to zero. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: use EXPORT_SYMBOL_GPLEduardo Valentin2013-04-241-4/+3
| | | | | | | | Restrict the usage to GPL modules. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: fix kernel_doc for cpufreq_cooling_deviceEduardo Valentin2013-04-241-3/+3
| | | | | | | | | | Simple fixes for making kernel_doc happy about struct cpufreq_cooling_device. Includes also a minor spelling fix. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: remove unused headersEduardo Valentin2013-04-241-2/+0
| | | | | | | | Remove some unused header files. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal: cpufreq cooling: endian bug in cpufreq_get_max_state()Dan Carpenter2013-04-171-2/+2
| | | | | | | | | This code doesn't work on big endian systems because we're storing low values in the high bits of the unsigned long. It makes it a very high value instead. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Merge branch 'thermal' of ↵Zhang Rui2013-04-151-50/+104
|\ | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux into next Conflicts: drivers/thermal/cpu_cooling.c
| * Thermal: exynos: fix cooling state translationZhang Rui2013-03-261-0/+11
| | | | | | | | | | Signed-off-by: Zhang Rui <rui.zhang@intel.com> Tested-by: Amit Daniel kachhap <amit.daniel@samsung.com>
| * Thermal: cpufreq cooling: fix parsing per_cpu cpufreq_frequency_tableZhang Rui2013-03-261-50/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cpufreq cooling uses different frequencies as different cooling states. But the per_cpu cpufreq_frequency_table may contain duplicate, invalid entries, and it may be in either ascending or descending order. And currently, code for parsing the per_cpu cpufreq_frequency_table is used in several places and inconsistent. Now introduce new code to 1. get the maximum cooling states 2. translate cooling state to cpu frequency 3. translate cpu frequency to cooling state in one place, with the correct logic of handling per_cpu cpufreq_frequency_table. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Tested-by: Amit Daniel kachhap <amit.daniel@samsung.com>
* | drivers: thermal: cpu_cooling: fix checkpatch warningLaurent Navet [Mali]2013-03-261-5/+5
|/ | | | | | | - WARNING: Avoid CamelCase: <maskPtr> Signed-off-by: Laurent Navet <laurent.navet@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Merge branch 'release' of ↵Linus Torvalds2013-03-011-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux Pull thermal management updates from Zhang Rui: "Highlights: - introduction of Dove thermal sensor driver. - introduction of Kirkwood thermal sensor driver. - introduction of intel_powerclamp thermal cooling device driver. - add interrupt and DT support for rcar thermal driver. - add thermal emulation support which allows platform thermal driver to do software/hardware emulation for thermal issues." * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (36 commits) thermal: rcar: remove __devinitconst thermal: return an error on failure to register thermal class Thermal: rename thermal governor Kconfig option to avoid generic naming thermal: exynos: Use the new thermal trend type for quick cooling action. Thermal: exynos: Add support for temperature falling interrupt. Thermal: Dove: Add Themal sensor support for Dove. thermal: Add support for the thermal sensor on Kirkwood SoCs thermal: rcar: add Device Tree support thermal: rcar: remove machine_power_off() from rcar_thermal_notify() thermal: rcar: add interrupt support thermal: rcar: add read/write functions for common/priv data thermal: rcar: multi channel support thermal: rcar: use mutex lock instead of spin lock thermal: rcar: enable CPCTL to use hardware TSC deciding thermal: rcar: use parenthesis on macro Thermal: fix a build warning when CONFIG_THERMAL_EMULATION cleared Thermal: fix a wrong comment thermal: sysfs: Add a new sysfs node emul_temp for thermal emulation PM: intel_powerclamp: off by one in start_power_clamp() thermal: exynos: Miscellaneous fixes to support falling threshold interrupt ...
| * Thermal: fix a wrong commentZhang Rui2013-02-061-2/+2
| | | | | | | | | | | | | | | | | | "level" parameter of get_cpu_frequency equals cooling state of cpu cooling device, and it starts from 0. Fix the misleading comment. Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* | thermal: convert to idr_alloc()Tejun Heo2013-02-281-12/+5
|/ | | | | | | | | Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* thermal: cpu cooling: use const parameter while registeringEduardo Valentin2012-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | There are predefined cpu_masks that are const data structures. This patch changes the cpu cooling register function so that those const cpu_masks can be used, without compilation warnings. include/linux/cpumask.h * The following particular system cpumasks and operations manage * possible, present, active and online cpus. * * cpu_possible_mask- has bit 'cpu' set iff cpu is populatable * cpu_present_mask - has bit 'cpu' set iff cpu is populated * cpu_online_mask - has bit 'cpu' set iff cpu available to scheduler * cpu_active_mask - has bit 'cpu' set iff cpu available to migration * Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: cpu_cooling: Make 'notify_device' staticSachin Kamat2012-11-151-1/+1
| | | | | | | | | | Silences the following sparse warning: drivers/thermal/cpu_cooling.c:67:31: warning: symbol 'notify_device' was not declared. Should it be static? Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal: Remove the cooling_cpufreq_list.hongbo.zhang2012-11-071-72/+19
| | | | | | | | | | | | | Problem of using this list is that the cpufreq_get_max_state callback will be called when register cooling device by thermal_cooling_device_register, but this list isn't ready at this moment. What's more, there is no need to maintain such a list, we can get cpufreq_cooling_device instance by the private thermal_cooling_device.devdata. Signed-off-by: hongbo.zhang <hongbo.zhang@linaro.com> Reviewed-by: Francesco Lavra <francescolavra.fl@gmail.com> Reviewed-by: Amit Daniel Kachhap <amit.kachhap@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal: fix bug of counting cpu frequencies.hongbo.zhang2012-11-071-4/+6
| | | | | | | | | | | | In the while loop for counting cpu frequencies, if table[i].frequency equals CPUFREQ_ENTRY_INVALID, index i won't be increased, so this leads to an endless loop, what's more the index i cannot be referred as cpu frequencies number if there is CPUFREQ_ENTRY_INVALID case. Signed-off-by: hongbo.zhang <hongbo.zhang@linaro.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Amit Daniel Kachhap <amit.kachhap@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal: add indent for code alignment.hongbo.zhang2012-11-071-1/+1
| | | | | | | | The curly bracket should be aligned with corresponding if else statements. Signed-off-by: hongbo.zhang <hongbo.zhang@linaro.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Merge branch 'release' of ↵Len Brown2012-10-091-1/+1
| | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux into thermal Conflicts: drivers/staging/omap-thermal/omap-thermal-common. OMAP supplied dummy TC1 and TC2, at the same time that the thermal tree removed them from thermal_zone_device_register() drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c propogate the upstream MAX_IDR_LEVEL re-name to prevent a build failure Previously-fixed-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Len Brown <len.brown@intel.com>
* Thermal: Fix bug on cpu_cooling, cooling device's id conflict problem.Jonghwa Lee2012-09-271-2/+1
| | | | | | | | | This patch fixes small bug on cpu_cooling. CPU cooling device has own id generated with idr mathod. However in the previous version, it swapped to all same id at last stage of probing as 0. This makes id's collision and also occures error when it releases that id. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>