summaryrefslogtreecommitdiff
path: root/include/linux/scmi_protocol.h
diff options
context:
space:
mode:
authorCristian Marussi <cristian.marussi@arm.com>2020-11-19 17:49:05 +0000
committerSudeep Holla <sudeep.holla@arm.com>2020-11-22 18:00:25 +0000
commit7b83c5f41088987d04e24c3af0e1fb9f43b747b5 (patch)
treed32278fbf3502113f3fe2ae085b125aa14c9fcd4 /include/linux/scmi_protocol.h
parente2083d36739168f7b612312160cf7bb45b251408 (diff)
firmware: arm_scmi: Add SCMI v3.0 sensor configuration support
Add SCMI v3.0 sensor support for CONFIG_GET/CONFIG_SET commands. Link: https://lore.kernel.org/r/20201119174906.43862-6-cristian.marussi@arm.com Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'include/linux/scmi_protocol.h')
-rw-r--r--include/linux/scmi_protocol.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index 0c52bf0cbee4..7e9e2cd3d46b 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -286,7 +286,38 @@ struct scmi_sensor_info {
unsigned int num_axis;
struct scmi_sensor_axis_info *axis;
struct scmi_sensor_intervals_info intervals;
+ unsigned int sensor_config;
+#define SCMI_SENS_CFG_UPDATE_SECS_MASK GENMASK(31, 16)
+#define SCMI_SENS_CFG_GET_UPDATE_SECS(x) \
+ FIELD_GET(SCMI_SENS_CFG_UPDATE_SECS_MASK, (x))
+
+#define SCMI_SENS_CFG_UPDATE_EXP_MASK GENMASK(15, 11)
+#define SCMI_SENS_CFG_GET_UPDATE_EXP(x) \
+ ({ \
+ int __signed_exp = \
+ FIELD_GET(SCMI_SENS_CFG_UPDATE_EXP_MASK, (x)); \
+ \
+ if (__signed_exp & BIT(4)) \
+ __signed_exp |= GENMASK(31, 5); \
+ __signed_exp; \
+ })
+
+#define SCMI_SENS_CFG_ROUND_MASK GENMASK(10, 9)
+#define SCMI_SENS_CFG_ROUND_AUTO 2
+#define SCMI_SENS_CFG_ROUND_UP 1
+#define SCMI_SENS_CFG_ROUND_DOWN 0
+
+#define SCMI_SENS_CFG_TSTAMP_ENABLED_MASK BIT(1)
+#define SCMI_SENS_CFG_TSTAMP_ENABLE 1
+#define SCMI_SENS_CFG_TSTAMP_DISABLE 0
+#define SCMI_SENS_CFG_IS_TSTAMP_ENABLED(x) \
+ FIELD_GET(SCMI_SENS_CFG_TSTAMP_ENABLED_MASK, (x))
+
+#define SCMI_SENS_CFG_SENSOR_ENABLED_MASK BIT(0)
+#define SCMI_SENS_CFG_SENSOR_ENABLE 1
+#define SCMI_SENS_CFG_SENSOR_DISABLE 0
char name[SCMI_MAX_STR_SIZE];
+#define SCMI_SENS_CFG_IS_ENABLED(x) FIELD_GET(BIT(0), (x))
bool extended_scalar_attrs;
unsigned int sensor_power;
unsigned int resolution;
@@ -409,6 +440,8 @@ enum scmi_sensor_class {
* Supports multi-axis sensors for sensors which
* supports it and if the @reading array size of
* @count entry equals the sensor num_axis
+ * @config_get: Get sensor current configuration
+ * @config_set: Set sensor current configuration
*/
struct scmi_sensor_ops {
int (*count_get)(const struct scmi_handle *handle);
@@ -421,6 +454,10 @@ struct scmi_sensor_ops {
int (*reading_get_timestamped)(const struct scmi_handle *handle,
u32 sensor_id, u8 count,
struct scmi_sensor_reading *readings);
+ int (*config_get)(const struct scmi_handle *handle,
+ u32 sensor_id, u32 *sensor_config);
+ int (*config_set)(const struct scmi_handle *handle,
+ u32 sensor_id, u32 sensor_config);
};
/**