From 4c80d996bad4a066bcfdc962ff523eee302519d6 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 29 Sep 2020 18:02:47 -0700 Subject: [PATCH] Revert "[201811][platform/cel]: Port fancontrol changes for dx010/e1031 to 201811 branch (#4867)" (#5496) This reverts commit c9d86f0587200c824e1ef6d9e176570b26937658. --- .../celestica/x86_64-cel_e1031-r0/fancontrol | 12 + .../x86_64-cel_e1031-r0/fancontrol-B2F | 11 - .../x86_64-cel_e1031-r0/fancontrol-F2B | 11 - .../x86_64-cel_e1031-r0/installer.conf | 1 - .../x86_64-cel_seastone-r0/fancontrol | 12 + .../x86_64-cel_seastone-r0/fancontrol-B2F | 13 - .../x86_64-cel_seastone-r0/fancontrol-F2B | 13 - .../x86_64-cel_seastone-r0/installer.conf | 1 - .../debian/platform-modules-dx010.install | 5 +- .../debian/platform-modules-dx010.postinst | 3 - .../platform-modules-haliburton.install | 3 - .../platform-modules-haliburton.postinst | 3 - .../dx010/scripts/fancontrol.service | 12 - .../dx010/scripts/fancontrol.sh | 80 --- .../haliburton/scripts/fancontrol.service | 12 - .../haliburton/scripts/fancontrol.sh | 77 -- .../services/fancontrol/fancontrol | 662 ------------------ 17 files changed, 25 insertions(+), 906 deletions(-) create mode 100644 device/celestica/x86_64-cel_e1031-r0/fancontrol delete mode 100644 device/celestica/x86_64-cel_e1031-r0/fancontrol-B2F delete mode 100644 device/celestica/x86_64-cel_e1031-r0/fancontrol-F2B create mode 100644 device/celestica/x86_64-cel_seastone-r0/fancontrol delete mode 100644 device/celestica/x86_64-cel_seastone-r0/fancontrol-B2F delete mode 100644 device/celestica/x86_64-cel_seastone-r0/fancontrol-F2B delete mode 100755 platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.service delete mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.sh delete mode 100755 platform/broadcom/sonic-platform-modules-cel/haliburton/scripts/fancontrol.service delete mode 100755 platform/broadcom/sonic-platform-modules-cel/haliburton/scripts/fancontrol.sh delete mode 100755 platform/broadcom/sonic-platform-modules-cel/services/fancontrol/fancontrol diff --git a/device/celestica/x86_64-cel_e1031-r0/fancontrol b/device/celestica/x86_64-cel_e1031-r0/fancontrol new file mode 100644 index 0000000000..27c6dcb78e --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=2 +DEVPATH=hwmon3=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-23/23-004d hwmon2=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-11/11-001a +DEVNAME=hwmon3=emc2305 hwmon2=max6697 +FCTEMPS=hwmon3/device/pwm1=hwmon2/temp2_input hwmon3/device/pwm2=hwmon2/temp2_input hwmon3/device/pwm4=hwmon2/temp2_input +FCFANS=hwmon3/device/pwm1=hwmon3/device/fan1_input hwmon3/device/pwm2=hwmon3/device/fan2_input hwmon3/device/pwm4=hwmon3/device/fan4_input +MINTEMP=hwmon3/device/pwm1=29 hwmon3/device/pwm2=29 hwmon3/device/pwm4=29 +MAXTEMP=hwmon3/device/pwm1=44 hwmon3/device/pwm2=44 hwmon3/device/pwm4=44 +MINSTART=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 +MINSTOP=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 +MINPWM=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 +MAXPWM=hwmon3/device/pwm1=255 hwmon3/device/pwm2=255 hwmon3/device/pwm4=255 diff --git a/device/celestica/x86_64-cel_e1031-r0/fancontrol-B2F b/device/celestica/x86_64-cel_e1031-r0/fancontrol-B2F deleted file mode 100644 index 7c16892835..0000000000 --- a/device/celestica/x86_64-cel_e1031-r0/fancontrol-B2F +++ /dev/null @@ -1,11 +0,0 @@ -# Configuration file generated by pwmconfig, changes will be lost -INTERVAL=2 -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 -FCFANS=23-004d/pwm1=23-004d/fan1_input 23-004d/pwm2=23-004d/fan2_input 23-004d/pwm4=23-004d/fan4_input -MINTEMP=23-004d/pwm1=27 23-004d/pwm2=27 23-004d/pwm4=27 -MAXTEMP=23-004d/pwm1=46 23-004d/pwm2=46 23-004d/pwm4=46 -MINSTART=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 -MINSTOP=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 -MINPWM=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 -MAXPWM=23-004d/pwm1=255 23-004d/pwm2=255 23-004d/pwm4=255 -THYST=23-004d/pwm1=2 23-004d/pwm2=2 23-004d/pwm4=2 diff --git a/device/celestica/x86_64-cel_e1031-r0/fancontrol-F2B b/device/celestica/x86_64-cel_e1031-r0/fancontrol-F2B deleted file mode 100644 index a19d510b18..0000000000 --- a/device/celestica/x86_64-cel_e1031-r0/fancontrol-F2B +++ /dev/null @@ -1,11 +0,0 @@ -# Configuration file generated by pwmconfig, changes will be lost -INTERVAL=2 -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 -FCFANS=23-004d/pwm1=23-004d/fan1_input 23-004d/pwm2=23-004d/fan2_input 23-004d/pwm4=23-004d/fan4_input -MINTEMP=23-004d/pwm1=29 23-004d/pwm2=29 23-004d/pwm4=29 -MAXTEMP=23-004d/pwm1=46 23-004d/pwm2=46 23-004d/pwm4=46 -MINSTART=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 -MINSTOP=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 -MINPWM=23-004d/pwm1=102 23-004d/pwm2=102 23-004d/pwm4=102 -MAXPWM=23-004d/pwm1=255 23-004d/pwm2=255 23-004d/pwm4=255 -THYST=23-004d/pwm1=2 23-004d/pwm2=2 23-004d/pwm4=2 diff --git a/device/celestica/x86_64-cel_e1031-r0/installer.conf b/device/celestica/x86_64-cel_e1031-r0/installer.conf index b158400b22..9b49af7808 100644 --- a/device/celestica/x86_64-cel_e1031-r0/installer.conf +++ b/device/celestica/x86_64-cel_e1031-r0/installer.conf @@ -1,4 +1,3 @@ CONSOLE_PORT=0x2f8 CONSOLE_DEV=1 CONSOLE_SPEED=9600 -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich" diff --git a/device/celestica/x86_64-cel_seastone-r0/fancontrol b/device/celestica/x86_64-cel_seastone-r0/fancontrol new file mode 100644 index 0000000000..8d5cbccb9d --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon6=devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e hwmon7=devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d +DEVNAME=hwmon6=emc2305 hwmon7=emc2305 +FCTEMPS=hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input +FCFANS=hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm5 hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm4 hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm3 hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm2 hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm1 hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm5 hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm4 hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm3 hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm2 hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm1 +MINTEMP=hwmon6/device/pwm1=26 hwmon6/device/pwm2=26 hwmon6/device/pwm3=26 hwmon6/device/pwm4=26 hwmon6/device/pwm5=26 hwmon7/device/pwm1=26 hwmon7/device/pwm2=26 hwmon7/device/pwm3=26 hwmon7/device/pwm4=26 hwmon7/device/pwm5=26 +MAXTEMP=hwmon6/device/pwm1=45 hwmon6/device/pwm2=45 hwmon6/device/pwm3=45 hwmon6/device/pwm4=45 hwmon6/device/pwm5=45 hwmon7/device/pwm1=45 hwmon7/device/pwm2=45 hwmon7/device/pwm3=45 hwmon7/device/pwm4=45 hwmon7/device/pwm5=45 +MINSTART=hwmon6/device/pwm1=89 hwmon6/device/pwm2=89 hwmon6/device/pwm3=89 hwmon6/device/pwm4=89 hwmon6/device/pwm5=89 hwmon7/device/pwm1=89 hwmon7/device/pwm2=89 hwmon7/device/pwm3=89 hwmon7/device/pwm4=89 hwmon7/device/pwm5=89 +MINSTOP=hwmon6/device/pwm1=89 hwmon6/device/pwm2=89 hwmon6/device/pwm3=89 hwmon6/device/pwm4=89 hwmon6/device/pwm5=89 hwmon7/device/pwm1=89 hwmon7/device/pwm2=89 hwmon7/device/pwm3=89 hwmon7/device/pwm4=89 hwmon7/device/pwm5=89 +MINPWM=hwmon6/device/pwm1=89 hwmon6/device/pwm2=89 hwmon6/device/pwm3=89 hwmon6/device/pwm4=89 hwmon6/device/pwm5=89 hwmon7/device/pwm1=89 hwmon7/device/pwm2=89 hwmon7/device/pwm3=89 hwmon7/device/pwm4=89 hwmon7/device/pwm5=89 +MAXPWM=hwmon6/device/pwm1=255 hwmon6/device/pwm2=255 hwmon6/device/pwm3=255 hwmon6/device/pwm4=255 hwmon6/device/pwm5=255 hwmon7/device/pwm1=255 hwmon7/device/pwm2=255 hwmon7/device/pwm3=255 hwmon7/device/pwm4=255 hwmon7/device/pwm5=255 diff --git a/device/celestica/x86_64-cel_seastone-r0/fancontrol-B2F b/device/celestica/x86_64-cel_seastone-r0/fancontrol-B2F deleted file mode 100644 index 61b1c386f3..0000000000 --- a/device/celestica/x86_64-cel_seastone-r0/fancontrol-B2F +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration file generated by pwmconfig, changes will be lost -INTERVAL=2 -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 -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 -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 -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 -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 -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 -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 -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 -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 -MAXTEMPCRIT=/sys/bus/i2c/devices/7-004a/hwmon/hwmon*/temp1_input=65 /sys/bus/i2c/devices/14-0048/hwmon/hwmon*/temp1_input=75 -MAXTEMPTYPE=/sys/bus/i2c/devices/7-004a/hwmon/hwmon*/temp1_input=ASIC /sys/bus/i2c/devices/14-0048/hwmon/hwmon*/temp1_input=CPU diff --git a/device/celestica/x86_64-cel_seastone-r0/fancontrol-F2B b/device/celestica/x86_64-cel_seastone-r0/fancontrol-F2B deleted file mode 100644 index b851d0a6d6..0000000000 --- a/device/celestica/x86_64-cel_seastone-r0/fancontrol-F2B +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration file generated by pwmconfig, changes will be lost -INTERVAL=2 -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 -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 -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 -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 -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 -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 -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 -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 -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 -MAXTEMPCRIT=/sys/bus/i2c/devices/7-004a/hwmon/hwmon*/temp1_input=75 /sys/bus/i2c/devices/14-0048/hwmon/hwmon*/temp1_input=75 -MAXTEMPTYPE=/sys/bus/i2c/devices/7-004a/hwmon/hwmon*/temp1_input=ASIC /sys/bus/i2c/devices/14-0048/hwmon/hwmon*/temp1_input=CPU diff --git a/device/celestica/x86_64-cel_seastone-r0/installer.conf b/device/celestica/x86_64-cel_seastone-r0/installer.conf index bf643a31d4..924e0fb819 100644 --- a/device/celestica/x86_64-cel_seastone-r0/installer.conf +++ b/device/celestica/x86_64-cel_seastone-r0/installer.conf @@ -1,3 +1,2 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich" diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install index a36e2cd137..b88645a922 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install @@ -1,8 +1,5 @@ dx010/scripts/dx010_check_qsfp.sh usr/local/bin dx010/cfg/dx010-modules.conf etc/modules-load.d dx010/systemd/platform-modules-dx010.service lib/systemd/system -dx010/scripts/fancontrol.sh etc/init.d -dx010/scripts/fancontrol.service lib/systemd/system -services/fancontrol/fancontrol usr/local/bin dx010/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-cel_seastone-r0 -services/platform_api/platform_api_mgnt.sh usr/local/bin +services/platform_api/platform_api_mgnt.sh usr/local/bin \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.postinst b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.postinst index 83be629df5..bf7a120bb8 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.postinst +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.postinst @@ -2,7 +2,4 @@ depmod -a systemctl enable platform-modules-dx010.service systemctl start platform-modules-dx010.service -systemctl start platform-modules-dx010.service -systemctl start fancontrol.service - /usr/local/bin/platform_api_mgnt.sh install diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install index 400a593373..93b2eed633 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install @@ -1,5 +1,2 @@ haliburton/cfg/haliburton-modules.conf etc/modules-load.d haliburton/systemd/platform-modules-haliburton.service lib/systemd/system -haliburton/scripts/fancontrol.sh etc/init.d -haliburton/scripts/fancontrol.service lib/systemd/system -services/fancontrol/fancontrol usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst index a4ece20d66..bdc23c66d5 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst @@ -1,6 +1,3 @@ depmod -a systemctl enable platform-modules-haliburton.service -systemctl enable fancontrol.service - systemctl start platform-modules-haliburton.service -systemctl start fancontrol.service diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.service b/platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.service deleted file mode 100755 index 25b9f34df2..0000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=fan speed regulator -After=platform-modules-dx010.service -Before=pmon.service - -[Service] -ExecStart=-/etc/init.d/fancontrol.sh start -ExecStop=-/etc/init.d/fancontrol.sh stop -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.sh b/platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.sh deleted file mode 100644 index 93b1bda428..0000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/scripts/fancontrol.sh +++ /dev/null @@ -1,80 +0,0 @@ -#! /bin/sh - -### BEGIN INIT INFO -# Provides: fancontrol -# Required-Start: $remote_fs -# Required-Stop: $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: -# Short-Description: fancontrol -# 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 - -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") -done -CONF=${MAIN_CONF}-${FANDIR} - -case "$1" in -start) - 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 - ;; -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|stop|restart|force-reload|status}" - exit 1 - ;; -esac - -exit 0 diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/scripts/fancontrol.service b/platform/broadcom/sonic-platform-modules-cel/haliburton/scripts/fancontrol.service deleted file mode 100755 index bda5416700..0000000000 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/scripts/fancontrol.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=fan speed regulator -After=platform-modules-haliburton.service -Before=pmon.service - -[Service] -ExecStart=-/etc/init.d/fancontrol.sh start -ExecStop=-/etc/init.d/fancontrol.sh stop -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/scripts/fancontrol.sh b/platform/broadcom/sonic-platform-modules-cel/haliburton/scripts/fancontrol.sh deleted file mode 100755 index f4275ad5c9..0000000000 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/scripts/fancontrol.sh +++ /dev/null @@ -1,77 +0,0 @@ -#! /bin/sh - -### BEGIN INIT INFO -# Provides: fancontrol -# Required-Start: $remote_fs -# Required-Stop: $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: -# Short-Description: fancontrol -# 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 -PLATFORMPATH=/sys/devices/platform/e1031.smc -MAIN_CONF=/usr/share/sonic/device/x86_64-cel_e1031-r0/fancontrol -DEVPATH=/sys/devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-23/23-004d - -test -x $DAEMON || exit 0 - -for i in 1 2 3; do - j=$i - [ $i -eq 3 ] && j=4 - FANFAULT=$(cat ${DEVPATH}/fan${j}_fault) - [ $FANFAULT = 1 ] && continue - FANDIR=$(cat ${PLATFORMPATH}/fan${i}_dir) -done -CONF=${MAIN_CONF}-${FANDIR} - -case "$1" in -start) - 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 - ;; -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|stop|restart|force-reload|status}" - exit 1 - ;; -esac - -exit 0 diff --git a/platform/broadcom/sonic-platform-modules-cel/services/fancontrol/fancontrol b/platform/broadcom/sonic-platform-modules-cel/services/fancontrol/fancontrol deleted file mode 100755 index b365d76e2a..0000000000 --- a/platform/broadcom/sonic-platform-modules-cel/services/fancontrol/fancontrol +++ /dev/null @@ -1,662 +0,0 @@ -#!/bin/bash -# -# Simple script implementing a temperature dependent fan speed control -# Supported Linux kernel versions: 2.6.5 and later -# -# Version 0.70 -# -# Usage: fancontrol [CONFIGFILE] -# -# Dependencies: -# bash, egrep, sed, cut, sleep, readlink, lm_sensors :) -# -# Please send any questions, comments or success stories to -# marius.reiner@hdev.de -# Thanks! -# -# For configuration instructions and warnings please see fancontrol.txt, which -# can be found in the doc/ directory or at the website mentioned above. -# -# -# Copyright 2003 Marius Reiner -# Copyright (C) 2007-2009 Jean Delvare -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301 USA. -# -# - -PIDFILE="/var/run/fancontrol.pid" -THERMAL_OVERLOAD_CONTROL_FILE="/usr/local/bin/thermal_overload_control.sh" - -#DEBUG=1 -MAX=255 - -function LoadConfig -{ - local fcvcount fcv - - echo "Loading configuration from $1 ..." - if [ ! -r "$1" ] - then - echo "Error: Can't read configuration file" >&2 - exit 1 - fi - - # grep configuration from file - INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//g'` - DEVPATH=`egrep '^DEVPATH=.*$' $1 | sed -e 's/DEVPATH= *//g'` - DEVNAME=`egrep '^DEVNAME=.*$' $1 | sed -e 's/DEVNAME= *//g'` - FCTEMPS=`egrep '^FCTEMPS=.*$' $1 | sed -e 's/FCTEMPS=//g'` - MINTEMP=`egrep '^MINTEMP=.*$' $1 | sed -e 's/MINTEMP=//g'` - MAXTEMP=`egrep '^MAXTEMP=.*$' $1 | sed -e 's/MAXTEMP=//g'` - MINSTART=`egrep '^MINSTART=.*$' $1 | sed -e 's/MINSTART=//g'` - MINSTOP=`egrep '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP=//g'` - # optional settings: - FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'` - MINPWM=`egrep '^MINPWM=.*$' $1 | sed -e 's/MINPWM=//g'` - MAXPWM=`egrep '^MAXPWM=.*$' $1 | sed -e 's/MAXPWM=//g'` - THYST=`egrep '^THYST=.*$' $1 | sed -e 's/THYST=//g'` - MAXTEMPCRIT=`egrep '^MAXTEMPCRIT=.*$' $1 | sed -e 's/MAXTEMPCRIT=//g'` - MAXTEMPTYPE=`egrep '^MAXTEMPTYPE=.*$' $1 | sed -e 's/MAXTEMPTYPE=//g'` - echo - # Check whether all mandatory settings are set - if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]] - then - echo "Some mandatory settings missing, please check your config file!" >&2 - exit 1 - fi - if [ "$INTERVAL" -le 0 ] - then - echo "Error in configuration file:" >&2 - echo "INTERVAL must be at least 1" >&2 - exit 1 - fi - - # write settings to arrays for easier use and print them - echo - echo "Common settings:" - echo " INTERVAL=$INTERVAL" - - let fcvcount=0 - for fcv in $FCTEMPS - do - if ! echo $fcv | egrep -q '=' - then - echo "Error in configuration file:" >&2 - echo "FCTEMPS value is improperly formatted" >&2 - exit 1 - fi - - AFCPWM[$fcvcount]=`echo $fcv |cut -d'=' -f1` - AFCTEMP[$fcvcount]=`echo $fcv |cut -d'=' -f2` - AFCFAN[$fcvcount]=`echo $FCFANS |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` - AFCFANFAULT[$fcvcount]=`echo "${AFCFAN[$fcvcount]}" |sed -e 's/input/fault/g'` - AFCMINTEMP[$fcvcount]=`echo $MINTEMP |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` - AFCMAXTEMP[$fcvcount]=`echo $MAXTEMP |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` - AFCMINSTART[$fcvcount]=`echo $MINSTART |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` - AFCMINSTOP[$fcvcount]=`echo $MINSTOP |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` - AFCMINPWM[$fcvcount]=`echo $MINPWM |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` - [ -z "${AFCMINPWM[$fcvcount]}" ] && AFCMINPWM[$fcvcount]=0 - AFCMAXPWM[$fcvcount]=`echo $MAXPWM |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` - [ -z "${AFCMAXPWM[$fcvcount]}" ] && AFCMAXPWM[$fcvcount]=255 - AFCTHYST[$fcvcount]=`echo $THYST |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` - [ -z "${AFCTHYST[$fcvcount]}" ] && AFCTHYST[$fcvcount]=0 - - # verify the validity of the settings - if [ "${AFCMINTEMP[$fcvcount]}" -ge "${AFCMAXTEMP[$fcvcount]}" ] - then - echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2 - echo "MINTEMP must be less than MAXTEMP" >&2 - exit 1 - fi - if [ "${AFCMAXPWM[$fcvcount]}" -gt 255 ] - then - echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2 - echo "MAXPWM must be at most 255" >&2 - exit 1 - fi - if [ "${AFCMINSTOP[$fcvcount]}" -ge "${AFCMAXPWM[$fcvcount]}" ] - then - echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2 - echo "MINSTOP must be less than MAXPWM" >&2 - exit 1 - fi - if [ "${AFCMINSTOP[$fcvcount]}" -lt "${AFCMINPWM[$fcvcount]}" ] - then - echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2 - echo "MINSTOP must be greater than or equal to MINPWM" >&2 - exit 1 - fi - if [ "${AFCMINPWM[$fcvcount]}" -lt 0 ] - then - echo "Error in configuration file (${AFCPWM[$fcvcount]}):" >&2 - echo "MINPWM must be at least 0" >&2 - exit 1 - fi - - echo - echo "Settings for ${AFCPWM[$fcvcount]}:" - echo " Depends on ${AFCTEMP[$fcvcount]}" - echo " Controls ${AFCFAN[$fcvcount]}" - echo " MINTEMP=${AFCMINTEMP[$fcvcount]}" - echo " MAXTEMP=${AFCMAXTEMP[$fcvcount]}" - echo " MINSTART=${AFCMINSTART[$fcvcount]}" - echo " MINSTOP=${AFCMINSTOP[$fcvcount]}" - echo " MINPWM=${AFCMINPWM[$fcvcount]}" - echo " MAXPWM=${AFCMAXPWM[$fcvcount]}" - echo " THYST=${AFCTHYST[$fcvcount]}" - let fcvcount=fcvcount+1 - done - echo - - - let tscount=0 - for ts in $MAXTEMPCRIT - do - CSTEMP[$tscount]=`echo $ts | cut -d '=' -f1` - CSMAXTEMPCRIT[$tscount]=`echo $ts | cut -d '=' -f2` - CSMAXTEMPTYPE=($(echo $MAXTEMPTYPE |sed -e 's/ /\n/g'| cut -d'=' -f2)) - - echo - echo "Settings for ${CSMAXTEMPTYPE[$tscount]} temperature sensor:" - echo " Depends on ${CSTEMP[$tscount]}" - echo " MAXTEMPCRIT=${CSMAXTEMPCRIT[$tscount]}" - let tscount=tscount+1q - done - echo - -} - -function CheckFanFault() -{ - let fancount=0 - while (( $fancount < ${#AFCFANFAULT[@]} )) # go through all fan fault. - do - fault=`cat ${AFCFANFAULT[$fancount]}` - if [[ "$fault" == "1" ]] - then - return 1 # fan fault detected - fi - let fancount=$fancount+1 - done - return 0 -} - -function CheckTempOver() -{ - let tempcount=0 - while (( $tempcount < ${#CSTEMP[@]} )) # go through all temp. - do - ctemp=`cat ${CSTEMP[$tempcount]}` - let maxcrit="${CSMAXTEMPCRIT[$tempcount]}*1000" - if [ $ctemp -ge $maxcrit ] - then - logger "Thermal overload : ${CSMAXTEMPTYPE[$tempcount]} temperature ${ctemp} > ${maxcrit}" - if [ -f "$THERMAL_OVERLOAD_CONTROL_FILE" ] - then - toc_cmd="${THERMAL_OVERLOAD_CONTROL_FILE} ${CSMAXTEMPTYPE[$tempcount],,}" - bash $toc_cmd - exit 1 - fi - fi - let tempcount=$tempcount+1 - done - return 0 -} - -function DevicePath() -{ - if [ -h "$1/device" ] - then - readlink -f "$1/device" | sed -e 's/^\/sys\///' - fi -} - -function DeviceName() -{ - if [ -r "$1/name" ] - then - cat "$1/name" | sed -e 's/[[:space:]=]/_/g' - elif [ -r "$1/device/name" ] - then - cat "$1/device/name" | sed -e 's/[[:space:]=]/_/g' - fi -} - -function ValidateDevices() -{ - local OLD_DEVPATH="$1" OLD_DEVNAME="$2" outdated=0 - local entry device name path - - for entry in $OLD_DEVPATH - do - device=`echo "$entry" | sed -e 's/=[^=]*$//'` - path=`echo "$entry" | sed -e 's/^[^=]*=//'` - - if [ "`DevicePath "$device"`" != "$path" ] - then - echo "Device path of $device has changed" >&2 - outdated=1 - fi - done - - for entry in $OLD_DEVNAME - do - device=`echo "$entry" | sed -e 's/=[^=]*$//'` - name=`echo "$entry" | sed -e 's/^[^=]*=//'` - - if [ "`DeviceName "$device"`" != "$name" ] - then - echo "Device name of $device has changed" >&2 - outdated=1 - fi - done - - return $outdated -} - -# Check that all referenced sysfs files exist -function CheckFiles -{ - local outdated=0 fcvcount pwmo tsen fan - - let fcvcount=0 - while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs - do - pwmo=${AFCPWM[$fcvcount]} - if [ ! -w $pwmo ] - then - echo "Error: file $pwmo doesn't exist" >&2 - outdated=1 - fi - let fcvcount=$fcvcount+1 - done - - let fcvcount=0 - while (( $fcvcount < ${#AFCTEMP[@]} )) # go through all temp inputs - do - tsen=${AFCTEMP[$fcvcount]} - if [ ! -r $tsen ] - then - echo "Error: file $tsen doesn't exist" >&2 - outdated=1 - fi - let fcvcount=$fcvcount+1 - done - - let fcvcount=0 - while (( $fcvcount < ${#AFCFAN[@]} )) # go through all fan inputs - do - # A given PWM output can control several fans - for fan in $(echo ${AFCFAN[$fcvcount]} | sed -e 's/+/ /') - do - if [ ! -r $fan ] - then - echo "Error: file $fan doesn't exist" >&2 - outdated=1 - fi - done - let fcvcount=$fcvcount+1 - done - - if [ $outdated -eq 1 ] - then - echo >&2 - echo "At least one referenced file is missing. Either some required kernel" >&2 - echo "modules haven't been loaded, or your configuration file is outdated." >&2 - echo "In the latter case, you should run pwmconfig again." >&2 - fi - - return $outdated -} - -if [ "$1" == "--check" ] -then - if [ -f "$2" ] - then - LoadConfig $2 - else - LoadConfig /etc/fancontrol - fi - exit 0 -fi - -if [ -f "$1" ] -then - LoadConfig $1 -else - LoadConfig /etc/fancontrol -fi - -# Detect path to sensors -if echo "${AFCPWM[0]}" | egrep -q '^/' -then - DIR=/ -elif echo "${AFCPWM[0]}" | egrep -q '^hwmon[0-9]' -then - DIR=/sys/class/hwmon -elif echo "${AFCPWM[0]}" | egrep -q '^[1-9]*[0-9]-[0-9abcdef]{4}' -then - DIR=/sys/bus/i2c/devices -else - echo "$0: Invalid path to sensors" >&2 - exit 1 -fi - -if [ ! -d $DIR ] -then - echo $0: 'No sensors found! (did you load the necessary modules?)' >&2 - exit 1 -fi -cd $DIR - -# Check for configuration change -# if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ] -# then -# echo "Configuration is too old, please run pwmconfig again" >&2 -# exit 1 -# fi - -if [ "$DIR" = "/" -a -n "$DEVPATH" ] -then - echo "Unneeded DEVPATH with absolute device paths" >&2 - exit 1 -fi -if ! ValidateDevices "$DEVPATH" "$DEVNAME" -then - echo "Configuration appears to be outdated, please run pwmconfig again" >&2 - exit 1 -fi -CheckFiles || exit 1 - -if [ -f "$PIDFILE" ] -then - echo "File $PIDFILE exists, is fancontrol already running?" >&2 - exit 1 -fi -echo $$ > "$PIDFILE" - -# $1 = pwm file name -function pwmdisable() -{ - local ENABLE=${1}_enable - - # No enable file? Just set to max - if [ ! -f $ENABLE ] - then - echo $MAX > $1 - return 0 - fi - - # Try pwmN_enable=0 - echo 0 > $ENABLE 2> /dev/null - if [ `cat $ENABLE` -eq 0 ] - then - # Success - echo $MAX > $1 - return 0 - fi - - # It didn't work, try pwmN_enable=1 pwmN=255 - echo 1 > $ENABLE 2> /dev/null - echo $MAX > $1 - if [ `cat $ENABLE` -eq 1 -a `cat $1` -ge 190 ] - then - # Success - return 0 - fi - - # Nothing worked - echo "$ENABLE stuck to" `cat $ENABLE` >&2 - return 1 -} - -# $1 = pwm file name -function pwmenable() -{ - local ENABLE=${1}_enable - - if [ -f $ENABLE ] - then - echo 1 > $ENABLE 2> /dev/null - if [ $? -ne 0 ] - then - return 1 - fi - fi - echo $MAX > $1 -} - -function restorefans() -{ - local status=$1 fcvcount pwmo - - echo 'Aborting, restoring fans...' - let fcvcount=0 - while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs - do - pwmo=${AFCPWM[$fcvcount]} - pwmdisable $pwmo - let fcvcount=$fcvcount+1 - done - echo 'Verify fans have returned to full speed' - rm -f "$PIDFILE" - exit $status -} - -trap 'restorefans 0' SIGQUIT SIGTERM -trap 'restorefans 1' SIGHUP SIGINT - -function upperBound -{ - # $1: temperature - # $2: Tmin - # $3: Tmax - # $4: MinPWM - # $5: MaxPWM - # $6 Thyst - # upper_bound = (temperature-Tmin+2) * (MaxPWM-MinPWM)/(Tmax-Tmin)+MinPWM - let a="($1-$2+$6)*($5-$4)/($3-$2)+$4" - up_b=$a -} -function lowerBound -{ - # $1: temperature - # $2: Tmin - # $3: Tmax - # $4: MinPWM - # $5: MaxPWM - # $6 Thyst - # lower_bound = (temperature-Tmin) *(MaxPWM-MinPWM)/(Tmax-Tmin)+MinPWM - let a="($1-$2)*($5-$4)/($3-$2)+$4" - lw_b=$a -} - -# main function -function UpdateFanSpeeds -{ - local fcvcount - local pwmo tsens fan mint maxt minsa minso minpwm maxpwm tHyst - local tval pwmpval fanval min_fanval one_fan one_fanval - local -i pwmval - - let fcvcount=0 - while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs - do - #hopefully shorter vars will improve readability: - pwmo=${AFCPWM[$fcvcount]} - tsens=${AFCTEMP[$fcvcount]} - fan=${AFCFAN[$fcvcount]} - let mint="${AFCMINTEMP[$fcvcount]}*1000" - let maxt="${AFCMAXTEMP[$fcvcount]}*1000" - minsa=${AFCMINSTART[$fcvcount]} - minso=${AFCMINSTOP[$fcvcount]} - minpwm=${AFCMINPWM[$fcvcount]} - maxpwm=${AFCMAXPWM[$fcvcount]} - let tHyst="${AFCTHYST[$fcvcount]}*1000" - - #if some fan fault detected all pwm=100% - CheckFanFault - if [ $? -ne 0 ] - then - echo $MAX > $pwmo - let fcvcount=$fcvcount+1 - continue - fi - - #check thermal overload - CheckTempOver - - read tval < ${tsens} - if [ $? -ne 0 ] - then - echo "Error reading temperature from $DIR/$tsens" - restorefans 1 - fi - - read pwmpval < ${pwmo} - if [ $? -ne 0 ] - then - echo "Error reading PWM value from $DIR/$pwmo" - restorefans 1 - fi - - # If fanspeed-sensor output shall be used, do it - if [[ -n ${fan} ]] - then - min_fanval=100000 - fanval= - # A given PWM output can control several fans - for one_fan in $(echo $fan | sed -e 's/+/ /') - do - read one_fanval < ${one_fan} - if [ $? -ne 0 ] - then - echo "Error reading Fan value from $DIR/$one_fan" >&2 - restorefans 1 - fi - - # Remember the minimum, it only matters if it is 0 - if [ $one_fanval -lt $min_fanval ] - then - min_fanval=$one_fanval - fi - - if [ -z "$fanval" ] - then - fanval=$one_fanval - else - fanval="$fanval/$one_fanval" - fi - done - else - fanval=1 # set it to a non zero value, so the rest of the script still works - fi - - # debug info - if [ "$DEBUG" != "" ] - then - echo "pwmo=$pwmo" - echo "tsens=$tsens" - echo "fan=$fan" - echo "mint=$mint" - echo "maxt=$maxt" - echo "minsa=$minsa" - echo "minso=$minso" - echo "minpwm=$minpwm" - echo "maxpwm=$maxpwm" - echo "tval=$tval" - echo "pwmpval=$pwmpval" - echo "fanval=$fanval" - echo "min_fanval=$min_fanval" - echo "tHyst=$tHyst" - fi - pwmval=$pwmpval - if (( $tval+$tHyst <= $mint )) - then pwmval=$minpwm # below min temp, use defined min pwm - elif (( $tval >= $maxt )) - then pwmval=$maxpwm # over max temp, use defined max pwm - elif (( $tval+$tHyst >= $maxt )) && (( $pwmpval == $maxpwm )) - then pwmval=$maxpwm - else - # calculate the new value from temperature and settings - # pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso} - lowerBound ${tval} ${mint} ${maxt} ${minpwm} ${maxpwm} ${tHyst} - lb=$lw_b - upperBound ${tval} ${mint} ${maxt} ${minpwm} ${maxpwm} ${tHyst} - ub=$up_b - - if [ "$DEBUG" != "" ] - then - echo "old pwm=$pwmval lw_b=$lw_b up_b=$up_b" - fi - - if [[ "$pwmval" -gt "$ub" ]] - then - pwmval=$ub - else - if [[ "$pwmval" -lt "$lb" ]] - then - pwmval=$lb - fi - fi - - if [ $pwmpval -eq 0 -o $min_fanval -eq 0 ] - then # if fan was stopped start it using a safe value - echo $minsa > $pwmo - # Sleep while still handling signals - sleep 1 & - wait $! - fi - fi - echo $pwmval > $pwmo # write new value to pwm output - if [ $? -ne 0 ] - then - echo "Error writing PWM value to $DIR/$pwmo" >&2 - restorefans 1 - fi - if [ "$DEBUG" != "" ] - then - echo "new pwmval=$pwmval" - fi - let fcvcount=$fcvcount+1 - done -} - -echo 'Enabling PWM on fans...' -let fcvcount=0 -while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs -do - pwmo=${AFCPWM[$fcvcount]} - pwmenable $pwmo - if [ $? -ne 0 ] - then - echo "Error enabling PWM on $DIR/$pwmo" >&2 - restorefans 1 - fi - let fcvcount=$fcvcount+1 -done - -echo 'Starting automatic fan control...' - -# main loop calling the main function at specified intervals -while true -do - UpdateFanSpeeds - # Sleep while still handling signals - sleep $INTERVAL & - wait $! -done