summaryrefslogtreecommitdiff
path: root/drivers/thermal/samsung
AgeCommit message (Collapse)Author
2020-01-27thermal: exynos: Rename Samsung and Exynos to lowercaseKrzysztof Kozlowski
Fix up inconsistent usage of upper and lowercase letters in "Samsung" and "Exynos" names. "SAMSUNG" and "EXYNOS" are not abbreviations but regular trademarked names. Therefore they should be written with lowercase letters starting with capital letter. The lowercase "Exynos" name is promoted by its manufacturer Samsung Electronics Co., Ltd., in advertisement materials and on website. Although advertisement materials usually use uppercase "SAMSUNG", the lowercase version is used in all legal aspects (e.g. on Wikipedia and in privacy/legal statements on https://www.samsung.com/semiconductor/privacy-global/). Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20200104152107.11407-7-krzk@kernel.org
2020-01-27thermal: samsung: Appease the kernel-doc deityAmit Kucheria
Fix up the following warning when compiled with make W=1: linux.git/drivers/thermal/samsung/exynos_tmu.c:141: warning: bad line: driver linux.git/drivers/thermal/samsung/exynos_tmu.c:203: warning: Function parameter or member 'tzd' not described in 'exynos_tmu_data' linux.git/drivers/thermal/samsung/exynos_tmu.c:203: warning: Function parameter or member 'tmu_set_trip_temp' not described in 'exynos_tmu_data' linux.git/drivers/thermal/samsung/exynos_tmu.c:203: warning: Function parameter or member 'tmu_set_trip_hyst' not described in 'exynos_tmu_data' Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/1ded1697c6e5eff11b034b3302b9c79e88fa9c42.1574242756.git.amit.kucheria@linaro.org
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version 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 you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18thermal: samsung: Fix incorrect check after code mergeMarek Szyprowski
Merge commit 19785cf93b6c ("Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal") broke the code introduced by commit ffe6e16f14fa ("thermal: exynos: Reduce severity of too early temperature read"). Restore the original code from the mentioned commit to finally fix the warning message during boot: thermal thermal_zone0: failed to read out thermal zone (-22) Reported-by: Marian Mihailescu <mihailescu2m@gmail.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Fixes: 19785cf93b6c ("Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal") Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-07-27thermal: samsung: Remove Exynos5440 clock handling left-oversKrzysztof Kozlowski
Commit 8014220d48e7 ("thermal: samsung: Remove support for Exynos5440") removed the Exynos5440 specific part of code for accessing TMU interrupt registers but the surrounding clock handling was left. Clean it up. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-06-12Merge branch 'linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal Pull thermal SoC updates from Zhang Rui: "Thermal SoC management updates: - imx thermal driver now supports i.MX7 thermal sensor (Anson Huang) - exynos thermal driver dropped support for exynos 5440 (Krzysztof Kozlowski) - rcar_thermal now supports r8a77995 (Yoshihiro Kaneko) - rcar_gen3_thermal now supports r8a77965 (Niklas Söderlund) - qcom-spmi-temp-alarm now supports GEN2 PMIC peripherals (David Collins) - uniphier thermal now supports UniPhier PXs3 (Kunihiko Hayashi) - mediatek thermal now supports MT7622 SoC (Sean Wang) - considerable refactoring of exynos driver (Bartlomiej Zolnierkiewicz) - small fixes all over the place on different drivers" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal: (50 commits) thermal: qcom: tsens: Allow number of sensors to come from DT thermal: tegra: soctherm: add const to struct thermal_cooling_device_ops thermal: exynos: Reduce severity of too early temperature read thermal: imx: Switch to SPDX identifier thermal: qcom-spmi-temp-alarm: add support for GEN2 PMIC peripherals thermal: ti-soc-thermal: fix incorrect entry in omap5430_adc_to_temp[] thermal: rcar_thermal: add r8a77995 support dt-bindings: thermal: rcar-thermal: add R8A77995 support thermal: mediatek: use of_device_get_match_data() thermal: exynos: remove trip reporting to user-space thermal: exynos: remove unused defines for Exynos5433 thermal: exynos: cleanup code for enabling threshold interrupts thermal: exynos: check return values of ->get_trip_[temp, hyst] methods thermal: exynos: move trips setting to exynos_tmu_initialize() thermal: exynos: set trips in ascending order in exynos7_tmu_initialize() thermal: exynos: do not use trips structure directly in ->tmu_initialize thermal: exynos: add exynos*_tmu_set_[trip,hyst]() helpers thermal: exynos: move IRQs clearing to exynos_tmu_initialize() thermal: exynos: clear IRQs later in exynos4412_tmu_initialize() thermal: exynos: make ->tmu_initialize method void ...
2018-06-01thermal: exynos: Reduce severity of too early temperature readKrzysztof Kozlowski
Thermal core tries to read temperature during sensor registering in thermal_zone_of_sensor_register(). In that time Exynos TMU driver and hardware are not yet initialized. Commit 0eb875d88aaa ("thermal: exynos: Reading temperature makes sense only when TMU is turned on") added a boolean flag to prevent reading bogus temperature in such case but it exposed warning message during boot: [ 3.864913] thermal thermal_zone0: failed to read out thermal zone (-22) Return EAGAIN in such case to skip omitting such message because it might mislead user. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove trip reporting to user-spaceBartlomiej Zolnierkiewicz
Remove trip reporting to user-space - I'm not aware of any user-space program which relies on it and there is a thermal user-space governor which does it in proper way nowadays. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove unused defines for Exynos5433Bartlomiej Zolnierkiewicz
Remove unused defines for Exynos5433. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: cleanup code for enabling threshold interruptsBartlomiej Zolnierkiewicz
Cleanup code for enabling threshold interrupts in ->tmu_control method implementations. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: check return values of ->get_trip_[temp, hyst] methodsBartlomiej Zolnierkiewicz
Check return values of ->get_trip_[temp,hyst] methods in exynos_tmu_initialize(). Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: move trips setting to exynos_tmu_initialize()Bartlomiej Zolnierkiewicz
* Add dummy exynos4210_tmu_set_trip_hyst() helper. * Add ->tmu_set_trip_temp and ->tmu_set_trip_hyst methods to struct exynos_tmu_data and set them in exynos_map_dt_data(). * Move trips setting to exynos_tmu_initialize(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: set trips in ascending order in exynos7_tmu_initialize()Bartlomiej Zolnierkiewicz
Set trips in ascending order in exynos7_tmu_initialize() (it should make no difference in driver operation). This prepares the driver code to moving trips setting from ->tmu_initialize method to exynos_tmu_initialize(). Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: do not use trips structure directly in ->tmu_initializeBartlomiej Zolnierkiewicz
Use ->get_trip_[temp,hyst] methods instead of using trips structure directly in all ->tmu_initialize method implementations. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: add exynos*_tmu_set_[trip,hyst]() helpersBartlomiej Zolnierkiewicz
Add exynos*_tmu_set_[trip,hyst]() helpers and convert all ->tmu_initialize implementations accordingly. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: move IRQs clearing to exynos_tmu_initialize()Bartlomiej Zolnierkiewicz
Move ->tmu_clear_irqs call from ->tmu_initialize method to exynos_tmu_initialize(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: clear IRQs later in exynos4412_tmu_initialize()Bartlomiej Zolnierkiewicz
Clear IRQs after enabling thermal tripping (it should make no difference in driver operation). This prepares the driver code to moving IRQs clearing call from ->tmu_initialize method to exynos_tmu_initialize(). Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: make ->tmu_initialize method voidBartlomiej Zolnierkiewicz
All implementations of ->tmu_initialize always return 0 so make the method void and convert all implementations accordingly. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove threshold_code checking from exynos4210_tmu_initialize()Bartlomiej Zolnierkiewicz
On Exynos4210 one-point trimming is always used and data->temp_error1 is equal to 75. Therefore temp_to_code() will never return negative value for the reference temperature conversion. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: fix trips limit checking in get_th_reg()Bartlomiej Zolnierkiewicz
of_thermal_get_ntrips() may return value bigger than supported by a given SoC (i.e. on Exynos5422/5800) so fix the code to not iterate the loop for i values >= data->ntrip. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: use sanitize_temp_error() in exynos7_tmu_initialize()Bartlomiej Zolnierkiewicz
Fix sanitize_temp_error() to handle Exynos7 SoCs and then use it in exynos7_tmu_initialize(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: check STATUS register in exynos_tmu_initialize()Bartlomiej Zolnierkiewicz
STATUS register is present on all SoCs so move its checking into exynos_tmu_initialize(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: always check for critical trip points existenceBartlomiej Zolnierkiewicz
* Check for critical trip point existence in exynos_tmu_initialize() so it is checked on all SoCs (except Exynos5433 for now). * Use dev_err() instead of pr_err(). * Fix dev_err() to reference "device tree" not "of-thermal.c". * Remove no longer needed check from exynos4412_tmu_initialize(). Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: always check for trips points existenceBartlomiej Zolnierkiewicz
* Check for trip points existence in exynos_tmu_initialize() so it is checked on all SoCs. * Use dev_err() instead of pr_err(). * Fix dev_err() to reference "device tree" not "of-thermal.c". * Remove no longer needed checks from exynos4210_tmu_initialize() and get_th_reg(). Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: fix setting rising_threshold for Exynos5433Bartlomiej Zolnierkiewicz
Add missing clearing of the previous value when setting rising temperature threshold. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: samsung: Remove support for Exynos5440Krzysztof Kozlowski
The Exynos5440 is not actively developed, there are no development boards available and probably there are no real products with it. Remove wide-tree support for Exynos5440. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> [b.zolnierkie: ported over driver changes] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove separate exynos_tmu.h header fileBartlomiej Zolnierkiewicz
exynos_tmu.h is used only by exynos_tmu.c so there is no need for a separate include file. Also while at it remove no longer needed cpu_cooling.h include. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove parsing of samsung, tmu_cal_type propertyBartlomiej Zolnierkiewicz
Since calibration type for temperature is SoC (not platform) specific just move it from platform data to struct exynos_tmu_data instance. Then remove parsing of samsung,tmu_cal_type property. Also remove no longer needed platform data structure. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove parsing of samsung,tmu_gain propertyBartlomiej Zolnierkiewicz
Since pdata gain values are SoC (not platform) specific just move it from platform data to struct exynos_tmu_data instance. Then remove parsing of samsung,tmu_gain property. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove parsing of samsung, tmu_reference_voltage propertyBartlomiej Zolnierkiewicz
Since pdata reference_voltage values are SoC (not platform) specific just move it from platform data to struct exynos_tmu_data instance. Then remove parsing of samsung,tmu_reference_voltage property. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove parsing of samsung, tmu[_min, _max]_efuse_value ↵Bartlomiej Zolnierkiewicz
properties Since pdata efuse values are SoC (not platform) specific just move them from platform data to struct exynos_tmu_data instance. Then remove parsing of samsung,tmu[_,min_,max]_efuse_value properties. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove parsing of samsung, tmu_noise_cancel_mode propertyBartlomiej Zolnierkiewicz
All SoCs use the same value (4) for the noise cancel mode so just make it explicit and remove parsing of samsung,tmu_noise_cancel_mode property. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove parsing of samsung, tmu_[first, second]_point_trim ↵Bartlomiej Zolnierkiewicz
properties All SoCs use the same values (25, 85) for trim points (except Exynos5440 which currently specifices value 70 for the second trim point -> it seems to be a mistake because documentation uses value 85 and two points based trimming has never been used by the driver for this SoC anyway) so just make it explicit and remove parsing of samsung,tmu_[first,second]_point_trim properties. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove parsing of samsung, tmu_default_temp_offset propertyBartlomiej Zolnierkiewicz
Trimming (one point based or two points based) is always used for the temperature calibration and the default non-trimming code is never reached. Remove it and then remove no longer needed parsing of samsung,tmu_default_temp_offset property. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: remove unused "type" field from struct exynos_tmu_platform_dataBartlomiej Zolnierkiewicz
Remove unused "type" field from struct exynos_tmu_platform_data. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: Read soc_type from match dataMaciej Purski
Device context's field data->soc is currently obtained by comparing of_compatible's. Provide soc_type as .data field in device's match table, as it is done in most drivers. Signed-off-by: Maciej Purski <m.purski@samsung.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: Propagate error value from tmu_read()Marek Szyprowski
tmu_read() in case of Exynos4210 might return error for out of bound values. Current code ignores such value, what leads to reporting critical temperature value. Add proper error code propagation to exynos_get_temp() function. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> CC: stable@vger.kernel.org # v4.6+ Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-05-06thermal: exynos: Reading temperature makes sense only when TMU is turned onMarek Szyprowski
When thermal sensor is not yet enabled, reading temperature might return random value. This might even result in stopping system booting when such temperature is higher than the critical value. Fix this by checking if TMU has been actually enabled before reading the temperature. This change fixes booting of Exynos4210-based board with TMU enabled (for example Samsung Trats board), which was broken since v4.4 kernel release. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Fixes: 9e4249b40340 ("thermal: exynos: Fix first temperature read after registering sensor") CC: stable@vger.kernel.org # v4.6+ Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-04-27thermal: exynos: Propagate error value from tmu_read()Marek Szyprowski
tmu_read() in case of Exynos4210 might return error for out of bound values. Current code ignores such value, what leads to reporting critical temperature value. Add proper error code propagation to exynos_get_temp() function. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> CC: stable@vger.kernel.org # v4.6+ Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-04-27thermal: exynos: Reading temperature makes sense only when TMU is turned onMarek Szyprowski
When thermal sensor is not yet enabled, reading temperature might return random value. This might even result in stopping system booting when such temperature is higher than the critical value. Fix this by checking if TMU has been actually enabled before reading the temperature. This change fixes booting of Exynos4210-based board with TMU enabled (for example Samsung Trats board), which was broken since v4.4 kernel release. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Fixes: 9e4249b40340 ("thermal: exynos: Fix first temperature read after registering sensor") CC: stable@vger.kernel.org # v4.6+ Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2017-08-11thermal: exynos: constify thermal_zone_of_device_ops structuresJulia Lawall
The thermal_zone_of_device_ops structure is only passed as the fourth argument to thermal_zone_of_sensor_register, which is declared as const. Thus the thermal_zone_of_device_ops structure itself can be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2017-02-18thermal: exynos: Remove parsing unused samsung,tmu_cal_mode propertyKrzysztof Kozlowski
The property samsung,tmu_cal_mode is not used and not used. We can safely remove it. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2016-09-27thermal: Enhance thermal_zone_device_update for eventsSrinivas Pandruvada
Added one additional parameter to thermal_zone_device_update() to provide caller with an optional capability to specify reason. Currently this event is used by user space governor to trigger different processing based on event code. Also it saves an additional call to read temperature when the event is received. The following events are cuurently defined: - Unspecified event - New temperature sample - Trip point violated - Trip point changed - thermal device up and down - thermal device power capability changed Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-03-08thermal: exynos: Defer probe if vtmu is present but not registeredJavier Martinez Canillas
The driver doesn't check if the regulator_get_optional return value is -EPROBE_DEFER so it will wrongly assume that the regulator couldn't be found just because the regulator driver wasn't registered yet, i.e: exynos-tmu 10060000.tmu: Regulator node (vtmu) not found In this case the return value should be propagated to allow the driver probe function to be deferred until the regulator driver is registered. Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2016-03-08thermal: exynos: Use devm_regulator_get_optional() for vtmuJavier Martinez Canillas
The Exynos TMU DT binding says that the vtmu-supply is optional but the driver uses devm_regulator_get() that creates a dummy regulator if it's not defined in the DT. For example the following message is in the log: 10060000.tmu supply vtmu not found, using dummy regulator Use the optional version of regulator_get() that doesn't create a dummy regulator and instead returns a -ENODEV errno code. Since it's expected that a regulator may not be defined and the driver will inform about it: exynos-tmu 10060000.tmu: Regulator node (vtmu) not found Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2016-03-08thermal: exynos: Print a message about exceeded number of supported trip-pointsKrzysztof Kozlowski
When DeviveTree contains more trip-points than SoC can configure (usually more than four) and polling mode is not enabled, then the remaining trip-points will be silently ignored. No interrupts will be generated for them. This might be quite dangerous when one provides DTB with a non-configurable critical trip-point, like (assuming four supported thresholds in TMU): - alert @50 C (type: active), - alert @60 C (type: active), - alert @70 C (type: active), - alert @80 C (type: active), - critical @120 C (type: critical) <- no interrupts generated. This is a mistake in DTB so print a message in such case. Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2016-03-08thermal: Fix build error of missing devm_ioremap_resource on UMKrzysztof Kozlowski
The devres.o gets linked if HAS_IOMEM is present so on ARCH=um allyesconfig (COMPILE_TEST) failed on many files with: drivers/built-in.o: In function `kirkwood_thermal_probe': kirkwood_thermal.c:(.text+0x390a25): undefined reference to `devm_ioremap_resource' drivers/built-in.o: In function `exynos_tmu_probe': exynos_tmu.c:(.text+0x39246b): undefined reference to `devm_ioremap' The users of devm_ioremap_resource() which are compile-testable should depend on HAS_IOMEM. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-11-11Merge branch 'next' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 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 Kozlowski
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>