From 3509d4ec56b488d82c8fc95df8d12691b2b6cd1d Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 21 Mar 2020 21:40:15 +0100 Subject: [PATCH] apm821xx: wndr4700: add preliminary drivetemp sensor This patch prepares the WNDR4700 to use the HDD sensor for the thermal zone. While the kernel's thermal.txt device-tree binding documentation files talks about supporting multiple sensors for a zone. This sadly is NOT the case. Even the most current upstream kernels (5.6-rc) supports just >one< sensor per zone: (driver/base/of-thermal.c:886) | * REVIST: for now, the thermal framework supports only | * one sensor per thermal zone. Thus, we are considering | * only the first two values as slope and offset. I do hope that this warning will prevent others wasteing time on trying to figure out why their multi-sensor thermal-zones definitions are not working as specified. Signed-off-by: Christian Lamparter --- .../linux/apm821xx/dts/netgear-wndr4700.dts | 25 ++++++++++++++++++- target/linux/apm821xx/image/Makefile | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/target/linux/apm821xx/dts/netgear-wndr4700.dts b/target/linux/apm821xx/dts/netgear-wndr4700.dts index 24603c4247..8972d2b030 100644 --- a/target/linux/apm821xx/dts/netgear-wndr4700.dts +++ b/target/linux/apm821xx/dts/netgear-wndr4700.dts @@ -36,13 +36,25 @@ thermal-sensors = <&temp0 1>; + /* + * REVISIT: + * + * Add the <&drive_temp>; sensor there and wire up + * the coefficients = <1 1>; property. + * + * Note: The kernel does not yet support more than + * one sensor (see of_thermal.c's function: + * thermal_of_build_thermal_zon()). Once this is + * implemented. + */ + trips { /* * Once the thermal governers are a bit smarter * and do hysteresis properly, we can disable * the fan when the HDD and CPU has < 39 C. */ - cpu_alert0: cpu-alert0 { + cpu_alert0: board-alert0 { temperature = <25000>; hysteresis = <2000>; type = "active"; @@ -145,6 +157,17 @@ &SATA1 { status = "okay"; + + /* + * This drive may have a temperature sensor with a + * thermal zone we can use for thermal control of the + * chassis temperature using the fan. + */ + + drive_temp: sata-port@0 { + reg = <0>; + #thermal-sensor-cells = <0>; + }; }; &USBOTG0 { diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 27c7f122da..d732141c8f 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -191,7 +191,7 @@ TARGET_DEVICES += netgear_wndap660 define Device/netgear_wndr4700 DEVICE_VENDOR := NETGEAR DEVICE_MODEL := Centria N900 WNDR4700/WNDR4720 - DEVICE_PACKAGES := badblocks block-mount e2fsprogs \ + DEVICE_PACKAGES := badblocks block-mount e2fsprogs kmod-hwmon-drivetemp \ kmod-dm kmod-fs-ext4 kmod-fs-vfat kmod-usb-ledtrig-usbport \ kmod-md-mod kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-iso8859-15 \ kmod-nls-utf8 kmod-usb3 kmod-usb-dwc2 kmod-usb-storage \