kernel: generic: backport linkstation-poweroff driver
[openwrt/staging/stintel.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 ctera,c200-v1)
11 path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-004c/hwmon/hwmon0'
12
13 # It should be related to hdd temerature instead lm63 temp
14 echo 1 > "$path_to_hwmon/pwm1_enable"
15 echo 128 > "$path_to_hwmon/pwm1"
16 ;;
17 iom,ix2-200)
18 path_to_hwmon='/sys/class/hwmon/hwmon0'
19 echo 2 > "$path_to_hwmon/pwm1_enable" # fan is on pwm1
20 ;;
21 seagate,blackarmor-nas220)
22 path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0'
23 # adt7476 fan control chip. 3 temp sensors. Set to 1/4 speed at 35C and max speed at 48C.
24 echo 7 > "$path_to_hwmon/pwm1_auto_channels_temp"
25 echo 64 > "$path_to_hwmon/pwm1_auto_point1_pwm"
26 echo 255 > "$path_to_hwmon/pwm1_auto_point2_pwm"
27 echo 35000 > "$path_to_hwmon/temp1_auto_point1_temp"
28 echo 48000 > "$path_to_hwmon/temp1_auto_point2_temp"
29 echo 35000 > "$path_to_hwmon/temp2_auto_point1_temp"
30 echo 48000 > "$path_to_hwmon/temp2_auto_point2_temp"
31 echo 35000 > "$path_to_hwmon/temp3_auto_point1_temp"
32 echo 48000 > "$path_to_hwmon/temp3_auto_point2_temp"
33 echo 2 > "$path_to_hwmon/pwm1_enable"
34 ;;
35 zyxel,nsa310b)
36 path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0'
37 # use the max. value of (temp1) OR (temp2) OR (temp3) as an input
38 # for the PWM of the cooling fan
39 echo 123 > "$path_to_hwmon/pwm1_auto_channels"
40 # Temperature sensor #1 placed on mainboard
41 echo 30000 > "$path_to_hwmon/temp1_auto_temp_min"
42 echo 49600 > "$path_to_hwmon/temp1_auto_temp_max"
43 # Temperature sensor #2 placed on mainboard
44 # range: 0 to 127000 in steps of 1000 [millicelsius]
45 echo 30000 > "$path_to_hwmon/temp2_auto_temp_min"
46 # range: 0 to 127000 in steps of ???? [millicelsius]
47 echo 49600 > "$path_to_hwmon/temp2_auto_temp_max"
48 # Temperature sensor #3 placed close to a chipset
49 # range: 0 to 60000 in steps of 1000 [millicelsius]
50 echo 23000 > "$path_to_hwmon/temp3_auto_temp_min"
51 # pre-defined steps: 103000, 122000, 143300, 170000 in [millicelsius]
52 echo 103000 > "$path_to_hwmon/temp3_auto_temp_max"
53 ;;
54 esac
55 }