Fix ALSA resume
PATCH 1/1 Fix ALSA resume
Some time ago, a patch was merged that removed pci_save_state() and pci_restore_state() from various ALSA drivers. That patch also added pci_restore_state() to sound/core/init.c but didn't add pci_save_state() anywhere. This is needed since the core pci handling doesn't do this for us anymore.
My laptop doesn't resume (gets what I assume is an ACPI timeout and hangs solid) without this small obvious patch.
sound/core/init.c +4 -1
@@ -782,12 +782,15 @@<br>int snd_card_pci_suspend (struct pci_dev *dev,u32 state) {snd_card_t *card =pci_get_drvdata (dev); +int err;if (! card || ! card->pm_suspend)return 0 ;if (card->power_state == SNDRV_CTL_POWER_D3hot)return 0 ;/* FIXME: correct state value? */ -return card->pm_suspend (card,0 ); + err = card->pm_suspend (card,0 ); +pci_save_state (dev); +return err; }int snd_card_pci_resume (struct pci_dev *dev)
Signature · 1 line
/Martin
Please cc: [email protected] on all ALSA issues.
Quoted 33 lines · Martin Josefsson
Some time ago, a patch was merged that removed
pci_save_state()andpci_restore_state()from various ALSA drivers. That patch also addedpci_restore_state()tosound/core/init.cbut didn't addpci_save_state()anywhere. This is needed since the core pci handling doesn't do this for us anymore.My laptop doesn't resume (gets what I assume is an ACPI timeout and hangs solid) without this small obvious patch.
Signed-off-by Martin Josefsson <[email protected]>Fixed-by Takashi Iwai <[email protected]>sound/core/init.c +4
-1@@ -782,12 +782,15 @@<br>int snd_card_pci_suspend (struct pci_dev *dev,u32 state) {snd_card_t *card =pci_get_drvdata (dev); +int err;if (! card || ! card->pm_suspend)return 0 ;if (card->power_state == SNDRV_CTL_POWER_D3hot)return 0 ;/* FIXME: correct state value? */ -return card->pm_suspend (card,0 ); + err = card->pm_suspend (card,0 ); +pci_save_state (dev); +return err; }int snd_card_pci_resume (struct pci_dev *dev)
Signature · 9 lines
Lee Revell <[email protected]> ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
Quoted 22 lines · Martin Josefsson
Some time ago, a patch was merged that removed
pci_save_state()andpci_restore_state()from various ALSA drivers. That patch also addedpci_restore_state()tosound/core/init.cbut didn't addpci_save_state()anywhere. This is needed since the core pci handling doesn't do this for us anymore.My laptop doesn't resume (gets what I assume is an ACPI timeout and hangs solid) without this small obvious patch.
Signed-off-by Martin Josefsson <[email protected]>Fixed-by Takashi Iwai <[email protected]>sound/core/init.c +1
-0@@ -782,12 +782,15 @@<br>int snd_card_pci_suspend (struct pci_dev *dev,u32 state) {snd_card_t *card =pci_get_drvdata (dev); +int err;if (! card || ! card->pm_suspend)return 0 ;
sound/core/init.c <br> · line 796
Quoted 10 lines
sound/core/init.c +3
-1if (card->power_state == SNDRV_CTL_POWER_D3hot)return 0 ;/* FIXME: correct state value? */ -return card->pm_suspend (card,0 ); + err = card->pm_suspend (card,0 ); +pci_save_state (dev); +return err; }int snd_card_pci_resume (struct pci_dev *dev)
OK. That's a better version of Joshua Kwan's patch:
From: Joshua Kwan <[email protected]>
Fix an intel8x0 problem which is breaking swsusp resumes.
---
25-akpm/sound/pci/intel8x0.c | 2 ++ 25-akpm/sound/pci/intel8x0m.c | 2 ++ 2 files changed, 4 insertions(+)
sound/pci/intel8x0.c renamed from sound/pci/intel8x0.c~intel8x0-pm-fix +2 -0
@@ -2279,6 +2279,8 @@ static int intel8x0_suspend(snd_card_t *for (i =0 ; i <3 ; i++)if (chip->ac97[i])snd_ac97_suspend (chip->ac97[i]); +pci_save_state (chip->pci); +pci_disable_device (chip->pci);snd_power_change_state (card, SNDRV_CTL_POWER_D3hot);return 0 ; }
sound/pci/intel8x0m.c renamed from sound/pci/intel8x0m.c~intel8x0-pm-fix +2 -0
@@ -1091,6 +1091,8 @@ static int intel8x0m_suspend(snd_card_tsnd_pcm_suspend_all (chip->pcm[i]);if (chip->ac97)snd_ac97_suspend (chip->ac97); +pci_save_state (chip->pci); +pci_disable_device (chip->pci);snd_power_change_state (card, SNDRV_CTL_POWER_D3hot);return 0 ; }
_
But Joshua crosses his heart and swears that the pci_disable_device() is also needed for a successful swsusp resume.
Should snd_card_pci_suspend() be doing the pci_disable_device() as well, or it that a responsibility of the driver which called snd_card_pci_suspend()?
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
Quoted 2 lines · Andrew Morton
But Joshua crosses his heart and swears that the
pci_disable_device()is also needed for a successful swsusp resume.
I never said I had any problems with resuming.
That said, I tried removing the pci_disable_device call and things seem to still work. So I guess it can be left out?
Signature · 7 lines
Joshua Kwan ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
Quoted 6 lines · Joshua Kwan
Quoted 2 lines · Andrew Morton
But Joshua crosses his heart and swears that the
pci_disable_device()is also needed for a successful swsusp resume.I never said I had any problems with resuming.
OK, suspend was failing, yes?
Quoted 2 lines
That said, I tried removing the
pci_disable_devicecall and things seem to still work. So I guess it can be left out?
Can you please test Martin's patch?
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
Quoted 1 line · Andrew Morton
OK, suspend was failing, yes?
Yes.
Quoted 1 line
Can you please test Martin's patch?
Works for me.
Signature · 7 lines
Joshua Kwan ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
Quoted 8 lines · Joshua Kwan
Quoted 1 line · Andrew Morton
OK, suspend was failing, yes?
Yes.
Quoted 1 line
Can you please test Martin's patch?
Works for me.
Works here as well.
This is the only problem I've had with ALSA and swsusp. It even handles suspending in the middle of playing music and then resuming and continuing where it was.
Signature · 1 line
/Martin
At Sat, 4 Dec 2004 17:28:55 -0800,
Quoted 3 lines · Andrew Morton
But Joshua crosses his heart and swears that the
pci_disable_device()is also needed for a successful swsusp resume.
Yes. This would make suspend safer.
The linux-sound bk tree already includes the fix above and the patches to add pci_disable_device() in appropriate places.
Andrew, could you update bk-alsa patch set?
Quoted 2 lines
Should
snd_card_pci_suspend()be doing thepci_disable_device()as well, or it that a responsibility of the driver which calledsnd_card_pci_suspend()?
So far, we suppose that the lowlevel suspend() callback should call pci_disable_device() although we can move it to the common place, snd_card_pci_suspend().
Takashi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/