Skip to content

Commit a1678b4

Browse files
abrestichsnaves
authored andcommitted
TEMP: CHROMIUM: ASoC: samsung: reparent mout_i2s for suspend/resume
On reset, fin_pll is the parent of mout_audss and mout_audss is the parent of mout_i2s, but we reparent them to fout_epll and sclk_audio0, respectively, when setting up the audio clock hierarchy. They are both then reparented on resume when the AUDSS registers are restored. This, however, causes the machine to hang during resume. It's not clear what the exact cause is, but it's possible that they cannot be reparented at the same time or that EPLL is still unstable. Temporarily reparenting mout_i2s to mout_audss across suspend/resume so that it is not reparented when the AUDSS registers are restored appears to make suspend/resume much more stable on Pit and Snow. BUG=chrome-os-partner:20102 TEST=Can suspend/resume on Pit and Snow. Audio still works. Change-Id: I75e30b66bfc103de8aa83cc62b21a9f4a938cbb5 Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58212 Reviewed-by: Simon Glass <sjg@chromium.org>
1 parent 90b33d1 commit a1678b4

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

sound/soc/samsung/daisy_max98095.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,70 @@ static int daisy_init(struct snd_soc_pcm_runtime *rtd)
479479
return 0;
480480
}
481481

482+
static int daisy_suspend_post(struct snd_soc_card *card)
483+
{
484+
struct clk *mout_audss, *mout_i2s;
485+
int ret;
486+
487+
mout_audss = clk_get(card->dev, "mout_audss");
488+
if (IS_ERR(mout_audss)) {
489+
pr_warn("Can't find mout_audss clock\n");
490+
ret = PTR_ERR(mout_audss);
491+
goto out1;
492+
}
493+
mout_i2s = clk_get(card->dev, "mout_i2s");
494+
if (IS_ERR(mout_i2s)) {
495+
pr_warn("Can't find mout_i2s clock\n");
496+
ret = PTR_ERR(mout_i2s);
497+
goto out2;
498+
}
499+
500+
/*
501+
* This really shouldn't fail. We probably won't come back from
502+
* suspend if it does.
503+
*/
504+
ret = clk_set_parent(mout_i2s, mout_audss);
505+
WARN_ON(ret < 0);
506+
507+
clk_put(mout_i2s);
508+
out2:
509+
clk_put(mout_audss);
510+
out1:
511+
return ret;
512+
}
513+
514+
static int daisy_resume_pre(struct snd_soc_card *card)
515+
{
516+
struct clk *sclk_audio0, *mout_i2s;
517+
int ret;
518+
519+
sclk_audio0 = clk_get(card->dev, "sclk_audio0");
520+
if (IS_ERR(sclk_audio0)) {
521+
pr_warn("Can't find sclk_audio0 clock\n");
522+
ret = PTR_ERR(sclk_audio0);
523+
goto out1;
524+
}
525+
mout_i2s = clk_get(card->dev, "mout_i2s");
526+
if (IS_ERR(mout_i2s)) {
527+
pr_warn("Can't find mout_i2s clock\n");
528+
ret = PTR_ERR(mout_i2s);
529+
goto out2;
530+
}
531+
532+
/*
533+
* If we were able to reparent this for suspend, we ought to be
534+
* able to change it back.
535+
*/
536+
ret = clk_set_parent(mout_i2s, sclk_audio0);
537+
WARN_ON(ret < 0);
538+
539+
clk_put(mout_i2s);
540+
out2:
541+
clk_put(sclk_audio0);
542+
out1:
543+
return ret;
544+
}
545+
482546
static int daisy_resume_post(struct snd_soc_card *card)
483547
{
484548
if (gpio_is_valid(daisy_mic_jack_gpio.gpio))
@@ -513,6 +577,8 @@ static struct snd_soc_card daisy_snd = {
513577
.num_dapm_widgets = ARRAY_SIZE(daisy_dapm_widgets),
514578
.dapm_routes = daisy_audio_map,
515579
.num_dapm_routes = ARRAY_SIZE(daisy_audio_map),
580+
.suspend_post = daisy_suspend_post,
581+
.resume_pre = daisy_resume_pre,
516582
.resume_post = daisy_resume_post,
517583
};
518584

0 commit comments

Comments
 (0)