This reverts commit ec07d10748
.
This commit is contained in:
parent
7e6fa15784
commit
81e9ec6be6
@ -12,8 +12,7 @@
|
||||
### END INIT INFO
|
||||
|
||||
function export_gpio {
|
||||
label=$3
|
||||
gpio_dir=$2
|
||||
label=$2
|
||||
gpio_num=$1
|
||||
gpio_base=`( cat /sys/class/gpio/gpiochip*/base | head -1 ) 2>/dev/null`
|
||||
gpio_label=`( cat /sys/class/gpio/gpiochip*/label | head -1 ) 2>/dev/null`
|
||||
@ -28,13 +27,6 @@ if [ $? -ne 0 ]; then
|
||||
echo "Platform driver error: Cannot export gpio$ionum!"
|
||||
exit 1;
|
||||
fi
|
||||
if [[ "X$gpio_dir" != "X" ]]; then
|
||||
echo $gpio_dir > /sys/class/gpio/gpio${ionum}/direction
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Platform driver error: Cannot set direction of gpio$ionum!"
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@ -103,33 +95,27 @@ start)
|
||||
sleep 2
|
||||
|
||||
# Export platform gpio sysfs
|
||||
export_gpio 10 "in" # Fan 1 present
|
||||
export_gpio 11 "in" # Fan 2 present
|
||||
export_gpio 12 "in" # Fan 3 present
|
||||
export_gpio 13 "in" # Fan 4 present
|
||||
export_gpio 14 "in" # Fan 5 present
|
||||
export_gpio 10 # Fan 1 present
|
||||
export_gpio 11 # Fan 2 present
|
||||
export_gpio 12 # Fan 3 present
|
||||
export_gpio 13 # Fan 4 present
|
||||
export_gpio 14 # Fan 5 present
|
||||
|
||||
export_gpio 15 "in" # Fan 1 direction
|
||||
export_gpio 16 "in" # Fan 2 direction
|
||||
export_gpio 17 "in" # Fan 3 direction
|
||||
export_gpio 18 "in" # Fan 4 direction
|
||||
export_gpio 19 "in" # Fan 5 direction
|
||||
export_gpio 22 # PSU L PWOK
|
||||
export_gpio 25 # PSU R PWOK
|
||||
export_gpio 27 # PSU L ABS
|
||||
export_gpio 28 # PSU R ABS
|
||||
|
||||
export_gpio 22 "in" # PSU L PWOK
|
||||
export_gpio 25 "in" # PSU R PWOK
|
||||
export_gpio 27 "in" # PSU L ABS
|
||||
export_gpio 28 "in" # PSU R ABS
|
||||
|
||||
export_gpio 29 "out" # Fan 1 LED: Red
|
||||
export_gpio 30 "out" # Fan 1 LED: Yellow
|
||||
export_gpio 31 "out" # Fan 2 LED: Red
|
||||
export_gpio 32 "out" # Fan 2 LED: Yellow
|
||||
export_gpio 33 "out" # Fan 3 LED: Red
|
||||
export_gpio 34 "out" # Fan 3 LED: Yellow
|
||||
export_gpio 35 "out" # Fan 4 LED: Red
|
||||
export_gpio 36 "out" # Fan 4 LED: Yellow
|
||||
export_gpio 37 "out" # Fan 5 LED: Red
|
||||
export_gpio 38 "out" # Fan 5 LED: Yellow
|
||||
export_gpio 29 # Fan 1 LED: Red
|
||||
export_gpio 30 # Fan 1 LED: Yellow
|
||||
export_gpio 31 # Fan 2 LED: Red
|
||||
export_gpio 32 # Fan 2 LED: Yellow
|
||||
export_gpio 33 # Fan 3 LED: Red
|
||||
export_gpio 34 # Fan 3 LED: Yellow
|
||||
export_gpio 35 # Fan 4 LED: Red
|
||||
export_gpio 36 # Fan 4 LED: Yellow
|
||||
export_gpio 37 # Fan 5 LED: Red
|
||||
export_gpio 38 # Fan 5 LED: Yellow
|
||||
|
||||
# Turn off/down lpmod by defult (0 - Normal, 1 - Low Pow)
|
||||
echo 0x00000000 > /sys/devices/platform/dx010_cpld/qsfp_lpmode
|
||||
@ -137,7 +123,7 @@ start)
|
||||
# Attach 32 instances of EEPROM driver QSFP ports
|
||||
for ((n=26;n<=58;n++));
|
||||
do
|
||||
echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-$n/new_device
|
||||
echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-$n/new_device
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
|
@ -6,4 +6,3 @@ systemctl start platform-modules-dx010.service
|
||||
systemctl start fancontrol.service
|
||||
|
||||
/usr/local/bin/platform_api_mgnt.sh install
|
||||
/etc/init.d/fancontrol.sh install
|
||||
|
0
platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.service
Normal file → Executable file
0
platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.service
Normal file → Executable file
63
platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.sh
Executable file → Normal file
63
platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.sh
Executable file → Normal file
@ -7,39 +7,72 @@
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: fancontrol
|
||||
# Description: fancontrol configuration selector
|
||||
# Description: fan speed regulator
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
[ -f /etc/default/rcS ] && . /etc/default/rcS
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
|
||||
DAEMON=/usr/local/bin/fancontrol
|
||||
DESC="fan speed regulator"
|
||||
NAME="fancontrol"
|
||||
PIDFILE=/var/run/fancontrol.pid
|
||||
MAIN_CONF=/usr/share/sonic/device/x86_64-cel_seastone-r0/fancontrol
|
||||
DEVPATH=/sys/devices/pci0000:00/0000:00:13.0/i2c-*/i2c-13/13-002e
|
||||
GPIO_DIR=/sys/class/gpio
|
||||
BASE_GPIO=$(find $GPIO_DIR | grep gpiochip | grep -o '[[:digit:]]*')
|
||||
DIRGPIO_START=15
|
||||
|
||||
init() {
|
||||
DIRGPIO_START=15
|
||||
BASE_GPIO=$(find $GPIO_DIR | grep gpiochip | grep -o '[[:digit:]]*')
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
for i in 1 2 3 4 5; do
|
||||
FANFAULT=$(cat ${DEVPATH}/fan${i}_fault)
|
||||
[ $FANFAULT = 1 ] && continue
|
||||
FANDIR_GPIO_NUMBER=$((DIRGPIO_START + BASE_GPIO))
|
||||
FANDIR_VALUE=$(cat ${GPIO_DIR}/gpio${FANDIR_GPIO_NUMBER}/value)
|
||||
DIRGPIO_START=$((DIRGPIO_START + 1))
|
||||
FANDIR=$([ $FANDIR_VALUE = 1 ] && echo "B2F" || echo "F2B")
|
||||
CONF=${MAIN_CONF}-${FANDIR}
|
||||
}
|
||||
|
||||
install() {
|
||||
find /var/lib/docker/overlay*/ -path */sbin/fancontrol -exec cp /usr/local/bin/fancontrol {} \;
|
||||
}
|
||||
done
|
||||
CONF=${MAIN_CONF}-${FANDIR}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
init
|
||||
cp $CONF $MAIN_CONF
|
||||
if [ -f $CONF ]; then
|
||||
if $DAEMON --check $CONF 1>/dev/null 2>/dev/null; then
|
||||
log_daemon_msg "Starting $DESC" "$NAME\n"
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON $CONF
|
||||
log_end_msg $?
|
||||
else
|
||||
log_failure_msg "Not starting fancontrol, broken configuration file; please re-run pwmconfig."
|
||||
fi
|
||||
else
|
||||
if [ "$VERBOSE" != no ]; then
|
||||
log_warning_msg "Not starting fancontrol; run pwmconfig first."
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
install)
|
||||
install
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --startas $DAEMON $CONF
|
||||
rm -f $PIDFILE
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 3
|
||||
$0 start
|
||||
;;
|
||||
force-reload)
|
||||
if start-stop-daemon --stop --test --quiet --pidfile $PIDFILE --startas $DAEMON $CONF; then
|
||||
$0 restart
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
status_of_proc $DAEMON $NAME $CONF && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
log_success_msg "Usage: /etc/init.d/fancontrol {start} | {install}"
|
||||
log_success_msg "Usage: /etc/init.d/fancontrol {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
@ -174,7 +174,7 @@ function LoadConfig
|
||||
echo "Settings for ${CSMAXTEMPTYPE[$tscount]} temperature sensor:"
|
||||
echo " Depends on ${CSTEMP[$tscount]}"
|
||||
echo " MAXTEMPCRIT=${CSMAXTEMPCRIT[$tscount]}"
|
||||
let tscount=tscount+1
|
||||
let tscount=tscount+1q
|
||||
done
|
||||
echo
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user