From fe4894d968f4333f3d425221f03add8666881d72 Mon Sep 17 00:00:00 2001 From: Cristian Marussi Date: Tue, 16 Mar 2021 12:48:53 +0000 Subject: firmware: arm_scmi: Port voltage protocol to new protocols interface Convert internals of protocol implementation to use protocol handles and expose a new protocol operations interface for SCMI driver using the new get/put common operations, while keeping the old handle->voltage_ops still around to ease transition. Remove handle->voltage_priv now unused. Link: https://lore.kernel.org/r/20210316124903.35011-29-cristian.marussi@arm.com Tested-by: Florian Fainelli Signed-off-by: Cristian Marussi Signed-off-by: Sudeep Holla --- include/linux/scmi_protocol.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'include/linux/scmi_protocol.h') diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 17b82c76cf7a..00fdf0c5786b 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -515,7 +515,7 @@ struct scmi_voltage_info { }; /** - * struct scmi_voltage_ops - represents the various operations provided + * struct scmi_voltage_proto_ops - represents the various operations provided * by SCMI Voltage Protocol * * @num_domains_get: get the count of voltage domains provided by SCMI @@ -525,14 +525,28 @@ struct scmi_voltage_info { * @level_set: set the voltage level for the specified domain * @level_get: get the voltage level of the specified domain */ +struct scmi_voltage_proto_ops { + int (*num_domains_get)(const struct scmi_protocol_handle *ph); + const struct scmi_voltage_info __must_check *(*info_get) + (const struct scmi_protocol_handle *ph, u32 domain_id); + int (*config_set)(const struct scmi_protocol_handle *ph, u32 domain_id, + u32 config); +#define SCMI_VOLTAGE_ARCH_STATE_OFF 0x0 +#define SCMI_VOLTAGE_ARCH_STATE_ON 0x7 + int (*config_get)(const struct scmi_protocol_handle *ph, u32 domain_id, + u32 *config); + int (*level_set)(const struct scmi_protocol_handle *ph, u32 domain_id, + u32 flags, s32 volt_uV); + int (*level_get)(const struct scmi_protocol_handle *ph, u32 domain_id, + s32 *volt_uV); +}; + struct scmi_voltage_ops { int (*num_domains_get)(const struct scmi_handle *handle); const struct scmi_voltage_info __must_check *(*info_get) (const struct scmi_handle *handle, u32 domain_id); int (*config_set)(const struct scmi_handle *handle, u32 domain_id, u32 config); -#define SCMI_VOLTAGE_ARCH_STATE_OFF 0x0 -#define SCMI_VOLTAGE_ARCH_STATE_ON 0x7 int (*config_get)(const struct scmi_handle *handle, u32 domain_id, u32 *config); int (*level_set)(const struct scmi_handle *handle, u32 domain_id, @@ -610,8 +624,6 @@ struct scmi_notify_ops { * operations and a dedicated protocol handler * @devm_protocol_put: devres managed method to release a protocol * @notify_ops: pointer to set of notifications related operations - * @voltage_priv: pointer to private data structure specific to voltage - * protocol(for internal use only) * @notify_priv: pointer to private data structure specific to notifications * (for internal use only) */ @@ -626,8 +638,6 @@ struct scmi_handle { void (*devm_protocol_put)(struct scmi_device *sdev, u8 proto); const struct scmi_notify_ops *notify_ops; - /* for protocol internal use */ - void *voltage_priv; void *notify_priv; }; -- cgit v1.2.3