sensors: occ: Add sensor nodes to clear min/max for CSM

Message ID 1500887460-13237-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Shilpasri G Bhat July 24, 2017, 9:11 a.m.
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
---
- This patch is based on top of the OCC cmd-rsp and inband sensors patch
  series:
  https://lists.ozlabs.org/pipermail/skiboot/2017-July/008352.html

 hw/occ.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/occ.c b/hw/occ.c
index c88e914..30e875b 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -1514,11 +1514,13 @@  void occ_add_sensor_groups(void)
 	}
 	dt_add_property_string(sg, "compatible", "ibm,opal-occ-sensor-group");
 
-	for (i = 0; i < nr_occs; i++)
+	for (i = 0; i < nr_occs; i++) {
+		struct dt_node *snode;
+		u32 handle;
+
 		for (j = 0; j < ARRAY_SIZE(limits); j++) {
 			struct dt_node *node;
 			char name[20];
-			u32 handle;
 
 			snprintf(name, 20, "occ-%s", limits[j].str);
 			handle = sensor_make_handler(SENSOR_OCC, 0,
@@ -1534,6 +1536,21 @@  void occ_add_sensor_groups(void)
 			dt_add_property_cells(node, "ibm,chip-id",
 					      chips[i].chip_id);
 		}
+
+		/* Add sensor nodes for clearing CSM min/max sensors */
+		handle = sensor_make_handler(SENSOR_OCC, 0,
+					     OCC_SENSOR_LIMIT_GROUP_CSM, i);
+		snode = dt_new_addr(sensor_node, "occ-reset-history", handle);
+		if (!snode) {
+			prerror("Failed to create sensor group node\n");
+			return;
+		}
+
+		dt_add_property_string(snode, "sensor-type", "reset_history");
+		dt_add_property_cells(snode, "sensor-data", handle);
+		dt_add_property_cells(snode, "ibm,chip-id", chips[i].chip_id);
+		dt_add_property_string(snode, "compatible", "ibm,opal-sensor");
+	}
 }
 
 /* CPU-OCC PState init */