Lines Matching +full:sigma +full:- +full:delta
2 * Copyright (C) 2017 Chen-Yu Tsai <wens@csie.org>
10 #include <linux/clk-provider.h>
18 if (!(common->features & CCU_FEATURE_SIGMA_DELTA_MOD)) in ccu_sdm_helper_is_enabled()
21 if (sdm->enable && !(readl(common->base + common->reg) & sdm->enable)) in ccu_sdm_helper_is_enabled()
24 return !!(readl(common->base + sdm->tuning_reg) & sdm->tuning_enable); in ccu_sdm_helper_is_enabled()
35 if (!(common->features & CCU_FEATURE_SIGMA_DELTA_MOD)) in ccu_sdm_helper_enable()
39 for (i = 0; i < sdm->table_size; i++) in ccu_sdm_helper_enable()
40 if (sdm->table[i].rate == rate) in ccu_sdm_helper_enable()
41 writel(sdm->table[i].pattern, in ccu_sdm_helper_enable()
42 common->base + sdm->tuning_reg); in ccu_sdm_helper_enable()
45 spin_lock_irqsave(common->lock, flags); in ccu_sdm_helper_enable()
46 reg = readl(common->base + sdm->tuning_reg); in ccu_sdm_helper_enable()
47 writel(reg | sdm->tuning_enable, common->base + sdm->tuning_reg); in ccu_sdm_helper_enable()
48 spin_unlock_irqrestore(common->lock, flags); in ccu_sdm_helper_enable()
50 spin_lock_irqsave(common->lock, flags); in ccu_sdm_helper_enable()
51 reg = readl(common->base + common->reg); in ccu_sdm_helper_enable()
52 writel(reg | sdm->enable, common->base + common->reg); in ccu_sdm_helper_enable()
53 spin_unlock_irqrestore(common->lock, flags); in ccu_sdm_helper_enable()
62 if (!(common->features & CCU_FEATURE_SIGMA_DELTA_MOD)) in ccu_sdm_helper_disable()
65 spin_lock_irqsave(common->lock, flags); in ccu_sdm_helper_disable()
66 reg = readl(common->base + common->reg); in ccu_sdm_helper_disable()
67 writel(reg & ~sdm->enable, common->base + common->reg); in ccu_sdm_helper_disable()
68 spin_unlock_irqrestore(common->lock, flags); in ccu_sdm_helper_disable()
70 spin_lock_irqsave(common->lock, flags); in ccu_sdm_helper_disable()
71 reg = readl(common->base + sdm->tuning_reg); in ccu_sdm_helper_disable()
72 writel(reg & ~sdm->tuning_enable, common->base + sdm->tuning_reg); in ccu_sdm_helper_disable()
73 spin_unlock_irqrestore(common->lock, flags); in ccu_sdm_helper_disable()
77 * Sigma delta modulation provides a way to do fractional-N frequency
99 if (!(common->features & CCU_FEATURE_SIGMA_DELTA_MOD)) in ccu_sdm_helper_has_rate()
102 for (i = 0; i < sdm->table_size; i++) in ccu_sdm_helper_has_rate()
103 if (sdm->table[i].rate == rate) in ccu_sdm_helper_has_rate()
116 pr_debug("%s: Read sigma-delta modulation setting\n", in ccu_sdm_helper_read_rate()
117 clk_hw_get_name(&common->hw)); in ccu_sdm_helper_read_rate()
119 if (!(common->features & CCU_FEATURE_SIGMA_DELTA_MOD)) in ccu_sdm_helper_read_rate()
122 pr_debug("%s: clock is sigma-delta modulated\n", in ccu_sdm_helper_read_rate()
123 clk_hw_get_name(&common->hw)); in ccu_sdm_helper_read_rate()
125 reg = readl(common->base + sdm->tuning_reg); in ccu_sdm_helper_read_rate()
128 clk_hw_get_name(&common->hw), reg); in ccu_sdm_helper_read_rate()
130 for (i = 0; i < sdm->table_size; i++) in ccu_sdm_helper_read_rate()
131 if (sdm->table[i].pattern == reg && in ccu_sdm_helper_read_rate()
132 sdm->table[i].m == m && sdm->table[i].n == n) in ccu_sdm_helper_read_rate()
133 return sdm->table[i].rate; in ccu_sdm_helper_read_rate()
146 if (!(common->features & CCU_FEATURE_SIGMA_DELTA_MOD)) in ccu_sdm_helper_get_factors()
147 return -EINVAL; in ccu_sdm_helper_get_factors()
149 for (i = 0; i < sdm->table_size; i++) in ccu_sdm_helper_get_factors()
150 if (sdm->table[i].rate == rate) { in ccu_sdm_helper_get_factors()
151 *m = sdm->table[i].m; in ccu_sdm_helper_get_factors()
152 *n = sdm->table[i].n; in ccu_sdm_helper_get_factors()
157 return -EINVAL; in ccu_sdm_helper_get_factors()