meta-facebook : Add phosphor-buttons gpio config YV2

This change adds phosphor-buttons gpio configs for
the following :

  1. Power button
  2. Reset button
  3. Host selector
  4. Debug host selector button
  5. serial uart mux

To keep the install method common for copying gpio_defs.json file
in supported platforms the install method is moved to
obmc-phosphor-buttons_git.bb file.

Signed-off-by: Naveen Moses <naveen.mosess@hcl.com>
Change-Id: I91a106fdc5ac9aa83eec63cbd41a9615b380c37d
diff --git a/meta-facebook/recipes-phosphor/phosphor-buttons/obmc-phosphor-buttons/yosemitev2/gpio_defs.json b/meta-facebook/recipes-phosphor/phosphor-buttons/obmc-phosphor-buttons/yosemitev2/gpio_defs.json
new file mode 100644
index 0000000..8e82aba
--- /dev/null
+++ b/meta-facebook/recipes-phosphor/phosphor-buttons/obmc-phosphor-buttons/yosemitev2/gpio_defs.json
@@ -0,0 +1,120 @@
+{
+    "gpio_definitions": [
+        {
+            "name": "POWER_BUTTON",
+            "pin": "D0",
+            "direction": "both"
+        },
+        {
+            "name": "RESET_BUTTON",
+            "pin": "AB0",
+            "direction": "both"
+        },
+        {
+            "name": "DEBUG_SELECTOR_BUTTON",
+            "pin": "O3",
+            "direction": "both"
+        },
+        {
+            "name" : "HOST_SELECTOR",
+
+            "group_gpio_config" : [
+            {
+                "name" : "host_select_0",
+                "pin": "AA4",
+                "direction": "both",
+                "polarity" : "active_high"
+
+            },
+            {
+                "name" : "host_select_1",
+                "pin": "AA5",
+                "direction": "both",
+                "polarity" : "active_high"
+
+            },
+            {
+                "name" : "host_select_2",
+                "pin": "AA6",
+                "direction": "both",
+                "polarity" : "active_high"
+
+            },
+            {
+                "name" : "host_select_3",
+                "pin": "AA7",
+                "direction": "both",
+                "polarity" : "active_high"
+
+            }
+            ],
+            "max_position" : 4,
+            "host_selector_map" : {
+                    "6" : 0,
+                    "7": 1,
+                    "8": 2,
+                    "9": 3,
+                    "10": 4,
+                    "11": 0,
+                    "12": 1,
+                    "13": 2,
+                    "14" : 3,
+                    "15" : 4
+                }
+
+        },
+        {
+            "name" : "SERIAL_UART_MUX",
+
+            "group_gpio_config" : [
+            {
+                "name" : "serial_uart_sel_0",
+                "pin": "E0",
+                "direction": "out",
+                "polarity" : "active_high"
+            },
+            {
+                "name" : "serial_uart_sel_1",
+                "pin": "E1",
+                "direction": "out",
+                "polarity" : "active_high"
+            },
+            {
+                "name" : "serial_uart_sel_2",
+                "pin": "E2",
+                "direction": "out",
+                "polarity" : "active_high"
+            },
+            {
+                "name" : "serial_uart_sel_3",
+                "pin": "E3",
+                "direction": "out",
+                "polarity" : "active_high"
+            },
+            {
+                "name" : "serial_uart_rx",
+                "pin": "E4",
+                "direction": "out",
+                "polarity" : "active_high"
+            },
+            {
+                "name" : "debug_card_present",
+                "pin": "R3",
+                "direction": "both",
+                "polarity" : "active_high"
+
+            }
+
+        ],
+        "serial_uart_mux_map" : {
+                "0" : 4,
+                "1": 0,
+                "2": 1,
+                "3": 2,
+                "4": 3
+            }
+
+        }
+
+    ]
+}
diff --git a/meta-facebook/recipes-phosphor/phosphor-buttons/obmc-phosphor-buttons_%.bbappend b/meta-facebook/recipes-phosphor/phosphor-buttons/obmc-phosphor-buttons_%.bbappend
new file mode 100644
index 0000000..8e32c2d
--- /dev/null
+++ b/meta-facebook/recipes-phosphor/phosphor-buttons/obmc-phosphor-buttons_%.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI:append:yosemitev2 = " file://gpio_defs.json"
\ No newline at end of file
diff --git a/meta-phosphor/recipes-phosphor/chassis/obmc-phosphor-buttons_git.bb b/meta-phosphor/recipes-phosphor/chassis/obmc-phosphor-buttons_git.bb
index e5f72ac..464139e 100644
--- a/meta-phosphor/recipes-phosphor/chassis/obmc-phosphor-buttons_git.bb
+++ b/meta-phosphor/recipes-phosphor/chassis/obmc-phosphor-buttons_git.bb
@@ -32,3 +32,11 @@
 BUTTON_PACKAGES = "${PN}-signals ${PN}-handler"
 
 PACKAGE_BEFORE_PN += "${BUTTON_PACKAGES}"
+
+do_install:append() {
+  if [ -e "${WORKDIR}/gpio_defs.json" ]; then
+     install -m 0755 -d ${D}/etc/default/obmc/gpio
+     install -m 0644 -D ${WORKDIR}/gpio_defs.json \
+                   ${D}/etc/default/obmc/gpio
+  fi
+}
\ No newline at end of file