diff mbox

[v3,04/11] dts: add a status property

Message ID 1425934582-7556-5-git-send-email-clg@fr.ibm.com
State Accepted
Headers show

Commit Message

Cédric Le Goater March 9, 2015, 8:56 p.m. UTC
The Linux driver should use this property to reflect the status as
a hwmon *_alarm or *_fault attribute.

The temperature sensors trip bits are currently always set, so we
brutaly assign the value to nil until we know why.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
---
 
 Changes since v2 :
 
 - removed the device tree modifications of the FSP sensors 
 - simplified the returned status value which was taking into account 
   the FSP sensors in the previous patchset.

 Changes since RFC :

 - added DTS status

 hw/dts.c |    9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox

Patch

diff --git a/hw/dts.c b/hw/dts.c
index a58703cf28de..1ac3aad50905 100644
--- a/hw/dts.c
+++ b/hw/dts.c
@@ -114,6 +114,12 @@  static int dts_read_core_temp(uint32_t pir, struct dts *dts)
 
 	prlog(PR_TRACE, "DTS: Chip %x Core %x temp:%dC trip:%x\n",
 	      chip_id, core, dts->temp, dts->trip);
+
+	/*
+	 * FIXME: The trip bits are always set ?! Just discard
+	 * them for the moment until we understand why.
+	 */
+	dts->trip = 0;
 	return 0;
 }
 
@@ -194,6 +200,9 @@  bool dts_sensor_create_nodes(struct dt_node *sensors)
 			dt_add_property_string(node, "compatible",
 					       "ibm,opal-sensor");
 			dt_add_property_cells(node, "sensor-data", handler);
+			handler = sensor_make_handler(sensor_class,
+					c->pir, SENSOR_DTS_ATTR_TEMP_TRIP);
+			dt_add_property_cells(node, "sensor-status", handler);
 		}
 	}