meta-ibm/wspoon: Switch fan presence to JSON config

Enable the use of JSON and install the fan presence JSON config file
into the witherspoon image. The other fan applications will continue to
use their respective YAML build time config file(s).

Tested:
    Built witherspoon image, uses JSON config
    Built mihawk image, continues to use YAML

(From meta-ibm rev: a6817ca6ca8c87a10eb325835ba4db59109f6101)

Change-Id: I1b675e8a3b064b04007d7474d12e5d5ad2094dad
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan-presence-config.bbappend b/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan-presence-config.bbappend
index 8f2097c..9442477 100644
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan-presence-config.bbappend
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan-presence-config.bbappend
@@ -1 +1,11 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
+
+SRC_URI_witherspoon = "file://config.json"
+
+do_install_witherspoon() {
+        install -d ${D}/${datadir}/phosphor-fan-presence/presence/
+        install -m 0644 ${WORKDIR}/config.json ${D}/${datadir}/phosphor-fan-presence/presence/
+}
+
+FILES_${PN}_append_witherspoon = " ${datadir}/phosphor-fan-presence/presence/config.json"
+FILES_${PN}_remove_witherspoon = "${presence_datadir}/config.yaml"
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan-presence-config/witherspoon/config.yaml b/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan-presence-config/witherspoon/config.yaml
deleted file mode 100644
index 1c26fc2..0000000
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan-presence-config/witherspoon/config.yaml
+++ /dev/null
@@ -1,55 +0,0 @@
-- name: fan0
-  path: /system/chassis/motherboard/fan0
-  methods:
-    - type: gpio
-      key: 4
-      physpath: /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a100.i2c-bus/i2c-3/3-0060
-      devpath: /dev/input/by-path/platform-gpio-keys-polled-event
-    - type: tach
-      sensors:
-        - fan0_0
-        - fan0_1
-  rpolicy:
-    type: anyof
-
-- name: fan1
-  path: /system/chassis/motherboard/fan1
-  methods:
-    - type: gpio
-      key: 5
-      physpath: /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a100.i2c-bus/i2c-3/3-0060
-      devpath: /dev/input/by-path/platform-gpio-keys-polled-event
-    - type: tach
-      sensors:
-        - fan1_0
-        - fan1_1
-  rpolicy:
-    type: anyof
-
-- name: fan2
-  path: /system/chassis/motherboard/fan2
-  methods:
-    - type: gpio
-      key: 6
-      physpath: /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a100.i2c-bus/i2c-3/3-0060
-      devpath: /dev/input/by-path/platform-gpio-keys-polled-event
-    - type: tach
-      sensors:
-        - fan2_0
-        - fan2_1
-  rpolicy:
-    type: anyof
-
-- name: fan3
-  path: /system/chassis/motherboard/fan3
-  methods:
-    - type: gpio
-      key: 7
-      physpath: /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a100.i2c-bus/i2c-3/3-0060
-      devpath: /dev/input/by-path/platform-gpio-keys-polled-event
-    - type: tach
-      sensors:
-        - fan3_0
-        - fan3_1
-  rpolicy:
-    type: anyof
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan_%.bbappend b/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan_%.bbappend
index 243a02f..70bbc77 100644
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan_%.bbappend
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/fans/phosphor-fan_%.bbappend
@@ -50,3 +50,7 @@
 # Link fan control service to also start at poweron
 FMT_CONTROL_PWRON_witherspoon = "../${TMPL_CONTROL}:${POWERON_TGT}.requires/${INSTFMT_CONTROL}"
 SYSTEMD_LINK_${PN}-control_witherspoon += "${@compose_list(d, 'FMT_CONTROL_PWRON', 'OBMC_CHASSIS_INSTANCES')}"
+
+# Enable the use of JSON on the fan applications that support it
+EXTRA_OECONF_append_witherspoon = " --enable-json"
+RDEPENDS_${PN}-presence-tach_append_witherspoon = " phosphor-fan-presence-config"