[Skiboot] [PATCH] occ: sensors-groups: Add DT properties to mark HWMON sensor groups
    Shilpasri G Bhat 
    shilpa.bhat at linux.vnet.ibm.com
       
    Thu Mar 22 21:44:00 AEDT 2018
    
    
  
Fix the sensor type to match HWMON sensor types. Add compatible flag
to indicate the environmental sensor groups so that operations on
these groups can be handled by HWMON linux interface.
Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
---
 hw/occ.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/hw/occ.c b/hw/occ.c
index 37cf73c..ca27cf6 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -1580,13 +1580,13 @@ void occ_add_sensor_groups(struct dt_node *sg, u32 *phandles, u32 *ptype,
 		{ OCC_SENSOR_TYPE_GENERIC, "generic",
 		  OPAL_SENSOR_GROUP_ENABLE
 		},
-		{ OCC_SENSOR_TYPE_CURRENT, "current",
+		{ OCC_SENSOR_TYPE_CURRENT, "curr",
 		  OPAL_SENSOR_GROUP_ENABLE
 		},
-		{ OCC_SENSOR_TYPE_VOLTAGE, "voltage",
+		{ OCC_SENSOR_TYPE_VOLTAGE, "in",
 		  OPAL_SENSOR_GROUP_ENABLE
 		},
-		{ OCC_SENSOR_TYPE_TEMPERATURE, "temperature",
+		{ OCC_SENSOR_TYPE_TEMPERATURE, "temp",
 		  OPAL_SENSOR_GROUP_ENABLE
 		},
 		{ OCC_SENSOR_TYPE_UTILIZATION, "utilization",
@@ -1627,6 +1627,17 @@ void occ_add_sensor_groups(struct dt_node *sg, u32 *phandles, u32 *ptype,
 
 		dt_add_property_cells(node, "sensor-group-id", handle);
 		dt_add_property_string(node, "type", groups[j].str);
+
+		if (groups[j].type == OCC_SENSOR_TYPE_CURRENT ||
+		    groups[j].type == OCC_SENSOR_TYPE_VOLTAGE ||
+		    groups[j].type == OCC_SENSOR_TYPE_TEMPERATURE ||
+		    groups[j].type == OCC_SENSOR_TYPE_POWER) {
+			dt_add_property_string(node, "sensor-type",
+					      groups[j].str);
+			dt_add_property_string(node, "compatible",
+					       "ibm,opal-sensor");
+		}
+
 		dt_add_property_cells(node, "ibm,chip-id", chipid);
 		dt_add_property_cells(node, "reg", handle);
 		if (groups[j].ops == OPAL_SENSOR_GROUP_ENABLE) {
-- 
1.8.3.1
    
    
More information about the Skiboot
mailing list