Commit Graph

361796 Commits (9b19ec39b0a92b13e487033e81257f9989867710)

Author SHA1 Message Date
Eduardo Valentin 9b19ec39b0 thermal: thermal_core: remove usage of IS_ERR_OR_NULL
This patch changes the driver to avoid the usage of IS_ERR_OR_NULL()
macro. This macro can lead to dangerous results, like returning
success (0) during a failure scenario (NULL pointer handling).

The case present in this patch has simply be translated to
normal check for NULL and if the pointer has an error code.
The later case is needed because functions like
thermal_zone_get_zone_by_name() could return an ERR_PTR().

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-27 09:28:25 +08:00
Zhang Rui 07273d25b8 Merge branch 'cpu_cooling-doc-comments-update' of .git into next 2013-04-25 00:57:37 +08:00
Zhang Rui eea2d4812d Merge branch 'thermal_core-doc-comments-update' of .git into next 2013-04-25 00:57:22 +08:00
Eduardo Valentin a00e55f9c8 thermal: update kernel-doc for thermal_zone_device_register
This patch updates the documentation for thermal_zone_device_register
and removes the warnings generated by scripts/kernel-doc -v.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:39 +08:00
Eduardo Valentin 269c174f27 thermal: update kernel-doc for create_trip_attrs
This patch updates the documentation for create_trip_attrs
and removes the warnings generated by scripts/kernel-doc -v.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:35 +08:00
Eduardo Valentin 3a6eccb352 thermal: update kernel-doc for thermal_cooling_device_register
This patch updates the documentation for thermal_cooling_device_register
and removes the warnings generated by scripts/kernel-doc -v.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:32 +08:00
Eduardo Valentin 9892e5dc56 thermal: update kernel-doc for thermal_zone_unbind_cooling_device
This patch updates the documentation for thermal_zone_unbind_cooling_device
and removes the warnings generated by scripts/kernel-doc -v.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:28 +08:00
Eduardo Valentin d2e4eb83e7 thermal: update kernel-doc for thermal_zone_bind_cooling_device
This patch updates the documentation for thermal_zone_bind_cooling_device
and removes the warnings generated by scripts/kernel-doc -v.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:24 +08:00
Eduardo Valentin 910cb1e34d thermal: use EXPORT_SYMBOL_GPL
Restrict usage of GPL modules.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:19 +08:00
Eduardo Valentin 7b73c99377 thermal: rename notify_thermal_framework to thermal_notify_framework
To follow the prefix names used by the thermal functions,
this patch renames notify_thermal_framework to thermal_notify_framework.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:16 +08:00
Eduardo Valentin 6d8d4974a2 thermal: update driver license
As per the comment at the top of this file, this is a GPLv2 driver.
This patch updates the driver license accordingly.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:12 +08:00
Eduardo Valentin c7a8b9d916 thermal: use strlcpy instead of strcpy
For memory boundaries safety, use strlcpy instead of strcpy.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:07 +08:00
Eduardo Valentin e44dec77be thermal: cpu_cooling: remove unused symbols on cpu_cooling.h
Remove defines that are not in used.

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>
2013-04-25 00:34:45 +08:00
Eduardo Valentin 198f38f7fb thermal: cpu_cooling: add needed header for cpu_cooling.h
Update header list for cpu_cooling.h. Missing definition of cpumask.

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>
2013-04-25 00:34:44 +08:00
Eduardo Valentin 67d0b2a826 thermal: cpu_cooling: remove unused symbols
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>
2013-04-25 00:34:44 +08:00
Eduardo Valentin 2d9bf71c12 thermal: cpu_cooling: remove not needed curl brackets
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>
2013-04-25 00:34:43 +08:00
Eduardo Valentin 99871a714b thermal: cpu_cooling: use snprintf instead of sprintf
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>
2013-04-25 00:34:43 +08:00
Eduardo Valentin 135266b4ea thermal: cpu_cooling: update kernel-doc comment for cpufreq_cooling_unregister
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>
2013-04-25 00:34:42 +08:00
Eduardo Valentin 12cb08ba50 thermal: cpu_cooling: update kernel-doc for cpufreq_cooling_register
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>
2013-04-25 00:34:42 +08:00
Eduardo Valentin 56e05fdb6d thermal: cpu_cooling: update documentation for cpufreq_set_cur_state
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>
2013-04-25 00:34:42 +08:00
Eduardo Valentin 3672552dc0 thermal: cpu_cooling: update documentation for cpufreq_get_cur_state
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>
2013-04-25 00:34:41 +08:00
Eduardo Valentin 62c00421b3 thermal: cpu_cooling: update documentation for cpufreq_get_max_state
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>
2013-04-25 00:34:41 +08:00
Eduardo Valentin f7188b3dde thermal: cpu_cooling: update Kconfig entry
There is no support for hotplug or any other means of reducing
temperature. So, this patch removes these references from Kconfig.

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>
2013-04-25 00:34:40 +08:00
Eduardo Valentin bab3055472 thermal: cpu_cooling: update documentation for cpufreq_thermal_notifier
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>
2013-04-25 00:34:40 +08:00
Eduardo Valentin 4b33deb547 thermal: cpu_cooling: update documentation for cpufreq_apply_cooling
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>
2013-04-25 00:34:39 +08:00
Eduardo Valentin 41518c41dd thermal: cpu_cooling: improve documentation for get_cpu_frequency
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>
2013-04-25 00:34:39 +08:00
Eduardo Valentin 44952d338a thermal: cpu_cooling: document cpufreq_get_cooling_level
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>
2013-04-25 00:34:38 +08:00
Eduardo Valentin 2d6f28fedc thermal: cpu_cooling: add documentation for get_property
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>
2013-04-25 00:34:38 +08:00
Eduardo Valentin 82b9ee402f thermal: cpu_cooling: fix kernel doc for is_cpufreq_valid
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>
2013-04-25 00:34:38 +08:00
Eduardo Valentin 4469b99743 thermal: cpu_cooling: remove compiler warning
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>
2013-04-25 00:34:37 +08:00
Eduardo Valentin 243dbd9c60 thermal: cpu_cooling: use EXPORT_SYMBOL_GPL
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>
2013-04-25 00:34:37 +08:00
Eduardo Valentin 3b3c074855 thermal: cpu_cooling: fix kernel_doc for cpufreq_cooling_device
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>
2013-04-25 00:34:36 +08:00
Eduardo Valentin 25c52afe1c thermal: cpu_cooling: remove unused headers
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>
2013-04-25 00:33:58 +08:00
Zhang Rui a502be1873 Merge branch 'exynos-fix' of .git into next 2013-04-25 00:04:06 +08:00
Sachin Kamat b6cee53c19 Thermal: exynos: Add compatible string for exynos4412
Added compatible string for Exynos4412 SoC.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Amit Daniel Kachhap <amit.daniel@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-24 23:37:34 +08:00
Sachin Kamat 2a16279c68 Thermal: exynos: Add clk_{un}prepare APIs
clk_{un}prepare APIs are required to migrate to common
clock framework. While at it convert to use devm_clk_get as
it removes some cleanup code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Amit Daniel Kachhap <amit.daniel@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-24 23:37:19 +08:00
Zhang Rui 335553ce40 Merge branch 'eduardo-1' of .git into next 2013-04-24 21:43:00 +08:00
Dan Carpenter 4f89038f17 Thermal: cpufreq cooling: endian bug in cpufreq_get_max_state()
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>
2013-04-17 23:43:31 +08:00
Eduardo Valentin 837b26bb2e thermal: expose thermal_zone_get_temp API
This patch exports the thermal_zone_get_temp API so that driver
writers can fetch temperature of thermal zones managed by other
drivers.

Acked-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-15 09:39:02 +08:00
Eduardo Valentin 63c4d919cf thermal: introduce thermal_zone_get_zone_by_name helper function
This patch adds a helper function to get a reference of
a thermal zone, based on the zone type name.

It will perform a zone name lookup and return a reference
to a thermal zone device that matches the name requested.
In case the zone is not found or when several zones match
same name or if the required parameters are invalid, it will return
the corresponding error code (ERR_PTR).

Cc: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-15 09:34:28 +08:00
Zhang Rui d13cb03aef Merge branch 'thermal' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux into next
Conflicts:
	drivers/thermal/cpu_cooling.c
2013-04-15 09:26:58 +08:00
Zhang Rui bbf7fc88c7 Thermal: build cpu_cooling code into thermal_sys module
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
2013-04-14 23:28:49 +08:00
Zhang Rui 80a26a5c22 Thermal: build thermal governors into thermal_sys module
The thermal governors are part of the thermal framework,
rather than a seperate feature/module.
Because the generic thermal layer can not work without
thermal governors, and it must load the thermal governors
during its initialization.

Build them into one module in this patch.

This also fix a problem that the generic thermal layer does not
work when CONFIG_THERMAL=m and CONFIG_THERMAL_GOV_XXX=y.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
2013-04-14 23:28:43 +08:00
Zhang Rui 5fc024ab47 Thermal: rename thermal_sys.c to thermal_core.c
this is the preparation work to build all the thermal core framework
source file, like governors, cpu cooling, etc, into one module.

No functional change in this patch.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
2013-04-14 02:14:12 +08:00
Arnd Bergmann 841d481b3c Thermal: exynos: remove unnecessary header inclusions
In multiplatform configurations, we cannot include headers
provided by only the exynos platform. Fortunately a number
of drivers that include those headers do not actually need
them, so we can just remove the inclusions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: linux-pm@vger.kernel.org
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-12 07:24:19 +08:00
Andrew Bresticker e79fe642cc thermal: step_wise: set throttle target within thermal instance limits
When selecting a target cooling state in get_target_state(), make sure
that the state is at least as high as the minimum when the temperature
is rising and at least as low as the maximum when the temperature is
falling.  This is necessary because, in the THREAML_TREND_RAISING and
THERMAL_TREND_DROPPING cases, the current state may only be incremented
or decremented by one even if it is outside the bounds of the thermal
instance.  This might occur, for example, if the CPU is heating up
and hits a thermal trip point for the first time when it's frequency
is much higher than the range specified by the thermal instance
corresponding to the trip point.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-12 07:23:50 +08:00
Eduardo Valentin 8837295a73 thermal: add a warning for temperature emulation feature
Because this feature is for debuging purposes, it is highly
recommended to do not enable this on production systems.
This patch adds warnings for system integrators, so that
people are aware of this potential security issue.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-02 21:34:42 +08:00
Amit Daniel Kachhap bffd1f8ac8 thermal: exynos: Adapt to temperature emulation core thermal framework
This removes the driver specific sysfs support of the temperature
emulation and uses the newly added core thermal framework for thermal
emulation. An exynos platform specific handler is added to support this.

In this patch, the exynos senor(tmu) related code and exynos framework
related (thermal zone, cooling devices) code are intentionally kept separate.
So an emulated function pointer is passed from sensor to framework. This is
beneficial in adding more sensor support using the same framework code
which is an ongoing work. The goal is to finally split them totally. Even
the existing read_temperature also follows the same execution method.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-02 21:29:54 +08:00
Kuninori Morimoto 51d45d2594 thermal: rcar: add pm_runtime_xxx() support
Current rcar_thermal() didn't care about own power.
Without this patch, rcar_thermal doesn't work on APE6 board

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-02 21:18:39 +08:00
Kuninori Morimoto 1dc20828e6 thermal: rcar: tidyup registration failure case
Current rcar_thermal driver didn't care about rcar_theraml_irq_disable()
when registration failure case on _probe(), and _remove().
And, it returns without unregistering thermal zone when
registration failure case on _probe().
This patch fixes these issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-02 21:15:04 +08:00