Add GPIO Presence
Add the GPIO Presence service file and needed Witherspoon
conf files for power supply GPIO presence detection.
Resolves openbmc/openbmc#1329
Change-Id: Ie8d5e3e6c2bda1c85fd10a4cffacfdd7ce9840ae
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor.bbappend b/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor.bbappend
new file mode 100644
index 0000000..9d1ca66
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor.bbappend
@@ -0,0 +1,14 @@
+FILESEXTRAPATHS_append := "${THISDIR}/${PN}:"
+
+OBMC_POWERSUPPLY_INSTANCES = "0 1"
+
+TMPL_POWERSUPPLY = "phosphor-gpio-presence@.service"
+INSTFMT_POWERSUPPLY = "phosphor-gpio-presence@{0}.service"
+POWERSUPPLY_TGT = "${SYSTEMD_DEFAULT_TARGET}"
+FMT_POWERSUPPLY = "../${TMPL_POWERSUPPLY}:${POWERSUPPLY_TGT}.requires/${INSTFMT_POWERSUPPLY}"
+
+SYSTEMD_LINK_${PN}-presence += "${@compose_list(d, 'FMT_POWERSUPPLY', 'OBMC_POWERSUPPLY_INSTANCES')}"
+
+POWERSUPPLY_ENV_FMT = "obmc/gpio/phosphor-power-supply-{0}.conf"
+
+SYSTEMD_ENVIRONMENT_FILE_${PN}-presence += "${@compose_list(d, 'POWERSUPPLY_ENV_FMT', 'OBMC_POWERSUPPLY_INSTANCES')}"
diff --git a/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/phosphor-power-supply-0.conf b/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/phosphor-power-supply-0.conf
new file mode 100644
index 0000000..1248641
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/phosphor-power-supply-0.conf
@@ -0,0 +1,4 @@
+INVENTORY=/system/chassis/power_supply0
+PATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=127
+NAME=power_supply0
diff --git a/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/phosphor-power-supply-1.conf b/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/phosphor-power-supply-1.conf
new file mode 100644
index 0000000..512905b
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/phosphor-power-supply-1.conf
@@ -0,0 +1,4 @@
+INVENTORY=/system/chassis/power_supply1
+PATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=104
+NAME=power_supply1