952e26664ce8680bdb75049d4577d3dfbe966fa1
[openwrt/staging/blogic.git] /
1 From 09ad53f0267e4b5433c27c77b3945d584ac0a6ba Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 22 Oct 2019 08:47:29 +0100
4 Subject: [PATCH] rpi-wm8804-soundcard: Fixed MCLKDIV for Allo Digione
5
6 The Allo Digione board wants a fixed MCLKDIV of 256.
7
8 See: https://github.com/raspberrypi/linux/issues/3296
9
10 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
11 ---
12 sound/soc/bcm/rpi-wm8804-soundcard.c | 10 +++++++---
13 1 file changed, 7 insertions(+), 3 deletions(-)
14
15 --- a/sound/soc/bcm/rpi-wm8804-soundcard.c
16 +++ b/sound/soc/bcm/rpi-wm8804-soundcard.c
17 @@ -66,6 +66,11 @@ static struct gpio_desc *snd_clk44gpio;
18 static struct gpio_desc *snd_clk48gpio;
19 static int wm8804_samplerate = 0;
20
21 +/* Forward declarations */
22 +static struct snd_soc_dai_link snd_allo_digione_dai[];
23 +static struct snd_soc_card snd_rpi_wm8804;
24 +
25 +
26 #define CLK_44EN_RATE 22579200UL
27 #define CLK_48EN_RATE 24576000UL
28
29 @@ -90,11 +95,10 @@ static unsigned int snd_rpi_wm8804_enabl
30 static void snd_rpi_wm8804_clk_cfg(unsigned int samplerate,
31 struct wm8804_clk_cfg *clk_cfg)
32 {
33 - clk_cfg->mclk_freq = 0;
34 - clk_cfg->mclk_div = 1;
35 clk_cfg->sysclk_freq = 27000000;
36
37 - if (samplerate <= 96000) {
38 + if (samplerate <= 96000 ||
39 + snd_rpi_wm8804.dai_link == snd_allo_digione_dai) {
40 clk_cfg->mclk_freq = samplerate * 256;
41 clk_cfg->mclk_div = WM8804_MCLKDIV_256FS;
42 } else {