diff options
author | Chen-Yu Tsai <wens@csie.org> | 2017-12-08 03:35:12 -0500 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2017-12-08 04:08:32 -0500 |
commit | e952ca3c6b2ffdfbf9618e4bd3e9aad1ff3f5eb4 (patch) | |
tree | 63c022815ebc73f810ae2b1a0edbab8ef1fd711d | |
parent | 10e6eb4f2c5b35ae71c9bc0db83d74238719b453 (diff) |
clk: sunxi-ng: sun8i: a83t: Use sigma-delta modulation for audio PLL
The audio blocks require specific clock rates. Until now we were using
the closest clock rate possible with integer N-M factors. This resulted
in audio playback being slightly slower than it should be.
The vendor kernel gets around this (for newer SoCs) by using sigma-delta
modulation to generate a fractional-N factor. This patch copies the
parameters for the A83T.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
-rw-r--r-- | drivers/clk/sunxi-ng/ccu-sun8i-a83t.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c b/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c index 06b69e433d0f..04a9c33f53f0 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-a83t.c | |||
@@ -76,17 +76,26 @@ static struct ccu_mult pll_c1cpux_clk = { | |||
76 | */ | 76 | */ |
77 | #define SUN8I_A83T_PLL_AUDIO_REG 0x008 | 77 | #define SUN8I_A83T_PLL_AUDIO_REG 0x008 |
78 | 78 | ||
79 | /* clock rates doubled for post divider */ | ||
80 | static struct ccu_sdm_setting pll_audio_sdm_table[] = { | ||
81 | { .rate = 45158400, .pattern = 0xc00121ff, .m = 29, .n = 54 }, | ||
82 | { .rate = 49152000, .pattern = 0xc000e147, .m = 30, .n = 61 }, | ||
83 | }; | ||
84 | |||
79 | static struct ccu_nm pll_audio_clk = { | 85 | static struct ccu_nm pll_audio_clk = { |
80 | .enable = BIT(31), | 86 | .enable = BIT(31), |
81 | .lock = BIT(2), | 87 | .lock = BIT(2), |
82 | .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), | 88 | .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), |
83 | .m = _SUNXI_CCU_DIV(0, 6), | 89 | .m = _SUNXI_CCU_DIV(0, 6), |
84 | .fixed_post_div = 2, | 90 | .fixed_post_div = 2, |
91 | .sdm = _SUNXI_CCU_SDM(pll_audio_sdm_table, BIT(24), | ||
92 | 0x284, BIT(31)), | ||
85 | .common = { | 93 | .common = { |
86 | .reg = SUN8I_A83T_PLL_AUDIO_REG, | 94 | .reg = SUN8I_A83T_PLL_AUDIO_REG, |
87 | .lock_reg = CCU_SUN8I_A83T_LOCK_REG, | 95 | .lock_reg = CCU_SUN8I_A83T_LOCK_REG, |
88 | .features = CCU_FEATURE_LOCK_REG | | 96 | .features = CCU_FEATURE_LOCK_REG | |
89 | CCU_FEATURE_FIXED_POSTDIV, | 97 | CCU_FEATURE_FIXED_POSTDIV | |
98 | CCU_FEATURE_SIGMA_DELTA_MOD, | ||
90 | .hw.init = CLK_HW_INIT("pll-audio", "osc24M", | 99 | .hw.init = CLK_HW_INIT("pll-audio", "osc24M", |
91 | &ccu_nm_ops, CLK_SET_RATE_UNGATE), | 100 | &ccu_nm_ops, CLK_SET_RATE_UNGATE), |
92 | }, | 101 | }, |