1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (c) 2016 Maxime Ripard. All rights reserved.
4 */
5
6#ifndef _CCU_FRAC_H_
7#define _CCU_FRAC_H_
8
9#include <linux/clk-provider.h>
10
11#include "ccu_common.h"
12
13struct ccu_frac_internal {
14 u32 enable;
15 u32 select;
16
17 unsigned long rates[2];
18};
19
20#define _SUNXI_CCU_FRAC(_enable, _select, _rate1, _rate2) \
21 { \
22 .enable = _enable, \
23 .select = _select, \
24 .rates = { _rate1, _rate2 }, \
25 }
26
27bool ccu_frac_helper_is_enabled(struct ccu_common *common,
28 struct ccu_frac_internal *cf);
29void ccu_frac_helper_enable(struct ccu_common *common,
30 struct ccu_frac_internal *cf);
31void ccu_frac_helper_disable(struct ccu_common *common,
32 struct ccu_frac_internal *cf);
33
34bool ccu_frac_helper_has_rate(struct ccu_common *common,
35 struct ccu_frac_internal *cf,
36 unsigned long rate);
37
38unsigned long ccu_frac_helper_read_rate(struct ccu_common *common,
39 struct ccu_frac_internal *cf);
40
41int ccu_frac_helper_set_rate(struct ccu_common *common,
42 struct ccu_frac_internal *cf,
43 unsigned long rate, u32 lock);
44
45#endif /* _CCU_FRAC_H_ */
46

source code of linux/drivers/clk/sunxi-ng/ccu_frac.h