diff options
| -rw-r--r-- | include/sound/soc.h | 3 | ||||
| -rw-r--r-- | sound/soc/soc-core.c | 38 |
2 files changed, 40 insertions, 1 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 9f306f0710df..8326fc3db1cf 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
| @@ -505,6 +505,9 @@ struct snd_soc_dai_link { | |||
| 505 | /* codec/machine specific init - e.g. add machine controls */ | 505 | /* codec/machine specific init - e.g. add machine controls */ |
| 506 | int (*init)(struct snd_soc_codec *codec); | 506 | int (*init)(struct snd_soc_codec *codec); |
| 507 | 507 | ||
| 508 | /* Keep DAI active over suspend */ | ||
| 509 | unsigned int ignore_suspend:1; | ||
| 510 | |||
| 508 | /* Symmetry requirements */ | 511 | /* Symmetry requirements */ |
| 509 | unsigned int symmetric_rates:1; | 512 | unsigned int symmetric_rates:1; |
| 510 | 513 | ||
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) |
