Skip to content

Commit 7d4f606

Browse files
Wang Xingchaotiwai
authored andcommitted
ALSA: hda - WAKEEN feature enabling for runtime pm
With runtime power save feature enabled, Headphone hotplug event will not be detected while controller/codec in D3. HDA has feature WAKEEN to let codec wake up system if controller is in D3 or system in S3.(HDA Spec 4.5.9.2/3). Codec can send out INT or wake up controller depending on whether CIE or GIE enabled.(Figure 4, Interupt structure). The controller must be in RESET mode after enter runtime-suspend, otherwise it will not be waken up even if codec send out wake-up event. And STATESTS will be cleared after controller brought out of RESET mode. This patch only enable WAKEEN for runtime-suspend(Controller D3) mode, not for system S3 mode. with tool "evtest", Headphone hotplug events could be cought and reported successfully. [fixed an unused variable warning by tiwai] Signed-off-by: Wang Xingchao <xingchao.wang@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 18e6062 commit 7d4f606

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎sound/pci/hda/hda_intel.c‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,6 +2971,10 @@ static int azx_runtime_suspend(struct device *dev)
29712971
struct snd_card *card = dev_get_drvdata(dev);
29722972
struct azx *chip = card->private_data;
29732973

2974+
/* enable controller wake up event */
2975+
azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
2976+
STATESTS_INT_MASK);
2977+
29742978
azx_stop_chip(chip);
29752979
azx_enter_link_reset(chip);
29762980
azx_clear_irq_pending(chip);
@@ -2983,11 +2987,31 @@ static int azx_runtime_resume(struct device *dev)
29832987
{
29842988
struct snd_card *card = dev_get_drvdata(dev);
29852989
struct azx *chip = card->private_data;
2990+
struct hda_bus *bus;
2991+
struct hda_codec *codec;
2992+
int status;
29862993

29872994
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
29882995
hda_display_power(true);
2996+
2997+
/* Read STATESTS before controller reset */
2998+
status = azx_readw(chip, STATESTS);
2999+
29893000
azx_init_pci(chip);
29903001
azx_init_chip(chip, 1);
3002+
3003+
bus = chip->bus;
3004+
if (status && bus) {
3005+
list_for_each_entry(codec, &bus->codec_list, list)
3006+
if (status & (1 << codec->addr))
3007+
queue_delayed_work(codec->bus->workq,
3008+
&codec->jackpoll_work, codec->jackpoll_interval);
3009+
}
3010+
3011+
/* disable controller Wake Up event*/
3012+
azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
3013+
~STATESTS_INT_MASK);
3014+
29913015
return 0;
29923016
}
29933017

0 commit comments

Comments
 (0)