cs46xx thinkpad resume fix - #bug1946
Hi,
attached patch fix resume on thinkpad notebooks with cs46xx chip. Tested with Thinkpad A21m.
Patch is opposite latest linus git 2.6.22.
Bug #1946 may be closed.
Pavel Kysilka
________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
http://www.eset.com
sound/pci/cs46xx/cs46xx_lib.c +1 -0
@@ -3715,6 +3715,7 @@ int snd_cs46xx_resume(struct pci_dev *pci) chip->active_ctrl (chip,1 );/* force to on */ snd_cs46xx_chip_init (chip); +snd_cs46xx_start_dsp (chip);/* upload dsp code */ #if 0 snd_cs46xx_codec_write(chip, BA0_AC97_GENERAL_PURPOSE,
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Sat, 14 Jul 2007 17:55:52 +0200,
Quoted 11 lines · Pavel Kysilka
Hi,attached patch fix resume on thinkpad notebooks with cs46xx chip. Tested with Thinkpad A21m.
Patch is opposite latest linus git 2.6.22.
Bug #1946 may be closed.
Signed-off-by Pavel Kysilka <[email protected]>
Oh, thanks for hunting this long-standing bug!
I think, however, it cannot be applied as it is.
First, snd_cs46xx_start_dsp() calls cs46xx_dsp_load_module(), and the latter function isn't designed for the PM resume. We'd need a special resume function just for clearing area & reloading the dsp images according to the already loaded DSP modules.
Second, __devinit prefix for snd_cs46xx_start_dsp() has to be removed if it's called from the PM handler.
Takashi
At Mon, 16 Jul 2007 11:24:45 +0200,
Quoted 17 lines · I wrote:
At Sat, 14 Jul 2007 17:55:52 +0200,
Quoted 11 lines · Pavel Kysilka
Hi,attached patch fix resume on thinkpad notebooks with cs46xx chip. Tested with Thinkpad A21m.
Patch is opposite latest linus git 2.6.22.
Bug #1946 may be closed.
Signed-off-by Pavel Kysilka <[email protected]>Oh, thanks for hunting this long-standing bug!
Quoted 8 lines
I think, however, it cannot be applied as it is.
First,snd_cs46xx_start_dsp()callscs46xx_dsp_load_module(), and the latter function isn't designed for the PM resume. We'd need a special resume function just for clearing area & reloading the dsp images according to the already loaded DSP modules.Second,
__devinitprefix forsnd_cs46xx_start_dsp()has to be removed if it's called from the PM handler.
Looking at the code more deeply, I suspect whether it really works when CONFIG_SND_CS46XX_NEW_DSP=y. snd_cs46xx_start_dsp() involves with many calls that add SCBs and co, which will eventually overflow.
I made a patch blindly to do the resume work in a saner way, but of course, it's totally untested. Could you check whether it works?
thanks,
Takashi
include/cs46xx.h +4 -0
@@ -1723,6 +1723,10 @@ struct snd_cs46xx {struct snd_cs46xx_pcm *playback_pcm;unsigned int play_ctl;#endif + +#ifdef CONFIG_PM +u32 *saved_regs; +#endif }; int snd_cs46xx_create(struct snd_card *card,
include/cs46xx_dsp_spos.h +2 -0
@@ -107,6 +107,7 @@ struct dsp_scb_descriptor {char scb_name[DSP_MAX_SCB_NAME ];u32 address;int index; +u32 *data;struct dsp_scb_descriptor * sub_list_ptr;struct dsp_scb_descriptor * next_scb_ptr;
@@ -127,6 +128,7 @@ struct dsp_task_descriptor {int size;u32 address;int index; +u32 *data; };struct dsp_pcm_channel_descriptor {
pci/cs46xx/cs46xx_lib.c +62 -15
135 lines not on this page · raw message
pci/cs46xx/cs46xx_lib.h +3 -0
@@ -86,6 +86,9 @@ struct dsp_spos_instance *cs46xx_dsp_spostruct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip);void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip);int cs46xx_dsp_load_module (struct snd_cs46xx * chip,struct dsp_module_desc * module); +#ifdef CONFIG_PM +int cs46xx_dsp_resume (struct snd_cs46xx * chip); +#endif struct dsp_symbol_entry *cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip,char * symbol_name,int symbol_type);#ifdef CONFIG_PROC_FS
pci/cs46xx/dsp_spos.c +126 -44
232 lines not on this page · raw message
On Tue Jul 17, 2007 at 12:50:21PM +0200, Takashi Iwai wrote:
Hi Takashi,
good news below.
Quoted 4 lines
At Mon, 16 Jul 2007 11:24:45 +0200,
Quoted 2 lines · I wrote:
<cut/>
Quoted 11 lines
Quoted 10 lines
Oh, thanks for hunting this long-standing bug!
I think, however, it cannot be applied as it is.
First,snd_cs46xx_start_dsp()callscs46xx_dsp_load_module(), and the latter function isn't designed for the PM resume. We'd need a special resume function just for clearing area & reloading the dsp images according to the already loaded DSP modules.Second,
__devinitprefix forsnd_cs46xx_start_dsp()has to be removed if it's called from the PM handler.
Quoted 6 lines
Looking at the code more deeply, I suspect whether it really works when
CONFIG_SND_CS46XX_NEW_DSP=y.snd_cs46xx_start_dsp()involves with many calls that add SCBs and co, which will eventually overflow.I made a patch blindly to do the resume work in a saner way, but of course, it's totally untested. Could you check whether it works?
Patch works perfectly.
Tested option:
- kernel compiled with and without CONFIG_SND_CS46XX_NEW_DSP=y
- play pcm stream, suspend, resume and pcm stream is playing
- play pcm stream, stop playing pcm stream, suspend, resume and play pcm stream
If you need log from resume from notebook, I'll send you this log.
Quoted 6 lines
thanks,
Takashi
Many thanks
Pavel
________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
http://www.eset.com
Would this also apply to bug #305?
I'm happy to test this on CentOS 5 then Fedora 7 on a 600X, and write up the needed steps for ThinkWiki until the patch is included in the distributions.
Chris
Quoted 57 lines · Pavel Kysilka
On Tue Jul 17, 2007 at 12:50:21PM +0200, Takashi Iwai wrote:
Hi Takashi,
good news below.
Quoted 4 lines
At Mon, 16 Jul 2007 11:24:45 +0200,
Quoted 2 lines · I wrote:
<cut/>
Quoted 11 lines
Quoted 10 lines
Oh, thanks for hunting this long-standing bug!
I think, however, it cannot be applied as it is.
First,snd_cs46xx_start_dsp()callscs46xx_dsp_load_module(), and the latter function isn't designed for the PM resume. We'd need a special resume function just for clearing area & reloading the dsp images according to the already loaded DSP modules.Second,
__devinitprefix forsnd_cs46xx_start_dsp()has to be removed if it's called from the PM handler.Quoted 6 lines
Looking at the code more deeply, I suspect whether it really works when
CONFIG_SND_CS46XX_NEW_DSP=y.snd_cs46xx_start_dsp()involves with many calls that add SCBs and co, which will eventually overflow.I made a patch blindly to do the resume work in a saner way, but of course, it's totally untested. Could you check whether it works?
Patch works perfectly.
Tested option:
- kernel compiled with and withoutCONFIG_SND_CS46XX_NEW_DSP=y
- play pcm stream, suspend, resume and pcm stream is playing
- play pcm stream, stop playing pcm stream, suspend, resume and play pcm streamIf you need log from resume from notebook, I'll send you this log.
Quoted 6 lines
thanks,
Takashi
Many thanks
Pavel________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
http://www.eset.com
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Wed, 18 Jul 2007 00:26:42 +0200,
Quoted 30 lines · Pavel Kysilka
On Tue Jul 17, 2007 at 12:50:21PM +0200, Takashi Iwai wrote:
Hi Takashi,
good news below.
Quoted 4 lines
At Mon, 16 Jul 2007 11:24:45 +0200,
Quoted 2 lines · I wrote:
<cut/>
Quoted 11 lines
Quoted 10 lines
Oh, thanks for hunting this long-standing bug!
I think, however, it cannot be applied as it is.
First,snd_cs46xx_start_dsp()callscs46xx_dsp_load_module(), and the latter function isn't designed for the PM resume. We'd need a special resume function just for clearing area & reloading the dsp images according to the already loaded DSP modules.Second,
__devinitprefix forsnd_cs46xx_start_dsp()has to be removed if it's called from the PM handler.Quoted 6 lines
Looking at the code more deeply, I suspect whether it really works when
CONFIG_SND_CS46XX_NEW_DSP=y.snd_cs46xx_start_dsp()involves with many calls that add SCBs and co, which will eventually overflow.I made a patch blindly to do the resume work in a saner way, but of course, it's totally untested. Could you check whether it works?
Quoted 8 lines
Patch works perfectly.
Tested option:
- kernel compiled with and withoutCONFIG_SND_CS46XX_NEW_DSP=y
- play pcm stream, suspend, resume and pcm stream is playing
- play pcm stream, stop playing pcm stream, suspend, resume and play pcm streamIf you need log from resume from notebook, I'll send you this log.
Thanks for testing! That's enough, so far. I applied the patch to HG tree now.
Takashi
At Wed, 18 Jul 2007 08:51:45 -0500 (CDT),
Quoted 2 lines · [email protected] wrote:
Would this also apply to bug #305?
Possible.
Quoted 3 lines
I'm happy to test this on CentOS 5 then Fedora 7 on a 600X, and write up the needed steps for ThinkWiki until the patch is included in the distributions.
You can either download the HG repo or take the latest daily snapshot from
ftp://ftp.suse.com/pub/projects/alsa/snapshot/driver
I applied the patch today (July 19), so hg20070720 snapshot will include it.
If the mirror HG repo (hg-mirror.alsa-project.org) is out of sync, you can try hg.alsa-project.org instead.
Takashi