diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-05-09 08:25:43 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-05-10 05:37:13 -0400 |
commit | 3efab7dcc0f4d0087f73ff975eaa2fddc02ffc69 (patch) | |
tree | 501e2991f13b6ca8b7b3c3a27b03ccd4c5196185 /sound/soc | |
parent | 452a5fd679f8a6f215df71c41487ad4b2c7774db (diff) |
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: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/soc-core.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 8661e5b4adb1..34f71bf60140 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -893,19 +893,31 @@ static int soc_suspend(struct device *dev) | |||
893 | /* mute any active DAC's */ | 893 | /* mute any active DAC's */ |
894 | for (i = 0; i < card->num_links; i++) { | 894 | for (i = 0; i < card->num_links; i++) { |
895 | struct snd_soc_dai *dai = card->dai_link[i].codec_dai; | 895 | struct snd_soc_dai *dai = card->dai_link[i].codec_dai; |
896 | |||
897 | if (card->dai_link[i].ignore_suspend) | ||
898 | continue; | ||
899 | |||
896 | if (dai->ops->digital_mute && dai->playback.active) | 900 | if (dai->ops->digital_mute && dai->playback.active) |
897 | dai->ops->digital_mute(dai, 1); | 901 | dai->ops->digital_mute(dai, 1); |
898 | } | 902 | } |
899 | 903 | ||
900 | /* suspend all pcms */ | 904 | /* suspend all pcms */ |
901 | for (i = 0; i < card->num_links; i++) | 905 | for (i = 0; i < card->num_links; i++) { |
906 | if (card->dai_link[i].ignore_suspend) | ||
907 | continue; | ||
908 | |||
902 | snd_pcm_suspend_all(card->dai_link[i].pcm); | 909 | snd_pcm_suspend_all(card->dai_link[i].pcm); |
910 | } | ||
903 | 911 | ||
904 | if (card->suspend_pre) | 912 | if (card->suspend_pre) |
905 | card->suspend_pre(pdev, PMSG_SUSPEND); | 913 | card->suspend_pre(pdev, PMSG_SUSPEND); |
906 | 914 | ||
907 | for (i = 0; i < card->num_links; i++) { | 915 | for (i = 0; i < card->num_links; i++) { |
908 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; | 916 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; |
917 | |||
918 | if (card->dai_link[i].ignore_suspend) | ||
919 | continue; | ||
920 | |||
909 | if (cpu_dai->suspend && !cpu_dai->ac97_control) | 921 | if (cpu_dai->suspend && !cpu_dai->ac97_control) |
910 | cpu_dai->suspend(cpu_dai); | 922 | cpu_dai->suspend(cpu_dai); |
911 | if (platform->suspend) | 923 | if (platform->suspend) |
@@ -918,6 +930,10 @@ static int soc_suspend(struct device *dev) | |||
918 | 930 | ||
919 | for (i = 0; i < codec->num_dai; i++) { | 931 | for (i = 0; i < codec->num_dai; i++) { |
920 | char *stream = codec->dai[i].playback.stream_name; | 932 | char *stream = codec->dai[i].playback.stream_name; |
933 | |||
934 | if (card->dai_link[i].ignore_suspend) | ||
935 | continue; | ||
936 | |||
921 | if (stream != NULL) | 937 | if (stream != NULL) |
922 | snd_soc_dapm_stream_event(codec, stream, | 938 | snd_soc_dapm_stream_event(codec, stream, |
923 | SND_SOC_DAPM_STREAM_SUSPEND); | 939 | SND_SOC_DAPM_STREAM_SUSPEND); |
@@ -943,6 +959,10 @@ static int soc_suspend(struct device *dev) | |||
943 | 959 | ||
944 | for (i = 0; i < card->num_links; i++) { | 960 | for (i = 0; i < card->num_links; i++) { |
945 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; | 961 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; |
962 | |||
963 | if (card->dai_link[i].ignore_suspend) | ||
964 | continue; | ||
965 | |||
946 | if (cpu_dai->suspend && cpu_dai->ac97_control) | 966 | if (cpu_dai->suspend && cpu_dai->ac97_control) |
947 | cpu_dai->suspend(cpu_dai); | 967 | cpu_dai->suspend(cpu_dai); |
948 | } | 968 | } |
@@ -982,6 +1002,10 @@ static void soc_resume_deferred(struct work_struct *work) | |||
982 | 1002 | ||
983 | for (i = 0; i < card->num_links; i++) { | 1003 | for (i = 0; i < card->num_links; i++) { |
984 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; | 1004 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; |
1005 | |||
1006 | if (card->dai_link[i].ignore_suspend) | ||
1007 | continue; | ||
1008 | |||
985 | if (cpu_dai->resume && cpu_dai->ac97_control) | 1009 | if (cpu_dai->resume && cpu_dai->ac97_control) |
986 | cpu_dai->resume(cpu_dai); | 1010 | cpu_dai->resume(cpu_dai); |
987 | } | 1011 | } |
@@ -1004,6 +1028,10 @@ static void soc_resume_deferred(struct work_struct *work) | |||
1004 | 1028 | ||
1005 | for (i = 0; i < codec->num_dai; i++) { | 1029 | for (i = 0; i < codec->num_dai; i++) { |
1006 | char *stream = codec->dai[i].playback.stream_name; | 1030 | char *stream = codec->dai[i].playback.stream_name; |
1031 | |||
1032 | if (card->dai_link[i].ignore_suspend) | ||
1033 | continue; | ||
1034 | |||
1007 | if (stream != NULL) | 1035 | if (stream != NULL) |
1008 | snd_soc_dapm_stream_event(codec, stream, | 1036 | snd_soc_dapm_stream_event(codec, stream, |
1009 | SND_SOC_DAPM_STREAM_RESUME); | 1037 | SND_SOC_DAPM_STREAM_RESUME); |
@@ -1016,12 +1044,20 @@ static void soc_resume_deferred(struct work_struct *work) | |||
1016 | /* unmute any active DACs */ | 1044 | /* unmute any active DACs */ |
1017 | for (i = 0; i < card->num_links; i++) { | 1045 | for (i = 0; i < card->num_links; i++) { |
1018 | struct snd_soc_dai *dai = card->dai_link[i].codec_dai; | 1046 | struct snd_soc_dai *dai = card->dai_link[i].codec_dai; |
1047 | |||
1048 | if (card->dai_link[i].ignore_suspend) | ||
1049 | continue; | ||
1050 | |||
1019 | if (dai->ops->digital_mute && dai->playback.active) | 1051 | if (dai->ops->digital_mute && dai->playback.active) |
1020 | dai->ops->digital_mute(dai, 0); | 1052 | dai->ops->digital_mute(dai, 0); |
1021 | } | 1053 | } |
1022 | 1054 | ||
1023 | for (i = 0; i < card->num_links; i++) { | 1055 | for (i = 0; i < card->num_links; i++) { |
1024 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; | 1056 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; |
1057 | |||
1058 | if (card->dai_link[i].ignore_suspend) | ||
1059 | continue; | ||
1060 | |||
1025 | if (cpu_dai->resume && !cpu_dai->ac97_control) | 1061 | if (cpu_dai->resume && !cpu_dai->ac97_control) |
1026 | cpu_dai->resume(cpu_dai); | 1062 | cpu_dai->resume(cpu_dai); |
1027 | if (platform->resume) | 1063 | if (platform->resume) |