From: Mark Brown Date: Tue, 31 Mar 2009 10:27:03 +0000 (+0100) Subject: ASoC: Don't defer resume work for AC97 codecs X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=64ab9baa00fa99070da993f00173c35a8e99abfa;p=linux-beck.git ASoC: Don't defer resume work for AC97 codecs AC97 devices may have other drivers hanging off them directly so need to have resumed when the resume function returns meaning that we can't defer the resume - complete it immediately for them. Non-AC97 devices should not have other drivers hanging directly off the ASoC devices. We only really need the deferral for non-AC97 devices - it's there since some I2C buses are very slow and non-AC97 codecs often have large numbers of registers to restore and require delays to bring the codec up cleanly leading to a substantial impact on overall resume time. Reported-by: Russell King Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6e710f705a74..6c62d4a54cdf 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -767,11 +767,21 @@ static int soc_resume(struct platform_device *pdev) { struct snd_soc_device *socdev = platform_get_drvdata(pdev); struct snd_soc_card *card = socdev->card; + struct snd_soc_dai *cpu_dai = card->dai_link[0].cpu_dai; - dev_dbg(socdev->dev, "scheduling resume work\n"); - - if (!schedule_work(&card->deferred_resume_work)) - dev_err(socdev->dev, "resume work item may be lost\n"); + /* AC97 devices might have other drivers hanging off them so + * need to resume immediately. Other drivers don't have that + * problem and may take a substantial amount of time to resume + * due to I/O costs and anti-pop so handle them out of line. + */ + if (cpu_dai->ac97_control) { + dev_dbg(socdev->dev, "Resuming AC97 immediately\n"); + soc_resume_deferred(&card->deferred_resume_work); + } else { + dev_dbg(socdev->dev, "Scheduling resume work\n"); + if (!schedule_work(&card->deferred_resume_work)) + dev_err(socdev->dev, "resume work item may be lost\n"); + } return 0; }