Skip to content

Commit 90b33d1

Browse files
abrestichsnaves
authored andcommitted
CHROMIUM: ASoC: samsung: initialize pll and audio bus clock rate
In the daisy_max98095 driver we rely on EPLL being set to a rate below the limit of the AudioSS block (192Mhz on 5250 and 200Mhz on 5420) and the audio bus divider being set to 1. On Pit, neither of these are initialized correctly, so explicitly set fout_epll to a reasonable rate and then set sclk_audio0 to that rate to ensure that the audio bus divider is 1. BUG=chrome-os-partner:18720 TEST=Audio still works on snow; peach-pit no longer hangs when daisy_max98095 driver is probed. Change-Id: I5dd811078d7964979e0c58d9937163e1d3a58850 Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57708 Reviewed-by: Simon Glass <sjg@chromium.org>
1 parent 6d6ab35 commit 90b33d1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

sound/soc/samsung/daisy_max98095.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@
4242

4343
#define DRV_NAME "daisy-snd-max98095"
4444

45+
/*
46+
* The initial rate that EPLL will be set to. This is the smallest multiple (4)
47+
* of the desired master clock frequency 256 * FS for FS = 44.1khz that can
48+
* be generated on both the 5250 and 5420 SoCs.
49+
*/
50+
#define DEFAULT_EPLL_RATE (256 * 44100 * 4)
51+
4552
/* Audio clock settings are belonged to board specific part. Every
4653
* board can set audio source clock setting which is matched with H/W
4754
* like this function-'set_audio_clock_heirachy'.
@@ -96,6 +103,20 @@ static int set_audio_clock_heirachy(struct platform_device *pdev)
96103
goto out5;
97104
}
98105

106+
/*
107+
* fout_epll may have been initialized to operate at a frequency higher
108+
* than the audio block's maximum (192Mhz on 5250, 200Mhz on 5420),
109+
* so lower it to a reasonable rate here. If we attempt to set
110+
* fout_epll as the parent of mout_audss when fout_epll is operating
111+
* at a frequency higher than the audio block's maximum, the system
112+
* may hang.
113+
*/
114+
ret = clk_set_rate(fout_epll, DEFAULT_EPLL_RATE);
115+
if (ret < 0) {
116+
printk(KERN_WARNING "Failed to set epll rate.\n");
117+
goto out6;
118+
}
119+
99120
/* Set audio clock hierarchy for S/PDIF */
100121
if (clk_set_parent(sclk_epll, fout_epll))
101122
printk(KERN_WARNING "Failed to set parent of epll.\n");
@@ -106,6 +127,13 @@ static int set_audio_clock_heirachy(struct platform_device *pdev)
106127
if (clk_set_parent(mout_i2s, sclk_audio0))
107128
printk(KERN_WARNING "Failed to set parent of mout i2s.\n");
108129

130+
/* Ensure that the divider between mout_audio0 and sclk_audio0 is 1. */
131+
ret = clk_set_rate(sclk_audio0, clk_get_rate(mout_audio0));
132+
if (ret < 0)
133+
printk(KERN_WARNING "Failed to set audio bus rate (%d).\n",
134+
ret);
135+
136+
out6:
109137
clk_put(mout_i2s);
110138
out5:
111139
clk_put(mout_audss);

0 commit comments

Comments
 (0)