diff options
| author | Jacky Bai <ping.bai@nxp.com> | 2025-07-28 15:04:46 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-11-13 15:34:34 -0500 |
| commit | 6bd92bdc43664a19b075d3c17f7e34f0d48220ab (patch) | |
| tree | d8e6b37b76a7d9a9db3d520b943b4faa8c1114a1 | |
| parent | 51771264b874f14e366f9c4601717f714804fa99 (diff) | |
| download | linux-6bd92bdc43664a19b075d3c17f7e34f0d48220ab.tar.gz linux-6bd92bdc43664a19b075d3c17f7e34f0d48220ab.tar.bz2 linux-6bd92bdc43664a19b075d3c17f7e34f0d48220ab.zip | |
clk: scmi: Add duty cycle ops only when duty cycle is supported
[ Upstream commit 18db1ff2dea0f97dedaeadd18b0cb0a0d76154df ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | drivers/clk/clk-scmi.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c index 1b1561c84127..7b7ea36333a6 100644 --- a/drivers/clk/clk-scmi.c +++ b/drivers/clk/clk-scmi.c @@ -349,6 +349,8 @@ scmi_clk_ops_select(struct scmi_clk *sclk, bool atomic_capable, unsigned int atomic_threshold_us, const struct clk_ops **clk_ops_db, size_t db_size) { + int ret; + u32 val; const struct scmi_clock_info *ci = sclk->info; unsigned int feats_key = 0; const struct clk_ops *ops; @@ -370,8 +372,13 @@ scmi_clk_ops_select(struct scmi_clk *sclk, bool atomic_capable, if (!ci->parent_ctrl_forbidden) feats_key |= BIT(SCMI_CLK_PARENT_CTRL_SUPPORTED); - if (ci->extended_config) - feats_key |= BIT(SCMI_CLK_DUTY_CYCLE_SUPPORTED); + if (ci->extended_config) { + ret = scmi_proto_clk_ops->config_oem_get(sclk->ph, sclk->id, + SCMI_CLOCK_CFG_DUTY_CYCLE, + &val, NULL, false); + if (!ret) + feats_key |= BIT(SCMI_CLK_DUTY_CYCLE_SUPPORTED); + } if (WARN_ON(feats_key >= db_size)) return NULL; |
