提交 3efab7dc 编写于 作者: M Mark Brown

ASoC: Allow DAI links to be kept active over suspend

As well as allowing DAPM pins to be marked as ignoring suspend allow DAI
links to be similarly marked.  This is primarily intended for digital
links between CODECs and non-CPU devices such as basebands in mobile
phones and will suppress all suspend calls for the DAI link.  It is
likely that this will need to be revisited if used with devices which
are part of the SoC CPU.
Tested-by: NPeter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: NLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 452a5fd6
...@@ -505,6 +505,9 @@ struct snd_soc_dai_link { ...@@ -505,6 +505,9 @@ struct snd_soc_dai_link {
/* codec/machine specific init - e.g. add machine controls */ /* codec/machine specific init - e.g. add machine controls */
int (*init)(struct snd_soc_codec *codec); int (*init)(struct snd_soc_codec *codec);
/* Keep DAI active over suspend */
unsigned int ignore_suspend:1;
/* Symmetry requirements */ /* Symmetry requirements */
unsigned int symmetric_rates:1; unsigned int symmetric_rates:1;
......
...@@ -893,19 +893,31 @@ static int soc_suspend(struct device *dev) ...@@ -893,19 +893,31 @@ static int soc_suspend(struct device *dev)
/* mute any active DAC's */ /* mute any active DAC's */
for (i = 0; i < card->num_links; i++) { for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *dai = card->dai_link[i].codec_dai; struct snd_soc_dai *dai = card->dai_link[i].codec_dai;
if (card->dai_link[i].ignore_suspend)
continue;
if (dai->ops->digital_mute && dai->playback.active) if (dai->ops->digital_mute && dai->playback.active)
dai->ops->digital_mute(dai, 1); dai->ops->digital_mute(dai, 1);
} }
/* suspend all pcms */ /* suspend all pcms */
for (i = 0; i < card->num_links; i++) for (i = 0; i < card->num_links; i++) {
if (card->dai_link[i].ignore_suspend)
continue;
snd_pcm_suspend_all(card->dai_link[i].pcm); snd_pcm_suspend_all(card->dai_link[i].pcm);
}
if (card->suspend_pre) if (card->suspend_pre)
card->suspend_pre(pdev, PMSG_SUSPEND); card->suspend_pre(pdev, PMSG_SUSPEND);
for (i = 0; i < card->num_links; i++) { for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
if (card->dai_link[i].ignore_suspend)
continue;
if (cpu_dai->suspend && !cpu_dai->ac97_control) if (cpu_dai->suspend && !cpu_dai->ac97_control)
cpu_dai->suspend(cpu_dai); cpu_dai->suspend(cpu_dai);
if (platform->suspend) if (platform->suspend)
...@@ -918,6 +930,10 @@ static int soc_suspend(struct device *dev) ...@@ -918,6 +930,10 @@ static int soc_suspend(struct device *dev)
for (i = 0; i < codec->num_dai; i++) { for (i = 0; i < codec->num_dai; i++) {
char *stream = codec->dai[i].playback.stream_name; char *stream = codec->dai[i].playback.stream_name;
if (card->dai_link[i].ignore_suspend)
continue;
if (stream != NULL) if (stream != NULL)
snd_soc_dapm_stream_event(codec, stream, snd_soc_dapm_stream_event(codec, stream,
SND_SOC_DAPM_STREAM_SUSPEND); SND_SOC_DAPM_STREAM_SUSPEND);
...@@ -943,6 +959,10 @@ static int soc_suspend(struct device *dev) ...@@ -943,6 +959,10 @@ static int soc_suspend(struct device *dev)
for (i = 0; i < card->num_links; i++) { for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
if (card->dai_link[i].ignore_suspend)
continue;
if (cpu_dai->suspend && cpu_dai->ac97_control) if (cpu_dai->suspend && cpu_dai->ac97_control)
cpu_dai->suspend(cpu_dai); cpu_dai->suspend(cpu_dai);
} }
...@@ -982,6 +1002,10 @@ static void soc_resume_deferred(struct work_struct *work) ...@@ -982,6 +1002,10 @@ static void soc_resume_deferred(struct work_struct *work)
for (i = 0; i < card->num_links; i++) { for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
if (card->dai_link[i].ignore_suspend)
continue;
if (cpu_dai->resume && cpu_dai->ac97_control) if (cpu_dai->resume && cpu_dai->ac97_control)
cpu_dai->resume(cpu_dai); cpu_dai->resume(cpu_dai);
} }
...@@ -1004,6 +1028,10 @@ static void soc_resume_deferred(struct work_struct *work) ...@@ -1004,6 +1028,10 @@ static void soc_resume_deferred(struct work_struct *work)
for (i = 0; i < codec->num_dai; i++) { for (i = 0; i < codec->num_dai; i++) {
char *stream = codec->dai[i].playback.stream_name; char *stream = codec->dai[i].playback.stream_name;
if (card->dai_link[i].ignore_suspend)
continue;
if (stream != NULL) if (stream != NULL)
snd_soc_dapm_stream_event(codec, stream, snd_soc_dapm_stream_event(codec, stream,
SND_SOC_DAPM_STREAM_RESUME); SND_SOC_DAPM_STREAM_RESUME);
...@@ -1016,12 +1044,20 @@ static void soc_resume_deferred(struct work_struct *work) ...@@ -1016,12 +1044,20 @@ static void soc_resume_deferred(struct work_struct *work)
/* unmute any active DACs */ /* unmute any active DACs */
for (i = 0; i < card->num_links; i++) { for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *dai = card->dai_link[i].codec_dai; struct snd_soc_dai *dai = card->dai_link[i].codec_dai;
if (card->dai_link[i].ignore_suspend)
continue;
if (dai->ops->digital_mute && dai->playback.active) if (dai->ops->digital_mute && dai->playback.active)
dai->ops->digital_mute(dai, 0); dai->ops->digital_mute(dai, 0);
} }
for (i = 0; i < card->num_links; i++) { for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
if (card->dai_link[i].ignore_suspend)
continue;
if (cpu_dai->resume && !cpu_dai->ac97_control) if (cpu_dai->resume && !cpu_dai->ac97_control)
cpu_dai->resume(cpu_dai); cpu_dai->resume(cpu_dai);
if (platform->resume) if (platform->resume)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册