Skip to content

Commit e89f78d

Browse files
XECDesignpopcornmix
authored andcommitted
Add rpi-poe-fan driver
Signed-off-by: Serge Schneider <[email protected]> PoE HAT driver cleanup * Fix undeclared variable in rpi_poe_fan_suspend * Add SPDX-License-Identifier * Expand PoE acronym in Kconfig help * Give clearer error message on of_property_count_u32_elems fail * Add documentation * Add vendor to of_device_id compatible string. * Rename m_data_s struct to fw_data_s * Fix typos Fixes: #2665 Signed-off-by: Serge Schneider <[email protected]> rpi-poe-fan: fix def_pwm1 writes Signed-off-by: Serge Schneider <[email protected]>
1 parent 3e88d27 commit e89f78d

File tree

5 files changed

+518
-0
lines changed

5 files changed

+518
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Bindings for the Raspberry Pi PoE HAT fan
2+
3+
Required properties:
4+
- compatible : "raspberrypi,rpi-poe-fan"
5+
- firmware : Reference to the RPi firmware device node
6+
- pwms : the PWM that is used to control the PWM fan
7+
- cooling-levels : PWM duty cycle values in a range from 0 to 255
8+
which correspond to thermal cooling states
9+
10+
Example:
11+
fan0: rpi-poe-fan@0 {
12+
compatible = "raspberrypi,rpi-poe-fan";
13+
firmware = <&firmware>;
14+
cooling-min-state = <0>;
15+
cooling-max-state = <3>;
16+
#cooling-cells = <2>;
17+
cooling-levels = <0 50 150 255>;
18+
status = "okay";
19+
};
20+
21+
thermal-zones {
22+
cpu_thermal: cpu-thermal {
23+
trips {
24+
threshold: trip-point@0 {
25+
temperature = <45000>;
26+
hysteresis = <5000>;
27+
type = "active";
28+
};
29+
target: trip-point@1 {
30+
temperature = <50000>;
31+
hysteresis = <2000>;
32+
type = "active";
33+
};
34+
cpu_hot: cpu_hot@0 {
35+
temperature = <55000>;
36+
hysteresis = <2000>;
37+
type = "active";
38+
};
39+
};
40+
cooling-maps {
41+
map0 {
42+
trip = <&threshold>;
43+
cooling-device = <&fan0 0 1>;
44+
};
45+
map1 {
46+
trip = <&target>;
47+
cooling-device = <&fan0 1 2>;
48+
};
49+
map2 {
50+
trip = <&cpu_hot>;
51+
cooling-device = <&fan0 2 3>;
52+
};
53+
};
54+
};
55+
};

Documentation/hwmon/rpi-poe-fan

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Kernel driver rpi-poe-fan
2+
=====================
3+
4+
This driver enables the use of the Raspberry Pi PoE HAT fan.
5+
6+
Author: Serge Schneider <[email protected]>
7+
8+
Description
9+
-----------
10+
11+
The driver implements a simple interface for driving the Raspberry Pi PoE
12+
(Power over Ethernet) HAT fan. The driver passes commands to the Raspberry Pi
13+
firmware through the mailbox property interface. The firmware then forwards
14+
the commands to the board over I2C on the ID_EEPROM pins. The driver exposes
15+
the fan to the user space through the hwmon sysfs interface.

drivers/hwmon/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,17 @@ config SENSORS_RASPBERRYPI_HWMON
15311531
This driver can also be built as a module. If so, the module
15321532
will be called raspberrypi-hwmon.
15331533

1534+
config SENSORS_RPI_POE_FAN
1535+
tristate "Raspberry Pi PoE HAT fan"
1536+
depends on RASPBERRYPI_FIRMWARE
1537+
depends on THERMAL || THERMAL=n
1538+
help
1539+
If you say yes here you get support for Raspberry Pi PoE (Power over
1540+
Ethernet) HAT fan.
1541+
1542+
This driver can also be built as a module. If so, the module
1543+
will be called rpi-poe-fan.
1544+
15341545
config SENSORS_SL28CPLD
15351546
tristate "Kontron sl28cpld hardware monitoring driver"
15361547
depends on MFD_SL28CPLD || COMPILE_TEST

drivers/hwmon/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
161161
obj-$(CONFIG_SENSORS_POWR1220) += powr1220.o
162162
obj-$(CONFIG_SENSORS_PWM_FAN) += pwm-fan.o
163163
obj-$(CONFIG_SENSORS_RASPBERRYPI_HWMON) += raspberrypi-hwmon.o
164+
obj-$(CONFIG_SENSORS_RPI_POE_FAN) += rpi-poe-fan.o
164165
obj-$(CONFIG_SENSORS_S3C) += s3c-hwmon.o
165166
obj-$(CONFIG_SENSORS_SBTSI) += sbtsi_temp.o
166167
obj-$(CONFIG_SENSORS_SCH56XX_COMMON)+= sch56xx-common.o

0 commit comments

Comments
 (0)