aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-08-16 10:35:33 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:59:07 -0400
commita221e287ab39a0d169809cb79536abd75392c3c1 (patch)
treebb3fc373c9057083525e65218c8020d44dc8a444 /sound/pci/hda/hda_codec.c
parent676a9b53dcb0843a98f7339a492e42baf4b9a734 (diff)
[ALSA] hda-intel - Avoid unnecessary work scheduling
Avoid unnecessary work scheduling for power-off. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 0b9029436bb4..b1eee9a044fe 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1664,6 +1664,7 @@ static void hda_call_codec_suspend(struct hda_codec *codec)
1664#ifdef CONFIG_SND_HDA_POWER_SAVE 1664#ifdef CONFIG_SND_HDA_POWER_SAVE
1665 cancel_delayed_work(&codec->power_work); 1665 cancel_delayed_work(&codec->power_work);
1666 codec->power_on = 0; 1666 codec->power_on = 0;
1667 codec->power_transition = 0;
1667#endif 1668#endif
1668} 1669}
1669 1670
@@ -2211,7 +2212,7 @@ static void hda_keep_power_on(struct hda_codec *codec)
2211void snd_hda_power_up(struct hda_codec *codec) 2212void snd_hda_power_up(struct hda_codec *codec)
2212{ 2213{
2213 codec->power_count++; 2214 codec->power_count++;
2214 if (codec->power_on) 2215 if (codec->power_on || codec->power_transition)
2215 return; 2216 return;
2216 2217
2217 codec->power_on = 1; 2218 codec->power_on = 1;
@@ -2219,16 +2220,19 @@ void snd_hda_power_up(struct hda_codec *codec)
2219 codec->bus->ops.pm_notify(codec); 2220 codec->bus->ops.pm_notify(codec);
2220 hda_call_codec_resume(codec); 2221 hda_call_codec_resume(codec);
2221 cancel_delayed_work(&codec->power_work); 2222 cancel_delayed_work(&codec->power_work);
2223 codec->power_transition = 0;
2222} 2224}
2223 2225
2224void snd_hda_power_down(struct hda_codec *codec) 2226void snd_hda_power_down(struct hda_codec *codec)
2225{ 2227{
2226 --codec->power_count; 2228 --codec->power_count;
2227 if (!codec->power_on || codec->power_count) 2229 if (!codec->power_on || codec->power_count || codec->power_transition)
2228 return; 2230 return;
2229 if (power_save) 2231 if (power_save) {
2232 codec->power_transition = 1; /* avoid reentrance */
2230 schedule_delayed_work(&codec->power_work, 2233 schedule_delayed_work(&codec->power_work,
2231 msecs_to_jiffies(power_save * 1000)); 2234 msecs_to_jiffies(power_save * 1000));
2235 }
2232} 2236}
2233 2237
2234int snd_hda_check_amp_list_power(struct hda_codec *codec, 2238int snd_hda_check_amp_list_power(struct hda_codec *codec,