meta-ampere: mtjade: support FAN fault check

Support FAN fault check via by enabling phosphor-led-manager's
monitor-operational-status with appropriate
phosphor-inventory-manager associations configuration.

Tested:
1. Get Led group list
   $ busctl tree xyz.openbmc_project.LED.GroupManager
   `- /xyz
  `- /xyz/openbmc_project
    `- /xyz/openbmc_project/led
      `- /xyz/openbmc_project/led/groups
        |- /xyz/openbmc_project/led/groups/fan_fault
2. Change the fan pwm, then stop the fan control service and verify
   that fault led is on
3. Start the fan control service and verify that fault led is off

Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com>
Change-Id: If473ebfe288d80515217e7e5fb9dc6244dcb8ed3
diff --git a/meta-ampere/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend b/meta-ampere/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend
new file mode 100644
index 0000000..9c240d1
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend
@@ -0,0 +1 @@
+PACKAGECONFIG:append = " monitor-operational-status"
diff --git a/meta-ampere/meta-jade/recipes-phosphor/inventory/phosphor-inventory-manager/associations.json b/meta-ampere/meta-jade/recipes-phosphor/inventory/phosphor-inventory-manager/associations.json
new file mode 100644
index 0000000..5f9e57a
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/inventory/phosphor-inventory-manager/associations.json
@@ -0,0 +1,230 @@
+[
+    {
+        "path": "system/chassis/Mt_Jade/FAN3",
+        "endpoints":
+        [
+            {
+                "types":
+                {
+                    "rType": "inventory",
+                    "fType": "sensors"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN3_1",
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN3_2"
+                ]
+            },
+            {
+                "types":
+                {
+                    "rType": "cooled_by",
+                    "fType": "cooling"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/inventory/system/chassis"
+                ]
+            },
+            {
+                "types": {
+                    "rType": "fault_identified_by",
+                    "fType": "fault_identifying"
+                },
+                "paths": [
+                    "/xyz/openbmc_project/led/groups/fan_fault"
+                ]
+            }
+        ]
+    },
+    {
+        "path": "system/chassis/Mt_Jade/FAN4",
+        "endpoints":
+        [
+            {
+                "types":
+                {
+                    "rType": "inventory",
+                    "fType": "sensors"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN4_1",
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN4_2"
+                ]
+            },
+            {
+                "types":
+                {
+                    "rType": "cooled_by",
+                    "fType": "cooling"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/inventory/system/chassis"
+                ]
+            },
+            {
+                "types": {
+                    "rType": "fault_identified_by",
+                    "fType": "fault_identifying"
+                },
+                "paths": [
+                    "/xyz/openbmc_project/led/groups/fan_fault"
+                ]
+            }
+        ]
+    },
+    {
+        "path": "system/chassis/Mt_Jade/FAN5",
+        "endpoints":
+        [
+            {
+                "types":
+                {
+                    "rType": "inventory",
+                    "fType": "sensors"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN5_1",
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN5_2"
+                ]
+            },
+            {
+                "types":
+                {
+                    "rType": "cooled_by",
+                    "fType": "cooling"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/inventory/system/chassis"
+                ]
+            },
+            {
+                "types": {
+                    "rType": "fault_identified_by",
+                    "fType": "fault_identifying"
+                },
+                "paths": [
+                    "/xyz/openbmc_project/led/groups/fan_fault"
+                ]
+            }
+        ]
+    },
+    {
+        "path": "system/chassis/Mt_Jade/FAN6",
+        "endpoints":
+        [
+            {
+                "types":
+                {
+                    "rType": "inventory",
+                    "fType": "sensors"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN6_1",
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN6_2"
+                ]
+            },
+            {
+                "types":
+                {
+                    "rType": "cooled_by",
+                    "fType": "cooling"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/inventory/system/chassis"
+                ]
+            },
+            {
+                "types": {
+                    "rType": "fault_identified_by",
+                    "fType": "fault_identifying"
+                },
+                "paths": [
+                    "/xyz/openbmc_project/led/groups/fan_fault"
+                ]
+            }
+        ]
+    },
+    {
+        "path": "system/chassis/Mt_Jade/FAN7",
+        "endpoints":
+        [
+            {
+                "types":
+                {
+                    "rType": "inventory",
+                    "fType": "sensors"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN7_1",
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN7_2"
+                ]
+            },
+            {
+                "types":
+                {
+                    "rType": "cooled_by",
+                    "fType": "cooling"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/inventory/system/chassis"
+                ]
+            },
+            {
+                "types": {
+                    "rType": "fault_identified_by",
+                    "fType": "fault_identifying"
+                },
+                "paths": [
+                    "/xyz/openbmc_project/led/groups/fan_fault"
+                ]
+            }
+        ]
+    },
+    {
+        "path": "system/chassis/Mt_Jade/FAN8",
+        "endpoints":
+        [
+            {
+                "types":
+                {
+                    "rType": "inventory",
+                    "fType": "sensors"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN8_1",
+                    "/xyz/openbmc_project/sensors/fan_tach/FAN8_2"
+                ]
+            },
+            {
+                "types":
+                {
+                    "rType": "cooled_by",
+                    "fType": "cooling"
+                },
+                "paths":
+                [
+                    "/xyz/openbmc_project/inventory/system/chassis"
+                ]
+            },
+            {
+                "types": {
+                    "rType": "fault_identified_by",
+                    "fType": "fault_identifying"
+                },
+                "paths": [
+                    "/xyz/openbmc_project/led/groups/fan_fault"
+                ]
+            }
+        ]
+    }
+]
\ No newline at end of file
diff --git a/meta-ampere/meta-jade/recipes-phosphor/inventory/phosphor-inventory-manager_%.bbappend b/meta-ampere/meta-jade/recipes-phosphor/inventory/phosphor-inventory-manager_%.bbappend
new file mode 100644
index 0000000..768c667
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/inventory/phosphor-inventory-manager_%.bbappend
@@ -0,0 +1,10 @@
+DEPENDS:append = " inventory-cleanup"
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+PACKAGECONFIG:append = " associations"
+SRC_URI:append = " file://associations.json"
+
+do_install:append() {
+    install -d ${D}${base_datadir}
+    install -m 0755 ${WORKDIR}/associations.json ${D}${base_datadir}
+}
diff --git a/meta-ampere/meta-jade/recipes-phosphor/leds/phosphor-led-manager/led-group-config.json b/meta-ampere/meta-jade/recipes-phosphor/leds/phosphor-led-manager/led-group-config.json
index 0bc0adc..bec2a99 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/leds/phosphor-led-manager/led-group-config.json
+++ b/meta-ampere/meta-jade/recipes-phosphor/leds/phosphor-led-manager/led-group-config.json
@@ -31,6 +31,17 @@
 					"Period": 1000
 				}
 			]
+		},
+		{
+			"group": "fan_fault",
+			"members": [
+				{
+					"Name": "fault",
+					"Action": "On",
+					"DutyOn": 50,
+					"Period": 1000
+				}
+			]
 		}
 	]
 }