Skip to content

Commit c9d86f0

Browse files
author
Wirut Getbamrung
authored
[201811][platform/cel]: Port fancontrol changes for dx010/e1031 to 201811 branch (#4867)
Update fancontrol service for Seastone-DX010/E1031 device to support hysteresis temperature threshold and difference config for each unit fan direction type (B2F/F2B); follow master branch
1 parent d04ad41 commit c9d86f0

File tree

17 files changed

+906
-25
lines changed

17 files changed

+906
-25
lines changed

device/celestica/x86_64-cel_e1031-r0/fancontrol

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Configuration file generated by pwmconfig, changes will be lost
2+
INTERVAL=2
3+
FCTEMPS=23-004d/pwm1=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp1_input 23-004d/pwm2=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp1_input 23-004d/pwm4=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp1_input
4+
FCFANS=23-004d/pwm1=23-004d/fan1_input 23-004d/pwm2=23-004d/fan2_input 23-004d/pwm4=23-004d/fan4_input
5+
MINTEMP=23-004d/pwm1=27 23-004d/pwm2=27 23-004d/pwm4=27
6+
MAXTEMP=23-004d/pwm1=46 23-004d/pwm2=46 23-004d/pwm4=46
7+
MINSTART=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102
8+
MINSTOP=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102
9+
MINPWM=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102
10+
MAXPWM=23-004d/pwm1=255 23-004d/pwm2=255 23-004d/pwm4=255
11+
THYST=23-004d/pwm1=2 23-004d/pwm2=2 23-004d/pwm4=2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Configuration file generated by pwmconfig, changes will be lost
2+
INTERVAL=2
3+
FCTEMPS=23-004d/pwm1=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp3_input 23-004d/pwm2=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp3_input 23-004d/pwm4=/sys/bus/i2c/devices/11-001a/hwmon/hwmon*/temp3_input
4+
FCFANS=23-004d/pwm1=23-004d/fan1_input 23-004d/pwm2=23-004d/fan2_input 23-004d/pwm4=23-004d/fan4_input
5+
MINTEMP=23-004d/pwm1=29 23-004d/pwm2=29 23-004d/pwm4=29
6+
MAXTEMP=23-004d/pwm1=46 23-004d/pwm2=46 23-004d/pwm4=46
7+
MINSTART=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102
8+
MINSTOP=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102
9+
MINPWM=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102
10+
MAXPWM=23-004d/pwm1=255 23-004d/pwm2=255 23-004d/pwm4=255
11+
THYST=23-004d/pwm1=2 23-004d/pwm2=2 23-004d/pwm4=2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CONSOLE_PORT=0x2f8
22
CONSOLE_DEV=1
33
CONSOLE_SPEED=9600
4+
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich"

device/celestica/x86_64-cel_seastone-r0/fancontrol

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Configuration file generated by pwmconfig, changes will be lost
2+
INTERVAL=2
3+
FCTEMPS=13-002e/pwm1=/sys/bus/i2c/devices/15-004e/hwmon/hwmon*/temp1_input 13-002e/pwm2=/sys/bus/i2c/devices/15-004e/hwmon/hwmon*/temp1_input 13-002e/pwm3=/sys/bus/i2c/devices/15-004e/hwmon/hwmon*/temp1_input 13-002e/pwm4=/sys/bus/i2c/devices/15-004e/hwmon/hwmon*/temp1_input 13-002e/pwm5=/sys/bus/i2c/devices/15-004e/hwmon/hwmon*/temp1_input 13-004d/pwm1=/sys/bus/i2c/devices/15-004e/hwmon/hwmon*/temp1_input 13-004d/pwm2=/sys/bus/i2c/devices/15-004e/hwmon/hwmon*/temp1_input 13-004d/pwm3=/sys/bus/i2c/devices/15-004e/hwmon/hwmon*/temp1_input 13-004d/pwm4=/sys/bus/i2c/devices/15-004e/hwmon/hwmon*/temp1_input 13-004d/pwm5=/sys/bus/i2c/devices/15-004e/hwmon/hwmon*/temp1_input
4+
FCFANS=13-004d/pwm5=13-004d/fan5_input 13-004d/pwm4=13-004d/fan4_input 13-004d/pwm3=13-004d/fan3_input 13-004d/pwm2=13-004d/fan2_input 13-004d/pwm1=13-004d/fan1_input 13-002e/pwm5=13-002e/fan5_input 13-002e/pwm4=13-002e/fan4_input 13-002e/pwm3=13-002e/fan3_input 13-002e/pwm2=13-002e/fan2_input 13-002e/pwm1=13-002e/fan1_input
5+
MINTEMP=13-002e/pwm1=27 13-002e/pwm2=27 13-002e/pwm3=27 13-002e/pwm4=27 13-002e/pwm5=27 13-004d/pwm1=27 13-004d/pwm2=27 13-004d/pwm3=27 13-004d/pwm4=27 13-004d/pwm5=27
6+
MAXTEMP=13-002e/pwm1=46 13-002e/pwm2=46 13-002e/pwm3=46 13-002e/pwm4=46 13-002e/pwm5=46 13-004d/pwm1=46 13-004d/pwm2=46 13-004d/pwm3=46 13-004d/pwm4=46 13-004d/pwm5=46
7+
MINSTART=13-002e/pwm1=89 13-002e/pwm2=89 13-002e/pwm3=89 13-002e/pwm4=89 13-002e/pwm5=89 13-004d/pwm1=89 13-004d/pwm2=89 13-004d/pwm3=89 13-004d/pwm4=89 13-004d/pwm5=89
8+
MINSTOP=13-002e/pwm1=89 13-002e/pwm2=89 13-002e/pwm3=89 13-002e/pwm4=89 13-002e/pwm5=89 13-004d/pwm1=89 13-004d/pwm2=89 13-004d/pwm3=89 13-004d/pwm4=89 13-004d/pwm5=89
9+
MINPWM=13-002e/pwm1=89 13-002e/pwm2=89 13-002e/pwm3=89 13-002e/pwm4=89 13-002e/pwm5=89 13-004d/pwm1=89 13-004d/pwm2=89 13-004d/pwm3=89 13-004d/pwm4=89 13-004d/pwm5=89
10+
MAXPWM=13-002e/pwm1=255 13-002e/pwm2=255 13-002e/pwm3=255 13-002e/pwm4=255 13-002e/pwm5=255 13-004d/pwm1=255 13-004d/pwm2=255 13-004d/pwm3=255 13-004d/pwm4=255 13-004d/pwm5=255
11+
THYST=13-002e/pwm1=3 13-002e/pwm2=3 13-002e/pwm3=3 13-002e/pwm4=3 13-002e/pwm5=3 13-004d/pwm1=3 13-004d/pwm2=3 13-004d/pwm3=3 13-004d/pwm4=3 13-004d/pwm5=3
12+
MAXTEMPCRIT=/sys/bus/i2c/devices/7-004a/hwmon/hwmon*/temp1_input=65 /sys/bus/i2c/devices/14-0048/hwmon/hwmon*/temp1_input=75
13+
MAXTEMPTYPE=/sys/bus/i2c/devices/7-004a/hwmon/hwmon*/temp1_input=ASIC /sys/bus/i2c/devices/14-0048/hwmon/hwmon*/temp1_input=CPU
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Configuration file generated by pwmconfig, changes will be lost
2+
INTERVAL=2
3+
FCTEMPS=13-002e/pwm1=/sys/bus/i2c/devices/5-0048/hwmon/hwmon*/temp1_input 13-002e/pwm2=/sys/bus/i2c/devices/5-0048/hwmon/hwmon*/temp1_input 13-002e/pwm3=/sys/bus/i2c/devices/5-0048/hwmon/hwmon*/temp1_input 13-002e/pwm4=/sys/bus/i2c/devices/5-0048/hwmon/hwmon*/temp1_input 13-002e/pwm5=/sys/bus/i2c/devices/5-0048/hwmon/hwmon*/temp1_input 13-004d/pwm1=/sys/bus/i2c/devices/5-0048/hwmon/hwmon*/temp1_input 13-004d/pwm2=/sys/bus/i2c/devices/5-0048/hwmon/hwmon*/temp1_input 13-004d/pwm3=/sys/bus/i2c/devices/5-0048/hwmon/hwmon*/temp1_input 13-004d/pwm4=/sys/bus/i2c/devices/5-0048/hwmon/hwmon*/temp1_input 13-004d/pwm5=/sys/bus/i2c/devices/5-0048/hwmon/hwmon*/temp1_input
4+
FCFANS=13-004d/pwm5=13-004d/fan5_input 13-004d/pwm4=13-004d/fan4_input 13-004d/pwm3=13-004d/fan3_input 13-004d/pwm2=13-004d/fan2_input 13-004d/pwm1=13-004d/fan1_input 13-002e/pwm5=13-002e/fan5_input 13-002e/pwm4=13-002e/fan4_input 13-002e/pwm3=13-002e/fan3_input 13-002e/pwm2=13-002e/fan2_input 13-002e/pwm1=13-002e/fan1_input
5+
MINTEMP=13-002e/pwm1=26 13-002e/pwm2=26 13-002e/pwm3=26 13-002e/pwm4=26 13-002e/pwm5=26 13-004d/pwm1=26 13-004d/pwm2=26 13-004d/pwm3=26 13-004d/pwm4=26 13-004d/pwm5=26
6+
MAXTEMP=13-002e/pwm1=45 13-002e/pwm2=45 13-002e/pwm3=45 13-002e/pwm4=45 13-002e/pwm5=45 13-004d/pwm1=45 13-004d/pwm2=45 13-004d/pwm3=45 13-004d/pwm4=45 13-004d/pwm5=45
7+
MINSTART=13-002e/pwm1=89 13-002e/pwm2=89 13-002e/pwm3=89 13-002e/pwm4=89 13-002e/pwm5=89 13-004d/pwm1=89 13-004d/pwm2=89 13-004d/pwm3=89 13-004d/pwm4=89 13-004d/pwm5=89
8+
MINSTOP=13-002e/pwm1=89 13-002e/pwm2=89 13-002e/pwm3=89 13-002e/pwm4=89 13-002e/pwm5=89 13-004d/pwm1=89 13-004d/pwm2=89 13-004d/pwm3=89 13-004d/pwm4=89 13-004d/pwm5=89
9+
MINPWM=13-002e/pwm1=89 13-002e/pwm2=89 13-002e/pwm3=89 13-002e/pwm4=89 13-002e/pwm5=89 13-004d/pwm1=89 13-004d/pwm2=89 13-004d/pwm3=89 13-004d/pwm4=89 13-004d/pwm5=89
10+
MAXPWM=13-002e/pwm1=255 13-002e/pwm2=255 13-002e/pwm3=255 13-002e/pwm4=255 13-002e/pwm5=255 13-004d/pwm1=255 13-004d/pwm2=255 13-004d/pwm3=255 13-004d/pwm4=255 13-004d/pwm5=255
11+
THYST=13-002e/pwm1=3 13-002e/pwm2=3 13-002e/pwm3=3 13-002e/pwm4=3 13-002e/pwm5=3 13-004d/pwm1=3 13-004d/pwm2=3 13-004d/pwm3=3 13-004d/pwm4=3 13-004d/pwm5=3
12+
MAXTEMPCRIT=/sys/bus/i2c/devices/7-004a/hwmon/hwmon*/temp1_input=75 /sys/bus/i2c/devices/14-0048/hwmon/hwmon*/temp1_input=75
13+
MAXTEMPTYPE=/sys/bus/i2c/devices/7-004a/hwmon/hwmon*/temp1_input=ASIC /sys/bus/i2c/devices/14-0048/hwmon/hwmon*/temp1_input=CPU
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
CONSOLE_PORT=0x3f8
22
CONSOLE_DEV=0
3+
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich"
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
dx010/scripts/dx010_check_qsfp.sh usr/local/bin
22
dx010/cfg/dx010-modules.conf etc/modules-load.d
33
dx010/systemd/platform-modules-dx010.service lib/systemd/system
4+
dx010/scripts/fancontrol.sh etc/init.d
5+
dx010/scripts/fancontrol.service lib/systemd/system
6+
services/fancontrol/fancontrol usr/local/bin
47
dx010/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-cel_seastone-r0
5-
services/platform_api/platform_api_mgnt.sh usr/local/bin
8+
services/platform_api/platform_api_mgnt.sh usr/local/bin

platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.postinst

+3
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ depmod -a
22
systemctl enable platform-modules-dx010.service
33
systemctl start platform-modules-dx010.service
44

5+
systemctl start platform-modules-dx010.service
6+
systemctl start fancontrol.service
7+
58
/usr/local/bin/platform_api_mgnt.sh install
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
haliburton/cfg/haliburton-modules.conf etc/modules-load.d
22
haliburton/systemd/platform-modules-haliburton.service lib/systemd/system
3+
haliburton/scripts/fancontrol.sh etc/init.d
4+
haliburton/scripts/fancontrol.service lib/systemd/system
5+
services/fancontrol/fancontrol usr/local/bin
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
depmod -a
22
systemctl enable platform-modules-haliburton.service
3+
systemctl enable fancontrol.service
4+
35
systemctl start platform-modules-haliburton.service
6+
systemctl start fancontrol.service
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=fan speed regulator
3+
After=platform-modules-dx010.service
4+
Before=pmon.service
5+
6+
[Service]
7+
ExecStart=-/etc/init.d/fancontrol.sh start
8+
ExecStop=-/etc/init.d/fancontrol.sh stop
9+
RemainAfterExit=yes
10+
11+
[Install]
12+
WantedBy=multi-user.target
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#! /bin/sh
2+
3+
### BEGIN INIT INFO
4+
# Provides: fancontrol
5+
# Required-Start: $remote_fs
6+
# Required-Stop: $remote_fs
7+
# Default-Start: 2 3 4 5
8+
# Default-Stop:
9+
# Short-Description: fancontrol
10+
# Description: fan speed regulator
11+
### END INIT INFO
12+
13+
. /lib/lsb/init-functions
14+
15+
[ -f /etc/default/rcS ] && . /etc/default/rcS
16+
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
17+
DAEMON=/usr/local/bin/fancontrol
18+
DESC="fan speed regulator"
19+
NAME="fancontrol"
20+
PIDFILE=/var/run/fancontrol.pid
21+
MAIN_CONF=/usr/share/sonic/device/x86_64-cel_seastone-r0/fancontrol
22+
DEVPATH=/sys/devices/pci0000:00/0000:00:13.0/i2c-*/i2c-13/13-002e
23+
GPIO_DIR=/sys/class/gpio
24+
BASE_GPIO=$(find $GPIO_DIR | grep gpiochip | grep -o '[[:digit:]]*')
25+
DIRGPIO_START=15
26+
27+
test -x $DAEMON || exit 0
28+
29+
for i in 1 2 3 4 5; do
30+
FANFAULT=$(cat ${DEVPATH}/fan${i}_fault)
31+
[ $FANFAULT = 1 ] && continue
32+
FANDIR_GPIO_NUMBER=$((DIRGPIO_START + BASE_GPIO))
33+
FANDIR_VALUE=$(cat ${GPIO_DIR}/gpio${FANDIR_GPIO_NUMBER}/value)
34+
DIRGPIO_START=$((DIRGPIO_START + 1))
35+
FANDIR=$([ $FANDIR_VALUE = 1 ] && echo "B2F" || echo "F2B")
36+
done
37+
CONF=${MAIN_CONF}-${FANDIR}
38+
39+
case "$1" in
40+
start)
41+
if [ -f $CONF ]; then
42+
if $DAEMON --check $CONF 1>/dev/null 2>/dev/null; then
43+
log_daemon_msg "Starting $DESC" "$NAME\n"
44+
start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON $CONF
45+
log_end_msg $?
46+
else
47+
log_failure_msg "Not starting fancontrol, broken configuration file; please re-run pwmconfig."
48+
fi
49+
else
50+
if [ "$VERBOSE" != no ]; then
51+
log_warning_msg "Not starting fancontrol; run pwmconfig first."
52+
fi
53+
fi
54+
;;
55+
stop)
56+
log_daemon_msg "Stopping $DESC" "$NAME"
57+
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --startas $DAEMON $CONF
58+
rm -f $PIDFILE
59+
log_end_msg $?
60+
;;
61+
restart)
62+
$0 stop
63+
sleep 3
64+
$0 start
65+
;;
66+
force-reload)
67+
if start-stop-daemon --stop --test --quiet --pidfile $PIDFILE --startas $DAEMON $CONF; then
68+
$0 restart
69+
fi
70+
;;
71+
status)
72+
status_of_proc $DAEMON $NAME $CONF && exit 0 || exit $?
73+
;;
74+
*)
75+
log_success_msg "Usage: /etc/init.d/fancontrol {start|stop|restart|force-reload|status}"
76+
exit 1
77+
;;
78+
esac
79+
80+
exit 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=fan speed regulator
3+
After=platform-modules-haliburton.service
4+
Before=pmon.service
5+
6+
[Service]
7+
ExecStart=-/etc/init.d/fancontrol.sh start
8+
ExecStop=-/etc/init.d/fancontrol.sh stop
9+
RemainAfterExit=yes
10+
11+
[Install]
12+
WantedBy=multi-user.target
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#! /bin/sh
2+
3+
### BEGIN INIT INFO
4+
# Provides: fancontrol
5+
# Required-Start: $remote_fs
6+
# Required-Stop: $remote_fs
7+
# Default-Start: 2 3 4 5
8+
# Default-Stop:
9+
# Short-Description: fancontrol
10+
# Description: fan speed regulator
11+
### END INIT INFO
12+
13+
. /lib/lsb/init-functions
14+
15+
[ -f /etc/default/rcS ] && . /etc/default/rcS
16+
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
17+
DAEMON=/usr/local/bin/fancontrol
18+
DESC="fan speed regulator"
19+
NAME="fancontrol"
20+
PIDFILE=/var/run/fancontrol.pid
21+
PLATFORMPATH=/sys/devices/platform/e1031.smc
22+
MAIN_CONF=/usr/share/sonic/device/x86_64-cel_e1031-r0/fancontrol
23+
DEVPATH=/sys/devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-23/23-004d
24+
25+
test -x $DAEMON || exit 0
26+
27+
for i in 1 2 3; do
28+
j=$i
29+
[ $i -eq 3 ] && j=4
30+
FANFAULT=$(cat ${DEVPATH}/fan${j}_fault)
31+
[ $FANFAULT = 1 ] && continue
32+
FANDIR=$(cat ${PLATFORMPATH}/fan${i}_dir)
33+
done
34+
CONF=${MAIN_CONF}-${FANDIR}
35+
36+
case "$1" in
37+
start)
38+
if [ -f $CONF ]; then
39+
if $DAEMON --check $CONF 1>/dev/null 2>/dev/null; then
40+
log_daemon_msg "Starting $DESC" "$NAME\n"
41+
start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON $CONF
42+
log_end_msg $?
43+
else
44+
log_failure_msg "Not starting fancontrol, broken configuration file; please re-run pwmconfig."
45+
fi
46+
else
47+
if [ "$VERBOSE" != no ]; then
48+
log_warning_msg "Not starting fancontrol; run pwmconfig first."
49+
fi
50+
fi
51+
;;
52+
stop)
53+
log_daemon_msg "Stopping $DESC" "$NAME"
54+
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --startas $DAEMON $CONF
55+
rm -f $PIDFILE
56+
log_end_msg $?
57+
;;
58+
restart)
59+
$0 stop
60+
sleep 3
61+
$0 start
62+
;;
63+
force-reload)
64+
if start-stop-daemon --stop --test --quiet --pidfile $PIDFILE --startas $DAEMON $CONF; then
65+
$0 restart
66+
fi
67+
;;
68+
status)
69+
status_of_proc $DAEMON $NAME $CONF && exit 0 || exit $?
70+
;;
71+
*)
72+
log_success_msg "Usage: /etc/init.d/fancontrol {start|stop|restart|force-reload|status}"
73+
exit 1
74+
;;
75+
esac
76+
77+
exit 0

0 commit comments

Comments
 (0)