aboutsummaryrefslogtreecommitdiff
path: root/drivers/thermal
AgeCommit message (Collapse)Author
2018-12-22treewide: surround Kconfig file paths with double quotesMasahiro Yamada
The Kconfig lexer supports special characters such as '.' and '/' in the parameter context. In my understanding, the reason is just to support bare file paths in the source statement. I do not see a good reason to complicate Kconfig for the room of ambiguity. The majority of code already surrounds file paths with double quotes, and it makes sense since file paths are constant string literals. Make it treewide consistent now. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Ingo Molnar <mingo@kernel.org>
2018-12-10thermal: stm32: Fix stm_thermal_read_factory_settingsDavid HERNANDEZ SANCHEZ
Adding brackets allows to multiply the register value, masked by TS1_RAMP_COEFF_MASK, by an ADJUST value properly and not to multiply ADJUST by register value and then mask the whole. Fixes: 1d693155 ("thermal: add stm32 thermal driver") Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: David Hernandez Sanchez <david.hernandezsanchez@st.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-12-10thermal: stm32: read factory settings inside stm_thermal_prepareDavid HERNANDEZ SANCHEZ
Calling stm_thermal_read_factory_settings before clocking internal peripheral causes bad register values and makes temperature computation wrong. Calling stm_thermal_read_factory_settings inside stm_thermal_prepare fixes this problem as internal peripheral is well clocked at this stage. Fixes: 1d693155 ("thermal: add stm32 thermal driver") Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: David Hernandez Sanchez <david.hernandezsanchez@st.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-12-10thermal/drivers/hisi: Fix number of sensors on hi3660Daniel Lezcano
Without this patch the thermal driver is broken on hi3660. The dual sensors support patchset was partially merged, unfortunately the dual thermal zones definition is not available in the DT yet, so when the driver tries to register all the sensors that fails. By reducing to 1 the number of sensors on the hi3660, we switch back to the previous functionnality. Fixes: 8c6c36846f11 (thermal/drivers/hisi: Add the dual clusters sensors for hi3660) Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-12-10thermal/drivers/hisi: Fix wrong platform_get_irq_byname()Daniel Lezcano
Without this patch, the thermal driver on hi6220 and hi3660 is broken. That is due because part of the posted patchset was merged but a small change in the DT was dropped. The hi6220 and hi3660 do not have an interrupt name in the DT, so finding interrupt by name fails. Fix this by returning back to the platform_get_irq() function call. Fixes: 2cffaeff083f (thermal/drivers/hisi: Use platform_get_irq_byname) Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-12-07Merge branches 'for-rc' and 'thermal-core' into nextZhang Rui
2018-12-07drivers: thermal: Move QCOM_SPMI_TEMP_ALARM into the qcom subdirAmit Kucheria
This cleans up the directory a bit allowing just one place to look for thermal related drivers for QCOM platforms instead of being scattered in the root directory and the qcom/ subdirectory. Compile-tested with ARCH=arm64 defconfig and the driver explicitly enabled with menuconfig. Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-12-07drivers: thermal: Move various drivers for intel platforms into a subdirAmit Kucheria
This cleans up the directory a bit, now that we have several other platforms using platform-specific sub-directories. Compile-tested with ARCH=x86 defconfig and the drivers explicitly enabled with menuconfig. Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-12-05thermal: broadcom: constify thermal_zone_of_device_ops structureJulia Lawall
The thermal_zone_of_device_ops structure can be const as it is only passed as the last argument of thermal_zone_of_sensor_register and the corresponding parameter is declared as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-12-05thermal: armada: constify thermal_zone_of_device_ops structureJulia Lawall
The thermal_zone_of_device_ops structure can be const as it is only passed as the last argument of devm_thermal_zone_of_sensor_register and the corresponding parameter is declared as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-12-04thermal: bcm2835: Switch to SPDX identifierStefan Wahren
Adopt the SPDX license identifier headers to ease license compliance management. Cc: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-12-04thermal: armada: fix legacy resource fixupRussell King
When the armada thermal module is inserted, removed and then reinserted, the system panics as per the messages below. The reason is that "edit" a live resource in the resource tree twice, and end up with it pointing to some other hardware. Editing live resources (resources that are part of the registered resource tree) is not permissible - the resource tree is an ordered set of resources, sorted by start address, and when a new resource is inserted, it is validated that it (a) fits within its parent resource and (b) does not overlap a neighbouring resource. Get rid of this resource editing. We can instead adjust the return value from ioremap() as ioremap() deals with the creation of page- based mappings - provided the adjustment does not cross a page boundary. SError Interrupt on CPU1, code 0xbf000000 -- SError CPU: 1 PID: 2749 Comm: modprobe Not tainted 4.19.0+ #175 Hardware name: Marvell 8040 MACCHIATOBin Double shot (DT) pstate: 20400085 (nzCv daIf +PAN -UAO) pc : regmap_mmio_read+0x3c/0x60 lr : regmap_mmio_read+0x3c/0x60 sp : ffffff800d453900 x29: ffffff800d453900 x28: ffffff800096a1d0 x27: 0000000000000100 x26: ffffff80009696d8 x25: ffffff8000969000 x24: ffffffc13a588918 x23: ffffffc13a9a28a8 x22: ffffff800d4539dc x21: 0000000000000084 x20: ffffff800d4539dc x19: ffffffc13a5d5480 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000030 x11: 0101010101010101 x10: 7f7f7f7f7f7f7f7f x9 : 0000000000000000 x8 : ffffffc13a5d5a80 x7 : 0000000000000000 x6 : 000000000000003f x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffffff800851be70 x2 : ffffff800851bd60 x1 : ffffff800d492ff8 x0 : 0000000000000000 Kernel panic - not syncing: Asynchronous SError Interrupt CPU: 1 PID: 2749 Comm: modprobe Not tainted 4.19.0+ #175 Hardware name: Marvell 8040 MACCHIATOBin Double shot (DT) Call trace: dump_backtrace+0x0/0x158 show_stack+0x14/0x1c dump_stack+0x90/0xb0 panic+0x128/0x298 print_tainted+0x0/0xa8 arm64_serror_panic+0x74/0x80 do_serror+0x5c/0xb8 el1_error+0xb4/0x144 regmap_mmio_read+0x3c/0x60 _regmap_bus_reg_read+0x18/0x20 _regmap_read+0x64/0x180 regmap_read+0x44/0x6c armada_ap806_init+0x24/0x5c [armada_thermal] armada_thermal_probe+0x2c8/0x37c [armada_thermal] platform_drv_probe+0x4c/0xb0 really_probe+0x21c/0x2b4 driver_probe_device+0x58/0xfc __driver_attach+0xd4/0xd8 bus_for_each_dev+0x50/0xa0 driver_attach+0x20/0x28 bus_add_driver+0x1c4/0x228 driver_register+0x6c/0x124 __platform_driver_register+0x4c/0x54 armada_thermal_driver_init+0x20/0x1000 [armada_thermal] do_one_initcall+0x30/0x204 do_init_module+0x5c/0x1d4 load_module+0x1a88/0x212c __se_sys_finit_module+0xa0/0xac __arm64_sys_finit_module+0x1c/0x24 el0_svc_common+0x94/0xf0 el0_svc_handler+0x24/0x80 el0_svc+0x8/0x3c0 SMP: stopping secondary CPUs Kernel Offset: disabled CPU features: 0x0,21806000 Memory Limit: none Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Tested-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-12-04thermal: armada: fix legacy validity test senseRussell King
Commit 8c0e64ac4075 ("thermal: armada: get rid of the ->is_valid() pointer") removed the unnecessary indirection through a function pointer, but in doing so, also removed the negation operator too: - if (priv->data->is_valid && !priv->data->is_valid(priv)) { + if (armada_is_valid(priv)) { which results in: armada_thermal f06f808c.thermal: Temperature sensor reading not valid armada_thermal f2400078.thermal: Temperature sensor reading not valid armada_thermal f4400078.thermal: Temperature sensor reading not valid at boot, or whenever the "temp" sysfs file is read. Replace the negation operator. Fixes: 8c0e64ac4075 ("thermal: armada: get rid of the ->is_valid() pointer") Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-11-30thermal: Fix locking in cooling device sysfs update cur_stateThara Gopinath
Sysfs interface to update cooling device cur_state does not currently holding cooling device lock sometimes leading to stale values in cur_state if getting updated simultanelously from user space and thermal framework. Adding the proper locking code fixes this issue. Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-11-30Thermal: do not clear passive state during system sleepWei Wang
commit ff140fea847e ("Thermal: handle thermal zone device properly during system sleep") added PM hook to call thermal zone reset during sleep. However resetting thermal zone will also clear the passive state and thus cancel the polling queue which leads the passive cooling device state not being cleared properly after sleep. thermal_pm_notify => thermal_zone_device_reset set passive to 0 thermal_zone_trip_update will skip update passive as `old_target == instance->target'. monitor_thermal_zone => thermal_zone_device_set_polling will cancel tz->poll_queue, so the cooling device state will not be changed afterwards. Reported-by: Kame Wang <kamewang@google.com> Signed-off-by: Wei Wang <wvw@google.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-11-30thermal: zx2967_thermal: simplify getting .driver_dataWolfram Sang
We should get 'driver_data' from 'struct device' directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Shawn Guo <shawnguo@kernel.org> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-11-30thermal: st: st_thermal: simplify getting .driver_dataWolfram Sang
We should get 'driver_data' from 'struct device' directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-11-30thermal: spear_thermal: simplify getting .driver_dataWolfram Sang
We should get 'driver_data' from 'struct device' directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-11-30thermal: rockchip_thermal: simplify getting .driver_dataWolfram Sang
We should get 'driver_data' from 'struct device' directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-11-30thermal: int340x_thermal: int3400_thermal: simplify getting .driver_dataWolfram Sang
We should get 'driver_data' from 'struct device' directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-11-30thermal: remove unused function parameterLukasz Luba
Clean unused parameter from internal framework function. Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-10-31Merge branch 'next' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux Pull thermal management updates from Zhang Rui: - Fix a use-after-free issue when unregistering a thermal cooling device (Dmitry Osipenko) - use power_efficient_wq for thermal worker to save more power (Jeson Gao) * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: thermal: core: using power_efficient_wq for thermal worker thermal: core: Fix use-after-free in thermal_cooling_device_destroy_sysfs
2018-10-26Merge branch 'linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal Pull thermal SoC updates from Eduardo Valentin: "Several new things coming up. Specifics: - Rework of tsens and hisi thermal drivers - OF-thermal now allows sharing multiple cooling devices on maps - Added support for r8a7744 and R8A77970 on rcar thermal driver - Added support for r8a774a1 on rcar_gen3 thermal driver - New thermal driver stm32 - Fixes on multiple thermal drivers: of-thermal, imx, qoriq, armada, qcom-spmi, rcar, da9062/61" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal: (41 commits) thermal: da9062/61: Prevent hardware access during system suspend thermal: rcar_thermal: Prevent doing work after unbind thermal: rcar_thermal: Prevent hardware access during system suspend thermal: rcar_gen3_thermal: add R8A77980 support dt-bindings: thermal: rcar-gen3-thermal: document R8A77980 bindings thermal: add stm32 thermal driver dt-bindings: stm32-thermal: add binding documentation thermal: rcar_thermal: add R8A77970 support dt-bindings: thermal: rcar-thermal: document R8A77970 bindings thermal: rcar_thermal: fix duplicate IRQ request dt-bindings: thermal: rcar: Add device tree support for r8a7744 thermal/drivers/hisi: Add the dual clusters sensors for hi3660 thermal/drivers/hisi: Add more sensors channel thermal/drivers/hisi: Remove pointless irq field thermal/drivers/hisi: Use platform_get_irq_byname thermal/drivers/hisi: Replace macro name with relevant sensor location thermal/drivers/hisi: Add multiple sensors support thermal/drivers/hisi: Prepare to support multiple sensors thermal/drivers/hisi: Factor out the probe functions thermal/drivers/hisi: Set the thermal zone private data to the sensor pointer ...
2018-10-25thermal: da9062/61: Prevent hardware access during system suspendGeert Uytterhoeven
The workqueue used for monitoring the hardware may run while the device is already suspended. Fix this by using the freezable system workqueue instead, cfr. commit 51e20d0e3a60cf46 ("thermal: Prevent polling from happening during system suspend"). Fixes: 608567aac3206ae8 ("thermal: da9062/61: Thermal junction temperature monitoring driver") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-25thermal: rcar_thermal: Prevent doing work after unbindGeert Uytterhoeven
When testing bind/unbind on r8a7791/koelsch: WARNING: CPU: 1 PID: 697 at lib/debugobjects.c:329 debug_print_object+0x8c/0xb4 ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x10 This happens if the workqueue runs after the device has been unbound. Fix this by cancelling any queued work during remove. Fixes: e0a5172e9eec7f0d ("thermal: rcar: add interrupt support") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-25thermal: rcar_thermal: Prevent hardware access during system suspendGeert Uytterhoeven
On r8a7791/koelsch, sometimes the following message is printed during system suspend: rcar_thermal e61f0000.thermal: thermal sensor was broken This happens if the workqueue runs while the device is already suspended. Fix this by using the freezable system workqueue instead, cfr. commit 51e20d0e3a60cf46 ("thermal: Prevent polling from happening during system suspend"). Fixes: e0a5172e9eec7f0d ("thermal: rcar: add interrupt support") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-25thermal: rcar_gen3_thermal: add R8A77980 supportSergei Shtylyov
Add the R-Car V3H (R8A77980) SoC support to the R-Car gen3 thermal driver. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-25thermal: add stm32 thermal driverDavid HERNANDEZ SANCHEZ
Add support for DTS thermal sensor that can be found on some STM32 platforms. This driver is based on OF and works in interrupt mode. It offers two temperature trip points: passive and critical. The first is intended for passive cooling notification while the second is used for over-temperature reset. Signed-off-by: David Hernandez Sanchez <david.hernandezsanchez@st.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-25thermal: rcar_thermal: add R8A77970 supportSergei Shtylyov
Add the R-Car V3M (R8A77970) SoC support to the R-Car gen2 thermal driver. The hardware is the same as in the R-Car D3 (R8A77995) plus the CIVM status register (we don't use). Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-25thermal: rcar_thermal: fix duplicate IRQ requestSergei Shtylyov
The driver on R8A77995 requests the same IRQ twice since platform_get_resource() is always called for the 1st IRQ resource. Fixes: 1969d9dc2079 ("thermal: rcar_thermal: add r8a77995 support") Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Add the dual clusters sensors for hi3660Daniel Lezcano
The code is ready to support multiple sensors on the hi3660. The DT defines a thermal zone per cluster. Add the little cluster sensor and let it bind with the thermal zone. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Add more sensors channelDaniel Lezcano
Add the sensor channels id for the little, g3d and modem. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Remove pointless irq fieldDaniel Lezcano
The irq field in the data structure is pointless as the scope of its usage is just to request the interrupt. It can be replaced by a local variable. Use the 'ret' variable to get the interrupt number. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Use platform_get_irq_bynameDaniel Lezcano
As we have the interrupt names defines, replace platform_get_irq() by platform_get_irq_byname(), so no confusion can be made when getting the interrupt with the sensor id. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Replace macro name with relevant sensor locationDaniel Lezcano
Change the macro name in order to give a better indication of the sensor location. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Add multiple sensors supportDaniel Lezcano
Change the code as it is dealing with several sensors. For git-bisect compatibility (compilation and booting), assume the DT is not yet changed and we have a single interrupt. Next changes will support multiple interrupt sorted by their name. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Prepare to support multiple sensorsDaniel Lezcano
Convert the 'sensor' field to a pointer and propagate the change in the file. Havintg a pointer, gives us the opportunity to define multiple sensors. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Factor out the probe functionsDaniel Lezcano
The hi6220 and the hi3660 probe functions are doing almost the same operations, they can share 90% of their code. Factor out the probe functions by moving the common code in the common probe function. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Set the thermal zone private data to the sensor pointerDaniel Lezcano
Store the sensor pointer in the thermal zone private data and use it in the callback functions. That allows to continue the conversion to sensor oriented code where the pointers are the sensors. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Change the driver to be sensor orientedDaniel Lezcano
In order to support multiple sensors, we have to change the code to deal with sensors and not the hisi thermal structure. Add a back pointer to the hisi thermal structure (containerof is not a good option because later we convert the sensor field to a pointer). Change the functions parameters to take a sensor instead of this hisi thermal 'data' structure. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal/drivers/hisi: Change the platform data pointer to sensor opsDaniel Lezcano
Group the temperature sensor specific ops into a single structure and assign it to hisi thermal data structure. Change the platform data pointer to reference the specific sensor ops instead of the probe functions. Moving out those allow to split the code to self-encapsulate the sensor object. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal: armada: fix a test in probe()Dan Carpenter
The platform_get_resource() function doesn't return error pointers, it returns NULL on error. Fixes: 3d4e51844a4e ("thermal: armada: convert driver to syscon register accesses") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal: imx: handle error path in one place to save duplicated codeAnson Huang
During probe phase, the error path can be handled in one place and use goto method to save many duplicated code. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal: imx: improve error messageAnson Huang
Remove the duplicated "from" to improve the error message. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal: tsens: Check if the IP is correctly enabled by firmwareAmit Kucheria
The SROT registers are initialised by the secure firmware at boot. We don't have write access to the registers. Check if the block is enabled before continuing. Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal: tsens: Pass register offsets as private dataAmit Kucheria
Registers have moved around across TSENS generations. For example, the CTRL register was at offset 0x0 in the SROT region on msm8916 but is at offset 0x4 in newer v2 based TSENS HW blocks. Allow passing offsets of important registers so that we can continue to use common functions. Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal: tsens: Add the SROT address mapAmit Kucheria
On platforms whose device trees specify two address spaces for TSENS, the second one points to the SROT registers. Initialise the SROT map on those platforms. Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal: tsens: Rename map field in order to add a second address mapAmit Kucheria
The TSENS driver currently only uses a limited set of registers from the TM address space. So it was ok to map just that set of registers and call it "map". We'd now like to map a second set: SROT registers to introduce new functionality. Rename the "map" field to a more appropriate "tm_map". The 8960 doesn't have a clear split between TM and SROT registers. To avoid complicating the data structure, it will switchover to using tm_map for its maps. There is no functional change with this patch. Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal: tsens: Get rid of dead codeAmit Kucheria
hw_id is dynamically allocated but not used anywhere. Get rid of dead code. Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2018-10-22thermal: tsens: Add SPDX license identifiersAmit Kucheria
The TSENS drivers use a GPL-2.0 license. Replace with equivalent SPDX tags and delete the full license text. Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>