a0e3de062b774a73dc4c285407e50f55d279774f
[openwrt/openwrt.git] / target / linux / kirkwood / base-files / etc / init.d / hwmon_fancontrol
1 #!/bin/sh /etc/rc.common
2
3 START=98
4
5 boot() {
6 # configuring (lm85/lm63) onboard temp/fan controller to run the fan on its own
7 # for more information, please read https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
8
9 case $(board_name) in
10 iom,ix2-200)
11 path_to_hwmon='/sys/class/hwmon/hwmon0'
12 echo 2 > "$path_to_hwmon/pwm1_enable" # fan is on pwm1
13 ;;
14 zyxel,nsa310b)
15 path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0'
16 echo 2 > "$path_to_hwmon/pwm1_enable" # fan is on pwm1
17 echo 1 > "$path_to_hwmon/pwm1_auto_channels" # temp1 is the only one that changes
18 echo 23000 > "$path_to_hwmon/temp1_auto_temp_min"
19 echo 43000 > "$path_to_hwmon/temp1_auto_temp_max" # next step is 49600 millicelsius, or 50 celsius, 43 celsius is better
20 ;;
21 esac
22 }