aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Tipton <[email protected]>2024-08-09 10:51:29 +0530
committerBjorn Andersson <[email protected]>2024-08-15 14:14:54 -0500
commita4e5af27e6f6a8b0d14bc0d7eb04f4a6c7291586 (patch)
tree2f8c9770eeaafdb2e7fa76df1db3ba486f8f3551
parentdb30c1160ca5f115476cd8c8008f67572acb2c08 (diff)
clk: qcom: clk-rpmh: Fix overflow in BCM vote
Valid frequencies may result in BCM votes that exceed the max HW value. Set vote ceiling to BCM_TCS_CMD_VOTE_MASK to ensure the votes aren't truncated, which can result in lower frequencies than desired. Fixes: 04053f4d23a4 ("clk: qcom: clk-rpmh: Add IPA clock support") Cc: [email protected] Signed-off-by: Mike Tipton <[email protected]> Reviewed-by: Taniya Das <[email protected]> Signed-off-by: Imran Shaik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
-rw-r--r--drivers/clk/qcom/clk-rpmh.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
index bb82abeed88f..4acde937114a 100644
--- a/drivers/clk/qcom/clk-rpmh.c
+++ b/drivers/clk/qcom/clk-rpmh.c
@@ -263,6 +263,8 @@ static int clk_rpmh_bcm_send_cmd(struct clk_rpmh *c, bool enable)
cmd_state = 0;
}
+ cmd_state = min(cmd_state, BCM_TCS_CMD_VOTE_MASK);
+
if (c->last_sent_aggr_state != cmd_state) {
cmd.addr = c->res_addr;
cmd.data = BCM_TCS_CMD(1, enable, 0, cmd_state);