All of lore.kernel.org
 help / color / mirror / Atom feed
* Aureal issues on resume
@ 2011-09-02 11:41 ` Anders Eriksson
  0 siblings, 0 replies; 13+ messages in thread
From: Anders Eriksson @ 2011-09-02 11:41 UTC (permalink / raw)
  To: linux-kernel, linux-sound



Hi, upon resuming from hibernation, I see this in my log:

Sep  2 11:15:20 tippex kernel: [72436.287020] vortex_adb_addroutes: unending route! 0x10
Sep  2 11:15:20 tippex kernel: [72436.287127] vortex_adb_addroutes: unending route! 0x838
Sep  2 11:15:20 tippex kernel: [72436.287277] vortex_adb_addroutes: unending route! 0x11
Sep  2 11:15:20 tippex kernel: [72436.287418] vortex_adb_addroutes: unending route! 0x8b9
Sep  2 11:15:20 tippex kernel: [72436.292037] Vortex: vortex_fifo_setadbctrl fail
Sep  2 11:15:55 tippex kernel: [72471.403490] vortex_adb_delroutes: route not found! 0x10
Sep  2 11:15:55 tippex kernel: [72471.403596] vortex_adb_delroutes: route not found! 0x838
Sep  2 11:15:55 tippex kernel: [72471.403710] vortex_adb_delroutes: route not found! 0x11
Sep  2 11:15:55 tippex kernel: [72471.403811] vortex_adb_delroutes: route not found! 0x8b9

And the sound is no more. I need to reboot to get it back.

If memory serves, it's been there since 2.6.30 or so. Any ideas what can be 
triggering it?

lspci says it's an 
00:04.0 Multimedia audio controller: Aureal Semiconductor Vortex 1 (rev 02)
        Subsystem: Diamond Multimedia Systems Sonic Impact A3D
        Flags: bus master, medium devsel, latency 64, IRQ 11
        Memory at 50000000 (32-bit, non-prefetchable) [size\x128K]
        I/O ports at 10b0 [size=8]
        I/O ports at 10b8 [size=8]
        Capabilities: [dc] Power Management version 1
        Kernel driver in use: snd_au8820
        Kernel modules: snd-au8820



-Anders


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Aureal issues on resume
@ 2011-09-02 11:41 ` Anders Eriksson
  0 siblings, 0 replies; 13+ messages in thread
From: Anders Eriksson @ 2011-09-02 11:41 UTC (permalink / raw)
  To: linux-kernel, linux-sound



Hi, upon resuming from hibernation, I see this in my log:

Sep  2 11:15:20 tippex kernel: [72436.287020] vortex_adb_addroutes: unending route! 0x10
Sep  2 11:15:20 tippex kernel: [72436.287127] vortex_adb_addroutes: unending route! 0x838
Sep  2 11:15:20 tippex kernel: [72436.287277] vortex_adb_addroutes: unending route! 0x11
Sep  2 11:15:20 tippex kernel: [72436.287418] vortex_adb_addroutes: unending route! 0x8b9
Sep  2 11:15:20 tippex kernel: [72436.292037] Vortex: vortex_fifo_setadbctrl fail
Sep  2 11:15:55 tippex kernel: [72471.403490] vortex_adb_delroutes: route not found! 0x10
Sep  2 11:15:55 tippex kernel: [72471.403596] vortex_adb_delroutes: route not found! 0x838
Sep  2 11:15:55 tippex kernel: [72471.403710] vortex_adb_delroutes: route not found! 0x11
Sep  2 11:15:55 tippex kernel: [72471.403811] vortex_adb_delroutes: route not found! 0x8b9

And the sound is no more. I need to reboot to get it back.

If memory serves, it's been there since 2.6.30 or so. Any ideas what can be 
triggering it?

lspci says it's an 
00:04.0 Multimedia audio controller: Aureal Semiconductor Vortex 1 (rev 02)
        Subsystem: Diamond Multimedia Systems Sonic Impact A3D
        Flags: bus master, medium devsel, latency 64, IRQ 11
        Memory at 50000000 (32-bit, non-prefetchable) [size=128K]
        I/O ports at 10b0 [size=8]
        I/O ports at 10b8 [size=8]
        Capabilities: [dc] Power Management version 1
        Kernel driver in use: snd_au8820
        Kernel modules: snd-au8820



-Anders


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Aureal issues on resume
@ 2011-09-02 15:05 Clemens Ladisch
  2011-09-02 23:41 ` Raymond Yau
  0 siblings, 1 reply; 13+ messages in thread
From: Clemens Ladisch @ 2011-09-02 15:05 UTC (permalink / raw)
  To: Anders Eriksson, Raymond Yau; +Cc: alsa-devel, linux-kernel

(added recipients)

-------- Original Message --------
Subject: Aureal issues on resume
Date: Fri, 02 Sep 2011 13:41:42 +0200
From: Anders Eriksson <aeriksson@fastmail.fm>
To: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org


Hi, upon resuming from hibernation, I see this in my log:

Sep  2 11:15:20 tippex kernel: [72436.287020] vortex_adb_addroutes: unending route! 0x10
Sep  2 11:15:20 tippex kernel: [72436.287127] vortex_adb_addroutes: unending route! 0x838
Sep  2 11:15:20 tippex kernel: [72436.287277] vortex_adb_addroutes: unending route! 0x11
Sep  2 11:15:20 tippex kernel: [72436.287418] vortex_adb_addroutes: unending route! 0x8b9
Sep  2 11:15:20 tippex kernel: [72436.292037] Vortex: vortex_fifo_setadbctrl fail
Sep  2 11:15:55 tippex kernel: [72471.403490] vortex_adb_delroutes: route not found! 0x10
Sep  2 11:15:55 tippex kernel: [72471.403596] vortex_adb_delroutes: route not found! 0x838
Sep  2 11:15:55 tippex kernel: [72471.403710] vortex_adb_delroutes: route not found! 0x11
Sep  2 11:15:55 tippex kernel: [72471.403811] vortex_adb_delroutes: route not found! 0x8b9

And the sound is no more. I need to reboot to get it back.

If memory serves, it's been there since 2.6.30 or so. Any ideas what can be 
triggering it?

lspci says it's an 
00:04.0 Multimedia audio controller: Aureal Semiconductor Vortex 1 (rev 02)
        Subsystem: Diamond Multimedia Systems Sonic Impact A3D
        Flags: bus master, medium devsel, latency 64, IRQ 11
        Memory at 50000000 (32-bit, non-prefetchable) [size=128K]
        I/O ports at 10b0 [size=8]
        I/O ports at 10b8 [size=8]
        Capabilities: [dc] Power Management version 1
        Kernel driver in use: snd_au8820
        Kernel modules: snd-au8820


-Anders

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Aureal issues on resume
  2011-09-02 15:05 Aureal issues on resume Clemens Ladisch
@ 2011-09-02 23:41 ` Raymond Yau
  2011-09-04 20:32   ` Clemens Ladisch
  0 siblings, 1 reply; 13+ messages in thread
From: Raymond Yau @ 2011-09-02 23:41 UTC (permalink / raw)
  To: ALSA Development Mailing List, clemens

2011/9/2 Clemens Ladisch <clemens@ladisch.de>:
> (added recipients)
>
> -------- Original Message --------
> Subject: Aureal issues on resume
> Date: Fri, 02 Sep 2011 13:41:42 +0200
> From: Anders Eriksson <aeriksson@fastmail.fm>
> To: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org
>
>
> Hi, upon resuming from hibernation, I see this in my log:
>
> Sep  2 11:15:20 tippex kernel: [72436.287020] vortex_adb_addroutes: unending route! 0x10
> Sep  2 11:15:20 tippex kernel: [72436.287127] vortex_adb_addroutes: unending route! 0x838
> Sep  2 11:15:20 tippex kernel: [72436.287277] vortex_adb_addroutes: unending route! 0x11
> Sep  2 11:15:20 tippex kernel: [72436.287418] vortex_adb_addroutes: unending route! 0x8b9
> Sep  2 11:15:20 tippex kernel: [72436.292037] Vortex: vortex_fifo_setadbctrl fail
> Sep  2 11:15:55 tippex kernel: [72471.403490] vortex_adb_delroutes: route not found! 0x10
> Sep  2 11:15:55 tippex kernel: [72471.403596] vortex_adb_delroutes: route not found! 0x838
> Sep  2 11:15:55 tippex kernel: [72471.403710] vortex_adb_delroutes: route not found! 0x11
> Sep  2 11:15:55 tippex kernel: [72471.403811] vortex_adb_delroutes: route not found! 0x8b9
>
> And the sound is no more. I need to reboot to get it back.
>
> If memory serves, it's been there since 2.6.30 or so. Any ideas what can be
> triggering it?
>
> lspci says it's an
> 00:04.0 Multimedia audio controller: Aureal Semiconductor Vortex 1 (rev 02)
>        Subsystem: Diamond Multimedia Systems Sonic Impact A3D
>        Flags: bus master, medium devsel, latency 64, IRQ 11
>        Memory at 50000000 (32-bit, non-prefetchable) [size=128K]
>        I/O ports at 10b0 [size=8]
>        I/O ports at 10b8 [size=8]
>        Capabilities: [dc] Power Management version 1
>        Kernel driver in use: snd_au8820
>        Kernel modules: snd-au8820
>
>
> -Anders
>

Those alsa au88x0 drivers does not support suspend/resume

As each audio stream is assigned different resources (e.g. SRC, mixer
, ...) dynamically and the cards can play 16 mono streams or 8 stereo
streams.

The possible way is to save the contents of 128K memory mapped I/O
ports before suspend to non-volatile memory and restore them after
resume

Is there any way for alsa driver to allocate non-volatile memory ?
au8830 has 256 K mmio

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Aureal issues on resume
  2011-09-02 23:41 ` Raymond Yau
@ 2011-09-04 20:32   ` Clemens Ladisch
  2011-09-12  7:53     ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Clemens Ladisch @ 2011-09-04 20:32 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

Raymond Yau wrote:
> The possible way is to save the contents of 128K memory mapped I/O
> ports before suspend to non-volatile memory and restore them after
> resume
>
> Is there any way for alsa driver to allocate non-volatile memory ?

'Normal' memory is saved over suspend.  Just use {k|v}malloc.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Aureal issues on resume
  2011-09-04 20:32   ` Clemens Ladisch
@ 2011-09-12  7:53     ` Takashi Iwai
  2011-09-12 11:54       ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2011-09-12  7:53 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: Raymond Yau, ALSA Development Mailing List

At Sun, 04 Sep 2011 22:32:44 +0200,
Clemens Ladisch wrote:
> 
> Raymond Yau wrote:
> > The possible way is to save the contents of 128K memory mapped I/O
> > ports before suspend to non-volatile memory and restore them after
> > resume
> >
> > Is there any way for alsa driver to allocate non-volatile memory ?
> 
> 'Normal' memory is saved over suspend.  Just use {k|v}malloc.

If it's a 128kB bulk memory, vmalloc() is a more sensible choice.


Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Aureal issues on resume
  2011-09-12  7:53     ` Takashi Iwai
@ 2011-09-12 11:54       ` Takashi Iwai
  2011-09-16  2:16         ` Raymond Yau
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2011-09-12 11:54 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List, Clemens Ladisch

At Mon, 12 Sep 2011 09:53:28 +0200,
Takashi Iwai wrote:
> 
> At Sun, 04 Sep 2011 22:32:44 +0200,
> Clemens Ladisch wrote:
> > 
> > Raymond Yau wrote:
> > > The possible way is to save the contents of 128K memory mapped I/O
> > > ports before suspend to non-volatile memory and restore them after
> > > resume
> > >
> > > Is there any way for alsa driver to allocate non-volatile memory ?
> > 
> > 'Normal' memory is saved over suspend.  Just use {k|v}malloc.
> 
> If it's a 128kB bulk memory, vmalloc() is a more sensible choice.

BTW, in many cases, you don't have to save/restore the whole mmio
region.  Instead, stop the stream, save / restore some important
registers and do the similar procedure for the normal prepare callback
in the resume, and restart the stream again.


Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Aureal issues on resume
  2011-09-12 11:54       ` Takashi Iwai
@ 2011-09-16  2:16         ` Raymond Yau
  2011-09-16  6:19           ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Raymond Yau @ 2011-09-16  2:16 UTC (permalink / raw)
  To: Takashi Iwai, ALSA Development Mailing List

2011/9/12 Takashi Iwai <tiwai@suse.de>:
> At Mon, 12 Sep 2011 09:53:28 +0200,
> Takashi Iwai wrote:
>>
>> At Sun, 04 Sep 2011 22:32:44 +0200,
>> Clemens Ladisch wrote:
>> >
>> > Raymond Yau wrote:
>> > > The possible way is to save the contents of 128K memory mapped I/O
>> > > ports before suspend to non-volatile memory and restore them after
>> > > resume
>> > >
>> > > Is there any way for alsa driver to allocate non-volatile memory ?
>> >
>> > 'Normal' memory is saved over suspend.  Just use {k|v}malloc.
>>
>> If it's a 128kB bulk memory, vmalloc() is a more sensible choice.
>
> BTW, in many cases, you don't have to save/restore the whole mmio
> region.  Instead, stop the stream, save / restore some important
> registers and do the similar procedure for the normal prepare callback
> in the resume, and restart the stream again.
>
>
> Takashi
>

The current au8830 alsa driver seem use less than 192Kbytes out of
256Kbytes mmio

http://thread.gmane.org/gmane.linux.kernel/564963/focus=47907

your patch seem initialse the request queue in figure 16 of pat 6167465

and the driver need to restore mixer and equalizer mmio for au8830 in figure 13


04:02.0 Multimedia audio controller: Aureal Semiconductor Vortex 2 (rev fe)
	Subsystem: Aureal Semiconductor AU8830 Vortex 3D Digital Audio Processor
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 64 (1000ns min, 3000ns max), Cache Line Size: 32 bytes
	Interrupt: pin A routed to IRQ 23
	Region 0: Memory at ff7c0000 (32-bit, non-prefetchable) [size=256K]
	Region 1: I/O ports at bc00 [size=8]
	Region 2: I/O ports at b880 [size=8]
	Capabilities: [dc] Power Management version 1
		Flags: PMEClk- DSI+ D1- D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: au8830
	Kernel modules: snd-au8830

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Aureal issues on resume
  2011-09-16  2:16         ` Raymond Yau
@ 2011-09-16  6:19           ` Takashi Iwai
  2011-09-17  2:16             ` Raymond Yau
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2011-09-16  6:19 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

At Fri, 16 Sep 2011 10:16:11 +0800,
Raymond Yau wrote:
> 
> 2011/9/12 Takashi Iwai <tiwai@suse.de>:
> > At Mon, 12 Sep 2011 09:53:28 +0200,
> > Takashi Iwai wrote:
> >>
> >> At Sun, 04 Sep 2011 22:32:44 +0200,
> >> Clemens Ladisch wrote:
> >> >
> >> > Raymond Yau wrote:
> >> > > The possible way is to save the contents of 128K memory mapped I/O
> >> > > ports before suspend to non-volatile memory and restore them after
> >> > > resume
> >> > >
> >> > > Is there any way for alsa driver to allocate non-volatile memory ?
> >> >
> >> > 'Normal' memory is saved over suspend.  Just use {k|v}malloc.
> >>
> >> If it's a 128kB bulk memory, vmalloc() is a more sensible choice.
> >
> > BTW, in many cases, you don't have to save/restore the whole mmio
> > region.  Instead, stop the stream, save / restore some important
> > registers and do the similar procedure for the normal prepare callback
> > in the resume, and restart the stream again.
> >
> >
> > Takashi
> >
> 
> The current au8830 alsa driver seem use less than 192Kbytes out of
> 256Kbytes mmio
> 
> http://thread.gmane.org/gmane.linux.kernel/564963/focus=47907
> 
> your patch seem initialse the request queue in figure 16 of pat 6167465
> 
> and the driver need to restore mixer and equalizer mmio for au8830 in figure 13

Yeah, that's what I mentioned in the thread.

Basically you'll need to restore the values assigned in hw_params()
for PCM.

The mixer is ac97, so it's restored by ac97_codec.c.  The rest are the
equalizer and a3d values to be restored separately.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Aureal issues on resume
  2011-09-16  6:19           ` Takashi Iwai
@ 2011-09-17  2:16             ` Raymond Yau
  2011-09-20  7:09               ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Raymond Yau @ 2011-09-17  2:16 UTC (permalink / raw)
  To: Takashi Iwai, ALSA Development Mailing List

2011/9/16 Takashi Iwai <tiwai@suse.de>:
> At Fri, 16 Sep 2011 10:16:11 +0800,
> Raymond Yau wrote:
>>
>> 2011/9/12 Takashi Iwai <tiwai@suse.de>:
>> > At Mon, 12 Sep 2011 09:53:28 +0200,
>> > Takashi Iwai wrote:
>> >>
>> >> At Sun, 04 Sep 2011 22:32:44 +0200,
>> >> Clemens Ladisch wrote:
>> >> >
>> >> > Raymond Yau wrote:
>> >> > > The possible way is to save the contents of 128K memory mapped I/O
>> >> > > ports before suspend to non-volatile memory and restore them after
>> >> > > resume
>> >> > >
>> >> > > Is there any way for alsa driver to allocate non-volatile memory ?
>> >> >
>> >> > 'Normal' memory is saved over suspend.  Just use {k|v}malloc.
>> >>
>> >> If it's a 128kB bulk memory, vmalloc() is a more sensible choice.
>> >
>> > BTW, in many cases, you don't have to save/restore the whole mmio
>> > region.  Instead, stop the stream, save / restore some important
>> > registers and do the similar procedure for the normal prepare callback
>> > in the resume, and restart the stream again.
>> >
>> >
>> > Takashi
>> >
>>
>> The current au8830 alsa driver seem use less than 192Kbytes out of
>> 256Kbytes mmio
>>
>> http://thread.gmane.org/gmane.linux.kernel/564963/focus=47907
>>
>> your patch seem initialse the request queue in figure 16 of pat 6167465
>>
>> and the driver need to restore mixer and equalizer mmio for au8830 in figure 13
>
> Yeah, that's what I mentioned in the thread.
>
> Basically you'll need to restore the values assigned in hw_params()
> for PCM.
>

The error messages are due to snd_vortex_suspend() call snd_vortex_adb_init()

There are static routes for the codec, mixin, mixout and equalizer and
dynamic routes of playback/capture streams

Those VORTEX_ADB_RTBASE and VORTEX_ADB_CHNBASE mmio ports are two
linked list, those vortex_route_* function are adding the routes to
the tail of those linked lists

so the only is to restore the routes since the driver does not keep
track of the order of routes of the playback stream  or capture stream
to the linked list

> The mixer is ac97, so it's restored by ac97_codec.c.  The rest are the
> equalizer and a3d values to be restored separately.

I mean the hardware mixer (mixin and mixout) inside au88x0 chip.

May be need to initialise mpu401_uart or joystick


Is there any way to force the system to suspend, it seem that gnome
power management in Fedora 10 does not provide any way to suspend
while playing an audio ? ( screen saver set to 1 minutes, put the
computer into sleep when inactive for 2 minutes )

Ubuntu 10.04 Live CD , you can force the system to suspend

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Aureal issues on resume
  2011-09-17  2:16             ` Raymond Yau
@ 2011-09-20  7:09               ` Takashi Iwai
  2011-10-20  9:42                 ` Raymond Yau
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2011-09-20  7:09 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

At Sat, 17 Sep 2011 10:16:19 +0800,
Raymond Yau wrote:
> 
> 2011/9/16 Takashi Iwai <tiwai@suse.de>:
> > At Fri, 16 Sep 2011 10:16:11 +0800,
> > Raymond Yau wrote:
> >>
> >> 2011/9/12 Takashi Iwai <tiwai@suse.de>:
> >> > At Mon, 12 Sep 2011 09:53:28 +0200,
> >> > Takashi Iwai wrote:
> >> >>
> >> >> At Sun, 04 Sep 2011 22:32:44 +0200,
> >> >> Clemens Ladisch wrote:
> >> >> >
> >> >> > Raymond Yau wrote:
> >> >> > > The possible way is to save the contents of 128K memory mapped I/O
> >> >> > > ports before suspend to non-volatile memory and restore them after
> >> >> > > resume
> >> >> > >
> >> >> > > Is there any way for alsa driver to allocate non-volatile memory ?
> >> >> >
> >> >> > 'Normal' memory is saved over suspend.  Just use {k|v}malloc.
> >> >>
> >> >> If it's a 128kB bulk memory, vmalloc() is a more sensible choice.
> >> >
> >> > BTW, in many cases, you don't have to save/restore the whole mmio
> >> > region.  Instead, stop the stream, save / restore some important
> >> > registers and do the similar procedure for the normal prepare callback
> >> > in the resume, and restart the stream again.
> >> >
> >> >
> >> > Takashi
> >> >
> >>
> >> The current au8830 alsa driver seem use less than 192Kbytes out of
> >> 256Kbytes mmio
> >>
> >> http://thread.gmane.org/gmane.linux.kernel/564963/focus=47907
> >>
> >> your patch seem initialse the request queue in figure 16 of pat 6167465
> >>
> >> and the driver need to restore mixer and equalizer mmio for au8830 in figure 13
> >
> > Yeah, that's what I mentioned in the thread.
> >
> > Basically you'll need to restore the values assigned in hw_params()
> > for PCM.
> >
> 
> The error messages are due to snd_vortex_suspend() call snd_vortex_adb_init()
> 
> There are static routes for the codec, mixin, mixout and equalizer and
> dynamic routes of playback/capture streams
> 
> Those VORTEX_ADB_RTBASE and VORTEX_ADB_CHNBASE mmio ports are two
> linked list, those vortex_route_* function are adding the routes to
> the tail of those linked lists
> 
> so the only is to restore the routes since the driver does not keep
> track of the order of routes of the playback stream  or capture stream
> to the linked list
> 
> > The mixer is ac97, so it's restored by ac97_codec.c.  The rest are the
> > equalizer and a3d values to be restored separately.
> 
> I mean the hardware mixer (mixin and mixout) inside au88x0 chip.
> 
> May be need to initialise mpu401_uart or joystick
> 
> 
> Is there any way to force the system to suspend, it seem that gnome
> power management in Fedora 10 does not provide any way to suspend
> while playing an audio ? ( screen saver set to 1 minutes, put the
> computer into sleep when inactive for 2 minutes )

See files in Documentation/power directory.
You may call s2ram, powersave, or whatever command directly, too.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Aureal issues on resume
  2011-09-20  7:09               ` Takashi Iwai
@ 2011-10-20  9:42                 ` Raymond Yau
  2011-10-27 16:24                   ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Raymond Yau @ 2011-10-20  9:42 UTC (permalink / raw)
  To: Takashi Iwai, ALSA Development Mailing List, Gert Robben,
	Manuel Jander, Alien <alien9>

[-- Attachment #1: Type: text/plain, Size: 4214 bytes --]

2011/9/20 Takashi Iwai <tiwai@suse.de>:
> At Sat, 17 Sep 2011 10:16:19 +0800,
> Raymond Yau wrote:
>>
>> 2011/9/16 Takashi Iwai <tiwai@suse.de>:
>> > At Fri, 16 Sep 2011 10:16:11 +0800,
>> > Raymond Yau wrote:
>> >>
>> >> 2011/9/12 Takashi Iwai <tiwai@suse.de>:
>> >> > At Mon, 12 Sep 2011 09:53:28 +0200,
>> >> > Takashi Iwai wrote:
>> >> >>
>> >> >> At Sun, 04 Sep 2011 22:32:44 +0200,
>> >> >> Clemens Ladisch wrote:
>> >> >> >
>> >> >> > Raymond Yau wrote:
>> >> >> > > The possible way is to save the contents of 128K memory mapped I/O
>> >> >> > > ports before suspend to non-volatile memory and restore them after
>> >> >> > > resume
>> >> >> > >
>> >> >> > > Is there any way for alsa driver to allocate non-volatile memory ?
>> >> >> >
>> >> >> > 'Normal' memory is saved over suspend.  Just use {k|v}malloc.
>> >> >>
>> >> >> If it's a 128kB bulk memory, vmalloc() is a more sensible choice.
>> >> >
>> >> > BTW, in many cases, you don't have to save/restore the whole mmio
>> >> > region.  Instead, stop the stream, save / restore some important
>> >> > registers and do the similar procedure for the normal prepare callback
>> >> > in the resume, and restart the stream again.
>> >> >
>> >> >
>> >> > Takashi
>> >> >
>> >>
>> >> The current au8830 alsa driver seem use less than 192Kbytes out of
>> >> 256Kbytes mmio
>> >>
>> >> http://thread.gmane.org/gmane.linux.kernel/564963/focus=47907
>> >>
>> >> your patch seem initialse the request queue in figure 16 of pat 6167465
>> >>
>> >> and the driver need to restore mixer and equalizer mmio for au8830 in figure 13
>> >
>> > Yeah, that's what I mentioned in the thread.
>> >
>> > Basically you'll need to restore the values assigned in hw_params()
>> > for PCM.
>> >
>>
>> The error messages are due to snd_vortex_suspend() call snd_vortex_adb_init()
>>
>> There are static routes for the codec, mixin, mixout and equalizer and
>> dynamic routes of playback/capture streams
>>
>> Those VORTEX_ADB_RTBASE and VORTEX_ADB_CHNBASE mmio ports are two
>> linked list, those vortex_route_* function are adding the routes to
>> the tail of those linked lists
>>
>> so the only is to restore the routes since the driver does not keep
>> track of the order of routes of the playback stream  or capture stream
>> to the linked list
>>
>> > The mixer is ac97, so it's restored by ac97_codec.c.  The rest are the
>> > equalizer and a3d values to be restored separately.
>>
>> I mean the hardware mixer (mixin and mixout) inside au88x0 chip.
>>
>> May be need to initialise mpu401_uart or joystick
>>
>>
>> Is there any way to force the system to suspend, it seem that gnome
>> power management in Fedora 10 does not provide any way to suspend
>> while playing an audio ? ( screen saver set to 1 minutes, put the
>> computer into sleep when inactive for 2 minutes )
>
> See files in Documentation/power directory.
> You may call s2ram, powersave, or whatever command directly, too.
>
>
> Takashi
>


1)Make sure that your computer can suspend and resume normally without
au88x0 sound card
2)Backup all your important data before you try the patch with your
au88x0 sound card
3)Only tested with au8830 , so it may need some modification for
au8820 and au8810

my au8830 ,with two streams playing at different sampling rate at the
same time, can suspend with the following script and resume as
expected by pressing power button with the attached patch

sync
echo 1 > /sys/power/pm_trace
echo mem > /sys/power/state


It is strange that it can resume without uncomment those SNDRV_PCM_INFO_RESUME
in au88x0_pcm.c

static struct snd_pcm_hardware snd_vortex_playback_hw_adb = {
	.info =
	    (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */
	     SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED |



ALSA au88x0.c:131: vortex suspending...
snd_au8830 0000:04:02.0: PCI INT A disabled
vortex suspended
...

ALSA au88x0.c:248: vortex resuming...
snd_au8830 0000:04:02.0: restoring config space at offset 0x1 (was
0x2900007, writing 0x2900003)
snd_au8830 0000:04:02.0: PCI INT A -> GSI 23 (level, low) -> IRQ 23
ALSA au88x0.c:350: vortex resumed

[-- Attachment #2: au88x0_suspend_resume.patch --]
[-- Type: application/octet-stream, Size: 11162 bytes --]

diff --git a/sound/pci/au88x0/au8810.h b/sound/pci/au88x0/au8810.h
index 79fbee3..98721bc 100644
--- a/sound/pci/au88x0/au8810.h
+++ b/sound/pci/au88x0/au8810.h
@@ -188,6 +188,7 @@
 
 /* Sample timer */
 #define VORTEX_SMP_TIME		0x29198
+#define VORTEX_SMP_TIMER	0x2919c
 
 #define VORTEX_MODEM_CTRL	0x291ac
 
diff --git a/sound/pci/au88x0/au8820.h b/sound/pci/au88x0/au8820.h
index cafdb96..471b074 100644
--- a/sound/pci/au88x0/au8820.h
+++ b/sound/pci/au88x0/au8820.h
@@ -14,6 +14,8 @@
 #define CARD_NAME "Aureal Vortex"
 #define CARD_NAME_SHORT "au8820"
 
+#define NR_WT_BANK 1
+
 /* Number of ADB and WT channels */
 #define NR_ADB		0x10
 #define NR_WT		0x20
@@ -171,6 +173,7 @@
 
 /* Sample timer */
 #define VORTEX_SMP_TIME 0x11998
+#define VORTEX_SMP_TIMER 0x1199c
 
 /* IRQ */
 #define VORTEX_IRQ_SOURCE 0x12800	/* Interrupt source flags. */
diff --git a/sound/pci/au88x0/au8830.h b/sound/pci/au88x0/au8830.h
index 999b29a..3ca2e6f 100644
--- a/sound/pci/au88x0/au8830.h
+++ b/sound/pci/au88x0/au8830.h
@@ -14,6 +14,8 @@
 #define CARD_NAME "Aureal Vortex 2"
 #define CARD_NAME_SHORT "au8830"
 
+#define NR_WT_BANK 2
+
 #define NR_ADB 0x20
 #define NR_SRC 0x10
 #define NR_A3D 0x10
@@ -52,6 +54,8 @@
 #define VORTEX_ENGINE_CTRL 0x27ae8
 #define 	ENGINE_INIT 0x1380000
 
+#define VORTEX_DMA_ADBREQQUE 0x27afc
+
 /* WTDMA */
 #define VORTEX_WTDMA_CTRL 0x27900	/* format, DMA pos */
 #define VORTEX_WTDMA_STAT 0x27d00	/* DMA subbuf, DMA pos */
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index a384699..d02ee7c 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -117,6 +117,241 @@ static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix)
 	pci_dev_put(via);
 }
 
+/*
+ * Power management code
+ */
+#ifdef CONFIG_PM
+static int snd_vortex_suspend(struct pci_dev *pci, pm_message_t state)
+{
+	struct snd_card *card = pci_get_drvdata(pci);
+	struct snd_vortex *chip = card->private_data;
+	int i;
+	u32 addr, value;
+
+        snd_printdd("vortex suspending...\n");
+	snd_pcm_suspend_all(chip->pcm[VORTEX_PCM_ADB]);
+#ifdef CHIP_AU8830
+	snd_pcm_suspend_all(chip->pcm[VORTEX_PCM_SPDIF]);
+	snd_pcm_suspend_all(chip->pcm[VORTEX_PCM_A3D]);
+#endif
+#ifndef CHIP_AU8810
+	snd_pcm_suspend_all(chip->pcm[VORTEX_PCM_WT]);
+#endif
+	vortex_disable_timer_int(chip);
+
+	chip->apm.smp_time = hwread(chip->mmio, VORTEX_SMP_TIME);
+	chip->apm.irq_ctrl = hwread(chip->mmio, VORTEX_IRQ_CTRL);
+	chip->apm.ctrl = hwread(chip->mmio, VORTEX_CTRL);
+	chip->apm.srcblock_sr = hwread(chip->mmio, VORTEX_SRCBLOCK_SR);
+        chip->apm.mixer_sr = hwread(chip->mmio, VORTEX_MIXER_SR);
+	chip->apm.adb_sr = hwread(chip->mmio, VORTEX_ADB_SR);
+	hwwrite(chip->mmio, VORTEX_IRQ_CTRL, 0);
+
+	chip->apm.irq_source = hwread(chip->mmio, VORTEX_IRQ_SOURCE);
+	hwwrite(chip->mmio, VORTEX_IRQ_SOURCE, 0x0000ffff);
+
+        hwwrite(chip->mmio, VORTEX_ADB_SR, 0);
+        hwwrite(chip->mmio, VORTEX_SRCBLOCK_SR, 0);
+	hwwrite(chip->mmio, VORTEX_MIXER_SR, 0);
+
+	hwwrite(chip->mmio, VORTEX_CTRL, chip->apm.ctrl & 0xffff7fff);
+	msleep(0x493);	/* 0x493e0 */
+#ifndef CHIP_AU8810
+	for (i = 0; i < NR_WT_BANK; i++) {
+		hwwrite(chip->mmio, WT_CTRL(i), 
+			(hwread(chip->mmio, WT_CTRL(i)) &  0xfffffff0));
+	};
+#endif
+#ifdef CHIP_AU8820
+	for (addr=0; addr < 0x20000; addr+=4) {
+#else
+	for (addr=0; addr < 0x2b800; addr+=4) {
+#endif
+		switch (addr){
+#ifndef CHIP_AU8820
+		case 0x291b0:
+		case 0x291b4:
+		case 0x291b8:
+		case 0x291bc:
+		case 0x291c0:
+		case 0x291c4:
+		case 0x291c8:
+		case 0x291cc:
+			break;
+#endif
+		default:
+			chip->apm.mmio[addr >> 2] = hwread(chip->mmio, addr);
+			break;
+		}
+	};
+#ifndef CHIP_AU8810
+	for (i = 0; i < NR_WT; i++) {
+		hwwrite(chip->mmio, (VORTEX_FIFO_WTCTRL+(i << 2)), 0x2020);
+	};
+#endif
+	for (i = 0; i < NR_ADB; i++) {
+		hwwrite(chip->mmio, (VORTEX_FIFO_ADBCTRL+(i << 2)), 0x2020);
+	};
+
+	hwwrite(chip->mmio, VORTEX_IRQ_SOURCE, 0x00007fff);
+	msleep(0xc3);	/*  0xc350 */
+
+	value = hwread(chip->mmio, VORTEX_ENGINE_CTRL);
+        if ((((value >> 8) & 1) != 0 ) || (((value >> 0x10) & 1) != 0)) 
+	 	printk(KERN_INFO "SaveApm : Error 1\n");
+	for (i=0; i < 4; i++) {
+		hwread(chip->mmio, 0x27aec + (i << 2));
+	};
+#ifdef CHIP_AU8830
+	if ((hwread(chip->mmio, VORTEX_DMA_ADBREQQUE) & 0x00400801) != 0)
+		printk(KERN_INFO "SaveApm : Error 3\n");
+#endif	
+#ifndef CHIP_AU8810
+	for (i = 0; i < NR_WT; i++) {
+		if ((hwread(chip->mmio, VORTEX_FIFO_WTDATA + (i << 2)) & 1) != 0)
+			printk(KERN_INFO "SaveApm : Error 5( IN LOOP!)\n");
+	};
+	for (i = 0; i < NR_WT_BANK; i++) {
+		if ((hwread(chip->mmio, WT_CTRL(i)) & 1) == 0)
+			printk(KERN_ERR "SaveAPM : ERROR!\n");
+	};
+#endif
+	msleep(0x13);	/* 0x1388 */
+	hwread(chip->mmio, VORTEX_SMP_TIMER);
+	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	snd_ac97_suspend(chip->codec);
+	pci_disable_device(pci);
+	pci_save_state(pci);
+        printk(KERN_INFO "vortex suspended\n");
+	return 0;
+}
+
+#define restore_mmio(c, a) hwwrite(c->mmio, a, c->apm.mmio[a >> 2])
+
+#define restore_mmios(chip, start_addr, end_addr) \
+{ \
+	for (addr = start_addr; addr <= end_addr; addr+=4) { \
+		restore_mmio(chip,addr); \
+	} \
+}
+
+static int snd_vortex_resume(struct pci_dev *pci)
+{
+	u32 addr, value;
+#ifndef CHIP_AU8810
+        int sleep_time;
+#endif
+	int i;
+	struct snd_card *card = pci_get_drvdata(pci);
+	struct snd_vortex *chip = card->private_data;
+
+        snd_printdd("vortex resuming...\n");
+	pci_set_power_state(pci, PCI_D0);
+	pci_restore_state(pci);
+	if (pci_enable_device(pci) < 0) {
+		printk(KERN_ERR "au88x0: pci_enable_device failed, "
+		       "disabling device\n");
+		snd_card_disconnect(card);
+		return -EIO;
+	}
+	pci_set_master(pci);
+
+	hwwrite(chip->mmio, VORTEX_CTRL, 0xffffffff);
+	msleep(5);
+	hwwrite(chip->mmio, VORTEX_CTRL, hwread(chip->mmio, VORTEX_CTRL) & 0xffdfffff);
+	msleep(5);
+	vortex_codec_init(chip);
+#ifndef CHIP_AU8820
+	restore_mmios(chip, 0, 0x21ffc);
+	restore_mmio(chip, VORTEX_SPDIF_FLAGS);
+	restore_mmios(chip, 0x24000, 0x287fc);
+	hwwrite(chip->mmio, VORTEX_ENGINE_CTRL,
+		(hwread(chip->mmio, VORTEX_ENGINE_CTRL) | 0x80000000));
+	
+	restore_mmios(chip, 0x29800, 0x29ffc);
+	restore_mmio(chip, VORTEX_STAT);
+//      restore_mmio(chip, 0x2a804);           /* SUBSYSTEM ID */
+#ifdef CHIP_AU8830
+	restore_mmios(chip, VORTEX_EQ_BASE, 0x2b43c);
+	hwwrite(chip->mmio, VORTEX_EQ_CTRL, 
+		(chip->apm.mmio[VORTEX_EQ_CTRL >> 2] & 0xfffff7ff));
+	hwwrite(chip->mmio, VORTEX_EQ_CTRL, 
+		(chip->apm.mmio[VORTEX_EQ_CTRL >> 2] & 0xfffff7ff));
+	restore_mmios(chip, VORTEX_EQ_CTRL, 0x2b7f8);
+#endif
+#endif        
+#ifndef CHIP_AU8810
+	for (i = 0; i < NR_WT; i++) {
+		addr = VORTEX_FIFO_WTCTRL + (i << 2);
+		value = chip->apm.mmio[addr >>2];
+		if (((value >> 4) & 0x1) == 0) {
+			hwwrite(chip->mmio, addr, 0x00002020);
+		}
+		else {
+			value &= 0x003fffff;
+			hwwrite(chip->mmio, addr, value);
+		};
+	}
+#endif
+	for (i = 0; i < NR_ADB; i++) {
+		addr = VORTEX_FIFO_ADBCTRL + (i << 2);
+		value = chip->apm.mmio[addr >> 2];
+		if (((value >> 4) & 1) == 0) {
+			hwwrite(chip->mmio, addr, 0x00042020); 
+		}
+		else {
+			value &= 0x003fffff;
+			hwwrite(chip->mmio, addr, value); 
+		};
+	};
+
+	hwwrite(chip->mmio, VORTEX_CTRL2, chip->apm.mmio[VORTEX_CTRL2 >> 2]);
+	hwread(chip->mmio, VORTEX_CTRL2);
+#ifndef CHIP_AU8810
+	for (i = 0; i < NR_WT_BANK; i++) {
+		addr = WT_CTRL(i);
+		value = hwread(chip->mmio, addr);
+		value &= 0xfffffffe;
+		hwwrite(chip->mmio, addr, value);
+	};
+#endif
+/* Disable Timer */
+
+	hwwrite(chip->mmio, VORTEX_SMP_TIMER, 0);
+	hwread(chip->mmio, VORTEX_SMP_TIMER);
+
+	hwwrite(chip->mmio, VORTEX_SMP_TIMER, 0x1e0);	
+
+	hwwrite(chip->mmio, VORTEX_ADB_SR, chip->apm.adb_sr);
+	hwwrite(chip->mmio, VORTEX_SRCBLOCK_SR, chip->apm.srcblock_sr);
+	hwwrite(chip->mmio, VORTEX_MIXER_SR, chip->apm.mixer_sr);
+#ifndef CHIP_AU8810
+	sleep_time = 0x27;  /* 0x2710 */
+	for (i = 0; i < NR_WT_BANK; i++) {
+		addr = WT_CTRL(i);
+		hwwrite(chip->mmio, addr, 1);
+		msleep(sleep_time);
+		hwwrite(chip->mmio, addr, 0);
+		msleep(sleep_time);
+		hwwrite(chip->mmio, addr, 1);
+		msleep(sleep_time);
+		hwwrite(chip->mmio, addr, 0);	
+		msleep(sleep_time);
+		hwwrite(chip->mmio, addr, 1);
+		msleep(sleep_time);
+	};
+#endif
+	hwwrite(chip->mmio, VORTEX_IRQ_SOURCE, chip->apm.irq_source);
+	hwwrite(chip->mmio, VORTEX_IRQ_CTRL, chip->apm.irq_ctrl);
+	hwwrite(chip->mmio, VORTEX_CTRL, chip->apm.ctrl);
+	vortex_enable_int(chip);
+	snd_ac97_resume(chip->codec);
+	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+        snd_printdd("vortex resumed\n");
+	return 0;
+}
+#endif /* CONFIG_PM */
+
 // component-destructor
 // (see "Management of Cards and Components")
 static int snd_vortex_dev_free(struct snd_device *device)
@@ -164,8 +399,6 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
 		return -ENOMEM;
 	}
 
-	chip->card = card;
-
 	// initialize the stuff
 	chip->pci_dev = pci;
 	chip->io = pci_resource_start(pci, 0);
@@ -259,6 +492,7 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
 		snd_card_free(card);
 		return err;
 	}
+	card->private_data = chip;
 	snd_vortex_workaround(pci, pcifix[dev]);
 
 	// Card details needed in snd_vortex_midi
@@ -379,6 +613,10 @@ static struct pci_driver driver = {
 	.id_table = snd_vortex_ids,
 	.probe = snd_vortex_probe,
 	.remove = __devexit_p(snd_vortex_remove),
+#ifdef CONFIG_PM
+	.suspend = snd_vortex_suspend,
+	.resume = snd_vortex_resume,
+#endif
 };
 
 // initialization of the module
diff --git a/sound/pci/au88x0/au88x0.h b/sound/pci/au88x0/au88x0.h
index 02f6e08..e983e68 100644
--- a/sound/pci/au88x0/au88x0.h
+++ b/sound/pci/au88x0/au88x0.h
@@ -184,6 +184,25 @@ struct snd_vortex {
 	u16 vendor;
 	u16 device;
 	u8 rev;
+#if CONFIG_PM
+	struct {
+		u32	adb_sr;
+		u32	ctrl;
+		u32     ctrl2;
+		u32     engine_ctrl;
+		u32	irq_ctrl;
+		u32	irq_source;
+		u32	mixer_sr;
+		u32     smp_time;
+		u32	srcblock_sr;
+#ifdef CHIP_AU8820
+		u32	mmio[0x8000];
+#else
+		u32	mmio[0x10000];
+#endif
+	} apm; 
+#endif
+
 };
 
 /* Functions. */
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
index 4891503..6e52593 100644
--- a/sound/pci/au88x0/au88x0_core.c
+++ b/sound/pci/au88x0/au88x0_core.c
@@ -2370,20 +2370,18 @@ static void vortex_settimer(vortex_t * vortex, int period)
 	hwwrite(vortex->mmio, VORTEX_IRQ_STAT, period);
 }
 
-#if 0
-static void vortex_enable_timer_int(vortex_t * card)
+static void vortex_enable_timer_int(vortex_t * vortex)
 {
-	hwwrite(card->mmio, VORTEX_IRQ_CTRL,
-		hwread(card->mmio, VORTEX_IRQ_CTRL) | IRQ_TIMER | 0x60);
+	hwwrite(vortex->mmio, VORTEX_IRQ_CTRL,
+		hwread(vortex->mmio, VORTEX_IRQ_CTRL) | IRQ_TIMER | 0x60);
 }
 
-static void vortex_disable_timer_int(vortex_t * card)
+static void vortex_disable_timer_int(vortex_t * vortex)
 {
-	hwwrite(card->mmio, VORTEX_IRQ_CTRL,
-		hwread(card->mmio, VORTEX_IRQ_CTRL) & ~IRQ_TIMER);
+	hwwrite(vortex->mmio, VORTEX_IRQ_CTRL,
+		hwread(vortex->mmio, VORTEX_IRQ_CTRL) & ~IRQ_TIMER);
 }
 
-#endif
 static void vortex_enable_int(vortex_t * card)
 {
 	// CAsp4ISR__EnableVortexInt_void_

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: Aureal issues on resume
  2011-10-20  9:42                 ` Raymond Yau
@ 2011-10-27 16:24                   ` Takashi Iwai
  0 siblings, 0 replies; 13+ messages in thread
From: Takashi Iwai @ 2011-10-27 16:24 UTC (permalink / raw)
  To: Raymond Yau
  Cc: Manuel Jander, ALSA Development Mailing List, Alien,
	Anders Eriksson, Gert Robben

At Thu, 20 Oct 2011 17:42:40 +0800,
Raymond Yau wrote:
> 
> 2011/9/20 Takashi Iwai <tiwai@suse.de>:
> > At Sat, 17 Sep 2011 10:16:19 +0800,
> > Raymond Yau wrote:
> >>
> >> 2011/9/16 Takashi Iwai <tiwai@suse.de>:
> >> > At Fri, 16 Sep 2011 10:16:11 +0800,
> >> > Raymond Yau wrote:
> >> >>
> >> >> 2011/9/12 Takashi Iwai <tiwai@suse.de>:
> >> >> > At Mon, 12 Sep 2011 09:53:28 +0200,
> >> >> > Takashi Iwai wrote:
> >> >> >>
> >> >> >> At Sun, 04 Sep 2011 22:32:44 +0200,
> >> >> >> Clemens Ladisch wrote:
> >> >> >> >
> >> >> >> > Raymond Yau wrote:
> >> >> >> > > The possible way is to save the contents of 128K memory mapped I/O
> >> >> >> > > ports before suspend to non-volatile memory and restore them after
> >> >> >> > > resume
> >> >> >> > >
> >> >> >> > > Is there any way for alsa driver to allocate non-volatile memory ?
> >> >> >> >
> >> >> >> > 'Normal' memory is saved over suspend.  Just use {k|v}malloc.
> >> >> >>
> >> >> >> If it's a 128kB bulk memory, vmalloc() is a more sensible choice.
> >> >> >
> >> >> > BTW, in many cases, you don't have to save/restore the whole mmio
> >> >> > region.  Instead, stop the stream, save / restore some important
> >> >> > registers and do the similar procedure for the normal prepare callback
> >> >> > in the resume, and restart the stream again.
> >> >> >
> >> >> >
> >> >> > Takashi
> >> >> >
> >> >>
> >> >> The current au8830 alsa driver seem use less than 192Kbytes out of
> >> >> 256Kbytes mmio
> >> >>
> >> >> http://thread.gmane.org/gmane.linux.kernel/564963/focus=47907
> >> >>
> >> >> your patch seem initialse the request queue in figure 16 of pat 6167465
> >> >>
> >> >> and the driver need to restore mixer and equalizer mmio for au8830 in figure 13
> >> >
> >> > Yeah, that's what I mentioned in the thread.
> >> >
> >> > Basically you'll need to restore the values assigned in hw_params()
> >> > for PCM.
> >> >
> >>
> >> The error messages are due to snd_vortex_suspend() call snd_vortex_adb_init()
> >>
> >> There are static routes for the codec, mixin, mixout and equalizer and
> >> dynamic routes of playback/capture streams
> >>
> >> Those VORTEX_ADB_RTBASE and VORTEX_ADB_CHNBASE mmio ports are two
> >> linked list, those vortex_route_* function are adding the routes to
> >> the tail of those linked lists
> >>
> >> so the only is to restore the routes since the driver does not keep
> >> track of the order of routes of the playback stream  or capture stream
> >> to the linked list
> >>
> >> > The mixer is ac97, so it's restored by ac97_codec.c.  The rest are the
> >> > equalizer and a3d values to be restored separately.
> >>
> >> I mean the hardware mixer (mixin and mixout) inside au88x0 chip.
> >>
> >> May be need to initialise mpu401_uart or joystick
> >>
> >>
> >> Is there any way to force the system to suspend, it seem that gnome
> >> power management in Fedora 10 does not provide any way to suspend
> >> while playing an audio ? ( screen saver set to 1 minutes, put the
> >> computer into sleep when inactive for 2 minutes )
> >
> > See files in Documentation/power directory.
> > You may call s2ram, powersave, or whatever command directly, too.
> >
> >
> > Takashi
> >
> 
> 
> 1)Make sure that your computer can suspend and resume normally without
> au88x0 sound card
> 2)Backup all your important data before you try the patch with your
> au88x0 sound card
> 3)Only tested with au8830 , so it may need some modification for
> au8820 and au8810
> 
> my au8830 ,with two streams playing at different sampling rate at the
> same time, can suspend with the following script and resume as
> expected by pressing power button with the attached patch
> 
> sync
> echo 1 > /sys/power/pm_trace
> echo mem > /sys/power/state
> 
> 
> It is strange that it can resume without uncomment those SNDRV_PCM_INFO_RESUME
> in au88x0_pcm.c
> 
> static struct snd_pcm_hardware snd_vortex_playback_hw_adb = {
> 	.info =
> 	    (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */
> 	     SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED |

This is normal.
SNDRV_PCM_INFO_RESUME means that the driver supports the full resume,
that is, the driver recovers the everything including the stream-restart
in the resume.  Most of drivers don't have it, and let the user-space
re-trigger the stream upon resume.

So, I believe the situation will be improved with your patch, at
least.  Could you brush it up to be merged to the upstream with the
usual things (a proper commit log and your sign-off)?


thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-10-27 16:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-02 15:05 Aureal issues on resume Clemens Ladisch
2011-09-02 23:41 ` Raymond Yau
2011-09-04 20:32   ` Clemens Ladisch
2011-09-12  7:53     ` Takashi Iwai
2011-09-12 11:54       ` Takashi Iwai
2011-09-16  2:16         ` Raymond Yau
2011-09-16  6:19           ` Takashi Iwai
2011-09-17  2:16             ` Raymond Yau
2011-09-20  7:09               ` Takashi Iwai
2011-10-20  9:42                 ` Raymond Yau
2011-10-27 16:24                   ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2011-09-02 11:41 Anders Eriksson
2011-09-02 11:41 ` Anders Eriksson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.