thermal: bcm2835: add thermal driver
Subsystems (5)
v7 cover thermal: bcm2835: add thermal driver
From: Martin Sperl <[email protected]>
Add a thermal driver for the TSENSE device of the bcm2835/6/7 SOC.
If the firmware enables the HW, then the configuration is not touched. In case the firmware has not enabled the device, then we try to set it up correctly (which unfortunately can not get tested).
It exposes temperature and a critical trip point (using a hardcoded default of 80C or the temperature configured in the control register by the firmware, which reads as 407C currently)
The calibrations are (potentially) different for bcm2835, bcm2836 and bcm2837 and can get selected by the compatible property in the device tree.
The driver also exposes the registers via debugfs.
Possible future enhancements:
* the device has the ability to trigger interrupts on reaching the programmed critical temperature.
I have no knowledge which interrupt could be responsible for this on the ARM side, so if we get to know which irq it is we can implement that.
Instead the driver right now implements polling in 1 second intervals
* the device can also reset the HW after the trip point
has been reached (also with some delay, so that corrective actions can get taken) - this is currently not enabled by the firmware, but could.
* we could define more trip points for THERMAL_TRIP_HOT
* make the trip point limits modifiable (ops.set_trip_temp)
Note:
No support for 32-bit arm bcm2837, as there is no arch/arm/boot/dts/bcm2836.dtsi upstream as of now. 64-bit arm support is not tested
Changelog:
V1 -> V2: renamed dt-binding documentation file
added specific settings depending on compatible added trip point based on register
setting up ctrl-register if HW is not enabled by firmware
as per recommendation of Eric (untested)
check that clock frequency is in range
(1.9 - 5MHz - as per comment in clk-bcm2835.c)
added driver to multi_v7_defconfig
V2 -> V3: made a module in multi_v7_defconfig
fixed typo in dt-binding document
V3 -> V4: moved driver back to thermal (not using bcm sub-directory)
set polling interval to 1second (was 0ms, so interrupt driven)
V4 -> V5: use correct compatiblity for different soc versions in dt
support ARM64 for bcm2837 in devicetree and defconfig
V5 -> V6: incorporated changes recommended by Stefan Wahren V6 -> V7: removed depends on ARCH_BCM2836 || ARCH_BCM2837 in Kconfig
Martin Sperl (6):
dt: bindings: add thermal device driver for bcm2835
thermal: bcm2835: add thermal driver for bcm2835 soc
ARM: bcm2835: dts: add thermal node to device-tree of bcm283x
ARM64: bcm2835: dts: add thermal node to device-tree of bcm2837
ARM: bcm2835: add thermal driver to default_config
ARM64: bcm2835: add thermal driver to default_config
.../bindings/thermal/brcm,bcm2835-thermal.txt | 17 ++ arch/arm/boot/dts/bcm2835.dtsi | 6 + arch/arm/boot/dts/bcm2836.dtsi | 6 + arch/arm/boot/dts/bcm283x.dtsi | 7 + arch/arm/configs/bcm2835_defconfig | 2 + arch/arm64/boot/dts/broadcom/bcm2837.dtsi | 6 + arch/arm64/configs/defconfig | 1 + drivers/thermal/Kconfig | 8 + drivers/thermal/Makefile | 1 + drivers/thermal/bcm2835_thermal.c | 340 +++++++++++++++++++++ 10 files changed, 394 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/brcm,bcm2835-thermal.txt create mode 100644 drivers/thermal/bcm2835_thermal.c
--
2.1.4
PATCH v7 1/6 dt: bindings: add thermal device driver for bcm2835
From: Martin Sperl <[email protected]>
Add dt-binding documentation for bcm2835 SOC thermal sensor.
Changelog:
V1 -> V2: renamed file to follow naming conventions V2 -> V3: removed 0x in node name
--- .../bindings/thermal/brcm,bcm2835-thermal.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/brcm,bcm2835-thermal.txt
Documentation/devicetree/bindings/thermal/brcm,bcm2835-thermal.txt new file +17 -0
@@ -0,0 +1,17 @@ +Binding for Thermal Sensor driver for BCM2835 SoCs. + +Required parameters: +------------------- + +compatible: should be one of: "brcm,bcm2835-thermal", + "brcm,bcm2836-thermal" or "brcm,bcm2837-thermal" +reg: Address range of the thermal registers. +clocks: Phandle of the clock used by the thermal sensor. + +Example: + +thermal: thermal at 7e212000 { + compatible = "brcm,bcm2835-thermal"; + reg = <0x7e212000 0x8>; + clocks = <&clocks BCM2835_CLOCK_TSENS>; +};
Signature · 1 line
2.1.4
PATCH v7 2/6 thermal: bcm2835: add thermal driver for bcm2835 soc
In reply to kernel at martin.sperl.orgFrom: Martin Sperl <[email protected]>
Add basic thermal driver for bcm2835 SOC.
This driver currently relies on the firmware setting up the tsense HW block and does not set it up itself.
ChangeLog:
V1 -> V2: added specific settings depending on compatiblity
added trip point based on register
setting up ctrl-register if HW is not enabled by firmware
as per recommendation of Eric (untested)
check that clock frequency is in range
(1.9 - 5MHz - as per comment in clk-bcm2835.c)
V2 -> V4: moved back to thermal (not using bcm sub-directory)
set polling interval to 1second (was 0ms, so interrupt driven)
V5 -> V6: added correct depends in KConfig
removed defined default for RESET_DELAY
removed obvious comments
clarify HW setup comments if not set up by FW already move clk_prepare_enable to an earlier stage and add error handling clarify warning when TS-clock runs out of recommended range clk_disable_unprepare added in bcm2835_thermal_remove added comment on recommended temperature ranges for SOC
V6 -> V7: removed depends on ARCH_BCM2836 || ARCH_BCM2837 in Kconfig
--- drivers/thermal/Kconfig | 8 + drivers/thermal/Makefile | 1 + drivers/thermal/bcm2835_thermal.c | 340 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 349 insertions(+) create mode 100644 drivers/thermal/bcm2835_thermal.c
drivers/thermal/Kconfig +8 -0
@@ -399,4 +399,12 @@ config GENERIC_ADC_THERMAL to this driver. This driver reports the temperature by reading ADC channel and converts it to temperature based on lookup table. +config BCM2835_THERMAL + tristate "Thermal sensors on bcm2835 SoC" + depends on ARCH_BCM2835 || COMPILE_TEST + depends on HAS_IOMEM + depends on OF + help + Support for thermal sensors on Broadcom bcm2835 SoCs. + endif
drivers/thermal/Makefile +1 -0
@@ -51,3 +51,4 @@ obj-$(CONFIG_TEGRA_SOCTHERM) += tegra/ obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o +obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o
drivers/thermal/bcm2835_thermal.c new file +340 -0
340 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v7 2/6 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 10 lines · kernel at martin.sperl.org
From: Martin Sperl <[email protected]>
Add basic thermal driver for bcm2835 SOC.
This driver currently relies on the firmware setting up the tsense HW block and does not set it up itself.
Signed-off-by Martin Sperl <[email protected]>Acked-by Eric Anholt <[email protected]>Acked-by Stefan Wahren <[email protected]>
What's the status of merging this one? I'd like to merge the other
patches.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160928/23e2792a/attachment.sig>
PATCH v7 2/6 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 13 lines
Eric Anholt <[email protected]> hat am 28. September 2016 um 23:10 geschrieben:
Quoted 7 lines · kernel at martin.sperl.org
From: Martin Sperl <[email protected]>
Add basic thermal driver for bcm2835 SOC.
This driver currently relies on the firmware setting up the tsense HW block and does not set it up itself.
Quoted 6 lines
Quoted 3 lines
Signed-off-by Martin Sperl <[email protected]>Acked-by Eric Anholt <[email protected]>Acked-by Stefan Wahren <[email protected]>What's the status of merging this one? I'd like to merge the other patches.
gently ping ...
PATCH v7 2/6 thermal: bcm2835: add thermal driver for bcm2835 soc
In reply to Eric AnholtHi Martin,
Am 28.09.2016 um 23:10 schrieb Eric Anholt:
Quoted 6 lines
Quoted 4 lines · kernel at martin.sperl.org
From: Martin Sperl <[email protected]>
Add basic thermal driver for bcm2835 SOC.
Quoted 8 lines
Quoted 6 lines
This driver currently relies on the firmware setting up the tsense HW block and does not set it up itself.
Signed-off-by Martin Sperl <[email protected]>Acked-by Eric Anholt <[email protected]>Acked-by Stefan Wahren <[email protected]>What's the status of merging this one? I'd like to merge the other patches.
i think it's necessary to rebase the whole series. Maybe we could get it into 4.10.
Stefan
PATCH v7 2/6 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 12 lines · Stefan Wahren
Hi Martin,
Am 28.09.2016 um 23:10 schrieb Eric Anholt:
Quoted 9 lines
Quoted 7 lines · kernel at martin.sperl.org
From: Martin Sperl <[email protected]>
Add basic thermal driver for bcm2835 SOC.
This driver currently relies on the firmware setting up the tsense HW block and does not set it up itself.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Martin Sperl <[email protected]>Acked-by Eric Anholt <[email protected]>Acked-by Stefan Wahren <[email protected]>What's the status of merging this one? I'd like to merge the other patches.
i think it's necessary to rebase the whole series. Maybe we could get it into 4.10.
Why would it need to be rebased? The status, as far as I know, is that
we're still waiting for the subsystem maintainer to respond.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161024/5f37774f/attachment.sig>
PATCH v7 2/6 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 20 lines
Eric Anholt <[email protected]> hat am 24. Oktober 2016 um 18:38 geschrieben:
Quoted 15 lines · Stefan Wahren
Hi Martin,
Am 28.09.2016 um 23:10 schrieb Eric Anholt:
Quoted 12 lines
Quoted 10 lines · kernel at martin.sperl.org
From: Martin Sperl <[email protected]>
Add basic thermal driver for bcm2835 SOC.
This driver currently relies on the firmware setting up the tsense HW block and does not set it up itself.
Signed-off-by Martin Sperl <[email protected]>Acked-by Eric Anholt <[email protected]>Acked-by Stefan Wahren <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
What's the status of merging this one? I'd like to merge the other patches.
i think it's necessary to rebase the whole series. Maybe we could get it into 4.10.
Why would it need to be rebased? The status, as far as I know, is that we're still waiting for the subsystem maintainer to respond.
Since at least this patch won't apply anymore, but feedback from maintainer is still good :-)
Sorry for this impatience, but i'm afraid that we possibly miss 4.10.
Zhang Rui
reviewerPATCH v7 2/6 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 31 lines · Stefan Wahren
Quoted 31 lines
Eric Anholt <[email protected]> hat am 24. Oktober 2016 um 18:38 geschrieben:
Quoted 24 lines · Stefan Wahren
Hi Martin,
Am 28.09.2016 um 23:10 schrieb Eric Anholt:
Quoted 11 lines
Quoted 8 lines · kernel at martin.sperl.org
From: Martin Sperl <[email protected]>
Add basic thermal driver for bcm2835 SOC.
This driver currently relies on the firmware setting up the tsense HW block and does not set it up itself.
Quoted 6 lines
Quoted 3 lines
Signed-off-by Martin Sperl <[email protected]>Acked-by Eric Anholt <[email protected]>Acked-by Stefan Wahren <[email protected]>What's the status of merging this one???I'd like to merge the other
patches.i think it's necessary to rebase the whole series. Maybe we could get it
into 4.10.
Quoted 8 lines
Quoted 3 lines
Why would it need to be rebased???The status, as far as I know, is that
we're still waiting for the subsystem maintainer to respond.Since at least this patch won't apply anymore, but feedback from maintainer is
still good :-)Sorry for this impatience, but i'm afraid that we possibly miss 4.10.
Eduardo,
any comments on this patchset?
thanks,
rui
PATCH v7 2/6 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 39 lines · Zhang Rui
Quoted 38 lines · Stefan Wahren
Quoted 28 lines
Eric Anholt <[email protected]> hat am 24. Oktober 2016 um 18:38 geschrieben:
Quoted 21 lines · Stefan Wahren
Hi Martin,
Am 28.09.2016 um 23:10 schrieb Eric Anholt:
Quoted 17 lines
Quoted 11 lines · kernel at martin.sperl.org
From: Martin Sperl <[email protected]>
Add basic thermal driver for bcm2835 SOC.
This driver currently relies on the firmware setting up the tsense HW block and does not set it up itself.
Signed-off-by Martin Sperl <[email protected]>Acked-by Eric Anholt <[email protected]>Acked-by Stefan Wahren <[email protected]>What's the status of merging this one???I'd like to merge the other
patches.Quoted 6 lines
Quoted 3 lines
i think it's necessary to rebase the whole series. Maybe we could get it
into 4.10.Why would it need to be rebased???The status, as far as I know, is that
we're still waiting for the subsystem maintainer to respond.Since at least this patch won't apply anymore, but feedback from maintainer is
still good :-)
Quoted 5 lines
Quoted 1 line
Sorry for this impatience, but i'm afraid that we possibly miss 4.10.
Eduardo,
any comments on this patchset?
It's been a month on v7 of this patch. Can we please merge it?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161031/4847b7b1/attachment.sig>
PATCH v7 2/6 thermal: bcm2835: add thermal driver for bcm2835 soc
In reply to Eric AnholtQuoted 12 lines · Eric Anholt
Quoted 4 lines · Stefan Wahren
Hi Martin,
i think it's necessary to rebase the whole series. Maybe we could get it into 4.10.
Why would it need to be rebased? The status, as far as I know, is that we're still waiting for the subsystem maintainer to respond.
Sending out a rebased version 8 (specifically needed for patch 2 and 6).
Martin
PATCH v7 3/6 ARM: bcm2835: dts: add thermal node to device-tree of bcm283x
In reply to kernel at martin.sperl.orgFrom: Martin Sperl <[email protected]>
Add the node for the thermal sensor of the bcm2835-soc to the device tree.
Changelog:
V1 -> V5: generic settings is shared in bcm283x.dtsi, but disabled
moved the compatible string to the SOC specific dtsi
for arm and arm64
V5 -> V6: fix remove 0x prefix from thermal at 0x7e212000
Note: there is no arm/boot/dts/bcm2837.dtsi as of now,
so the 32-bit rpi3 dt is not modified.
--- arch/arm/boot/dts/bcm2835.dtsi | 6 ++++++ arch/arm/boot/dts/bcm2836.dtsi | 6 ++++++ arch/arm/boot/dts/bcm283x.dtsi | 7 +++++++ 3 files changed, 19 insertions(+)
arch/arm/boot/dts/bcm2835.dtsi +6 -0
@@ -23,3 +23,9 @@ }; }; }; + +/* enable thermal sensor with the correct compatible property set */ +&thermal { + compatible = "brcm,bcm2835-thermal"; + status = "okay"; +};
arch/arm/boot/dts/bcm2836.dtsi +6 -0
@@ -76,3 +76,9 @@ interrupt-parent = <&local_intc>; interrupts = <8>; }; + +/* enable thermal sensor with the correct compatible property set */ +&thermal { + compatible = "brcm,bcm2836-thermal"; + status = "okay"; +};
arch/arm/boot/dts/bcm283x.dtsi +7 -0
@@ -186,6 +186,13 @@ interrupts = <2 14>; /* pwa1 */ }; + thermal: thermal at 7e212000 { + compatible = "brcm,bcm2835-thermal"; + reg = <0x7e212000 0x8>; + clocks = <&clocks BCM2835_CLOCK_TSENS>; + status = "disabled"; + }; + aux: aux at 0x7e215000 { compatible = "brcm,bcm2835-aux"; #clock-cells = <1>;
Signature · 1 line
2.1.4
PATCH v7 4/6 ARM64: bcm2835: dts: add thermal node to device-tree of bcm2837
In reply to kernel at martin.sperl.orgFrom: Martin Sperl <[email protected]>
Add the node for the thermal sensor of the bcm2837-soc to the device tree.
--- arch/arm64/boot/dts/broadcom/bcm2837.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/broadcom/bcm2837.dtsi +6 -0
@@ -74,3 +74,9 @@ interrupt-parent = <&local_intc>; interrupts = <8>; }; + +/* enable thermal sensor with the correct compatible property set */ +&thermal { + compatible = "brcm,bcm2837-thermal"; + status = "okay"; +};
Signature · 1 line
2.1.4
PATCH v7 5/6 ARM: bcm2835: add thermal driver to default_config
In reply to kernel at martin.sperl.orgFrom: Martin Sperl <[email protected]>
Add the thermal driver to list of compiled modules in the default config for bcm2835.
--- arch/arm/configs/bcm2835_defconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/configs/bcm2835_defconfig +2 -0
@@ -73,6 +73,8 @@ CONFIG_SPI_BCM2835=y CONFIG_SPI_BCM2835AUX=y CONFIG_GPIO_SYSFS=y # CONFIG_HWMON is not set +CONFIG_THERMAL=y +CONFIG_BCM2835_THERMAL=y CONFIG_WATCHDOG=y CONFIG_BCM2835_WDT=y CONFIG_DRM=y
Signature · 1 line
2.1.4
PATCH v7 6/6 ARM64: bcm2835: add thermal driver to default_config
In reply to kernel at martin.sperl.orgFrom: Martin Sperl <[email protected]>
Add the thermal driver for bcm2837 to list of compiled modules in the default config.
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -252,6 +252,7 @@ CONFIG_SENSORS_INA2XX=m CONFIG_SENSORS_ARM_SCPI=y CONFIG_THERMAL=y CONFIG_THERMAL_EMULATION=y +CONFIG_BCM2835_THERMAL=y CONFIG_EXYNOS_THERMAL=y CONFIG_WATCHDOG=y CONFIG_RENESAS_WDT=y
Signature · 1 line
2.1.4