thermal: add brcmstb AVS TMON driver
Subsystems (5)
v2 cover thermal: add brcmstb AVS TMON driver
From: Markus Mayer <[email protected]>
This series adds the brcmstb AVS TMON driver.
The driver was originally written by Brian Norris.
v1 of this series can be found at https://lkml.org/lkml/2017/6/5/921
Changes since v1:
- Fixed wording in binding document
- Fixed lincensing to consistently mention GPL v2
- Use thermal_zone_get_slope() and thermal_zone_get_offset()
- Some minor clean-ups
Brian Norris (2):
Documentation: devicetree: add binding for Broadcom STB AVS TMON
thermal: add brcmstb AVS TMON driver
Markus Mayer (2):
ARM: multi_v7_defconfig: add CONFIG_BRCMSTB_THERMAL
arm64: defconfig: add CONFIG_BRCMSTB_THERMAL
.../devicetree/bindings/thermal/brcm,avs-tmon.txt | 20 ++ MAINTAINERS | 8 + arch/arm/configs/multi_v7_defconfig | 1 + arch/arm64/configs/defconfig | 1 + drivers/thermal/Kconfig | 2 +- drivers/thermal/broadcom/Kconfig | 7 + drivers/thermal/broadcom/Makefile | 1 + drivers/thermal/broadcom/brcmstb_thermal.c | 386 +++++++++++++++++++++ 8 files changed, 425 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-tmon.txt create mode 100644 drivers/thermal/broadcom/brcmstb_thermal.c
Signature · 1 line
2.7.4
PATCH v2 1/4 Documentation: devicetree: add binding for Broadcom STB AVS TMON
From: Brian Norris <[email protected]>
Add binding for Broadcom STB thermal.
--- .../devicetree/bindings/thermal/brcm,avs-tmon.txt | 20 ++++++++++++++++++++ MAINTAINERS | 8 ++++++++ 2 files changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-tmon.txt
Documentation/devicetree/bindings/thermal/brcm,avs-tmon.txt new file +20 -0
@@ -0,0 +1,20 @@ +* Broadcom STB thermal management + +Thermal management core, provided by the AVS TMON hardware block. + +Required properties: +- compatible: must be "brcm,avs-tmon" and/or "brcm,avs-tmon-bcm7445" +- reg: address range for the AVS TMON registers +- interrupts: temperature monitor interrupt, for high/low threshold triggers +- interrupt-names: should be "tmon" +- interrupt-parent: the parent interrupt controller + +Example: + + thermal at f04d1500 { + compatible = "brcm,avs-tmon-bcm7445", "brcm,avs-tmon"; + reg = <0xf04d1500 0x28>; + interrupts = <0x6>; + interrupt-names = "tmon"; + interrupt-parent = <&avs_host_l2_intc>; + };
MAINTAINERS +8 -0
@@ -2928,6 +2928,14 @@ S: Maintained F: Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt F: drivers/cpufreq/brcmstb* +BROADCOM STB AVS TMON DRIVER +M: Markus Mayer <[email protected]> +M: bcm-kernel-feedback-list at broadcom.com +L: linux-pm at vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/thermal/brcm,avs-tmon.txt +F: drivers/thermal/broadcom/brcmstb* + BROADCOM SPECIFIC AMBA DRIVER (BCMA) M: Rafa? Mi?ecki <[email protected]> L: linux-wireless at vger.kernel.org
Signature · 1 line
2.7.4
PATCH v2 2/4 thermal: add brcmstb AVS TMON driver
In reply to Markus MayerFrom: Brian Norris <[email protected]>
The AVS TMON core provides temperature readings, a pair of configurable high- and low-temperature threshold interrupts, and an emergency over-temperature chip reset. The driver utilizes the first two to provide temperature readings and high-temperature notifications to applications. The over-temperature reset is not exposed to applications; this reset threshold is critical to the system and should be set with care within the bootloader.
Applications may choose to utilize the notification mechanism, the temperature reading mechanism (e.g., through polling), or both.
--- drivers/thermal/Kconfig | 2 +- drivers/thermal/broadcom/Kconfig | 7 + drivers/thermal/broadcom/Makefile | 1 + drivers/thermal/broadcom/brcmstb_thermal.c | 386 +++++++++++++++++++++++++++++ 4 files changed, 395 insertions(+), 1 deletion(-) create mode 100644 drivers/thermal/broadcom/brcmstb_thermal.c
drivers/thermal/Kconfig +1 -1
@@ -408,7 +408,7 @@ config MTK_THERMAL controller present in Mediatek SoCs menu "Broadcom thermal drivers" -depends on ARCH_BCM || COMPILE_TEST +depends on ARCH_BCM || ARCH_BRCMSTB || COMPILE_TEST source "drivers/thermal/broadcom/Kconfig" endmenu
drivers/thermal/broadcom/Kconfig +7 -0
@@ -6,6 +6,13 @@ config BCM2835_THERMAL help Support for thermal sensors on Broadcom bcm2835 SoCs. +config BRCMSTB_THERMAL + tristate "Broadcom STB AVS TMON thermal driver" + depends on ARCH_BRCMSTB || COMPILE_TEST + help + Enable this driver if you have a Broadcom STB SoC and would like + thermal framework support. + config BCM_NS_THERMAL tristate "Northstar thermal driver" depends on ARCH_BCM_IPROC || COMPILE_TEST
drivers/thermal/broadcom/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o +obj-$(CONFIG_BRCMSTB_THERMAL) += brcmstb_thermal.o obj-$(CONFIG_BCM_NS_THERMAL) += ns-thermal.o
drivers/thermal/broadcom/brcmstb_thermal.c new file +386 -0
386 lines not on this page · raw message
Signature · 1 line
2.7.4
I'm far from being thermal expert, to me it looks OK, only 1 trivial issue
noticed (see below).
drivers/thermal/broadcom/brcmstb_thermal.c line 194
Quoted 7 lines · Markus Mayer
drivers/thermal/broadcom/brcmstb_thermal.c new file +7
-0+static void avs_tmon_trip_enable (struct brcmstb_thermal_priv *priv, +enum avs_tmon_trip_type type,int en) +{ +struct avs_tmon_trip *trip = &avs_tmon_trips[type]; +u32 val =__raw_readl (priv->tmon_base + trip->enable_offs); + +pr_debug ("%sable trip, type %d\n" , en ?"en" :"dis" , type);
This probably could be dev_dbg?
drivers/thermal/broadcom/brcmstb_thermal.c line 223
Quoted 8 lines
drivers/thermal/broadcom/brcmstb_thermal.c new file +8
-0+static void avs_tmon_set_trip_temp (struct brcmstb_thermal_priv *priv, +enum avs_tmon_trip_type type, +int temp) +{ +struct avs_tmon_trip *trip = &avs_tmon_trips[type]; +u32 val, orig; + +pr_debug ("set temp %d to %d\n" , type, temp);
Same here.
drivers/thermal/broadcom/brcmstb_thermal.c line 278
Quoted 5 lines
drivers/thermal/broadcom/brcmstb_thermal.c new file +5
-0+static int brcmstb_set_trips (void *data,int low,int high) +{ +struct brcmstb_thermal_priv *priv = data; + +pr_debug ("set trips %d <--> %d\n" , low, high);
And the last time here.
Quoted 5 lines · Rafał Miłecki
I'm far from being thermal expert, to me it looks OK, only 1 trivial issue noticed (see below).
On 2017-07-21 21:27, Markus Mayer wrote:
Quoted 11 lines
drivers/thermal/broadcom/brcmstb_thermal.c line 194
Quoted 8 lines
drivers/thermal/broadcom/brcmstb_thermal.c new file +7
-0+static void avs_tmon_trip_enable (struct brcmstb_thermal_priv *priv, +enum avs_tmon_trip_type type,int en) +{ +struct avs_tmon_trip *trip = &avs_tmon_trips[type]; +u32 val =__raw_readl (priv->tmon_base + trip->enable_offs); + +pr_debug ("%sable trip, type %d\n" , en ?"en" :"dis" , type);This probably could be
dev_dbg?
Indeed. I made the change in my local copy for all three instances. I'll wait for more feedback before re-sending.
+static void avs_tmon_set_trip_temp(struct brcmstb_thermal_priv *priv,
Quoted 21 lines
drivers/thermal/broadcom/brcmstb_thermal.c line 223
Quoted 8 lines
drivers/thermal/broadcom/brcmstb_thermal.c new file +7
-0+ enum avs_tmon_trip_type type, + int temp) +{ +struct avs_tmon_trip *trip = &avs_tmon_trips[type]; +u32 val, orig; + +pr_debug ("set temp %d to %d\n" , type, temp);Same here.
+static int
brcmstb_set_trips(void *data, int low, int high)drivers/thermal/broadcom/brcmstb_thermal.c line 278
Quoted 5 lines
drivers/thermal/broadcom/brcmstb_thermal.c new file +4
-0+{ +struct brcmstb_thermal_priv *priv = data; + +pr_debug ("set trips %d <--> %d\n" , low, high);And the last time here.
PATCH v2 3/4 ARM: multi_v7_defconfig: add CONFIG_BRCMSTB_THERMAL
In reply to Markus MayerFrom: Markus Mayer <[email protected]>
Turn on CONFIG_BRCMSTB_THERMAL as module.
--- arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -455,6 +455,7 @@ CONFIG_SENSORS_NTC_THERMISTOR=m CONFIG_SENSORS_PWM_FAN=m CONFIG_SENSORS_INA2XX=m CONFIG_CPU_THERMAL=y +CONFIG_BRCMSTB_THERMAL=m CONFIG_ROCKCHIP_THERMAL=y CONFIG_RCAR_THERMAL=y CONFIG_ARMADA_THERMAL=y
Signature · 1 line
2.7.4
PATCH v2 4/4 arm64: defconfig: add CONFIG_BRCMSTB_THERMAL
In reply to Markus MayerFrom: Markus Mayer <[email protected]>
Turn on CONFIG_BRCMSTB_THERMAL as module.
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -304,6 +304,7 @@ CONFIG_SENSORS_INA2XX=m CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y CONFIG_CPU_THERMAL=y CONFIG_THERMAL_EMULATION=y +CONFIG_BRCMSTB_THERMAL=m CONFIG_EXYNOS_THERMAL=y CONFIG_ROCKCHIP_THERMAL=m CONFIG_WATCHDOG=y
Signature · 1 line
2.7.4
Quoted 7 lines · Markus Mayer
From: Markus Mayer <[email protected]>
This series adds the brcmstb AVS TMON driver.
The driver was originally written by Brian Norris.
v1 of this series can be found at https://lkml.org/lkml/2017/6/5/921
Rui, Eduardo, I can take patches 3 and 4 through the Broadcom ARM/ARM64 SoC pull requests while you take patches 1 and 2, thanks!
Quoted 27 lines
Changes since v1:
- Fixed wording in binding document
- Fixed lincensing to consistently mention GPL v2
- Usethermal_zone_get_slope()andthermal_zone_get_offset()
- Some minor clean-upsBrian Norris (2):
Documentation: devicetree: add binding for Broadcom STB AVS TMON
thermal: add brcmstb AVS TMON driverMarkus Mayer (2):
ARM:multi_v7_defconfig: addCONFIG_BRCMSTB_THERMAL
arm64: defconfig: addCONFIG_BRCMSTB_THERMAL.../devicetree/bindings/thermal/brcm,avs-tmon.txt | 20 ++ MAINTAINERS | 8 + arch/arm/configs/multi_v7_defconfig | 1 + arch/arm64/configs/defconfig | 1 + drivers/thermal/Kconfig | 2 +- drivers/thermal/broadcom/Kconfig | 7 + drivers/thermal/broadcom/Makefile | 1 + drivers/thermal/broadcom/brcmstb_thermal.c | 386 +++++++++++++++++++++ 8 files changed, 425 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-tmon.txt create mode 100644 drivers/thermal/broadcom/brcmstb_thermal.c
Signature · 1 line
Florian