summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%.bbappend9
-rwxr-xr-xmeta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh26
2 files changed, 35 insertions, 0 deletions
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%.bbappend b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%.bbappend
index 1b8819695..16c8d618b 100644
--- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%.bbappend
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%.bbappend
@@ -1,5 +1,9 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+SRC_URI += " \
+ file://start_max31785_hwmon.sh \
+ "
+
WSPOON_CHIPS = " \
i2c@1e78a000/i2c-bus@100/bmp280@77 \
i2c@1e78a000/i2c-bus@100/dps310@76 \
@@ -28,3 +32,8 @@ SYSTEMD_ENVIRONMENT_FILE_${PN} += "${@compose_list(d, 'ENVS', 'WSPOON_OCCITEMS')
SYSTEMD_ENVIRONMENT_FILE_max31785-msl += "obmc/hwmon-max31785/wspoon.conf"
SYSTEMD_LINK_max31785-msl += "../phosphor-max31785-msl@.service:${SYSTEMD_DEFAULT_TARGET}.wants/phosphor-max31785-msl@wspoon.service"
+
+do_install_append() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/start_max31785_hwmon.sh ${D}${bindir}
+}
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh
new file mode 100755
index 000000000..1270427a6
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Link in the correct MAX31785 phosphor-hwmon config file to use based on the
+# WaterCooled property, and then start the hwmon service.
+
+# $1: The OF_FULLNAME udev attribute for the MAX31785
+
+base="/etc/default/obmc/hwmon/"$1
+target=$base".conf"
+
+service=$(mapper get-service /xyz/openbmc_project/inventory/system/chassis)
+
+if [ $(busctl get-property $service \
+ /xyz/openbmc_project/inventory/system/chassis \
+ xyz.openbmc_project.Inventory.Decorator.CoolingType \
+ WaterCooled | grep true | wc -l) != 0 ];
+then
+ source=$base'_water.conf'
+else
+ source=$base'_air.conf'
+fi
+
+ln -sf $source $target
+
+instance=$(systemd-escape $1)
+systemctl start xyz.openbmc_project.Hwmon@$instance.service