4 #include <linux/clk-provider.h>
6 #include "ccu_common.h"
8 struct ccu_mux_internal
{
24 #define SUNXI_CLK_MUX(_shift, _width) \
34 struct ccu_mux_internal mux
;
35 struct ccu_common common
;
38 #define SUNXI_CCU_MUX(_struct, _name, _parents, _reg, _shift, _width, _flags) \
39 struct ccu_mux _struct = { \
40 .mux = SUNXI_CLK_MUX(_shift, _width), \
43 .hw.init = CLK_HW_INIT_PARENTS(_name, \
50 #define SUNXI_CCU_MUX_WITH_GATE(_struct, _name, _parents, _reg, \
51 _shift, _width, _gate, _flags) \
52 struct ccu_mux _struct = { \
54 .mux = SUNXI_CLK_MUX(_shift, _width), \
57 .hw.init = CLK_HW_INIT_PARENTS(_name, \
64 static inline struct ccu_mux
*hw_to_ccu_mux(struct clk_hw
*hw
)
66 struct ccu_common
*common
= hw_to_ccu_common(hw
);
68 return container_of(common
, struct ccu_mux
, common
);
71 extern const struct clk_ops ccu_mux_ops
;
73 void ccu_mux_helper_adjust_parent_for_prediv(struct ccu_common
*common
,
74 struct ccu_mux_internal
*cm
,
76 unsigned long *parent_rate
);
77 int ccu_mux_helper_determine_rate(struct ccu_common
*common
,
78 struct ccu_mux_internal
*cm
,
79 struct clk_rate_request
*req
,
80 unsigned long (*round
)(struct ccu_mux_internal
*,
85 u8
ccu_mux_helper_get_parent(struct ccu_common
*common
,
86 struct ccu_mux_internal
*cm
);
87 int ccu_mux_helper_set_parent(struct ccu_common
*common
,
88 struct ccu_mux_internal
*cm
,
91 #endif /* _CCU_MUX_H_ */