Skip to content

Commit a1b8faf

Browse files
cris-mabebarino
authored andcommitted
clk: scmi: Add support for state control restricted clocks
Some exposed SCMI Clocks could be marked as non-supporting state changes. Configure a clk_ops descriptor which does not provide the state change callbacks for such clocks when registering with CLK framework. CC: Michael Turquette <mturquette@baylibre.com> CC: Stephen Boyd <sboyd@kernel.org> CC: linux-clk@vger.kernel.org Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20240415163649.895268-3-cristian.marussi@arm.com Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 2641ee1 commit a1b8faf

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

drivers/clk/clk-scmi.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
enum scmi_clk_feats {
2121
SCMI_CLK_ATOMIC_SUPPORTED,
22+
SCMI_CLK_STATE_CTRL_SUPPORTED,
2223
SCMI_CLK_FEATS_COUNT
2324
};
2425

@@ -230,15 +231,19 @@ scmi_clk_ops_alloc(struct device *dev, unsigned long feats_key)
230231
* only the prepare/unprepare API, as allowed by the clock framework
231232
* when atomic calls are not available.
232233
*/
233-
if (feats_key & BIT(SCMI_CLK_ATOMIC_SUPPORTED)) {
234-
ops->enable = scmi_clk_atomic_enable;
235-
ops->disable = scmi_clk_atomic_disable;
236-
ops->is_enabled = scmi_clk_atomic_is_enabled;
237-
} else {
238-
ops->prepare = scmi_clk_enable;
239-
ops->unprepare = scmi_clk_disable;
234+
if (feats_key & BIT(SCMI_CLK_STATE_CTRL_SUPPORTED)) {
235+
if (feats_key & BIT(SCMI_CLK_ATOMIC_SUPPORTED)) {
236+
ops->enable = scmi_clk_atomic_enable;
237+
ops->disable = scmi_clk_atomic_disable;
238+
} else {
239+
ops->prepare = scmi_clk_enable;
240+
ops->unprepare = scmi_clk_disable;
241+
}
240242
}
241243

244+
if (feats_key & BIT(SCMI_CLK_ATOMIC_SUPPORTED))
245+
ops->is_enabled = scmi_clk_atomic_is_enabled;
246+
242247
/* Rate ops */
243248
ops->recalc_rate = scmi_clk_recalc_rate;
244249
ops->round_rate = scmi_clk_round_rate;
@@ -294,6 +299,9 @@ scmi_clk_ops_select(struct scmi_clk *sclk, bool atomic_capable,
294299
if (atomic_capable && ci->enable_latency <= atomic_threshold_us)
295300
feats_key |= BIT(SCMI_CLK_ATOMIC_SUPPORTED);
296301

302+
if (!ci->state_ctrl_forbidden)
303+
feats_key |= BIT(SCMI_CLK_STATE_CTRL_SUPPORTED);
304+
297305
if (WARN_ON(feats_key >= db_size))
298306
return NULL;
299307

0 commit comments

Comments
 (0)