helios64: Added temp sensor and fancontrol to PWM page
This commit is contained in:
parent
7b9bea6083
commit
329c53fa36
1 changed files with 115 additions and 1 deletions
|
@ -35,7 +35,7 @@ The term *duty cycle* describes the proportion of 'on' time to the regular inter
|
|||
|
||||
## PWM Fan Connector
|
||||
|
||||
![Fan Connector](/helios4/img/pwm/fan_connector.png)
|
||||
![Fan Connector](/helios64/img/pwm/fan_connector.png)
|
||||
|
||||
Connector Pinout
|
||||
|
||||
|
@ -45,3 +45,117 @@ Connector Pinout
|
|||
| 2 | 12V | Red |
|
||||
| 3 | Sense | Yellow |
|
||||
| 4 | Control | Blue |
|
||||
|
||||
## Helios64 Temperature Sensors
|
||||
|
||||
### SoC Temperature Sensor
|
||||
|
||||
RK3399 has internal temperature sensor (TS-ADC) for monitoring die temperature. The system has two Temperature Sensors, channel 0 is for CPU, channel 1 is for GPU.
|
||||
|
||||
The sensor has -40~125°C temperature range and 5°C temperature resolution.
|
||||
|
||||
### Board Temp Sensor
|
||||
|
||||
Helios64 has a **Digital Temperature Sensor with 2‐wire Interface** ([NCT75 Datasheet](https://www.onsemi.com/pub/Collateral/NCT75-D.PDF)), located on top side of the board near RTC battery. It is used to read ambient temperature.
|
||||
|
||||
## PWM Fan Control under Linux
|
||||
|
||||
Linux use 8-bit integer to represent duty cycle. PWM value 0 represent 0% duty cycle and PWM value 255 represent 100% duty cycle.
|
||||
|
||||
### Using SYSFS interface
|
||||
|
||||
Linux export the fan control mechanism to SYSFS under hwmon class.
|
||||
List of devices can be checked under /sys/class/hwmon
|
||||
|
||||
```
|
||||
ls -l /sys/class/hwmon/
|
||||
total 0
|
||||
lrwxrwxrwx 1 root root 0 Oct 16 08:38 hwmon0 -> ../../devices/virtual/thermal/thermal_zone0/hwmon0
|
||||
lrwxrwxrwx 1 root root 0 Oct 16 08:38 hwmon1 -> ../../devices/virtual/thermal/thermal_zone1/hwmon1
|
||||
lrwxrwxrwx 1 root root 0 Oct 16 08:38 hwmon2 -> ../../devices/platform/ff120000.i2c/i2c-2/2-004c/hwmon/hwmon2
|
||||
lrwxrwxrwx 1 root root 0 Oct 16 09:29 hwmon3 -> ../../devices/platform/gpio-charger/power_supply/gpio-charger/hwmon3
|
||||
lrwxrwxrwx 1 root root 0 Oct 16 09:29 hwmon4 -> ../../devices/platform/p7-fan/hwmon/hwmon4
|
||||
lrwxrwxrwx 1 root root 0 Oct 16 09:29 hwmon5 -> ../../devices/platform/p6-fan/hwmon/hwmon5
|
||||
lrwxrwxrwx 1 root root 0 Oct 16 09:29 hwmon6 -> ../../devices/platform/ff3d0000.i2c/i2c-4/4-0022/power_supply/tcpm-source-psy-4-0022/hwmon6
|
||||
```
|
||||
|
||||
!!! info
|
||||
The numbering may different from above example output. It depends on whether the driver built as kernel module or built-in, device initialization order. Take this as consideration when using [fancontrol](#fancontrol-automated-software-based-fan-speed-control)
|
||||
|
||||
To identify which hwmon belong to fan, look for *p6-fan* and *p7-fan*. On above example
|
||||
|
||||
```
|
||||
hwmon4 -> ../../devices/platform/p7-fan/hwmon/hwmon4
|
||||
hwmon5 -> ../../devices/platform/p6-fan/hwmon/hwmon5
|
||||
```
|
||||
|
||||
To read current PWM
|
||||
```
|
||||
cat /sys/class/hwmon4/pwm1
|
||||
cat /sys/class/hwmon5/pwm1
|
||||
```
|
||||
|
||||
To set PWM
|
||||
```
|
||||
echo NEW_PWM_VALUE > /sys/class/hwmon4/pwm1
|
||||
echo NEW_PWM_VALUE > /sys/class/hwmon5/pwm1
|
||||
```
|
||||
|
||||
### Fancontrol - automated software based fan speed control
|
||||
|
||||
fancontrol is a shell script for use with lm_sensors. It reads its configuration from a file, then calculates fan speeds from temperatures and sets the corresponding PWM outputs to the computed values.
|
||||
|
||||
```
|
||||
sudo apt-get install fancontrol
|
||||
```
|
||||
|
||||
fancontrol includes *pwmconfig* script to create automatically a configuration file but it can not be used for Helios64.
|
||||
|
||||
#### UDEV rules
|
||||
|
||||
Since hwmon order can be changed between kernel version or even between reboot, on Armbian we use udev rules as workaround. The rules can be found from [here](https://raw.githubusercontent.com/armbian/build/master/packages/bsp/helios64/90-helios64-hwmon.rules) (mainline) or [here](https://raw.githubusercontent.com/armbian/build/master/packages/bsp/helios64/90-helios64-hwmon-legacy.rules) (legacy kernel 4.4) and to be copied to **/etc/udev/rules.d/**
|
||||
|
||||
*/dev/fan-p6, /dev/fan-p7, /dev/thermal-cpu* and */dev/thermal-board* are symlinks generated by the udev rules.
|
||||
|
||||
#### Configuration File
|
||||
|
||||
fancontrol uses **/etc/fancontrol** as configuration file. Below is an example configuration to control fan speed on Helios64.
|
||||
|
||||
```
|
||||
# Helios64 PWM Fan Control Configuration
|
||||
# Temp source : /dev/thermal-cpu
|
||||
INTERVAL=10
|
||||
FCTEMPS=/dev/fan-p6/pwm1=/dev/thermal-cpu/temp1_input /dev/fan-p7/pwm1=/dev/thermal-cpu/temp1_input
|
||||
MINTEMP=/dev/fan-p6/pwm1=40 /dev/fan-p7/pwm1=40
|
||||
MAXTEMP=/dev/fan-p6/pwm1=80 /dev/fan-p7/pwm1=80
|
||||
MINSTART=/dev/fan-p6/pwm1=60 /dev/fan-p7/pwm1=60
|
||||
MINSTOP=/dev/fan-p6/pwm1=29 /dev/fan-p7/pwm1=29
|
||||
MINPWM=20
|
||||
```
|
||||
|
||||
INTERVAL
|
||||
|
||||
This variable defines at which interval in seconds the main loop of fancontrol will be executed.
|
||||
|
||||
FCTEMPS
|
||||
|
||||
Maps PWM outputs to temperature sensors so fancontrol knows which temperature sensors should be used for calculation of new values for the corresponding PWM outputs.
|
||||
|
||||
Fans (**fan-p6** & **fan-p7**) are controlled based on CPU thermal sensor (**thermal-cpu**) reading.
|
||||
|
||||
-----
|
||||
|
||||
*Following settings can be adjusted by user to tweak further.*
|
||||
|
||||
MINTEMP
|
||||
|
||||
The temperature below which the fan gets switched to minimum speed.
|
||||
|
||||
Fans (fan-p6 & fan-p7) runs in minimum speed if the CPU temperature below **40** degree C.
|
||||
|
||||
MAXTEMP
|
||||
|
||||
The temperature over which the fan gets switched to maximum speed.
|
||||
|
||||
Fans (fan-p6 & fan-p7) runs in maximum speed if the CPU temperature above **80** degree C.
|
||||
|
||||
|
|
Loading…
Reference in a new issue