[PATCH/RFC 5/9] clk: scmi: Add scmi_clk_is_pm_clk()
Geert Uytterhoeven <[email protected]>
| Newsgroups | org.kernel.vger.arm-scmi,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-clk,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm,org.kernel.vger.linux-renesas-soc |
|---|---|
| Message-ID | <af9666e8fb841606b42d865d42adcaf472099ce1.1781171705.git.geert+renesas@glider.be> |
Add a helper for querying if an SCMI clock can be used for power-management. Signed-off-by: Geert Uytterhoeven <[email protected]> --- drivers/clk/clk-scmi.c | 9 +++++++++ include/linux/clk/scmi.h | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 include/linux/clk/scmi.h diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c index 7c562559ad8bb47f..20e6da1859290b75 100644 --- a/drivers/clk/clk-scmi.c +++ b/drivers/clk/clk-scmi.c @@ -7,6 +7,7 @@ #include <linux/bits.h> #include <linux/clk-provider.h> +#include <linux/clk/scmi.h> #include <linux/device.h> #include <linux/err.h> #include <linux/of.h> @@ -364,6 +365,14 @@ scmi_clk_ops_select(struct scmi_clk *sclk, bool atomic_capable, return ops; } +bool scmi_clk_is_pm_clk(struct clk *clk) +{ + struct clk_hw *hw = __clk_get_hw(clk); + + return hw && to_scmi_clk(hw)->info->pm_clk; +} +EXPORT_SYMBOL_GPL(scmi_clk_is_pm_clk); + static int scmi_clocks_probe(struct scmi_device *sdev) { int idx, count, err; diff --git a/include/linux/clk/scmi.h b/include/linux/clk/scmi.h new file mode 100644 index 0000000000000000..12c338598d09296f --- /dev/null +++ b/include/linux/clk/scmi.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __LINUX_CLK_SCMI_H_ +#define __LINUX_CLK_SCMI_H_ + +#include <linux/types.h> + +struct clk; + +#if IS_ENABLED(CONFIG_COMMON_CLK_SCMI) +bool scmi_clk_is_pm_clk(struct clk *clk); +#else +static inline bool scmi_clk_is_pm_clk(struct clk *clk) { return false; } +#endif + +#endif /* __LINUX_CLK_SCMI_H_ */ -- 2.43.0