blob: 5394cb6c8f699617b90e0d4ceb80681849ffa91d [file] [log] [blame]
mustafae67e2282021-03-29 15:08:45 -05001#!/bin/bash
2#
3# Set all fans to pwm mode.
4
5# Set all pwm_enable to 1
Charles Boyer0dd80062022-03-17 14:57:50 -05006find /sys/class/hwmon/hwmon*/ -name 'pwm*_enable' -exec bash -c 'echo "$1" && echo 1 > "$1" && cat "$1"' -- {} \;
avenash.thambif2b509f2021-11-24 14:42:31 -06007
8for i in {0..5}
9do
10 fan_pwm_rate_of_change=0x$(printf '%02x' $((8 + i)) | \
11 awk '{print $1}')
12 # Set Fan PWM Rate-of-Change Bits(bits 4:2) to 000b
13 # Register 08h to 0Dh
14 oriRegVal=$(i2cget -y -f 18 0x2c \
15 "${fan_pwm_rate_of_change}")
16 updateVal=$((oriRegVal & 0xe3))
17 updateVal=0x$(printf "%x" ${updateVal})
18 i2cset -y -f 18 0x2c \
19 "${fan_pwm_rate_of_change}" "${updateVal}"
20done