Bug 6244

Summary: cs46xx in Thinkapad A21m after suspend/resume doesn't play
Product: Drivers Reporter: Daniel Smolik (marvin)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: bunk, goldenfish, protasnb, rjwysocki, tiwai, tommi.kyntola
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.20 and earlier Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 7216    

Description Daniel Smolik 2006-03-18 15:56:05 UTC
Most recent kernel where this bug did not occur: all 2.6.x
Distribution: Debian Sarge
Hardware Environment: Thinkpad A21m
Software Environment: 
Problem Description:
When I suspend to Ram and resume cs46xx stop working. If I rmmod modprobe
snd_cs46xx sound start working, but If I do this often comp sometime freeze

Steps to reproduce:
Close and open lid switch a try to play some song
Comment 1 Adrian Bunk 2006-07-04 03:15:37 UTC
Upstream bug:
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1946
Comment 2 Rafael J. Wysocki 2006-09-29 09:26:33 UTC
Has it been fixed after 2.6.16-rc6?
Comment 3 Rafael J. Wysocki 2006-10-26 10:03:01 UTC
Rejecting due to the lack of response.
Comment 4 Daniel Smolik 2006-10-26 10:33:17 UTC
Sorry I lost previous mail. This but isn't fixed. problem still exists in
2.6.18. But I resubmit bug to ALSA.
Dan
Comment 5 Rafael J. Wysocki 2006-11-16 07:06:07 UTC
Is the problem still present in 2.6.19-rc6?  If so, does it happen after a
resume from RAM or from disk?

Comment 6 Daniel Smolik 2006-11-17 12:30:44 UTC
I now use 2.6.18. I try 2.6.19-rc6 and let you know.
Comment 7 Adrian Bunk 2007-02-10 00:14:15 UTC
Please reopen this bug if it's still present with kernel 2.6.20.
Comment 8 Daniel Smolik 2007-02-10 10:03:35 UTC
I compile 2.6.20 on this week and let you know.
Comment 9 Daniel Smolik 2007-02-12 01:44:04 UTC
with 2.6.20 still the same after suspend/resume  sound stop working. cat
/etc/hosts > /dev/dsp newer returns. Reload modules help.
Comment 10 Rafael J. Wysocki 2007-02-12 07:57:56 UTC
Can you please try the suspend to disk and see if the problem occurs after the 
resume?
Comment 11 Daniel Smolik 2007-02-12 08:40:32 UTC
I try suspend to disk and resume and sound doesn't work situation is the same.
Comment 12 Tommi Kyntola 2007-02-28 01:59:17 UTC
I'm thinking that this may or may not be related, but the 2.6.19-rc3 patch
(namely the commit 30b35399ceb2398d05837863476dcb12f12f3a82) broke atleast the
intel8x0 on my laptop (HP NW8000)so that sounds from the speakers remained dead.

When I removed the line:
pci_set_power_state(pci, pci_choose_state(pci, state));

from the intel8x0_suspend function it works again after the supend as it has
always as far back as I can remember. Same remove-that-line also does the trick
for newer kernels (I actually started noticing that after the FC6 upgraded to 
2.6.19 base).

I did check that the pci_choose_state does indeed return 3 (PCI_D3hot ain't
it?), which seems ok, so the actual reason why that breaks the sounds from the
speakers (headphones do work!) on my laptop I have no idea.

Perhaps someone with more understanding on the pci power settings can have a go
at this.

I'm more than willing to try out patches or be more verbose about this.
For now I'll just stick to commenting out that line for my kernels.
Comment 13 Rafael J. Wysocki 2007-02-28 02:21:06 UTC
Can you please send your one-liner patch to LKML (Cc to the ALSA development 
list maybe) with the information why it's needed?
Comment 14 Tommi Kyntola 2007-02-28 02:27:53 UTC
sure, I would've done that straight way, but it's just that the one-liner in
question is most certainly not a proper _fix_.

but yes, it probably best to report there, too, atleast it's worth pointing out
that the given regression does break sounds after suspend atleast on some hw.

Comment 15 Takashi Iwai 2007-03-08 03:10:40 UTC
The problem of cs46xx driver is very likely different from intel8x0.  It never
worked with some Thinkpad models.

The call of pci_set_power_state(pci, pci_choose_state(pci, state)) in the
suspend callback was added because it is what Documentation/power/pci.txt tells.
 How can this call be harmful?

Or, is it the order of pci_save_state() and pci_disable_device()?  Tommi, could
you try to exchange pci_save_state() and pci_disable_device() lines in suspend?
Comment 16 Tommi Kyntola 2007-03-09 06:42:14 UTC
takashi: Doesn't work. 

There's likely some state-like settings that's not being saved using mere
pci_save_state, or more likely not restored upon resume.

I recall having read somewhere about some amplifier power setting on laptops,
but I can't remeber that much more accurately than that. I'll try to google that
up and let you know if I'll find the right threads again.

In anycase this seems like a wrong bug entry to deal with this issue, eh?
#6181 might be closer.

I'll try go through the bugzilla listings once more and see if there's some
other information that might be related, but it'll probably have to wait for
next week.
Comment 17 Takashi Iwai 2007-03-09 07:07:04 UTC
OK, let's continue the discussion about intel8x0 on #6181.
Comment 18 Rafael J. Wysocki 2007-05-30 11:18:48 UTC
What is the current status of this bug?
Comment 19 Takashi Iwai 2007-05-31 09:14:56 UTC
It's a long-standing problem (likely specific to thinkpad), and hard to fix
without a hardware...
Comment 20 Natalie Protasevich 2007-06-17 23:11:22 UTC
So what's the next step. whould it be helpful to get guidance from ACPI side? Contacting laptop/chipset manufacturers?
Comment 21 Pavel Kysilka 2007-07-14 09:10:13 UTC
Patch submited to alsa-devel list and patch aviable there [last patch].

https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1946
Comment 22 Natalie Protasevich 2007-07-20 20:49:54 UTC
Has this patch fixed problem for you Daniel?
Comment 23 Daniel Smolik 2007-07-22 11:10:51 UTC
I don't know  now. I must test it this week. Please be patient.
Comment 24 Daniel Smolik 2007-07-22 15:11:49 UTC
Situation is much better, but in dmesg I found this warnings:
dsp_spos: WARNING current parameter data may be overwriten!                        
dsp_spos: symbol <sposCB> duplicated                       
dsp_spos: symbol <nullSCB> duplicated
dsp_spos: symbol <FGtaskTreeHdr> duplicated
dsp_spos: symbol <BGtaskTreeHdr> duplicated
dsp_spos: symbol <TimingMasterSCBInst> duplicated
dsp_spos: symbol <CodecOutSCB_I> duplicated      
dsp_spos: symbol <MasterMixSCB> duplicated   
dsp_spos: symbol <CodecInSCB> duplicated      
dsp_spos: symbol <WriteBackSCB> duplicated    
dsp_spos: symbol <VariDecimateSCB> duplicated 
dsp_spos: symbol <RecordMixerSCB> duplicated  
dsp_spos: symbol <CodecOutSCB_Rear> duplicated
dsp_spos: symbol <RearMixerSCB> duplicated    
dsp_spos: symbol <MagicSnoopSCB_I> duplicated
dsp_spos: symbol <SPIOWriteSCB> duplicated
dsp_spos: symbol <SrcTaskSCB_SPDIFI> duplicated
dsp_spos: symbol <SPDIFOSCB> duplicated        
dsp_spos: symbol <SPDIFISCB> duplicated
dsp_spos: symbol <AsynCodecInputSCB> duplicated
ACPI: PCI Interrupt 0000:00:07.2[D] -> Link [LNKD] -> GSI 11 (level, low) -> IRQ 11
usb usb1: root hub lost power or was res

I mean that this patch is not 100% correct. With this patch I cannot resume propertly from hibernation.
Comment 25 Takashi Iwai 2007-07-23 03:23:09 UTC
A better patch was already merged to 2.6.23-rc1 tree.  Give it a try.
Comment 26 Daniel Smolik 2007-07-24 15:31:47 UTC
:-( With 2.6.23-rc1 sound after resume did't work. cat /etc/hosts > /dev/dsp never returns. And after resume I get OOPS :-(. Situation is the same as before.
Comment 27 Kristóf Ralovich 2008-01-11 04:32:08 UTC
I can reproduce the same problem, on a Thinkpad T22, with the same sound card using 2.6.24.-rc4. I dont get any OOPS, and cs46xx is built into the kernel(not module). Running cat /etc/hosts > /dev/dsp never returns after the resume.
Comment 28 Daniel Smolik 2008-01-11 06:22:52 UTC
Switching  to another DSP core solve my problem.
Comment 29 Rafael J. Wysocki 2008-01-11 09:13:54 UTC
Can you provide some more details, thanks.
Comment 30 Daniel Smolik 2008-01-11 09:36:20 UTC
Look at this bug.
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1946
Switch  to OLD DSP image solve problem.
Comment 31 Rafael J. Wysocki 2008-01-11 09:53:11 UTC
I still don't understand what the "OLD DSP image" is and why switching to in apparently helps.

May I see the patch please?

Also, is it fixed in the latest mainline kernel?
Comment 32 Daniel Smolik 2008-01-11 10:16:39 UTC
Run menuconfig and go Drivers->Sound->Alsa
 <M> Cirrus Logic (Sound Fusion) CS4281                           x x  
  x x    <M> Cirrus Logic (Sound Fusion) CS4280/CS461x/CS462x/CS463x      x x  
  x x    [ ]   Cirrus Logic (Sound Fusion) New DSP support    

and disable New DSP support compile new kernel and enjoy.
Comment 33 Rafael J. Wysocki 2008-01-11 10:37:59 UTC
Thanks for the clarification.

Still, this seems to mean that suspend is only supported if the old DSP is used.

If that's the case, we have only a workaround and the problem is still not fixed.
Comment 34 Daniel Smolik 2008-01-11 10:45:36 UTC
Or my sound card work well only with old DSP code I dont' know sorry.
Comment 35 drkludge 2009-01-31 12:41:52 UTC
still present in 2.6.28 on thinkpad a21m.

using OLD_DSP is no solution, since it breaks features (i.e.: multiple programs using soundcard at the same time).