Add mihawk platform to meta-ibm
The contents of this up-stream include the following items
1.Basic function
2.Led settings
3.GPIO monitor (id button and power supply)
4.Linux dts patch.
(From meta-ibm rev: c53430a2234917b71f29d7e61d6aea749c45a2fc)
Change-Id: Id0e47fd9197c8b2a70cbc94888bd572255664cdd
Signed-off-by: Ben Pai <Ben_Pai@wistron.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button.bb b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button.bb
new file mode 100644
index 0000000..cdbdf77
--- /dev/null
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button.bb
@@ -0,0 +1,30 @@
+SUMMARY = "ID Button pressed application"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${IBMBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
+
+inherit obmc-phosphor-systemd
+
+DEPENDS += "virtual/obmc-gpio-monitor"
+RDEPENDS_${PN} += "virtual/obmc-gpio-monitor"
+
+S = "${WORKDIR}"
+SRC_URI += "file://toggle_identify_led.sh"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/toggle_identify_led.sh \
+ ${D}${bindir}/toggle_identify_led.sh
+}
+
+SYSTEMD_ENVIRONMENT_FILE_${PN} +="obmc/gpio/id_button"
+
+ID_BUTTON_SERVICE = "id_button"
+
+TMPL = "phosphor-gpio-monitor@.service"
+INSTFMT = "phosphor-gpio-monitor@{0}.service"
+TGT = "multi-user.target"
+FMT = "../${TMPL}:${TGT}.requires/${INSTFMT}"
+
+SYSTEMD_SERVICE_${PN} += "id-button-pressed.service"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'ID_BUTTON_SERVICE')}"
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button/id-button-pressed.service b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button/id-button-pressed.service
new file mode 100644
index 0000000..c4f939c
--- /dev/null
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button/id-button-pressed.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=ID Button Pressed Service
+Wants=mapper-wait@-xyz-openbmc_project-led-groups.service
+After=mapper-wait@-xyz-openbmc_project-led-groups.service
+StartLimitIntervalSec=0
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/toggle_identify_led.sh
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button/obmc/gpio/id_button b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button/obmc/gpio/id_button
new file mode 100644
index 0000000..370e609
--- /dev/null
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button/obmc/gpio/id_button
@@ -0,0 +1,5 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=41
+POLARITY=1
+TARGET=id-button-pressed.service
+EXTRA_ARGS=--continue
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button/toggle_identify_led.sh b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
new file mode 100644
index 0000000..cd44c4b
--- /dev/null
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Toggle the state of identify LED Group
+
+SERVICE="xyz.openbmc_project.LED.GroupManager"
+INTERFACE="xyz.openbmc_project.Led.Group"
+PROPERTY="Asserted"
+
+# Get current state
+object=$(busctl tree $SERVICE --list | grep identify)
+led=$(cat /sys/devices/platform/leds/leds/rear-id/brightness)
+if [ "$led" == "0" ]; then
+ busctl set-property $SERVICE $object $INTERFACE $PROPERTY b false
+else
+ busctl set-property $SERVICE $object $INTERFACE $PROPERTY b true
+fi
+
+state=$(busctl get-property $SERVICE $object $INTERFACE $PROPERTY \
+ | awk '{print $NF;}')
+
+if [ "$state" == "false" ]; then
+ target='true'
+else
+ target='false'
+fi
+
+# Set target state
+busctl set-property $SERVICE $object $INTERFACE $PROPERTY b $target
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/mihawk/obmc/gpio/phosphor-power-supply-0.conf b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/mihawk/obmc/gpio/phosphor-power-supply-0.conf
new file mode 100755
index 0000000..5775487
--- /dev/null
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/mihawk/obmc/gpio/phosphor-power-supply-0.conf
@@ -0,0 +1,6 @@
+INVENTORY=/system/chassis/motherboard/powersupply0
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=200
+NAME=powersupply0
+DRIVERS=/sys/bus/i2c/drivers/ibm-cffps,3-005b
+EXTRA_IFACES=xyz.openbmc_project.Inventory.Item.PowerSupply
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/mihawk/obmc/gpio/phosphor-power-supply-1.conf b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/mihawk/obmc/gpio/phosphor-power-supply-1.conf
new file mode 100755
index 0000000..4d76afb
--- /dev/null
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor/mihawk/obmc/gpio/phosphor-power-supply-1.conf
@@ -0,0 +1,6 @@
+INVENTORY=/system/chassis/motherboard/powersupply1
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=202
+NAME=powersupply1
+DRIVERS=/sys/bus/i2c/drivers/ibm-cffps,3-0058
+EXTRA_IFACES=xyz.openbmc_project.Inventory.Item.PowerSupply
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend
index 032056c..6919edf 100644
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/gpio/phosphor-gpio-monitor_%.bbappend
@@ -6,7 +6,9 @@
FMT_POWERSUPPLY = "../${TMPL_POWERSUPPLY}:${POWERSUPPLY_TGT}.requires/${INSTFMT_POWERSUPPLY}"
SYSTEMD_LINK_${PN}-presence_append_ibm-ac-server = " ${@compose_list(d, 'FMT_POWERSUPPLY', 'OBMC_POWER_SUPPLY_INSTANCES')}"
+SYSTEMD_LINK_${PN}-presence_append_mihawk = " ${@compose_list(d, 'FMT_POWERSUPPLY', 'OBMC_POWER_SUPPLY_INSTANCES')}"
POWERSUPPLY_ENV_FMT = "obmc/gpio/phosphor-power-supply-{0}.conf"
SYSTEMD_ENVIRONMENT_FILE_${PN}-presence_append_ibm-ac-server = " ${@compose_list(d, 'POWERSUPPLY_ENV_FMT', 'OBMC_POWER_SUPPLY_INSTANCES')}"
+SYSTEMD_ENVIRONMENT_FILE_${PN}-presence_append_mihawk = " ${@compose_list(d, 'POWERSUPPLY_ENV_FMT', 'OBMC_POWER_SUPPLY_INSTANCES')}"