aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/samsung (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-11-11Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linuxLinus Torvalds1-30/+38
Pull thermal updates from Zhang Rui: - Implement generic devfreq cooling mechanism through frequency reduction for devices using devfreq. From Ørjan Eide and Javi Merino. - Introduce OMAP3 support on TI SoC thermal driver. From Pavel Mack and Eduardo Valentin. - A bounch of small fixes on devfreq_cooling, Exynos, IMX, Armada, and Rockchip thermal drivers. * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (24 commits) thermal: exynos: Directly return 0 instead of using local ret variable thermal: exynos: Remove unneeded semicolon thermal: exynos: Use IS_ERR() because regulator cannot be NULL thermal: exynos: Fix first temperature read after registering sensor thermal: exynos: Fix unbalanced regulator disable on probe failure devfreq_cooling: return on allocation failure thermal: rockchip: support the sleep pinctrl state to avoid glitches in s2r dt-bindings: rockchip-thermal: Add the pinctrl states in this document thermal: devfreq_cooling: Make power a u64 thermal: devfreq_cooling: use a thermal_cooling_device for register and unregister thermal: underflow bug in imx_set_trip_temp() thermal: armada: Fix possible overflow in the Armada 380 thermal sensor formula thermal: imx: register irq handler later in probe thermal: rockhip: fix setting thermal shutdown polarity thermal: rockchip: fix handling of invalid readings devfreq_cooling: add trace information thermal: Add devfreq cooling PM / OPP: get the voltage for all OPPs tools/thermal: tmon: use pkg-config also for CFLAGS linux/thermal.h: rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS ...
2015-11-04thermal: exynos: Directly return 0 instead of using local ret variableKrzysztof Kozlowski1-2/+3
The 'ret' variable in exynos5440_tmu_initialize() is initialized to 0 and returned as is. Replace it with direct return statement. This also fixes coccinelle warning: drivers/thermal/samsung/exynos_tmu.c:611:5-8: Unneeded variable: "ret". Return "0" on line 654 Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-11-04thermal: exynos: Remove unneeded semicolonKrzysztof Kozlowski1-2/+2
Remove semicolons after switch statement. Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-11-04thermal: exynos: Use IS_ERR() because regulator cannot be NULLKrzysztof Kozlowski1-1/+1
The NULL check in probe's error path is not needed because in that time the regulator cannot be NULL (regulator_get() returns valid pointer or ERR_PTR). Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-11-04thermal: exynos: Fix first temperature read after registering sensorKrzysztof Kozlowski1-10/+17
Thermal core could not read the temperature after registering the thermal sensor with thermal_zone_of_sensor_register() because the driver was not yet initialized. The call trace looked like: exynos_tmu_probe() thermal_zone_of_sensor_register() of_thermal_set_mode() thermal_zone_device_update() exynos_get_temp() if (!data->tmu_read) return -EINVAL; exynos_map_dt_data() data->tmu_read = ... This produced an error in dmesg: thermal thermal_zone0: failed to read out thermal zone (-22) Register the thermal_zone_device later, after parsing Device Tree and enabling necessary clocks, but before calling exynos_tmu_initialize() which uses the registered thermal_zone_device. Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Tested-by: Alim Akhtar <alim.akhtar@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: 3b6a1a805f34 ("thermal: samsung: core: Exynos TMU rework to use device tree for configuration") Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-11-04thermal: exynos: Fix unbalanced regulator disable on probe failureKrzysztof Kozlowski1-17/+17
During probe if the regulator could not be enabled, the error exit path would still disable it. This could lead to unbalanced counter of regulator enable/disable. The patch moves code for getting and enabling the regulator from exynos_map_dt_data() to probe function because it is really not a part of getting Device Tree properties. Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure") Cc: <stable@vger.kernel.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-10-17thermal: exynos: Fix register read in TMUSudip Mukherjee1-1/+1
The value of emul_con was getting overwritten if the selected soc is SOC_ARCH_EXYNOS5260. And so as a result we were reading from the wrong register in the case of SOC_ARCH_EXYNOS5260. Fixes: 488c7455d74c ("thermal: exynos: Add the support for Exynos5433 TMU") Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Kukjin Kim <kgene@kernel.org>
2015-09-02Merge branches 'thermal-core' and 'thermal-intel' of .git into nextZhang Rui1-12/+11
2015-08-03thermal: consistently use int for temperaturesSascha Hauer1-12/+11
The thermal code uses int, long and unsigned long for temperatures in different places. Using an unsigned type limits the thermal framework to positive temperatures without need. Also several drivers currently will report temperatures near UINT_MAX for temperatures below 0°C. This will probably immediately shut the machine down due to overtemperature if started below 0°C. 'long' is 64bit on several architectures. This is not needed since INT_MAX °mC is above the melting point of all known materials. Consistently use a plain 'int' for temperatures throughout the thermal code and the drivers. This only changes the places in the drivers where the temperature is passed around as pointer, when drivers internally use another type this is not changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Reviewed-by: Darren Hart <dvhart@linux.intel.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Peter Feuerer <peter@piie.net> Cc: Punit Agrawal <punit.agrawal@arm.com> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Jean Delvare <jdelvare@suse.de> Cc: Peter Feuerer <peter@piie.net> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Stephen Warren <swarren@wwwdotorg.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: linux-acpi@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org Cc: Guenter Roeck <linux@roeck-us.net> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Darren Hart <dvhart@infradead.org> Cc: lm-sensors@lm-sensors.org Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-08-02thermal: exynos: Remove unused code related to platform_data on probe()Chanwoo Choi1-3/+0
This patch removes the unused code related to struct exynos_tmu_platform_data because exynos_tmu_probe() don't handle the struct exynos_tmu_platform_data *pdata. Test HW: Exynos4412 - Trats2 board Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-08-02thermal: exynos: Add the dependency of CONFIG_THERMAL_OF instead of CONFIG_OFChanwoo Choi1-1/+1
The exynos thermal driver use the of_thermal_*() API to parse the basic data for thermal management from devicetree file. So, if CONFIG_EXYNOS_THERMAL is selected without CONFIG_THERMAL_OF, kernel can build it without any problem. But, exynos thermal driver is not working with following error log. This patch add the dependency of CONFIG_THERMAL_OF instead of CONFIG_OF. [ 1.458644] get_th_reg: Cannot get trip points from of-thermal.c! [ 1.459096] get_th_reg: Cannot get trip points from of-thermal.c! [ 1.465211] exynos4412_tmu_initialize: No CRITICAL trip point defined at of-thermal.c! Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-08-02thermal: exynos: Disable the regulator on probe failureKrzysztof Kozlowski1-0/+2
During probe the regulator (if present) was enabled but not disabled in case of failure. So an unsuccessful probe lead to enabling the regulator which was actually not needed because the device was not enabled. Additionally each deferred probe lead to increase of regulator enable count so it would not be effectively disabled during removal of the device. Test HW: Exynos4412 - Trats2 board Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: 498d22f616f6 ("thermal: exynos: Support for TMU regulator defined at device tree") Cc: <stable@vger.kernel.org> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-05-04thermal: exynos: Add the support for Exynos5433 TMUChanwoo Choi2-2/+186
This patch adds the support for Exynos5433's TMU (Thermal Management Unit). Exynos5433 has a little different register bit fields as following description: - Support the eight trip points for rising/falling interrupt by using two registers - Read the calibration type (1-point or 2-point) and sensor id from TRIMINFO register - Use a little different register address Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-03-02thermal: exynos: Fix wrong control of power down detection mode for Exynos7Chanwoo Choi1-1/+2
This patch fixes the wrong control of PD_DET_EN (power down detection mode) for Exynos7 because exynos7_tmu_control() always enables the power down detection mode regardless 'on' parameter. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Tested-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
2015-02-24thermal: exynos: Clean-up code to use oneline entry for exynos compatible tableChanwoo Choi1-28/+10
This patch cleanup the code to use oneline for entry of exynos compatible table. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-02-20thermal: exynos: fix: Check if data->tmu_read callback is present before readLukasz Majewski1-1/+1
The exynos_tmu_data() function should on entrance test not only for valid data pointer, but also for data->tmu_read one. It is important, since afterwards it is dereferenced to get temperature code. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-01-31thermal: exynos: Add TMU support for Exynos7 SoCAbhilash Kesavan2-8/+198
Add registers, bit fields and compatible strings for Exynos7 TMU (Thermal Management Unit). Following are a few of the differences in the Exynos7 TMU from earlier SoCs: - 8 trigger levels - Different bit offsets and more registers for the rising and falling thresholds. - New power down detection bit in the TMU_CONTROL register which does not update the CURRENT_TEMP0 when tmu power down is detected. - Change in bit offset for the NEXT_DATA field of EMUL_CON register. EMUL_CON register address has also changed. - INTSTAT and INTCLEAR registers present in earlier SoCs have been combined into one INTPEND register. The register address for INTCLEAR and INTPEND is also different. - Since there are 8 rising/falling interrupts as against at most 4 in earlier SoCs the INTEN bit offsets are different. - Multiple probe support which is handled by a TMU_CONTROL1 register (No support for this in the current patch). This patch adds special clock support required only for Exynos7. It also updates the "code_to_temp" prototype as Exynos7 has 9 bit code-temp mapping. Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-01-28thermal: exynos: Correct sanity check at exynos_report_trigger() functionLukasz Majewski1-2/+2
Up till now, by mistake, wrong variable was tested against being NULL. Since exynos_report_trigger() is always called with valid p pointer, it is only necessary to check if a valid thermal zone device is passed. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-01-27thermal: Kconfig: Remove config for not used EXYNOS_THERMAL_CORELukasz Majewski1-9/+0
After removing exynos_thermal_common.[c|h] files the CONFIG_EXYNOS_THERMA_CORE is not needed anymore. This patch removes this entry from Kconfig. Reported-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-01-26thermal: exynos: Remove exynos_tmu_data.c fileLukasz Majewski1-228/+0
Data already present in the exynos_tmu_data.c file has been moved to the appropriate device tree files. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-01-24thermal: exynos: Remove exynos_thermal_common.[c|h] filesLukasz Majewski2-551/+0
After defining all necessary Exynos data in the device tree and heavy reusage of the of-thermal.c those files can be removed. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-01-24thermal: samsung: core: Exynos TMU rework to use device tree for configurationLukasz Majewski3-182/+220
This patch brings support for providing configuration via device tree. Previously this data has been hardcoded in the exynos_tmu_data.c file. Such approach was not scalable and very often required copying the whole data. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-01-24thermal: exynos: Modify exynos thermal code to use device tree for cpu cooling configurationLukasz Majewski4-103/+73
Up till now exynos_tmu_data.c was used for storing CPU cooling configuration data. Now the Exynos thermal core code uses device tree to get this data. For this purpose generic thermal code for configuring CPU cooling was used. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-01-24thermal: exynos: Provide thermal_exynos.h file to be included in device tree filesLukasz Majewski1-9/+3
This patch is a preparatory patch to be able to read Exynos thermal configuration from the device tree. It turned out that DTC is not able to interpret enums properly and hence it is necessary to #define those values explicitly. For this reason the ./include/dt-bindings/thermal/thermal_exynos.h file has been introduced. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-01-24thermal: exynos: cosmetic: Correct comment formatLukasz Majewski1-1/+1
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-12-21Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal into thermal-socZhang Rui3-8/+11
2014-12-17Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linuxLinus Torvalds5-729/+485
Pull thermal management update from Zhang Rui: "Summary: - of-thermal extension to allow drivers to register and use its functionality in a better way, without exploiting thermal core. From Lukasz Majewski. - Fix a bug in intel_soc_dts_thermal driver which calls a sleep function in interrupt handler. From Maurice Petallo. - add a thermal UAPI header file for exporting the thermal generic netlink information to user-space. From Florian Fainelli. - First round of refactoring in Exynos driver. Bartlomiej and Lukasz are attempting to make it lean and easier to understand. - New thermal driver for Rockchip (rk3288), with support for DT thermal. From Caesar Wang. - New thermal driver for Nvidia, Tegra124 SOCTHERM driver, with support for DT thermal. From Mikko Perttunen. - New cooling device, based on common clock framework. From Eduardo Valentin. - a couple of small fixes in thermal core framework. From Srinivas Pandruvada, Javi Merino, Luis Henriques. - Dropping Armada A375-Z1 SoC thermal support as the chip is not in the market, armada folks decided to drop its support. - a couple of small fixes and cleanups in int340x thermal driver" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (58 commits) thermal: provide an UAPI header file Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call thermal/powerclamp: add id for braswell cpu thermal: Intel SoC DTS: Don't do thermal zone update inside spin_lock Thermal: fix platform_no_drv_owner.cocci warnings Thermal/int340x: avoid unnecessary pointer casting thermal: int3403: Delete a check before thermal_zone_device_unregister() thermal/int3400: export uuids thermal: of: Extend current of-thermal.c code to allow setting emulated temp thermal: of: Extend of-thermal to export table of trip points thermal: of: Rename struct __thermal_trip to struct thermal_trip thermal: of: Extend of-thermal.c to provide check if trip point is valid thermal: of: Extend of-thermal.c to provide number of trip points thermal: Fix error path in thermal_init() thermal: lock the thermal zone when switching governors thermal: core: ignore invalid trip temperature thermal: armada: Remove support for A375-Z1 SoC thermal: rockchip: add driver for thermal dt-bindings: document Rockchip thermal thermal: exynos: remove exynos_tmu_data.h include ...
2014-12-14Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-coreLinus Torvalds1-1/+0
Pull driver core update from Greg KH: "Here's the set of driver core patches for 3.19-rc1. They are dominated by the removal of the .owner field in platform drivers. They touch a lot of files, but they are "simple" changes, just removing a line in a structure. Other than that, a few minor driver core and debugfs changes. There are some ath9k patches coming in through this tree that have been acked by the wireless maintainers as they relied on the debugfs changes. Everything has been in linux-next for a while" * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits) Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries" fs: debugfs: add forward declaration for struct device type firmware class: Deletion of an unnecessary check before the function call "vunmap" firmware loader: fix hung task warning dump devcoredump: provide a one-way disable function device: Add dev_<level>_once variants ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries ath: use seq_file api for ath9k debugfs files debugfs: add helper function to create device related seq_file drivers/base: cacheinfo: remove noisy error boot message Revert "core: platform: add warning if driver has no owner" drivers: base: support cpu cache information interface to userspace via sysfs drivers: base: add cpu_device_create to support per-cpu devices topology: replace custom attribute macros with standard DEVICE_ATTR* cpumask: factor out show_cpumap into separate helper function driver core: Fix unbalanced device reference in drivers_probe driver core: fix race with userland in device_add() sysfs/kernfs: make read requests on pre-alloc files use the buffer. sysfs/kernfs: allow attributes to request write buffer be pre-allocated. fs: sysfs: return EGBIG on write if offset is larger than file size ...
2014-12-10drivers: thermal: Remove ARCH_HAS_BANDGAP dependency for samsungAbhilash Kesavan1-1/+1
As samsung thermal support is enabled only for ARCH_EXYNOS, there is no need to select ARCH_HAS_BANDGAP from the arch-specific code. Removing this dependency will also allow the driver to be enabled on 64-bit SoCs. Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-12-09Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal into eduardo-soc-thermalZhang Rui5-729/+485
2014-12-08thermal: exynos: pass cpu_present_mask to cpufreq_cooling_register()Viresh Kumar1-3/+1
cpufreq_cooling_register() expects mask of all the CPUs where frequency constraint is applicable. This platform has more than one CPU to which these constraints will apply and so passing mask of only CPU0 wouldn't be sufficient. Also, this platform has a single cluster of CPUs and the constraint applies to all CPUs. If CPU0 is hoplugged out then we may face strange BUGs as cpu_cooling framework isn't aware of any siblings sharing clock line. Fix it by passing cpu_present_mask to cpufreq_cooling_register(). Cc: Chanwoo Choi <cw00.choi@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-12-08thermal: cpu_cooling: check for the readiness of cpufreq layerEduardo Valentin2-4/+9
In this patch, the cpu_cooling code checks for the usability of cpufreq layer before proceeding with the CPU cooling device registration. The main reason is: CPU cooling device is not usable if cpufreq cannot switch frequencies. Similar checks are spread in thermal drivers. Thus, the advantage now is to have the check in a single place: cpu cooling device registration. For this reason, this patch also updates the existing drivers that depend on CPU cooling to simply propagate the error code of the cpu cooling registration call. Therefore, in case cpufreq is not ready, the thermal drivers will still return -EPROBE_DEFER, in an attempt to try again when cpufreq layer gets ready. Cc: devicetree@vger.kernel.org Cc: Grant Likely <grant.likely@linaro.org> Cc: Kukjin Kim <kgene.kim@samsung.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Zhang Rui <rui.zhang@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-21thermal: Exynos: Deletion of unnecessary checks before two function callsMarkus Elfring1-6/+3
The functions cpufreq_cooling_unregister() and thermal_zone_device_unregister() test whether their argument is NULL and then return immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: remove exynos_tmu_data.h includeBartlomiej Zolnierkiewicz4-117/+89
There is no longer need to share defines between exynos_tmu.c and exynos_tmu_data.c (as they are now only used by the former file) so move them accordingly. Then move externs for struct exynos_tmu_init_data instances to exynos_tmu.h and remove no longer needed exynos_tmu_data.h include. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: remove __EXYNOS5420_TMU_DATA macroBartlomiej Zolnierkiewicz1-38/+2
__EXYNOS5420_TMU_DATA macro is now identical to __EXYNOS5260_TMU_DATA one and can be removed. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: remove SoC type ifdefsBartlomiej Zolnierkiewicz3-67/+8
Maximum theoretical size saving (i.e. with only Exynos5410 SoC support enabled in kernel config so all SoC dependend Exynos thermal driver code was dropped) is 4096 bytes so there is no much sense in keeping these ifdefs (especially given that they are useless once the driver gets updated to use device tree). While at it remove needless 'void *' casts. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: remove test_mux pdata fieldBartlomiej Zolnierkiewicz3-6/+3
Replace pdata->test_mux check in get_con_reg() by explicitly checking for SoC type. Also since the used pdata->test_mux value is always identical use it directly and remove pdata->test_mux completely. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: remove TMU_SUPPORT_MULTI_INST flagBartlomiej Zolnierkiewicz2-15/+1
Remove unused TMU_SUPPORT_MULTI_INST flag, no longer needed TMU_SUPPORTS() macro and features field from struct exynos_tmu_platform_data. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: remove TMU_SUPPORT_ADDRESS_MULTIPLE flagBartlomiej Zolnierkiewicz3-42/+38
Replace TMU_SUPPORT_ADDRESS_MULTIPLE flag check in exynos_map_dt_data() by an explicit check for a SoC type (only Exynos5420 with TRIMINFO quirk and Exynos5440 have TMU_SUPPORT_ADDRESS_MULTIPLE flag set in their struct exynos_tmu_init_data instances). Please note that this requires moving SoC type assignment and verification from exynos_tmu_probe() to exynos_map_dt_data() so it happens earlier (which is a good thing in itself). There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: remove TMU_SUPPORT_EMULATION flagBartlomiej Zolnierkiewicz3-17/+9
Replace TMU_SUPPORT_EMULATION flag check in exynos_tmu_set_emulation() by an explicit check for a SoC type (all SoC types except Exynos4210 have TMU_SUPPORT_EMULATION flag set in their struct exynos_tmu_init_data instances). There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: remove TMU_SUPPORT_EMUL_TIME flagBartlomiej Zolnierkiewicz3-13/+7
Replace TMU_SUPPORT_EMUL_TIME flag check in get_emul_con_reg() by an explicit check for a SoC type (all SoC types except Exynos4210 and Exynos5440 have TMU_SUPPORT_EMUL_TIME flag set in their struct exynos_tmu_init_data instances). There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: remove TMU_SUPPORT_FALLING_TRIP flagBartlomiej Zolnierkiewicz3-21/+12
Replace TMU_SUPPORT_FALLING_TRIP flag check in exynos[4210,5440]_tmu_control() by an explicit check for a SoC type (all SoC types except Exynos4210 have TMU_SUPPORT_FALLING_TRIP flag set in their struct exynos_tmu_init_data instances). There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: add ->tmu_clear_irqs methodBartlomiej Zolnierkiewicz3-71/+43
Add ->tmu_clear_irqs method to struct exynos_tmu_data and use it instead exynos_tmu_clear_irqs(). Then add ->tmu_clear_irqs implementations for Exynos4210+ and Exynos5440. Finally remove no longer needed reg->tmu_int[stat,clear] abstractions and struct exynos_tmu_registers instances. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: add ->tmu_set_emulation methodBartlomiej Zolnierkiewicz3-14/+34
Add ->tmu_set_emulation method to struct exynos_tmu_data and use it in exynos_tmu_set_emulation(). Then add ->tmu_set_emulation implementations for Exynos4412+ and Exynos5440. Finally remove no longer needed reg->emul_con abstraction. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: add get_emul_con_reg() helperBartlomiej Zolnierkiewicz1-15/+23
Factor out code for preparing EMUL_CON register value from exynos_tmu_set_emulation() into get_emul_con_reg(). This is a preparation for introducing per-SoC type tmu_set_emulation method. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: add ->tmu_read methodBartlomiej Zolnierkiewicz3-25/+28
Add ->tmu_read method to struct exynos_tmu_data and use it in exynos_tmu_control(). Then add ->tmu_read implementations for Exynos4210, Exynos4412+ and Exynos5440. Finally remove no longer needed reg->tmu_cur_temp abstractions. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: add ->tmu_control methodBartlomiej Zolnierkiewicz3-87/+60
Add ->tmu_control method to struct exynos_tmu_data and use it in exynos_tmu_control(). Then add ->tmu_control implementations for Exynos4210+ and Exynos5440. Finally remove no longer needed reg->tmu_[ctrl,inten], reg->inten_rise[0,1,2,3]_shift and reg->inten_fall0_shift abstractions. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: add get_con_reg() helperBartlomiej Zolnierkiewicz1-9/+16
Factor out code for preparing TMU_CONTROL register value from exynos_tmu_control() into get_con_reg(). This is a preparation for introducing per-SoC type tmu_control method. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: add ->tmu_initialize methodBartlomiej Zolnierkiewicz3-133/+159
Add ->tmu_initialize method to struct exynos_tmu_data and use it in exynos_tmu_initialize(). Then add ->tmu_initialize implementations for Exynos4210, Exynos4412+ and Exynos5440. Finally remove no longer needed reg->threshold_th[0,1], reg->intclr_[fall,rise]_shift and reg->intclr_[rise,fall]_mask abstractions. There are more improvements available in the future on top of this patch like merging HW_TRIP level setting with setting of other levels for Exynos4412+ or adding separate method for clearing IRQs using INTCLEAR register (for Exynos5420, Exynos5260 and Exynos4412+). There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-11-20thermal: exynos: add get_th_reg() helperBartlomiej Zolnierkiewicz1-14/+23
Factor out code for preparing threshold register value from exynos_tmu_initialize() into get_th_reg(). This is a preparation for introducing per-SoC type tmu_initialize method. There should be no functional changes caused by this patch. Cc: Amit Daniel Kachhap <amit.daniel@samsung.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>