[ALSA] hda-intel - Fix resume logic, when dynamic power managment is on

Comment in hda_intel.c states that 'the explicit resume is needed only
when POWER_SAVE isn't set', but this is not true.
There is no code that will automaticly power up the codec on resume,
but only code that powers it up when user accesses it. So if user
leaves a sound playing, codec will not be powered
To fix that I check if there are any codecs that should be powered
codec->power_count, and if so I power them up together with main
controller.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 3d06ecc..72fd345 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1586,11 +1586,11 @@
 	if (azx_acquire_irq(chip, 1) < 0)
 		return -EIO;
 	azx_init_pci(chip);
-#ifndef CONFIG_SND_HDA_POWER_SAVE
-	/* the explicit resume is needed only when POWER_SAVE isn't set */
-	azx_init_chip(chip);
+
+	if (snd_hda_codecs_inuse(chip->bus))
+		azx_init_chip(chip);
+
 	snd_hda_resume(chip->bus);
-#endif
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
 	return 0;
 }