Skip to contentSkip to conversation

hwmon: Add KEBA fan controller support

PATCH Applied Gerhard Engleder 2 participants 3 messages Apr 25, 2025 – May 13, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: Add KEBA fan controller support

From: Gerhard Engleder <[email protected]>

The KEBA fan controller is found in the system FPGA of KEBA PLC devices. It detects if the fan is removed or blocked. For fans with tacho signal the monitoring of the speed of the fan is supported. It also supports to regulate the speed of fans with PWM input.

The auxiliary device for this driver is instantiated by the cp500 misc driver.

---
 Documentation/hwmon/index.rst |   1 +
 Documentation/hwmon/kfan.rst  |  39 ++++++
 drivers/hwmon/Kconfig         |  10 ++
 drivers/hwmon/Makefile        |   1 +
 drivers/hwmon/kfan.c          | 243 ++++++++++++++++++++++++++++++++++
 5 files changed, 294 insertions(+)
 create mode 100644 Documentation/hwmon/kfan.rst
 create mode 100644 drivers/hwmon/kfan.c
Documentation/hwmon/index.rst +1 -0
index 946b8a266d89..983aa0233e4a 100644
@@ -107,6 +107,7 @@ Hardware Monitoring Kernel Drivers
    k10temp
    k8temp
    kbatt
+   kfan
    lan966x
    lineage-pem
    lm25066
Documentation/hwmon/kfan.rst new file +39 -0
new file mode 100644
index 000000000000..ce02dddfb4b8
@@ -0,0 +1,39 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+Kernel driver kfan
+==================
+
+Supported chips:
+
+  * KEBA fan controller (IP core in FPGA)
+
+    Prefix: 'kfan'
+
+Authors:
+
+	Gerhard Engleder <[email protected]>
+	Petar Bojanic <[email protected]>
+
+Description
+-----------
+
+The KEBA fan controller is an IP core for FPGAs, which monitors the health
+and controls the speed of a fan. The fan is typically used to cool the CPU
+and the whole device. E.g., the CP500 FPGA includes this IP core to monitor
+and control the fan of PLCs and the corresponding cp500 driver creates an
+auxiliary device for the kfan driver.
+
+This driver provides information about the fan health to user space.
+The user space shall be informed if the fan is removed or blocked.
+Additionally, the speed in RPM is reported for fans with tacho signal.
+
+For fan control PWM is supported. For PWM 255 equals 100%. None-regulable
+fans can be turned on with PWM 255 and turned off with PWM 0.
+
+====================== ==== ===================================================
+Attribute              R/W  Contents
+====================== ==== ===================================================
+fan1_fault             R    Fan fault
+fan1_input             R    Fan tachometer input (in RPM)
+pwm1                   RW   Fan target duty cycle (0..255)
+====================== ==== ===================================================
drivers/hwmon/Kconfig +10 -0
index 80e277448c71..01b21fe55ccd 100644
@@ -345,6 +345,16 @@ config SENSORS_KBATT
 	  This driver can also be built as a module. If so, the module
 	  will be called kbatt.
 
+config SENSORS_KFAN
+	tristate "KEBA fan controller support"
+	depends on KEBA_CP500
+	help
+	  This driver supports the fan controller found in KEBA system
+	  FPGA devices.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called kfan.
+
 config SENSORS_FAM15H_POWER
 	tristate "AMD Family 15h processor power"
 	depends on X86 && PCI && CPU_SUP_AMD
drivers/hwmon/Makefile +1 -0
index 50df221f67c2..c34a0ae658e0 100644
@@ -111,6 +111,7 @@ obj-$(CONFIG_SENSORS_JC42)	+= jc42.o
 obj-$(CONFIG_SENSORS_K8TEMP)	+= k8temp.o
 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_LENOVO_EC)	+= lenovo-ec-sensors.o
 obj-$(CONFIG_SENSORS_LINEAGE)	+= lineage-pem.o
drivers/hwmon/kfan.c new file +243 -0

243 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#1 lore raw
Quoted 11 lines · Gerhard Engleder

From: Gerhard Engleder <[email protected]>

The KEBA fan controller is found in the system FPGA of KEBA PLC devices. It detects if the fan is removed or blocked. For fans with tacho signal the monitoring of the speed of the fan is supported. It also supports to regulate the speed of fans with PWM input.

The auxiliary device for this driver is instantiated by the cp500 misc driver.

Applied.

Thanks,
Guenter

#2 lore raw
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Gerhard Engleder

From: Gerhard Engleder <[email protected]>

The KEBA fan controller is found in the system FPGA of KEBA PLC devices. It detects if the fan is removed or blocked. For fans with tacho signal the monitoring of the speed of the fan is supported. It also supports to regulate the speed of fans with PWM input.

Quoted 6 lines
Quoted 4 lines

The auxiliary device for this driver is instantiated by the cp500 misc driver.

Applied.

Thanks for applying and fixing the fall through warnings of clang!

regards, gerhard