Skip to contentSkip to conversation

hwmon: xgene: Add support for X-Gene hwmon driver

PATCH In review Hoan Tran 2 participants 6 messages Jul 21, 2016 – Jul 22, 2016

Subsystems (4)
lore
Share & tools
lore

Hoan Tran

author
#0 lore raw

v4 cover hwmon: xgene: Add support for X-Gene hwmon driver

This patch set adds hardware temperature and power reading support for APM X-Gene SoC using the mailbox communication interface. For device tree, it is the standard DT mailbox.
For ACPI, it is the PCC mailbox.

For ACPI, this patch is built on top and depends on patch[1]:
[1] http://www.spinics.net/lists/linux-acpi/msg66041.html
- [PATCH v3] mailbox: pcc: Support HW-Reduced Communication Subspace type 2

v4
- Return 0 if driver registers successfully

v3
- Order include files alphabetically
- Use sign_extend32() to decode temperature
- Use DEVICE_ATTR_RO() for temperature and power attributes
- Temperature and power attributes start with index 1
- Use !!amsg->param2
- Fix checkpatch WARNING with --strict flag
- Use hwmon_device_register_with_groups()
- Check invalid sensor data

v2
- Increase power reading accurateness by using 2 registers
(a register for Watt, another for milli-Watt)
- Remove power reading for SoC
- Fix review comments from Guenter

v1
- Initial

Hoan Tran (3):
Documentation: dtb: xgene: Add hwmon dts binding documentation
hwmon: xgene: Add hwmon driver
arm64: dts: apm: Add X-Gene SoC hwmon to device tree

 .../devicetree/bindings/hwmon/apm-xgene-hwmon.txt  |  14 +
 Documentation/hwmon/xgene-hwmon                    |  30 +
 arch/arm64/boot/dts/apm/apm-shadowcat.dtsi         |   5 +
 arch/arm64/boot/dts/apm/apm-storm.dtsi             |   5 +
 drivers/hwmon/Kconfig                              |   7 +
 drivers/hwmon/Makefile                             |   1 +
 drivers/hwmon/xgene-hwmon.c                        | 755 +++++++++++++++++++++
 7 files changed, 817 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/apm-xgene-hwmon.txt
 create mode 100644 Documentation/hwmon/xgene-hwmon
 create mode 100644 drivers/hwmon/xgene-hwmon.c
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v4 1/3 Documentation: dtb: xgene: Add hwmon dts binding documentation

This patch adds the APM X-Gene hwmon device tree node documentation.

---
 .../devicetree/bindings/hwmon/apm-xgene-hwmon.txt          | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/apm-xgene-hwmon.txt
Documentation/devicetree/bindings/hwmon/apm-xgene-hwmon.txt new file +14 -0
new file mode 100644
index 0000000..59b3855
@@ -0,0 +1,14 @@
+APM X-Gene hwmon driver
+
+APM X-Gene SOC sensors are accessed over the "SLIMpro" mailbox.
+
+Required properties :
+ - compatible : should be "apm,xgene-slimpro-hwmon"
+ - mboxes : use the label reference for the mailbox as the first parameter.
+	    The second parameter is the channel number.
+
+Example :
+	hwmonslimpro {
+		compatible = "apm,xgene-slimpro-hwmon";
+		mboxes = <&mailbox 7>;
+	};
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v4 2/3 hwmon: xgene: Add hwmon driver

In reply to Hoan Tran

This patch adds hardware temperature and power reading support for APM X-Gene SoC using the mailbox communication interface.

---
 Documentation/hwmon/xgene-hwmon |  30 ++
 drivers/hwmon/Kconfig           |   7 +
 drivers/hwmon/Makefile          |   1 +
 drivers/hwmon/xgene-hwmon.c     | 755 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 793 insertions(+)
 create mode 100644 Documentation/hwmon/xgene-hwmon
 create mode 100644 drivers/hwmon/xgene-hwmon.c
Documentation/hwmon/xgene-hwmon new file +30 -0
new file mode 100644
index 0000000..6ec50ed
@@ -0,0 +1,30 @@
+Kernel driver xgene-hwmon
+========================
+
+Supported chips:
+ * APM X-Gene SoC
+
+Description
+-----------
+
+This driver adds hardware temperature and power reading support for
+APM X-Gene SoC using the mailbox communication interface.
+For device tree, it is the standard DT mailbox.
+For ACPI, it is the PCC mailbox.
+
+The following sensors are supported
+
+  * Temperature
+    - SoC on-die temperature in milli-degree C
+    - Alarm when high/over temperature occurs
+  * Power
+    - CPU power in uW
+    - IO power in uW
+
+sysfs-Interface
+---------------
+
+temp0_input - SoC on-die temperature (milli-degree C)
+temp0_critical_alarm - An 1 would indicates on-die temperature exceeded threshold
+power0_input - CPU power in (uW)
+power1_input - IO power in (uW)
drivers/hwmon/Kconfig +7 -0
index ff94007..55218c6 100644
@@ -1787,6 +1787,13 @@ config SENSORS_ULTRA45
 	  This driver provides support for the Ultra45 workstation environmental
 	  sensors.
 
+config SENSORS_XGENE
+	tristate "APM X-Gene SoC hardware monitoring driver"
+	depends on XGENE_SLIMPRO_MBOX || PCC
+	help
+	  If you say yes here you get support for the temperature
+	  and power sensors for APM X-Gene SoC.
+
 if ACPI
 
 comment "ACPI drivers"
drivers/hwmon/Makefile +1 -0
index 2ef5b7c..a2460dd 100644
@@ -162,6 +162,7 @@ obj-$(CONFIG_SENSORS_W83L785TS)	+= w83l785ts.o
 obj-$(CONFIG_SENSORS_W83L786NG)	+= w83l786ng.o
 obj-$(CONFIG_SENSORS_WM831X)	+= wm831x-hwmon.o
 obj-$(CONFIG_SENSORS_WM8350)	+= wm8350-hwmon.o
+obj-$(CONFIG_SENSORS_XGENE)	+= xgene-hwmon.o
 
 obj-$(CONFIG_PMBUS)		+= pmbus/
 
drivers/hwmon/xgene-hwmon.c new file +755 -0

755 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#3 lore raw

PATCH v4 3/3 arm64: dts: apm: Add X-Gene SoC hwmon to device tree

In reply to Hoan Tran

This patch adds DT node to enable hwmon driver for APM X-Gene SoC.

---
 arch/arm64/boot/dts/apm/apm-shadowcat.dtsi | 5 +++++
 arch/arm64/boot/dts/apm/apm-storm.dtsi     | 5 +++++
 2 files changed, 10 insertions(+)
arch/arm64/boot/dts/apm/apm-shadowcat.dtsi +5 -0
index c569f76..a5935f5 100644
@@ -472,6 +472,11 @@
 			mboxes = <&mailbox 0>;
 		};
 
+		hwmonslimpro {
+			compatible = "apm,xgene-slimpro-hwmon";
+			mboxes = <&mailbox 7>;
+		};
+
 		serial0: serial at 10600000 {
 			device_type = "serial";
 			compatible = "ns16550";
arch/arm64/boot/dts/apm/apm-storm.dtsi +5 -0
index 5147d76..f8ea5b5 100644
@@ -716,6 +716,11 @@
 			mboxes = <&mailbox 0>;
 		};
 
+		hwmonslimpro {
+			compatible = "apm,xgene-slimpro-hwmon";
+			mboxes = <&mailbox 7>;
+		};
+
 		serial0: serial at 1c020000 {
 			status = "disabled";
 			device_type = "serial";
Signature · 1 line
1.9.1
maintainer
#4 lore raw
In reply to Hoan Tran
Quoted 9 lines · Hoan Tran

This patch set adds hardware temperature and power reading support for APM X-Gene SoC using the mailbox communication interface. For device tree, it is the standard DT mailbox.
For ACPI, it is the PCC mailbox.

For ACPI, this patch is built on top and depends on patch[1]:
[1] http://www.spinics.net/lists/linux-acpi/msg66041.html
- [PATCH v3] mailbox: pcc: Support HW-Reduced Communication Subspace type 2

One thought: You might consider taking ACPI support out of the driver for now, and add it back in after the dependent patch was accepted.

Guenter

Quoted 39 lines

v4
- Return 0 if driver registers successfully

v3
- Order include files alphabetically
- Use sign_extend32() to decode temperature
- Use DEVICE_ATTR_RO() for temperature and power attributes
- Temperature and power attributes start with index 1
- Use !!amsg->param2
- Fix checkpatch WARNING with --strict flag
- Use hwmon_device_register_with_groups()
- Check invalid sensor data

v2
- Increase power reading accurateness by using 2 registers
(a register for Watt, another for milli-Watt)
- Remove power reading for SoC
- Fix review comments from Guenter

v1
- Initial

Hoan Tran (3):
Documentation: dtb: xgene: Add hwmon dts binding documentation
hwmon: xgene: Add hwmon driver
arm64: dts: apm: Add X-Gene SoC hwmon to device tree

  .../devicetree/bindings/hwmon/apm-xgene-hwmon.txt  |  14 +
  Documentation/hwmon/xgene-hwmon                    |  30 +
  arch/arm64/boot/dts/apm/apm-shadowcat.dtsi         |   5 +
  arch/arm64/boot/dts/apm/apm-storm.dtsi             |   5 +
  drivers/hwmon/Kconfig                              |   7 +
  drivers/hwmon/Makefile                             |   1 +
  drivers/hwmon/xgene-hwmon.c                        | 755 +++++++++++++++++++++
  7 files changed, 817 insertions(+)

create mode 100644 Documentation/devicetree/bindings/hwmon/apm-xgene-hwmon.txt create mode 100644 Documentation/hwmon/xgene-hwmon
create mode 100644 drivers/hwmon/xgene-hwmon.c

author
#5 lore raw

Hi Guenter,

Quoted 13 lines · Guenter Roeck
Quoted 11 lines · Hoan Tran

This patch set adds hardware temperature and power reading support for APM X-Gene SoC using the mailbox communication interface. For device tree, it is the standard DT mailbox.
For ACPI, it is the PCC mailbox.

For ACPI, this patch is built on top and depends on patch[1]:
[1] http://www.spinics.net/lists/linux-acpi/msg66041.html
- [PATCH v3] mailbox: pcc: Support HW-Reduced Communication Subspace
type 2

Quoted 4 lines

One thought: You might consider taking ACPI support out of the driver for now,
and add it back in after the dependent patch was accepted.

Thanks for your suggestion. Rafael agreed to apply this patch as the link below but he didn't do it yet.
http://www.spinics.net/lists/linux-acpi/msg67100.html
Let me check with him again.

Thanks
Hoan

Quoted 45 lines

Guenter

Quoted 41 lines

v4
- Return 0 if driver registers successfully

v3
- Order include files alphabetically
- Use sign_extend32() to decode temperature
- Use DEVICE_ATTR_RO() for temperature and power attributes
- Temperature and power attributes start with index 1
- Use !!amsg->param2
- Fix checkpatch WARNING with --strict flag
- Use hwmon_device_register_with_groups()
- Check invalid sensor data

v2
- Increase power reading accurateness by using 2 registers
(a register for Watt, another for milli-Watt)
- Remove power reading for SoC
- Fix review comments from Guenter

v1
- Initial

Hoan Tran (3):
Documentation: dtb: xgene: Add hwmon dts binding documentation
hwmon: xgene: Add hwmon driver
arm64: dts: apm: Add X-Gene SoC hwmon to device tree

  .../devicetree/bindings/hwmon/apm-xgene-hwmon.txt  |  14 +
  Documentation/hwmon/xgene-hwmon                    |  30 +
  arch/arm64/boot/dts/apm/apm-shadowcat.dtsi         |   5 +
  arch/arm64/boot/dts/apm/apm-storm.dtsi             |   5 +
  drivers/hwmon/Kconfig                              |   7 +
  drivers/hwmon/Makefile                             |   1 +
  drivers/hwmon/xgene-hwmon.c                        | 755
+++++++++++++++++++++
  7 files changed, 817 insertions(+)

create mode 100644
Documentation/devicetree/bindings/hwmon/apm-xgene-hwmon.txt
create mode 100644 Documentation/hwmon/xgene-hwmon create mode 100644 drivers/hwmon/xgene-hwmon.c