bcm2835: add thermal driver
Subsystems (5)
v3 cover bcm2835: add thermal driver
From: Martin Sperl <[email protected]>
Add a thermal driver for the TSENSE device of the bcm2835 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
* 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)
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
Martin Sperl (5):
dt: bindings: add thermal device driver for bcm2835
thermal: bcm2835: add thermal driver for bcm2835 soc
ARM: bcm2835: add thermal node to device-tree of bcm283x
ARM: bcm2835: add thermal driver to default_config
ARM: multi_v7_defconfig: bcm2835: add bcm2835-thermal driver
.../bindings/thermal/brcm,bcm2835-thermal.txt | 17 ++ arch/arm/boot/dts/bcm283x.dtsi | 6 + arch/arm/configs/bcm2835_defconfig | 2 + arch/arm/configs/multi_v7_defconfig | 1 + drivers/thermal/Kconfig | 5 + drivers/thermal/Makefile | 1 + drivers/thermal/bcm/Kconfig | 4 + drivers/thermal/bcm/Makefile | 1 + drivers/thermal/bcm/bcm2835_thermal.c | 326 +++++++++++++++++++++ 9 files changed, 363 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/brcm,bcm2835-thermal.txt create mode 100644 drivers/thermal/bcm/Kconfig create mode 100644 drivers/thermal/bcm/Makefile create mode 100644 drivers/thermal/bcm/bcm2835_thermal.c
--
2.1.4
PATCH v3 1/5 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>; +};
--
2.1.4
PATCH v3 2/5 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)
--- drivers/thermal/Kconfig | 5 + drivers/thermal/Makefile | 1 + drivers/thermal/bcm/Kconfig | 4 + drivers/thermal/bcm/Makefile | 1 + drivers/thermal/bcm/bcm2835_thermal.c | 326 ++++++++++++++++++++++++++++++++++ 5 files changed, 337 insertions(+) create mode 100644 drivers/thermal/bcm/Kconfig create mode 100644 drivers/thermal/bcm/Makefile create mode 100644 drivers/thermal/bcm/bcm2835_thermal.c
drivers/thermal/Kconfig +5 -0
@@ -383,6 +383,11 @@ config MTK_THERMAL Enable this option if you want to have support for thermal management controller present in Mediatek SoCs +menu "Broadcom thermal drivers" +depends on ARCH_BCM || COMPILE_TEST +source "drivers/thermal/bcm/Kconfig" +endmenu + menu "Texas Instruments thermal drivers" depends on ARCH_HAS_BANDGAP || COMPILE_TEST depends on HAS_IOMEM
drivers/thermal/Makefile +1 -0
@@ -49,3 +49,4 @@ obj-$(CONFIG_ST_THERMAL) += st/ obj-$(CONFIG_TEGRA_SOCTHERM) += tegra_soctherm.o obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o +obj-y += bcm/
drivers/thermal/bcm/Kconfig new file +4 -0
@@ -0,0 +1,4 @@ +config BCM2835_THERMAL + tristate "Thermal sensors on bcm2835 SoC" + help + Support for thermal sensors on Broadcom bcm2835 SoCs.
drivers/thermal/bcm/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_BCM2835_THERMAL) := bcm2835_thermal.o
drivers/thermal/bcm/bcm2835_thermal.c new file +326 -0
326 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v3 3/5 ARM: bcm2835: 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.
--- arch/arm/boot/dts/bcm283x.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +6 -0
@@ -153,6 +153,12 @@ status = "disabled"; }; + thermal: thermal at 0x7e212000 { + compatible = "brcm,bcm2835-thermal"; + reg = <0x7e212000 0x8>; + clocks = <&clocks BCM2835_CLOCK_TSENS>; + }; + aux: aux at 0x7e215000 { compatible = "brcm,bcm2835-aux"; #clock-cells = <1>;
Signature · 1 line
2.1.4
PATCH v3 4/5 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
@@ -71,6 +71,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_FB=y
Signature · 1 line
2.1.4
PATCH v3 5/5 ARM: multi_v7_defconfig: bcm2835: add bcm2835-thermal driver
In reply to kernel at martin.sperl.orgFrom: Martin Sperl <[email protected]>
Add the thermal driver to list of compiled modules in multi_v7_defconfig.
Changelog:
V1 -> V2: added this patch
V2 -> V3: made driver compile as a module not in-kernel
--- arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -422,6 +422,7 @@ CONFIG_CPU_THERMAL=y CONFIG_ROCKCHIP_THERMAL=y CONFIG_RCAR_THERMAL=y CONFIG_ARMADA_THERMAL=y +CONFIG_BCM2835_THERMAL=m CONFIG_DAVINCI_WATCHDOG=m CONFIG_EXYNOS_THERMAL=m CONFIG_ST_THERMAL_SYSCFG=y
--
2.1.4
PATCH v3 2/5 thermal: bcm2835: add thermal driver for bcm2835 soc
In reply to kernel at martin.sperl.orgQuoted 39 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]>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 inclk-bcm2835.c)
---drivers/thermal/bcm/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_BCM2835_THERMAL) := bcm2835_thermal.odrivers/thermal/bcm/bcm2835_thermal.c new file +7
-0+static const struct of_device_id bcm2835_thermal_of_match_table[]; +static int bcm2835_thermal_probe (struct platform_device *pdev) +{ +/* enable clock and check rate */ +clk_prepare_enable (data->clk); + rate =clk_get_rate (data->clk); +if ((rate <1920000 ) || (rate >5000000 )) {
drivers/thermal/bcm/bcm2835_thermal.c line 256
Quoted 10 lines
drivers/thermal/bcm/bcm2835_thermal.c new file +10
-0+dev_warn (&pdev->dev, +"Clock %pCn is running at %pCr Hz, which is outside the recommended range of 1.9 to 5.0 MHz\n" , + data->clk, data->clk); + } + +/* register it */ + tz =thermal_zone_device_register ("bcm2835_thermal" , +1 ,0 , data, + &bcm2835_thermal_ops, +NULL ,0 ,0 );
I notice that the polling_delay is set to 0, but we're not using interrupts to trigger the trip. Is it valid to expose a trip without a polling_delay or interrupts? Should passive_delay be set as well?
This is up to the thermal maintainers. As far as I'm concerned, it's:
One it lands I'll pull the defconfig and DT bits.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160531/fdfb9eec/attachment.sig>
PATCH v3 2/5 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 56 lines · Eric Anholt
Quoted 39 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]>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 inclk-bcm2835.c)
---drivers/thermal/bcm/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_BCM2835_THERMAL) := bcm2835_thermal.odrivers/thermal/bcm/bcm2835_thermal.c new file +7
-0+static const struct of_device_id bcm2835_thermal_of_match_table[]; +static int bcm2835_thermal_probe (struct platform_device *pdev) +{ +/* enable clock and check rate */ +clk_prepare_enable (data->clk); + rate =clk_get_rate (data->clk); +if ((rate <1920000 ) || (rate >5000000 )) {drivers/thermal/bcm/bcm2835_thermal.c line 256
Quoted 10 lines
drivers/thermal/bcm/bcm2835_thermal.c new file +10
-0+dev_warn (&pdev->dev, +"Clock %pCn is running at %pCr Hz, which is outside the recommended range of 1.9 to 5.0 MHz\n" , + data->clk, data->clk); + } + +/* register it */ + tz =thermal_zone_device_register ("bcm2835_thermal" , +1 ,0 , data, + &bcm2835_thermal_ops, +NULL ,0 ,0 );I notice that the
polling_delayis set to 0, but we're not using interrupts to trigger the trip. Is it valid to expose a trip without apolling_delayor interrupts? Shouldpassive_delaybe set as well?
Quoted 5 lines
This is up to the thermal maintainers. As far as I'm concerned, it's:
Acked-by Eric Anholt <[email protected]>One it lands I'll pull the defconfig and DT bits.
Ping on this question to thermal maintainers. I'd still love to see
this driver land.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160818/6eb1e5f3/attachment.sig>
Zhang Rui
reviewerPATCH v3 2/5 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 65 lines · Eric Anholt
Quoted 63 lines · Eric Anholt
Quoted 47 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]>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 inclk-bcm2835.c)
---drivers/thermal/bcm/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_BCM2835_THERMAL) :=bcm2835_thermal.o
drivers/thermal/bcm/bcm2835_thermal.c new file +1
-0+static const struct of_device_idbcm2835_thermal_of_match_table[];
drivers/thermal/bcm/bcm2835_thermal.c new file +8
-0+static int bcm2835_thermal_probe (struct platform_device *pdev) +{ +/* enable clock and check rate */ +clk_prepare_enable (data->clk); + rate =clk_get_rate (data->clk); +if ((rate <1920000 ) || (rate >5000000 )) { + dev_warn(&pdev->dev, + ?"Clock %pCn is running at %pCr Hz,which is outside the recommended range of 1.9 to 5.0 MHz\n",
drivers/thermal/bcm/bcm2835_thermal.c
Quoted 8 lines
drivers/thermal/bcm/bcm2835_thermal.c new file +8
-0+ ?data->clk, data->clk); + } + +/* register it */ + tz =thermal_zone_device_register ("bcm2835_thermal" , + ??1, 0, data, + ??&bcm2835_thermal_ops, + ??NULL, 0, 0);I notice that the
polling_delayis set to 0, but we're not using interrupts to trigger the trip.??Is it valid to expose a trip without apolling_delayor interrupts???Shouldpassive_delaybe set as well?
Quoted 8 lines
Quoted 6 lines
This is up to the thermal maintainers.??As far as I'm concerned, it's:
Acked-by Eric Anholt <[email protected]>One it lands I'll pull the defconfig and DT bits.
Ping on this question to thermal maintainers.??I'd still love to see this driver land.
hmmm, how is this driver supposed to work?
With this patch set, I think the only benefit is that we can get the temperature and trip point information via thermal sysfs interface, but kernel thermal control is a no-op here, right?
thanks,
rui
PATCH v3 2/5 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 71 lines · Zhang Rui
Quoted 70 lines · Eric Anholt
Quoted 68 lines · Eric Anholt
Quoted 47 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]>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 inclk-bcm2835.c)
---drivers/thermal/bcm/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_BCM2835_THERMAL) :=bcm2835_thermal.o
drivers/thermal/bcm/bcm2835_thermal.c new file +1
-0+static const struct of_device_idbcm2835_thermal_of_match_table[];
drivers/thermal/bcm/bcm2835_thermal.c new file +8
-0+static int bcm2835_thermal_probe (struct platform_device *pdev) +{ +/* enable clock and check rate */ +clk_prepare_enable (data->clk); + rate =clk_get_rate (data->clk); +if ((rate <1920000 ) || (rate >5000000 )) { + dev_warn(&pdev->dev, + ?"Clock %pCn is running at %pCr Hz,which is outside the recommended range of 1.9 to 5.0 MHz\n",
drivers/thermal/bcm/bcm2835_thermal.c
Quoted 8 lines
drivers/thermal/bcm/bcm2835_thermal.c new file +8
-0+ ?data->clk, data->clk); + } + +/* register it */ + tz =thermal_zone_device_register ("bcm2835_thermal" , + ??1, 0, data, + ??&bcm2835_thermal_ops, + ??NULL, 0, 0);I notice that the
polling_delayis set to 0, but we're not using interrupts to trigger the trip.??Is it valid to expose a trip without apolling_delayor interrupts???Shouldpassive_delaybe set as well?This is up to the thermal maintainers.??As far as I'm concerned, it's:
Acked-by Eric Anholt <[email protected]>
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
One it lands I'll pull the defconfig and DT bits.
Ping on this question to thermal maintainers.??I'd still love to see this driver land.
hmmm, how is this driver supposed to work?
With this patch set, I think the only benefit is that we can get the temperature and trip point information via thermal sysfs interface, but kernel thermal control is a no-op here, right?
Yeah. It seems useful to be able to get the information. Once we land
this, I hope someone can add interrupt support so that there are actual
trip points.
-------------- 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/20160819/166e10c1/attachment.sig>
Zhang Rui
reviewerPATCH v3 2/5 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 93 lines · Eric Anholt
Quoted 85 lines · Zhang Rui
Quoted 77 lines · Eric Anholt
Quoted 74 lines · Eric Anholt
Quoted 58 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]>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 inclk-bcm2835.c)
---drivers/thermal/bcm/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_BCM2835_THERMAL) :=bcm2835_thermal.o
drivers/thermal/bcm/bcm2835_thermal.c new file +1
-0+static const struct of_device_idbcm2835_thermal_of_match_table[];
+static intbcm2835_thermal_probe(struct platform_device *pdev)drivers/thermal/bcm/bcm2835_thermal.c new file +7
-0+{ +/* enable clock and check rate */ +clk_prepare_enable (data->clk); + rate =clk_get_rate (data->clk); +if ((rate <1920000 ) || (rate >5000000 )) { + dev_warn(&pdev->dev, + ?"Clock %pCn is running at %pCr Hz,which is outside the recommended range of 1.9 to 5.0 MHz\n",
drivers/thermal/bcm/bcm2835_thermal.c new file +7
-0+ ?data->clk, data->clk); + } + +/* register it */ + tz =thermal_zone_device_register ("bcm2835_thermal" , + ??1, 0, data, + ??&bcm2835_thermal_ops,
drivers/thermal/bcm/bcm2835_thermal.c
Quoted 1 line
drivers/thermal/bcm/bcm2835_thermal.c new file +1
-0+ ??NULL, 0, 0);I notice that the
polling_delayis set to 0, but we're not using
interrupts to trigger the trip.??Is it valid to expose a trip without apolling_delayor interrupts???Shouldpassive_delaybe set as well?This is up to the thermal maintainers.??As far as I'm concerned,
it's:Quoted 6 lines
Quoted 3 lines
Acked-by Eric Anholt <[email protected]>One it lands I'll pull the defconfig and DT bits.
Ping on this question to thermal maintainers.??I'd still love to see
this driver land.Quoted 6 lines
hmmm, how is this driver supposed to work?
With this patch set, I think the only benefit is that we can get the
temperature and trip point information via thermal sysfs interface, but
kernel thermal control is a no-op here, right?
Quoted 5 lines
Yeah.??It seems useful to be able to get the information.??Once we land
this, I hope someone can add interrupt support so that there are actual
trip points.
sounds reasonable to me.
Another question, why you need a separate directory for a single file,?bcm2835_thermal.c?
thanks,
rui
Zhang Rui
reviewerPATCH v3 2/5 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 106 lines · Zhang Rui
Quoted 105 lines · Eric Anholt
Quoted 102 lines · Zhang Rui
Quoted 85 lines · Eric Anholt
Quoted 81 lines · Eric Anholt
Quoted 64 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]>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 inclk-bcm2835.c)
---drivers/thermal/bcm/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_BCM2835_THERMAL) :=bcm2835_thermal.o
drivers/thermal/bcm/bcm2835_thermal.c new file +1
-0+static const struct of_device_idbcm2835_thermal_of_match_table[];
+static intbcm2835_thermal_probe(struct platform_device *pdev)drivers/thermal/bcm/bcm2835_thermal.c new file +7
-0+{ +/* enable clock and check rate */ +clk_prepare_enable (data->clk); + rate =clk_get_rate (data->clk); +if ((rate <1920000 ) || (rate >5000000 )) { + dev_warn(&pdev->dev, + ?"Clock %pCn is running at %pCrHz,
which is outside the recommended range of 1.9 to 5.0 MHz\n",drivers/thermal/bcm/bcm2835_thermal.c new file +5
-0+ ?data->clk, data->clk); + } + +/* register it */ + tz =thermal_zone_device_register("bcm2835_thermal",
drivers/thermal/bcm/bcm2835_thermal.c new file +2
-0+ ??1, 0, data, + ??&bcm2835_thermal_o
ps,drivers/thermal/bcm/bcm2835_thermal.c
Quoted 1 line
drivers/thermal/bcm/bcm2835_thermal.c new file +1
-0+ ??NULL, 0, 0);I notice that the
polling_delayis set to 0, but we're not using
interrupts to trigger the trip.??Is it valid to expose a trip without apolling_delayor interrupts???Shouldpassive_delaybe set as well?This is up to the thermal maintainers.??As far as I'm concerned,
it's:Quoted 7 lines
Quoted 3 lines
Acked-by Eric Anholt <[email protected]>One it lands I'll pull the defconfig and DT bits.
Ping on this question to thermal maintainers.??I'd still love to
see
this driver land.hmmm, how is this driver supposed to work?
With this patch set, I think the only benefit is that we can get the
temperature and trip point information via thermal sysfs interface,
but
kernel thermal control is a no-op here, right?
Quoted 6 lines
Quoted 5 lines
Yeah.??It seems useful to be able to get the information.??Once we land
this, I hope someone can add interrupt support so that there are actual
trip points.sounds reasonable to me.
BTW, can you add a "TODO" comment for this gap?
thanks,
rui
Quoted 10 lines
Another question, why you need a separate directory for a single file,?bcm2835_thermal.c?
thanks,
rui
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo at vger.kernel.org More majordomo info at??http://vger.kernel.org/majordomo-info.html
PATCH v3 2/5 thermal: bcm2835: add thermal driver for bcm2835 soc
In reply to Zhang RuiQuoted 103 lines · Zhang Rui
Quoted 95 lines · Eric Anholt
Quoted 85 lines · Zhang Rui
Quoted 79 lines · Eric Anholt
Quoted 74 lines · Eric Anholt
Quoted 57 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]>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 inclk-bcm2835.c)
---drivers/thermal/bcm/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_BCM2835_THERMAL) :=bcm2835_thermal.o
drivers/thermal/bcm/bcm2835_thermal.c new file +1
-0+static const struct of_device_idbcm2835_thermal_of_match_table[];
+static intbcm2835_thermal_probe(struct platform_device *pdev)drivers/thermal/bcm/bcm2835_thermal.c new file +7
-0+{ +/* enable clock and check rate */ +clk_prepare_enable (data->clk); + rate =clk_get_rate (data->clk); +if ((rate <1920000 ) || (rate >5000000 )) { + dev_warn(&pdev->dev, + "Clock %pCn is running at %pCr Hz,which is outside the recommended range of 1.9 to 5.0 MHz\n",
drivers/thermal/bcm/bcm2835_thermal.c new file +7
-0+ data->clk, data->clk); + } + +/* register it */ + tz =thermal_zone_device_register ("bcm2835_thermal" , +1 ,0 , data, + &bcm2835_thermal_oQuoted 2 lines
ps,
+ NULL, 0, 0);I notice that the
polling_delayis set to 0, but we're not using
interrupts to trigger the trip. Is it valid to expose a trip without apolling_delayor interrupts? Shouldpassive_delaybe set as well?This is up to the thermal maintainers. As far as I'm concerned,
it's:Quoted 6 lines
Quoted 3 lines
Acked-by Eric Anholt <[email protected]>One it lands I'll pull the defconfig and DT bits.
Ping on this question to thermal maintainers. I'd still love to see
this driver land.Quoted 6 lines
hmmm, how is this driver supposed to work?
With this patch set, I think the only benefit is that we can get the
temperature and trip point information via thermal sysfs interface, but
kernel thermal control is a no-op here, right?Quoted 5 lines
Yeah. It seems useful to be able to get the information. Once we land
this, I hope someone can add interrupt support so that there are actual
trip points.
Quoted 3 lines
sounds reasonable to me.
Another question, why you need a separate directory for a single file,bcm2835_thermal.c?
Lots of other subsystems (clk, sound/soc, ...) are using vendor specific sub directories.
In thermal there are already subdirectories for Samsung or st. So this was done in this case as well to support Broadcom immediately following this pattern.
You want a new version to keep it in thermal directly I can create a new version of the patch.
Thanks, Martin
Zhang Rui
reviewerPATCH v3 2/5 thermal: bcm2835: add thermal driver for bcm2835 soc
Quoted 126 lines · Martin Sperl
Quoted 116 lines · Zhang Rui
Quoted 108 lines · Eric Anholt
Quoted 95 lines · Zhang Rui
Quoted 88 lines · Eric Anholt
Quoted 81 lines · Eric Anholt
Quoted 55 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]>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 inclk-bcm2835.c)
---drivers/thermal/bcm/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_BCM2835_THERMAL)????????:=bcm2835_thermal.o
drivers/thermal/bcm/bcm2835_thermal.c new file +1
-0+static const struct of_device_idbcm2835_thermal_of_match_table[];
+static intbcm2835_thermal_probe(struct platform_device *pdev)
+{+????/* enable clock and check rate */ +????clk_prepare_enable(data->clk); +????rate =
clk_get_rate(data->clk);
+????if ((rate < 1920000) || (rate > 5000000)) { +????????dev_warn(&pdev->dev, +?????????????"Clock %pCn is running at %pCr Hz, which is outside the recommended range of 1.9 to 5.0 MHz\n",
+?????????????data->clk,data->clk);Quoted 8 lines
+????}
+
+????/* register it */
+????tz = thermal_zone_device_register("bcm2835_thermal", +??????????????????????1, 0, data, +??????????????????????&bcm2835_thermal_o
ps,
+??????????????????????NULL, 0, 0);I notice that the
polling_delayis set to 0, but we're not using
interrupts to trigger the trip.??Is it valid to expose a trip
without apolling_delayor interrupts???Shouldpassive_delaybe set as
well?This is up to the thermal maintainers.??As far as I'm concerned,
it's:Quoted 7 lines
Quoted 3 lines
Acked-by Eric Anholt <[email protected]>One it lands I'll pull the defconfig and DT bits.
Ping on this question to thermal maintainers.??I'd still love to
see
this driver land.Quoted 8 lines
hmmm, how is this driver supposed to work?
With this patch set, I think the only benefit is that we can get
the
temperature and trip point information via thermal sysfs interface,
but
kernel thermal control is a no-op here, right?Quoted 6 lines
Yeah.??It seems useful to be able to get the information.??Once we
land
this, I hope someone can add interrupt support so that there are actual
trip points.Quoted 3 lines
sounds reasonable to me.
Another question, why you need a separate directory for a single file,bcm2835_thermal.c?Lots of other subsystems (clk,
sound/soc, ...) are using vendor specific
sub directories.
In thermal there are already subdirectories for Samsung or st. So this was done in this case as well to support Broadcom immediately following this pattern.
Quoted 3 lines
You want a new version to keep it in thermal directly I can create a new version of the patch.
If there are more broadcom patches coming, in your plan, it's okay to have its own subdirectory. Or else, it's better to create the subdirectory when it's actually needed.
thanks,
rui
Quoted 1 line
Thanks, Martin