summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
index 5cbf49bb5..01c52deac 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
@@ -7,6 +7,23 @@
# Global variable: PSU_HARDRESET_DELAY specifies the number of seconds to wait
# before pulling the trigger. If not specified or zero, the script power cycles
# immediately.
+
+##################################################
+# Stop the phosphor-hwmon daemon
+# Return:
+# 0 if success, non-zero if error
+##################################################
+stop_phosphor_hwmon() {
+ if (( $# != 0 )); then
+ echo 'Usage: stop_phosphor_hwmon' >&2
+ return 1
+ fi
+
+ echo "Stopping phosphor-hwmon" >&2
+ local srv='system-xyz.openbmc_project.Hwmon.slice'
+ systemctl stop "${srv}"
+}
+
main() {
# Sleep PSU_HARDRESET_DELAY seconds
local psu_delay=$((PSU_HARDRESET_DELAY))
@@ -15,6 +32,10 @@ main() {
sleep "${psu_delay}"
fi
+ # Stop phosphor-hwmon so that ADM1272 powercycle doesn't happen
+ # in the middle of an i2c transaction and stuck the bus low
+ stop_phosphor_hwmon
+
gpioset gpiochip6 26=1
}