xref: /linux/drivers/clk/clk-scmi.h (revision 502d45774af09f1c681c754c4b7cdfb5d7f72fd9)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *  Copyright 2025 NXP
4  */
5 
6 #ifndef __SCMI_CLK_H
7 #define __SCMI_CLK_H
8 
9 #include <linux/bits.h>
10 #include <linux/clk-provider.h>
11 #include <linux/scmi_protocol.h>
12 #include <linux/types.h>
13 
14 #define NOT_ATOMIC	false
15 #define ATOMIC		true
16 
17 enum scmi_clk_feats {
18 	SCMI_CLK_ATOMIC_SUPPORTED,
19 	SCMI_CLK_STATE_CTRL_SUPPORTED,
20 	SCMI_CLK_RATE_CTRL_SUPPORTED,
21 	SCMI_CLK_PARENT_CTRL_SUPPORTED,
22 	SCMI_CLK_DUTY_CYCLE_SUPPORTED,
23 	SCMI_CLK_EXT_OEM_SSC_SUPPORTED,
24 	SCMI_CLK_FEATS_COUNT
25 };
26 
27 #define SCMI_MAX_CLK_OPS	BIT(SCMI_CLK_FEATS_COUNT)
28 
29 struct scmi_clk {
30 	u32 id;
31 	struct device *dev;
32 	struct clk_hw hw;
33 	const struct scmi_clock_info *info;
34 	const struct scmi_protocol_handle *ph;
35 	struct clk_parent_data *parent_data;
36 };
37 
38 #define to_scmi_clk(clk) container_of(clk, struct scmi_clk, hw)
39 
40 extern const struct scmi_clk_proto_ops *scmi_proto_clk_ops;
41 
42 struct scmi_clk_oem {
43 	int (*query_ext_oem_feats)(const struct scmi_protocol_handle *ph,
44 				   u32 id, unsigned int *feats_key);
45 	int (*set_spread_spectrum)(struct clk_hw *hw,
46 				   const struct clk_spread_spectrum *ss_conf);
47 };
48 
49 int scmi_clk_oem_init(struct scmi_device *dev);
50 
51 #endif
52