diff options
| author | David Cemin <dcemin@nvidia.com> | 2026-09-12 11:21:20 -0700 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2026-09-13 09:09:06 +0200 |
| commit | a41da0bb086e7c170755c4d2bbb0520e82a2a738 (patch) | |
| tree | a0c1a3f45aef8e4050254dc50b1d84f9344b85f9 | |
| parent | a347cc458d97ecd8adb5462b91559682a70aced6 (diff) | |
ALSA: hda/acpi: add runtime PM suspend/resume to the ACPI controller
The hda-acpi platform driver never enables runtime PM, so
pm_runtime_force_suspend() in hda_acpi_suspend() skips the runtime
callbacks. On resume the controller is therefore never re-initialised:
azx_init_chip() is called only at probe time, so after S3 the codec
verbs time out and audio is dead until the driver is rebound.
Add explicit runtime_suspend/runtime_resume callbacks and invoke them
from the system-sleep paths, mirroring the pattern used by snd-hda-intel.
Tested on an arm64 platform with the NVDA2014 controller: resume latency
drops from 81.5 s to 3.6 s and audio is live immediately after wake.
Signed-off-by: David Cemin <dcemin@nvidia.com>
Link: https://patch.msgid.link/20260912182120.1156356-1-dcemin@nvidia.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/hda/controllers/acpi.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sound/hda/controllers/acpi.c b/sound/hda/controllers/acpi.c index 505cc97e0ee9..04b261dde22e 100644 --- a/sound/hda/controllers/acpi.c +++ b/sound/hda/controllers/acpi.c @@ -266,6 +266,38 @@ static void hda_acpi_shutdown(struct platform_device *pdev) azx_stop_chip(chip); } +static int hda_acpi_runtime_suspend(struct device *dev) +{ + struct snd_card *card = dev_get_drvdata(dev); + struct azx *chip = card->private_data; + + if (chip && chip->running) { + /* enable controller wake up event */ + azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | + STATESTS_INT_MASK); + + azx_stop_chip(chip); + azx_enter_link_reset(chip); + } + + return 0; +} + +static int hda_acpi_runtime_resume(struct device *dev) +{ + struct snd_card *card = dev_get_drvdata(dev); + struct azx *chip = card->private_data; + + if (chip && chip->running) { + azx_init_chip(chip, 1); + /* disable controller wake up event */ + azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & + ~STATESTS_INT_MASK); + } + + return 0; +} + static int hda_acpi_suspend(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); @@ -274,6 +306,12 @@ static int hda_acpi_suspend(struct device *dev) rc = pm_runtime_force_suspend(dev); if (rc < 0) return rc; + /* + * Runtime PM is never enabled for this device, so the force_suspend + * above does not reach the runtime callback; stop the controller + * explicitly. + */ + hda_acpi_runtime_suspend(dev); snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); return 0; @@ -287,6 +325,8 @@ static int hda_acpi_resume(struct device *dev) rc = pm_runtime_force_resume(dev); if (rc < 0) return rc; + /* See hda_acpi_suspend(): re-init the controller explicitly. */ + hda_acpi_runtime_resume(dev); snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; @@ -294,6 +334,7 @@ static int hda_acpi_resume(struct device *dev) static const struct dev_pm_ops hda_acpi_pm = { SYSTEM_SLEEP_PM_OPS(hda_acpi_suspend, hda_acpi_resume) + RUNTIME_PM_OPS(hda_acpi_runtime_suspend, hda_acpi_runtime_resume, NULL) }; static const struct hda_data nvidia_hda_data = { |
