Commit a1b8faf8 authored by Cristian Marussi's avatar Cristian Marussi Committed by Stephen Boyd

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: default avatarCristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20240415163649.895268-3-cristian.marussi@arm.comReviewed-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 2641ee13
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
enum scmi_clk_feats { enum scmi_clk_feats {
SCMI_CLK_ATOMIC_SUPPORTED, SCMI_CLK_ATOMIC_SUPPORTED,
SCMI_CLK_STATE_CTRL_SUPPORTED,
SCMI_CLK_FEATS_COUNT SCMI_CLK_FEATS_COUNT
}; };
...@@ -230,15 +231,19 @@ scmi_clk_ops_alloc(struct device *dev, unsigned long feats_key) ...@@ -230,15 +231,19 @@ scmi_clk_ops_alloc(struct device *dev, unsigned long feats_key)
* only the prepare/unprepare API, as allowed by the clock framework * only the prepare/unprepare API, as allowed by the clock framework
* when atomic calls are not available. * when atomic calls are not available.
*/ */
if (feats_key & BIT(SCMI_CLK_ATOMIC_SUPPORTED)) { if (feats_key & BIT(SCMI_CLK_STATE_CTRL_SUPPORTED)) {
ops->enable = scmi_clk_atomic_enable; if (feats_key & BIT(SCMI_CLK_ATOMIC_SUPPORTED)) {
ops->disable = scmi_clk_atomic_disable; ops->enable = scmi_clk_atomic_enable;
ops->is_enabled = scmi_clk_atomic_is_enabled; ops->disable = scmi_clk_atomic_disable;
} else { } else {
ops->prepare = scmi_clk_enable; ops->prepare = scmi_clk_enable;
ops->unprepare = scmi_clk_disable; ops->unprepare = scmi_clk_disable;
}
} }
if (feats_key & BIT(SCMI_CLK_ATOMIC_SUPPORTED))
ops->is_enabled = scmi_clk_atomic_is_enabled;
/* Rate ops */ /* Rate ops */
ops->recalc_rate = scmi_clk_recalc_rate; ops->recalc_rate = scmi_clk_recalc_rate;
ops->round_rate = scmi_clk_round_rate; ops->round_rate = scmi_clk_round_rate;
...@@ -294,6 +299,9 @@ scmi_clk_ops_select(struct scmi_clk *sclk, bool atomic_capable, ...@@ -294,6 +299,9 @@ scmi_clk_ops_select(struct scmi_clk *sclk, bool atomic_capable,
if (atomic_capable && ci->enable_latency <= atomic_threshold_us) if (atomic_capable && ci->enable_latency <= atomic_threshold_us)
feats_key |= BIT(SCMI_CLK_ATOMIC_SUPPORTED); feats_key |= BIT(SCMI_CLK_ATOMIC_SUPPORTED);
if (!ci->state_ctrl_forbidden)
feats_key |= BIT(SCMI_CLK_STATE_CTRL_SUPPORTED);
if (WARN_ON(feats_key >= db_size)) if (WARN_ON(feats_key >= db_size))
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment