1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2017 Chen-Yu Tsai. All rights reserved.
9 #include <linux/clk-provider.h>
11 #include "ccu_common.h"
13 struct ccu_sdm_setting
{
17 * XXX We don't know what the step and bottom register fields
18 * mean. Just copy the whole register value from the vendor
24 * M and N factors here should be the values used in
25 * calculation, not the raw values written to registers
31 struct ccu_sdm_internal
{
32 struct ccu_sdm_setting
*table
;
34 /* early SoCs don't have the SDM enable bit in the PLL register */
36 /* second enable bit in tuning register */
41 #define _SUNXI_CCU_SDM(_table, _enable, \
45 .table_size = ARRAY_SIZE(_table), \
47 .tuning_enable = _reg_enable, \
51 bool ccu_sdm_helper_is_enabled(struct ccu_common
*common
,
52 struct ccu_sdm_internal
*sdm
);
53 void ccu_sdm_helper_enable(struct ccu_common
*common
,
54 struct ccu_sdm_internal
*sdm
,
56 void ccu_sdm_helper_disable(struct ccu_common
*common
,
57 struct ccu_sdm_internal
*sdm
);
59 bool ccu_sdm_helper_has_rate(struct ccu_common
*common
,
60 struct ccu_sdm_internal
*sdm
,
63 unsigned long ccu_sdm_helper_read_rate(struct ccu_common
*common
,
64 struct ccu_sdm_internal
*sdm
,
67 int ccu_sdm_helper_get_factors(struct ccu_common
*common
,
68 struct ccu_sdm_internal
*sdm
,
70 unsigned long *m
, unsigned long *n
);