Skip to contentSkip to conversation

hwmon: Add LattePanda Sigma EC driver

PATCH Applied Mariano Abad 2 participants 2 messages Mar 3

Subsystems (3)
lore
Share & tools
lore

Mariano Abad

author maintainer
#0 lore raw

PATCH v3 1/1 hwmon: Add LattePanda Sigma EC driver

Add hardware monitoring support for the LattePanda Sigma SBC (DFRobot, ITE IT8613E EC). The driver reads fan speed and temperatures via direct port I/O, as the BIOS disables the ACPI EC interface.

---
Hi Guenter,

Thank you for taking the time to review this again and for the detailed feedback — I really appreciate your patience. The rollover catch was a great point, I hadn't considered that scenario.

All points addressed:

- Trimmed commit message — moved details to code comments and documentation
- Added devm_request_region() for both EC ports (0x62, 0x66) in probe — used the devm variant for consistency with the rest of probe which already uses devm-managed resources
- Fixed alignment on platform_device_register_simple()
- Added read-twice-verify in ec_read_reg16() to guard against 16-bit rollover between reading high and low bytes, following the same approach as lm90_read16()

V2 -> V3:
- Trim commit message body (details already in code and docs)
- Reserve EC I/O ports with devm_request_region()
- Fix argument alignment in platform_device_register_simple()
- Guard ec_read_reg16() against 16-bit rollover

V1 -> V2:
- Add to Documentation/hwmon/index.rst
- Move reverse-engineering details from .rst to .c code comments
- BIOS version matching + force module parameter
- Document why no ACPI lock or driver mutex is needed
- Replace usleep_range() with udelay() (EC protocol requires it)
- Handle temperature as unsigned 8-bit
- Register platform_driver before platform_device (correct order)

v2: https://lore.kernel.org/linux-hwmon/[email protected]/
v1: https://lore.kernel.org/linux-hwmon/[email protected]/

 Documentation/hwmon/index.rst               |   1 +
 Documentation/hwmon/lattepanda-sigma-ec.rst |  61 ++++
 MAINTAINERS                                 |   7 +
 drivers/hwmon/Kconfig                       |  17 +
 drivers/hwmon/Makefile                      |   1 +
 drivers/hwmon/lattepanda-sigma-ec.c         | 359 ++++++++++++++++++++
 6 files changed, 446 insertions(+)
 create mode 100644 Documentation/hwmon/lattepanda-sigma-ec.rst
 create mode 100644 drivers/hwmon/lattepanda-sigma-ec.c
Documentation/hwmon/index.rst +1 -0
index d91dbb20c..dff283064 100644
@@ -111,6 +111,7 @@ Hardware Monitoring Kernel Drivers
    kbatt
    kfan
    lan966x
+   lattepanda-sigma-ec
    lineage-pem
    lm25066
    lm63
Documentation/hwmon/lattepanda-sigma-ec.rst new file +61 -0

61 lines not on this page · raw message

MAINTAINERS +7 -0
index 96e97d25e..7b0c5bb5d 100644
@@ -14414,6 +14414,13 @@ F:	drivers/net/wan/framer/
 F:	drivers/pinctrl/pinctrl-pef2256.c
 F:	include/linux/framer/
 
+LATTEPANDA SIGMA EC HARDWARE MONITOR DRIVER
+M:	Mariano Abad <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/hwmon/lattepanda-sigma-ec.rst
+F:	drivers/hwmon/lattepanda-sigma-ec.c
+
 LASI 53c700 driver for PARISC
 M:	"James E.J. Bottomley" <[email protected]>
 L:	[email protected]
drivers/hwmon/Kconfig +17 -0
index 41c381764..f2e2ee96f 100644
@@ -990,6 +990,23 @@ config SENSORS_LAN966X
 	  This driver can also be built as a module. If so, the module
 	  will be called lan966x-hwmon.
 
+config SENSORS_LATTEPANDA_SIGMA_EC
+	tristate "LattePanda Sigma EC hardware monitoring"
+	depends on X86
+	depends on DMI
+	depends on HAS_IOPORT
+	help
+	  If you say yes here you get support for the hardware monitoring
+	  features of the Embedded Controller on LattePanda Sigma
+	  single-board computers, including CPU fan speed (RPM) and
+	  board and CPU temperatures.
+
+	  The driver reads the EC directly via ACPI EC I/O ports and
+	  uses DMI matching to ensure it only loads on supported hardware.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called lattepanda-sigma-ec.
+
 config SENSORS_LENOVO_EC
         tristate "Sensor reader for Lenovo ThinkStations"
         depends on X86
drivers/hwmon/Makefile +1 -0
index eade8e3b1..0372fedbb 100644
@@ -114,6 +114,7 @@ obj-$(CONFIG_SENSORS_K10TEMP)	+= k10temp.o
 obj-$(CONFIG_SENSORS_KBATT)	+= kbatt.o
 obj-$(CONFIG_SENSORS_KFAN)	+= kfan.o
 obj-$(CONFIG_SENSORS_LAN966X)	+= lan966x-hwmon.o
+obj-$(CONFIG_SENSORS_LATTEPANDA_SIGMA_EC) += lattepanda-sigma-ec.o
 obj-$(CONFIG_SENSORS_LENOVO_EC)	+= lenovo-ec-sensors.o
 obj-$(CONFIG_SENSORS_LINEAGE)	+= lineage-pem.o
 obj-$(CONFIG_SENSORS_LOCHNAGAR)	+= lochnagar-hwmon.o
drivers/hwmon/lattepanda-sigma-ec.c new file +359 -0

359 lines not on this page · raw message

base-commit: 4d349ee5c7782f8b27f6cb550f112c5e26fff38d

Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Mariano Abad

Add hardware monitoring support for the LattePanda Sigma SBC (DFRobot, ITE IT8613E EC). The driver reads fan speed and temperatures via direct port I/O, as the BIOS disables the ACPI EC interface.

Quoted 9 lines

---
Hi Guenter,

Thank you for taking the time to review this again and for the detailed feedback — I really appreciate your patience. The rollover catch was a great point, I hadn't considered that scenario.

My pleasure.

Applied.

Thanks,
Guenter