aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-09-04 13:44:07 -0400
committerMark Brown <broonie@kernel.org>2014-09-04 15:10:25 -0400
commita80932979a72ef9d4e66a69520c7588cc6de5699 (patch)
tree78b33bf8816bc0df7333ae765f5d8315b8ae799e
parent86dbf2ac6fcb2d2932d4610f2dfe0954aa0633f7 (diff)
ASoC: Always run default suspend/resume code
We do a bit more than just running the callbacks during suspend and resume these days (e.g. call regcache_mark_dirty() during suspend). But this is only when suspend and resume callbacks are specified for the driver, otherwise nothing is done. This means that drivers which don't want to do anything special during suspend and resume, but still want the standard operations to run, need to provide empty suspend and resume callback functions (rather than no callbacks). This patch updates the suspend and resume code to always run standard sequence regardless of whether suspend and resume handlers are provided. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-core.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 2bdf9a4ac2b4..c612900c80ff 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -637,7 +637,7 @@ int snd_soc_suspend(struct device *dev)
637 list_for_each_entry(codec, &card->codec_dev_list, card_list) { 637 list_for_each_entry(codec, &card->codec_dev_list, card_list) {
638 /* If there are paths active then the CODEC will be held with 638 /* If there are paths active then the CODEC will be held with
639 * bias _ON and should not be suspended. */ 639 * bias _ON and should not be suspended. */
640 if (!codec->suspended && codec->driver->suspend) { 640 if (!codec->suspended) {
641 switch (codec->dapm.bias_level) { 641 switch (codec->dapm.bias_level) {
642 case SND_SOC_BIAS_STANDBY: 642 case SND_SOC_BIAS_STANDBY:
643 /* 643 /*
@@ -651,8 +651,10 @@ int snd_soc_suspend(struct device *dev)
651 "ASoC: idle_bias_off CODEC on over suspend\n"); 651 "ASoC: idle_bias_off CODEC on over suspend\n");
652 break; 652 break;
653 } 653 }
654
654 case SND_SOC_BIAS_OFF: 655 case SND_SOC_BIAS_OFF:
655 codec->driver->suspend(codec); 656 if (codec->driver->suspend)
657 codec->driver->suspend(codec);
656 codec->suspended = 1; 658 codec->suspended = 1;
657 codec->cache_sync = 1; 659 codec->cache_sync = 1;
658 if (codec->component.regmap) 660 if (codec->component.regmap)
@@ -726,11 +728,12 @@ static void soc_resume_deferred(struct work_struct *work)
726 * left with bias OFF or STANDBY and suspended so we must now 728 * left with bias OFF or STANDBY and suspended so we must now
727 * resume. Otherwise the suspend was suppressed. 729 * resume. Otherwise the suspend was suppressed.
728 */ 730 */
729 if (codec->driver->resume && codec->suspended) { 731 if (codec->suspended) {
730 switch (codec->dapm.bias_level) { 732 switch (codec->dapm.bias_level) {
731 case SND_SOC_BIAS_STANDBY: 733 case SND_SOC_BIAS_STANDBY:
732 case SND_SOC_BIAS_OFF: 734 case SND_SOC_BIAS_OFF:
733 codec->driver->resume(codec); 735 if (codec->driver->resume)
736 codec->driver->resume(codec);
734 codec->suspended = 0; 737 codec->suspended = 0;
735 break; 738 break;
736 default: 739 default: