linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: scmi: Add duty cycle ops only when duty cycle is supported
@ 2025-07-28  7:04 Jacky Bai
  2025-08-19 11:02 ` Sudeep Holla
  0 siblings, 1 reply; 2+ messages in thread
From: Jacky Bai @ 2025-07-28  7:04 UTC (permalink / raw)
  To: sudeep.holla, cristian.marussi, mturquette, sboyd
  Cc: arm-scmi, linux-arm-kernel, linux-clk, imx

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>
---
 drivers/clk/clk-scmi.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
index d2408403283f..c2f3ef4e58fe 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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: scmi: Add duty cycle ops only when duty cycle is supported
  2025-07-28  7:04 [PATCH] clk: scmi: Add duty cycle ops only when duty cycle is supported Jacky Bai
@ 2025-08-19 11:02 ` Sudeep Holla
  0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Holla @ 2025-08-19 11:02 UTC (permalink / raw)
  To: Jacky Bai
  Cc: cristian.marussi, mturquette, Sudeep Holla, sboyd, arm-scmi,
	linux-arm-kernel, linux-clk, imx

On Mon, Jul 28, 2025 at 03:04:46PM +0800, Jacky Bai wrote:
> 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.
> 

Fair enough.

LGTM,

Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>

I assume clk tree maintainers can pick this up.

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-19 11:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28  7:04 [PATCH] clk: scmi: Add duty cycle ops only when duty cycle is supported Jacky Bai
2025-08-19 11:02 ` Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).