2 * Copyright (c) 2017 Chen-Yu Tsai. All rights reserved.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
17 #include <linux/clk-provider.h>
19 #include "ccu_common.h"
21 struct ccu_sdm_setting {
25 * XXX We don't know what the step and bottom register fields
26 * mean. Just copy the whole register value from the vendor
32 * M and N factors here should be the values used in
33 * calculation, not the raw values written to registers
39 struct ccu_sdm_internal {
40 struct ccu_sdm_setting *table;
42 /* early SoCs don't have the SDM enable bit in the PLL register */
44 /* second enable bit in tuning register */
49 #define _SUNXI_CCU_SDM(_table, _enable, \
53 .table_size = ARRAY_SIZE(_table), \
55 .tuning_enable = _reg_enable, \
59 bool ccu_sdm_helper_is_enabled(struct ccu_common *common,
60 struct ccu_sdm_internal *sdm);
61 void ccu_sdm_helper_enable(struct ccu_common *common,
62 struct ccu_sdm_internal *sdm,
64 void ccu_sdm_helper_disable(struct ccu_common *common,
65 struct ccu_sdm_internal *sdm);
67 bool ccu_sdm_helper_has_rate(struct ccu_common *common,
68 struct ccu_sdm_internal *sdm,
71 unsigned long ccu_sdm_helper_read_rate(struct ccu_common *common,
72 struct ccu_sdm_internal *sdm,
75 int ccu_sdm_helper_get_factors(struct ccu_common *common,
76 struct ccu_sdm_internal *sdm,
78 unsigned long *m, unsigned long *n);