Skip to content

Commit

Permalink
drivers: scmi-msg: fix for clock min/max/step triplet description sup…
Browse files Browse the repository at this point in the history
…port

The return value of plat_scmi_clock_rates_array() is one of "SCMI_DENIED",
"SCMI_GENERIC_ERROR" and "SCMI_SUCCESS".
The code in scmi_clock_describe_rates() for clock min/max/step triplet
description support would never be executed due to the return value of
plat_scmi_clock_rates_array() could never be "SCMI_NOT_SUPPORTED".
Fix by modifying the return value of plat_scmi_clock_rates_array().

Signed-off-by: Tony Han <[email protected]>
  • Loading branch information
TonyHan11 committed Dec 10, 2024
1 parent 40848ef commit 72101ce
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/drivers/scmi-msg/clock_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,20 @@ int32_t plat_scmi_clock_rates_array(unsigned int channel_id,
unsigned long *rates,
size_t *nb_elts)
{
TEE_Result res = TEE_ERROR_GENERIC;
struct scmi_clk *clk = NULL;

clk = clk_scmi_get_by_id(channel_id, scmi_id);
if (!clk)
return SCMI_DENIED;

if (clk_get_rates_array(clk->clk, start_index, rates, nb_elts))
res = clk_get_rates_array(clk->clk, start_index, rates, nb_elts);
if (res == TEE_SUCCESS)
return SCMI_SUCCESS;
else if (res == TEE_ERROR_NOT_SUPPORTED)
return SCMI_NOT_SUPPORTED;
else
return SCMI_GENERIC_ERROR;

return SCMI_SUCCESS;
}

unsigned long plat_scmi_clock_get_rate(unsigned int channel_id,
Expand Down

0 comments on commit 72101ce

Please sign in to comment.