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