Skip to content

Commit 18db1ff

Browse files
JackyBaibebarino
authored andcommitted
clk: scmi: Add duty cycle ops only when duty cycle is supported
For some of the SCMI based platforms, the oem extended config may be supported, but not for duty cycle purpose. Skip the duty cycle ops if err return when trying to get duty cycle info. Signed-off-by: Jacky Bai <ping.bai@nxp.com> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 8f5ae30 commit 18db1ff

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

drivers/clk/clk-scmi.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ scmi_clk_ops_select(struct scmi_clk *sclk, bool atomic_capable,
349349
unsigned int atomic_threshold_us,
350350
const struct clk_ops **clk_ops_db, size_t db_size)
351351
{
352+
int ret;
353+
u32 val;
352354
const struct scmi_clock_info *ci = sclk->info;
353355
unsigned int feats_key = 0;
354356
const struct clk_ops *ops;
@@ -370,8 +372,13 @@ scmi_clk_ops_select(struct scmi_clk *sclk, bool atomic_capable,
370372
if (!ci->parent_ctrl_forbidden)
371373
feats_key |= BIT(SCMI_CLK_PARENT_CTRL_SUPPORTED);
372374

373-
if (ci->extended_config)
374-
feats_key |= BIT(SCMI_CLK_DUTY_CYCLE_SUPPORTED);
375+
if (ci->extended_config) {
376+
ret = scmi_proto_clk_ops->config_oem_get(sclk->ph, sclk->id,
377+
SCMI_CLOCK_CFG_DUTY_CYCLE,
378+
&val, NULL, false);
379+
if (!ret)
380+
feats_key |= BIT(SCMI_CLK_DUTY_CYCLE_SUPPORTED);
381+
}
375382

376383
if (WARN_ON(feats_key >= db_size))
377384
return NULL;

0 commit comments

Comments
 (0)