aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>2017-07-28 00:45:31 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-07-28 14:53:19 +1000
commit89d80cad678e7cc9e6240b451f80793c953880e5 (patch)
treece9a48276e8b7b150ba4b66237af029d22bed495
parent1ded56ceb6a1c0f6e37321cbb74f4104ebfcf3fa (diff)
downloadskiboot-89d80cad678e7cc9e6240b451f80793c953880e5.zip
skiboot-89d80cad678e7cc9e6240b451f80793c953880e5.tar.gz
skiboot-89d80cad678e7cc9e6240b451f80793c953880e5.tar.bz2
sensors: occ: Add CSM_{min/max} sensors
HWMON's lowest/highest attribute is used by CSM agent, so map min/max device-tree properties "sensor-data-min" and "sensor-data-max" to the min/max of CSM. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/occ-sensor.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index 7cee9a9..2b7974a 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -203,9 +203,9 @@ struct occ_sensor_name {
* @sample: Latest sample of this sensor
* @sample_min: Minimum value since last OCC reset
* @sample_max: Maximum value since last OCC reset
- * @CSM_min: Minimum value since last reset request
+ * @csm_min: Minimum value since last reset request
* by CSM (CORAL)
- * @CSM_max: Maximum value since last reset request
+ * @csm_max: Maximum value since last reset request
* by CSM (CORAL)
* @profiler_min: Minimum value since last reset request
* by profiler (CORAL)
@@ -226,8 +226,8 @@ struct occ_sensor_record {
u16 sample;
u16 sample_min;
u16 sample_max;
- u16 CSM_min;
- u16 CSM_max;
+ u16 csm_min;
+ u16 csm_max;
u16 profiler_min;
u16 profiler_max;
u16 job_scheduler_min;
@@ -256,8 +256,10 @@ struct occ_sensor_counter {
enum sensor_attr {
SENSOR_SAMPLE,
- SENSOR_MAX,
- SENSOR_MIN,
+ SENSOR_SAMPLE_MIN, /* OCC's min/max */
+ SENSOR_SAMPLE_MAX,
+ SENSOR_CSM_MIN, /* CSM's min/max */
+ SENSOR_CSM_MAX,
MAX_SENSOR_ATTR,
};
@@ -371,11 +373,17 @@ int occ_sensor_read(u32 handle, u32 *data)
case SENSOR_SAMPLE:
*data = sensor->sample;
break;
- case SENSOR_MAX:
+ case SENSOR_SAMPLE_MIN:
+ *data = sensor->sample_min;
+ break;
+ case SENSOR_SAMPLE_MAX:
*data = sensor->sample_max;
break;
- case SENSOR_MIN:
- *data = sensor->sample_min;
+ case SENSOR_CSM_MIN:
+ *data = sensor->csm_min;
+ break;
+ case SENSOR_CSM_MAX:
+ *data = sensor->csm_max;
break;
default:
*data = 0;
@@ -580,10 +588,10 @@ void occ_sensors_init(void)
dt_add_property_string(node, "sensor-type", type);
dt_add_property_cells(node, "sensor-data", handler);
- handler = sensor_handler(occ_num, i, SENSOR_MAX);
+ handler = sensor_handler(occ_num, i, SENSOR_CSM_MAX);
dt_add_property_cells(node, "sensor-data-max", handler);
- handler = sensor_handler(occ_num, i, SENSOR_MIN);
+ handler = sensor_handler(occ_num, i, SENSOR_CSM_MIN);
dt_add_property_cells(node, "sensor-data-min", handler);
dt_add_property_string(node, "compatible",