aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/hda_codec.c16
-rw-r--r--sound/pci/hda/hda_codec.h4
-rw-r--r--sound/pci/hda/hda_intel.c8
3 files changed, 21 insertions, 7 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 08104e2a3e99..e594de0b153e 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2787,7 +2787,6 @@ int snd_hda_suspend(struct hda_bus *bus, pm_message_t state)
2787 return 0; 2787 return 0;
2788} 2788}
2789 2789
2790#ifndef CONFIG_SND_HDA_POWER_SAVE
2791/** 2790/**
2792 * snd_hda_resume - resume the codecs 2791 * snd_hda_resume - resume the codecs
2793 * @bus: the HDA bus 2792 * @bus: the HDA bus
@@ -2803,10 +2802,21 @@ int snd_hda_resume(struct hda_bus *bus)
2803 struct hda_codec *codec; 2802 struct hda_codec *codec;
2804 2803
2805 list_for_each_entry(codec, &bus->codec_list, list) { 2804 list_for_each_entry(codec, &bus->codec_list, list) {
2806 hda_call_codec_resume(codec); 2805 if (snd_hda_codec_needs_resume(codec))
2806 hda_call_codec_resume(codec);
2807 } 2807 }
2808 return 0; 2808 return 0;
2809} 2809}
2810#endif /* !CONFIG_SND_HDA_POWER_SAVE */ 2810#ifdef CONFIG_SND_HDA_POWER_SAVE
2811int snd_hda_codecs_inuse(struct hda_bus *bus)
2812{
2813 struct hda_codec *codec;
2811 2814
2815 list_for_each_entry(codec, &bus->codec_list, list) {
2816 if (snd_hda_codec_needs_resume(codec))
2817 return 1;
2818 }
2819 return 0;
2820}
2821#endif
2812#endif 2822#endif
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index ca157e5100c9..2bce925d84ef 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -686,9 +686,13 @@ int snd_hda_resume(struct hda_bus *bus);
686#ifdef CONFIG_SND_HDA_POWER_SAVE 686#ifdef CONFIG_SND_HDA_POWER_SAVE
687void snd_hda_power_up(struct hda_codec *codec); 687void snd_hda_power_up(struct hda_codec *codec);
688void snd_hda_power_down(struct hda_codec *codec); 688void snd_hda_power_down(struct hda_codec *codec);
689#define snd_hda_codec_needs_resume(codec) codec->power_count
690int snd_hda_codecs_inuse(struct hda_bus *bus);
689#else 691#else
690static inline void snd_hda_power_up(struct hda_codec *codec) {} 692static inline void snd_hda_power_up(struct hda_codec *codec) {}
691static inline void snd_hda_power_down(struct hda_codec *codec) {} 693static inline void snd_hda_power_down(struct hda_codec *codec) {}
694#define snd_hda_codec_needs_resume(codec) 1
695#define snd_hda_codecs_inuse(bus) 1
692#endif 696#endif
693 697
694#endif /* __SOUND_HDA_CODEC_H */ 698#endif /* __SOUND_HDA_CODEC_H */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 3d06eccc9b9c..72fd34538994 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1586,11 +1586,11 @@ static int azx_resume(struct pci_dev *pci)
1586 if (azx_acquire_irq(chip, 1) < 0) 1586 if (azx_acquire_irq(chip, 1) < 0)
1587 return -EIO; 1587 return -EIO;
1588 azx_init_pci(chip); 1588 azx_init_pci(chip);
1589#ifndef CONFIG_SND_HDA_POWER_SAVE 1589
1590 /* the explicit resume is needed only when POWER_SAVE isn't set */ 1590 if (snd_hda_codecs_inuse(chip->bus))
1591 azx_init_chip(chip); 1591 azx_init_chip(chip);
1592
1592 snd_hda_resume(chip->bus); 1593 snd_hda_resume(chip->bus);
1593#endif
1594 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 1594 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
1595 return 0; 1595 return 0;
1596} 1596}