diff mbox

[V8,5/8] sensors: occ: Send CSM_{min/max} on min/max sensor read

Message ID 1500635680-26245-6-git-send-email-shilpa.bhat@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Shilpasri G Bhat July 21, 2017, 11:14 a.m. UTC
HWMON's lowest/highest attribute is used by CSM agent, so map it to
the min/max of CSM.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
---
 hw/occ-sensor.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Stewart Smith July 27, 2017, 8:54 a.m. UTC | #1
Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> writes:
> HWMON's lowest/highest attribute is used by CSM agent, so map it to
> the min/max of CSM.

I'm unsure to the exact reasoning of this patch?

I get that we have 3 sets of min/max sensors, but I am unclear as to why
we change to pick the CSM min/max rather than sample min/max.

Is there a good reason for it? Do they behave differently?
Shilpasri G Bhat July 27, 2017, 9:34 a.m. UTC | #2
Hi Stewart,

On 07/27/2017 02:24 PM, Stewart Smith wrote:
> Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> writes:
>> HWMON's lowest/highest attribute is used by CSM agent, so map it to
>> the min/max of CSM.
> 
> I'm unsure to the exact reasoning of this patch?
> 
> I get that we have 3 sets of min/max sensors, but I am unclear as to why
> we change to pick the CSM min/max rather than sample min/max.
> 
> Is there a good reason for it? Do they behave differently?
> 
> 

We actually have 4 sets of min/max sensors owned by OCC, CSM, Profiler and
Job-Scheduler. The difference between OCC and the remaining three is that
'sample min/max' belong to OCC and these cannot be reset, while the remaining
three sets of min/max can be reset using the OPAL-OCC command.

CSM agent reads the sensors using hwmon and the highest/lowest attributes in
hwmon points to CSM min/max, so that's why I am passing CSM's min/max in this
patch here.

I will define CSM min/max in
+enum sensor_attr {
+	SENSOR_SAMPLE,
+	SENSOR_MAX,
+	SENSOR_MIN,
+	MAX_SENSOR_ATTR,
+};

to add SENSOR_CSM_MIN and SENSOR_CSM_MAX and encode the same in the device-tree
for "sensor-data-max" and "sensor-data-min" property.

Thanks and Reagrds,
Shilpa
diff mbox

Patch

diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index 75f00d5..21d1722 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;
@@ -372,10 +372,10 @@  int occ_sensor_read(u32 handle, u32 *data)
 		*data = sensor->sample;
 		break;
 	case SENSOR_MAX:
-		*data = sensor->sample_max;
+		*data = sensor->csm_max;
 		break;
 	case SENSOR_MIN:
-		*data = sensor->sample_min;
+		*data = sensor->csm_min;
 		break;
 	default:
 		*data = 0;