firmware: arm_scmi: Add SCMI v3.0 sensors timestamped reads

Add new .reading_get_timestamped() method to sensor_ops to support SCMI v3.0
timestamped reads.

Link: https://lore.kernel.org/r/20201119174906.43862-5-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
Cristian Marussi 2020-11-19 17:49:04 +00:00 committed by Sudeep Holla
parent d7971d57d2
commit e2083d3673
2 changed files with 143 additions and 6 deletions

View file

@ -149,6 +149,20 @@ struct scmi_power_ops {
u32 *state);
};
/**
* scmi_sensor_reading - represent a timestamped read
*
* Used by @reading_get_timestamped method.
*
* @value: The signed value sensor read.
* @timestamp: An unsigned timestamp for the sensor read, as provided by
* SCMI platform. Set to zero when not available.
*/
struct scmi_sensor_reading {
long long value;
unsigned long long timestamp;
};
/**
* scmi_range_attrs - specifies a sensor or axis values' range
* @min_range: The minimum value which can be represented by the sensor/axis.
@ -390,6 +404,11 @@ enum scmi_sensor_class {
* @info_get: get the information of the specified sensor
* @trip_point_config: selects and configures a trip-point of interest
* @reading_get: gets the current value of the sensor
* @reading_get_timestamped: gets the current value and timestamp, when
* available, of the sensor. (as of v3.0 spec)
* Supports multi-axis sensors for sensors which
* supports it and if the @reading array size of
* @count entry equals the sensor num_axis
*/
struct scmi_sensor_ops {
int (*count_get)(const struct scmi_handle *handle);
@ -399,6 +418,9 @@ struct scmi_sensor_ops {
u32 sensor_id, u8 trip_id, u64 trip_value);
int (*reading_get)(const struct scmi_handle *handle, u32 sensor_id,
u64 *value);
int (*reading_get_timestamped)(const struct scmi_handle *handle,
u32 sensor_id, u8 count,
struct scmi_sensor_reading *readings);
};
/**