Skip to contentSkip to conversation

Amazon's Annapurna Labs Thermal Sensor Driver

PATCH Superseded Talel Shenhar 2 participants 4 messages Apr 4, 2019 – Apr 10, 2019

Subsystems (3)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Talel Shenhar

author maintainer
#0 lore raw

v2 cover Amazon's Annapurna Labs Thermal Sensor Driver

This series introduces support for Amazon's Annapurna Labs Thermal Sensor based on a new simple MMIO thermal driver. This driver is intended to be used by other devices as well, which require just a simple MMIO access to read temperature.

Changes since v1:
==================
- removed the "thermal_mmio" compatible string. With v2 version, only specific hardware can bound
- add initialization function that is mapped based on the specific binding string
- removed thermal_mmio_readl and thermal_readw, but kept mmio reads in callback function. Left only thermal_mmio_reab which is used by al-thermal
- removed divider, bias, width which are not needed for al-thermal.

Talel Shenhar (2):
dt-bindings: thermal: al-thermal: Add binding documentation
thermal: Introduce Amazon's Annapurna Labs Thermal Driver

 .../bindings/thermal/amazon,al-thermal.txt         |  33 ++++++
 MAINTAINERS                                        |   6 +
 drivers/thermal/Kconfig                            |  10 ++
 drivers/thermal/Makefile                           |   1 +
 drivers/thermal/thermal_mmio.c                     | 129 +++++++++++++++++++++
 5 files changed, 179 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt
 create mode 100644 drivers/thermal/thermal_mmio.c
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH v2 1/2 dt-bindings: thermal: al-thermal: Add binding documentation

Add thermal binding documentation for Amazon's Annapurna Labs Thermal Sensor.

---
 .../bindings/thermal/amazon,al-thermal.txt         | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt
Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt new file +33 -0
new file mode 100644
index 0000000..af8cf18
@@ -0,0 +1,33 @@
+Amazon's Annapurna Labs Thermal Sensor
+
+Simple thermal device that allows temperature reading by a single MMIO
+transaction.
+
+Required properties:
+- compatible: "amazon,al-thermal".
+- reg: The physical base address and length of the sensor's registers.
+- #thermal-sensor-cells: Must be 1. See ./thermal.txt for a description.
+
+Example:
+	thermal: thermal {
+		compatible = "amazon,al-thermal";
+		reg = <0x0 0x05002860 0x0 0x1>;
+		#thermal-sensor-cells = <0x1>;
+	};
+
+	thermal-zones {
+		thermal_z0 {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+			thermal-sensors = <&thermal 0>;
+			trips {
+				thermalz0_crit {
+					temperature = <105000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+
+		};
+	};
+
Signature · 1 line
2.7.4
author maintainer
#3 lore raw

PATCH v2 2/2 thermal: Introduce Amazon's Annapurna Labs Thermal Driver

In reply to Talel Shenhar

This is a generic thermal driver for simple MMIO sensors, of which amazon,al-thermal is one.

This device uses a single MMIO transaction to read the temperature and report it to the thermal subsystem.

---
 MAINTAINERS                    |   6 ++
 drivers/thermal/Kconfig        |  10 ++++
 drivers/thermal/Makefile       |   1 +
 drivers/thermal/thermal_mmio.c | 129 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 146 insertions(+)
 create mode 100644 drivers/thermal/thermal_mmio.c
MAINTAINERS +6 -0
index 955463f..262cb2c 100644
@@ -727,6 +727,12 @@ S:	Supported
 F:	Documentation/networking/ena.txt
 F:	drivers/net/ethernet/amazon/
 
+AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER
+M:	Talel Shenhar <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt
+F:	drivers/thermal/thermal_mmio.c
+
 AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER
 M:	Tom Lendacky <[email protected]>
 M:	Gary Hook <[email protected]>
drivers/thermal/Kconfig +10 -0
index 1775d44..96d9236 100644
@@ -199,6 +199,16 @@ config THERMAL_EMULATION
 	  because userland can easily disable the thermal policy by simply
 	  flooding this sysfs node with low temperature values.
 
+config THERMAL_MMIO
+	tristate "Generic Thermal MMIO driver"
+	depends on OF || COMPILE_TEST
+	help
+	  This option enables the generic thermal MMIO driver that will use
+	  memory-mapped reads to get the temperature.  Any HW/System that
+	  allows temperature reading by a single memory-mapped reading, be it
+	  register or shared memory, is a potential candidate to work with this
+	  driver.
+
 config HISI_THERMAL
 	tristate "Hisilicon thermal driver"
 	depends on ARCH_HISI || COMPILE_TEST
drivers/thermal/Makefile +1 -0
index 82bb50d..d4c9ae7 100644
@@ -29,6 +29,7 @@ thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
 
 # platform thermal drivers
 obj-y				+= broadcom/
+obj-$(CONFIG_THERMAL_MMIO)		+= thermal_mmio.o
 obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM)	+= qcom-spmi-temp-alarm.o
 obj-$(CONFIG_SPEAR_THERMAL)	+= spear_thermal.o
 obj-$(CONFIG_ROCKCHIP_THERMAL)	+= rockchip_thermal.o
drivers/thermal/thermal_mmio.c new file +129 -0

129 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: thermal: al-thermal: Add binding documentation

In reply to Talel Shenhar
Quoted 25 lines · Talel Shenhar

Add thermal binding documentation for Amazon's Annapurna Labs Thermal Sensor.

---
 .../bindings/thermal/amazon,al-thermal.txt         | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt
Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt new file +9 -0
new file mode 100644
index 0000000..af8cf18
@@ -0,0 +1,33 @@
+Amazon's Annapurna Labs Thermal Sensor
+
+Simple thermal device that allows temperature reading by a single MMIO
+transaction.
+
+Required properties:
+- compatible: "amazon,al-thermal".
+- reg: The physical base address and length of the sensor's registers.
+- #thermal-sensor-cells: Must be 1. See ./thermal.txt for a description.

Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt line 19

Quoted 10 lines
Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt new file +10 -0
+
+Example:
+	thermal: thermal {
+		compatible = "amazon,al-thermal";
+		reg = <0x0 0x05002860 0x0 0x1>;
+		#thermal-sensor-cells = <0x1>;
+	};
+
+	thermal-zones {
+		thermal_z0 {

thermal-z0 {

Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt line 24

Quoted 5 lines
Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt new file +5 -0
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+			thermal-sensors = <&thermal 0>;
+			trips {
+				thermalz0_crit {

critical {

With that,

Quoted 12 lines
Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt new file +9 -0
+					temperature = <105000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+
+		};
+	};
+
Signature · 1 line
2.7.4