mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
firmware: arm_scmi: Add optional flags to extended names helper
Some recently added SCMI protocols needs an additional flags parameter to be able to properly configure the command used to query the extended name of a resource. Modify extended_name_get helper accordingly. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20231114145449.3136412-1-cristian.marussi@arm.com Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
parent
619bc6e034
commit
e4e6e8f1ad
9 changed files with 18 additions and 12 deletions
|
@ -318,7 +318,7 @@ static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph,
|
|||
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x2) {
|
||||
if (SUPPORTS_EXTENDED_NAMES(attributes))
|
||||
ph->hops->extended_name_get(ph, CLOCK_NAME_GET, clk_id,
|
||||
clk->name,
|
||||
NULL, clk->name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
|
||||
if (SUPPORTS_RATE_CHANGED_NOTIF(attributes))
|
||||
|
|
|
@ -1438,6 +1438,7 @@ struct scmi_msg_resp_domain_name_get {
|
|||
* @ph: A protocol handle reference.
|
||||
* @cmd_id: The specific command ID to use.
|
||||
* @res_id: The specific resource ID to use.
|
||||
* @flags: A pointer to specific flags to use, if any.
|
||||
* @name: A pointer to the preallocated area where the retrieved name will be
|
||||
* stored as a NULL terminated string.
|
||||
* @len: The len in bytes of the @name char array.
|
||||
|
@ -1445,19 +1446,22 @@ struct scmi_msg_resp_domain_name_get {
|
|||
* Return: 0 on Succcess
|
||||
*/
|
||||
static int scmi_common_extended_name_get(const struct scmi_protocol_handle *ph,
|
||||
u8 cmd_id, u32 res_id, char *name,
|
||||
size_t len)
|
||||
u8 cmd_id, u32 res_id, u32 *flags,
|
||||
char *name, size_t len)
|
||||
{
|
||||
int ret;
|
||||
size_t txlen;
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_resp_domain_name_get *resp;
|
||||
|
||||
ret = ph->xops->xfer_get_init(ph, cmd_id, sizeof(res_id),
|
||||
sizeof(*resp), &t);
|
||||
txlen = !flags ? sizeof(res_id) : sizeof(res_id) + sizeof(*flags);
|
||||
ret = ph->xops->xfer_get_init(ph, cmd_id, txlen, sizeof(*resp), &t);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
put_unaligned_le32(res_id, t->tx.buf);
|
||||
if (flags)
|
||||
put_unaligned_le32(*flags, t->tx.buf + sizeof(res_id));
|
||||
resp = t->rx.buf;
|
||||
|
||||
ret = ph->xops->do_xfer(ph, t);
|
||||
|
|
|
@ -288,7 +288,7 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph,
|
|||
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x3 &&
|
||||
SUPPORTS_EXTENDED_NAMES(flags))
|
||||
ph->hops->extended_name_get(ph, PERF_DOMAIN_NAME_GET,
|
||||
dom_info->id, dom_info->info.name,
|
||||
dom_info->id, NULL, dom_info->info.name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
|
||||
if (dom_info->level_indexing_mode) {
|
||||
|
|
|
@ -133,7 +133,7 @@ scmi_power_domain_attributes_get(const struct scmi_protocol_handle *ph,
|
|||
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x3 &&
|
||||
SUPPORTS_EXTENDED_NAMES(flags)) {
|
||||
ph->hops->extended_name_get(ph, POWER_DOMAIN_NAME_GET,
|
||||
domain, dom_info->name,
|
||||
domain, NULL, dom_info->name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
}
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ clean:
|
|||
*/
|
||||
if (!ret && SUPPORTS_EXTENDED_NAMES(flags))
|
||||
ph->hops->extended_name_get(ph, POWERCAP_DOMAIN_NAME_GET,
|
||||
domain, dom_info->name,
|
||||
domain, NULL, dom_info->name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -256,7 +256,8 @@ struct scmi_fc_info {
|
|||
*/
|
||||
struct scmi_proto_helpers_ops {
|
||||
int (*extended_name_get)(const struct scmi_protocol_handle *ph,
|
||||
u8 cmd_id, u32 res_id, char *name, size_t len);
|
||||
u8 cmd_id, u32 res_id, u32 *flags, char *name,
|
||||
size_t len);
|
||||
void *(*iter_response_init)(const struct scmi_protocol_handle *ph,
|
||||
struct scmi_iterator_ops *ops,
|
||||
unsigned int max_resources, u8 msg_id,
|
||||
|
|
|
@ -128,7 +128,8 @@ scmi_reset_domain_attributes_get(const struct scmi_protocol_handle *ph,
|
|||
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x3 &&
|
||||
SUPPORTS_EXTENDED_NAMES(attributes))
|
||||
ph->hops->extended_name_get(ph, RESET_DOMAIN_NAME_GET, domain,
|
||||
dom_info->name, SCMI_MAX_STR_SIZE);
|
||||
NULL, dom_info->name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -644,7 +644,7 @@ iter_sens_descr_process_response(const struct scmi_protocol_handle *ph,
|
|||
if (PROTOCOL_REV_MAJOR(si->version) >= 0x3 &&
|
||||
SUPPORTS_EXTENDED_NAMES(attrl))
|
||||
ph->hops->extended_name_get(ph, SENSOR_NAME_GET, s->id,
|
||||
s->name, SCMI_MAX_STR_SIZE);
|
||||
NULL, s->name, SCMI_MAX_STR_SIZE);
|
||||
|
||||
if (s->extended_scalar_attrs) {
|
||||
s->sensor_power = le32_to_cpu(sdesc->power);
|
||||
|
|
|
@ -242,7 +242,7 @@ static int scmi_voltage_descriptors_get(const struct scmi_protocol_handle *ph,
|
|||
if (SUPPORTS_EXTENDED_NAMES(attributes))
|
||||
ph->hops->extended_name_get(ph,
|
||||
VOLTAGE_DOMAIN_NAME_GET,
|
||||
v->id, v->name,
|
||||
v->id, NULL, v->name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
if (SUPPORTS_ASYNC_LEVEL_SET(attributes))
|
||||
v->async_level_set = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue