aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Cooper <codekipper@gmail.com>2017-08-12 07:00:49 -0400
committerMark Brown <broonie@kernel.org>2017-08-14 12:24:34 -0400
commit0aef27cab880d9612331350c008aec00cbb3d247 (patch)
tree049c18bca754ba24e7f110e5f1d5fcb94dd409a5
parent92ff5d085ecc8255600551055262bf98a8f3f1d0 (diff)
ASoC: sun4i-i2s: Add clkdiv offsets to quirks
The BCLKDIV and MCLKDIV found on newer SoCs start from an offset of 1. Add the functionality to adjust the division values according to the needs to the device being used. Signed-off-by: Marcus Cooper <codekipper@gmail.com> Reviewed-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sunxi/sun4i-i2s.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
index d7ee7a443e4e..9a35313c4f9b 100644
--- a/sound/soc/sunxi/sun4i-i2s.c
+++ b/sound/soc/sunxi/sun4i-i2s.c
@@ -94,9 +94,13 @@
94 * struct sun4i_i2s_quirks - Differences between SoC variants. 94 * struct sun4i_i2s_quirks - Differences between SoC variants.
95 * 95 *
96 * @has_reset: SoC needs reset deasserted. 96 * @has_reset: SoC needs reset deasserted.
97 * @mclk_offset: Value by which mclkdiv needs to be adjusted.
98 * @bclk_offset: Value by which bclkdiv needs to be adjusted.
97 */ 99 */
98struct sun4i_i2s_quirks { 100struct sun4i_i2s_quirks {
99 bool has_reset; 101 bool has_reset;
102 unsigned int mclk_offset;
103 unsigned int bclk_offset;
100}; 104};
101 105
102struct sun4i_i2s { 106struct sun4i_i2s {
@@ -237,6 +241,10 @@ static int sun4i_i2s_set_clk_rate(struct sun4i_i2s *i2s,
237 if (mclk_div < 0) 241 if (mclk_div < 0)
238 return -EINVAL; 242 return -EINVAL;
239 243
244 /* Adjust the clock division values if needed */
245 bclk_div += i2s->variant->bclk_offset;
246 mclk_div += i2s->variant->mclk_offset;
247
240 regmap_write(i2s->regmap, SUN4I_I2S_CLK_DIV_REG, 248 regmap_write(i2s->regmap, SUN4I_I2S_CLK_DIV_REG,
241 SUN4I_I2S_CLK_DIV_BCLK(bclk_div) | 249 SUN4I_I2S_CLK_DIV_BCLK(bclk_div) |
242 SUN4I_I2S_CLK_DIV_MCLK(mclk_div) | 250 SUN4I_I2S_CLK_DIV_MCLK(mclk_div) |