summaryrefslogtreecommitdiff
path: root/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2018-04-25 18:53:41 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-05-02 19:56:54 +0300
commit245cb96f91b58bb08fca020dede2313feafae58a (patch)
treec8f6d4e09ca73d2d648b70a9c45ebfcc531207f6 /meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor
parent2739f60c411cdbd648975c0922af8c85bd0a7356 (diff)
downloadopenbmc-245cb96f91b58bb08fca020dede2313feafae58a.tar.xz
wspoon: Script to help start MAX31785 hwmon daemon
The phosphor-hwmon instance for the MAX31785 fan controller chip needs to use different config files based on if the system is air or water cooled, since different numbers of fans are used. This script will check the cooling type, link in the correct file based on that cooling type, and then start the actual hwmon service. Tested: Tested as part of end to end testing of this feature. Change-Id: Ie3efee5d3c6671911b505223152d32f3f5c5c259 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor')
-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