All of lore.kernel.org
 help / color / mirror / Atom feed
* system suspend and live audio streams
@ 2012-04-14 15:40 Grazvydas Ignotas
  2012-04-15 19:18 ` Jarkko Nikula
  0 siblings, 1 reply; 6+ messages in thread
From: Grazvydas Ignotas @ 2012-04-14 15:40 UTC (permalink / raw)
  To: alsa-devel; +Cc: Peter Ujfalusi, Jarkko Nikula

Hi,

Currently on OMAP the system fails to suspend properly if there are
audio streams active (PER and CORE don't enter low power states). I
wonder if this is expected to be handled by the driver and can be
considered a bug, or is it audio daemon's/system's responsibility to
stop all audio streams before kernel to is asked to start suspending?

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

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

* Re: system suspend and live audio streams
  2012-04-14 15:40 system suspend and live audio streams Grazvydas Ignotas
@ 2012-04-15 19:18 ` Jarkko Nikula
  2012-04-16 10:40   ` Peter Ujfalusi
  0 siblings, 1 reply; 6+ messages in thread
From: Jarkko Nikula @ 2012-04-15 19:18 UTC (permalink / raw)
  To: Grazvydas Ignotas; +Cc: Peter Ujfalusi, alsa-devel

On 04/14/2012 06:40 PM, Grazvydas Ignotas wrote:
> Hi,
> 
> Currently on OMAP the system fails to suspend properly if there are
> audio streams active (PER and CORE don't enter low power states). I
> wonder if this is expected to be handled by the driver and can be
> considered a bug, or is it audio daemon's/system's responsibility to
> stop all audio streams before kernel to is asked to start suspending?
> 
Hmm.. this is actually something which is not implemented.

Before arch/arm/plat-omap/mcbsp: omap_mcbsp_request used to enable
clocks and keep them active until omap_mcbsp_free. I.e.
omap_mcbsp_stop/_start which are called during suspend-resume cycle
don't change the clock state.

I don't actually remember why it used to be so. Might be related to SPI
mode use on OMAP1?

But as now the SPI support is dropped (no users and not supported in
later omaps) and mcbsp is merged with omap-mcbsp (no other users than
audio) I don't see why the clocks (or runtime pm) should be active
before omap_mcbsp_start.

I don't know immediately does this require any major changes for McBSP
register access that are done in function calls before omap_mcbsp_start
(IRCC hwmod might set already ICLK gating for register access) but some
code is needed to deal with McBSP register cache restore (due OMAP
OFFMODE that might be hit) and most probably for McBSP FIFO draining as
well.

-- 
Jarkko

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

* Re: system suspend and live audio streams
  2012-04-15 19:18 ` Jarkko Nikula
@ 2012-04-16 10:40   ` Peter Ujfalusi
  2012-04-16 12:24     ` Mark Brown
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Peter Ujfalusi @ 2012-04-16 10:40 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel, Grazvydas Ignotas

Hi,

On 04/15/2012 10:18 PM, Jarkko Nikula wrote:
> On 04/14/2012 06:40 PM, Grazvydas Ignotas wrote:
>> Hi,
>>
>> Currently on OMAP the system fails to suspend properly if there are
>> audio streams active (PER and CORE don't enter low power states). I
>> wonder if this is expected to be handled by the driver and can be
>> considered a bug, or is it audio daemon's/system's responsibility to
>> stop all audio streams before kernel to is asked to start suspending?

Did the suspend/resume worked in the past during audio activity?

>>
> Hmm.. this is actually something which is not implemented.
> 
> Before arch/arm/plat-omap/mcbsp: omap_mcbsp_request used to enable
> clocks and keep them active until omap_mcbsp_free. I.e.
> omap_mcbsp_stop/_start which are called during suspend-resume cycle
> don't change the clock state.
> 
> I don't actually remember why it used to be so. Might be related to SPI
> mode use on OMAP1?

We need to have the clocks enabled in order to change McBSP registers.
We do register writes in several places after startup (prepare,
hw_params, clock configuration).

> But as now the SPI support is dropped (no users and not supported in
> later omaps) and mcbsp is merged with omap-mcbsp (no other users than
> audio) I don't see why the clocks (or runtime pm) should be active
> before omap_mcbsp_start.

Because we need to write registers (configure McPBSP).

> I don't know immediately does this require any major changes for McBSP
> register access that are done in function calls before omap_mcbsp_start
> (IRCC hwmod might set already ICLK gating for register access) but some
> code is needed to deal with McBSP register cache restore (due OMAP
> OFFMODE that might be hit) and most probably for McBSP FIFO draining as
> well.

What we need to do is to have proper register store/restore for McBSP to
support suspend during audio activity. But. Even with that if the McBSP
is hitting OFF mode we will loose the McBSP FIFO content (invalidated).
This means we are going to have missing samples. Probably the user will
not going to notice it, but it is going to happen.
I'm sure this issue present on other platforms as well. The pm_runtime
is handled by the core, we should have suspend/resume checked in ASoC
core, if there's an issue we need to fix it. After that the McBSP
store/restore need to be implemented.

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

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

* Re: system suspend and live audio streams
  2012-04-16 10:40   ` Peter Ujfalusi
@ 2012-04-16 12:24     ` Mark Brown
  2012-04-16 16:10     ` Jarkko Nikula
  2012-04-17 10:21     ` Grazvydas Ignotas
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-04-16 12:24 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: alsa-devel, Grazvydas Ignotas, Jarkko Nikula

On Mon, Apr 16, 2012 at 01:40:41PM +0300, Peter Ujfalusi wrote:

> What we need to do is to have proper register store/restore for McBSP to
> support suspend during audio activity. But. Even with that if the McBSP
> is hitting OFF mode we will loose the McBSP FIFO content (invalidated).
> This means we are going to have missing samples. Probably the user will
> not going to notice it, but it is going to happen.

> I'm sure this issue present on other platforms as well. The pm_runtime
> is handled by the core, we should have suspend/resume checked in ASoC
> core, if there's an issue we need to fix it. After that the McBSP
> store/restore need to be implemented.

If the driver is using runtime PM and needs to ensure that a reference
is held outside of audio streaming then it should be taking care of
holding a reference itself.

Tegra is now handling this using the regmap cache infrastructure to make
the device powerdown transparent.

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

* Re: system suspend and live audio streams
  2012-04-16 10:40   ` Peter Ujfalusi
  2012-04-16 12:24     ` Mark Brown
@ 2012-04-16 16:10     ` Jarkko Nikula
  2012-04-17 10:21     ` Grazvydas Ignotas
  2 siblings, 0 replies; 6+ messages in thread
From: Jarkko Nikula @ 2012-04-16 16:10 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: alsa-devel, Grazvydas Ignotas

On 04/16/2012 01:40 PM, Peter Ujfalusi wrote:
> Because we need to write registers (configure McPBSP).
> 
>> I don't know immediately does this require any major changes for McBSP
>> register access that are done in function calls before omap_mcbsp_start
>> (IRCC hwmod might set already ICLK gating for register access) but some
>> code is needed to deal with McBSP register cache restore (due OMAP
>> OFFMODE that might be hit) and most probably for McBSP FIFO draining as
>> well.
> 
I meant above if hwmod has already set ICLK so (was it autogating?) that
manual enable/disable cycle for ICLK may not be needed for register
access if clock is automatically gated. I have vague memory that I saw
something like this in hwmod for some block but I'm not sure about this.

But that reminds me that did we have some use-case where FCLK was needed
during register access?

> What we need to do is to have proper register store/restore for McBSP to
> support suspend during audio activity. But. Even with that if the McBSP
> is hitting OFF mode we will loose the McBSP FIFO content (invalidated).
> This means we are going to have missing samples. Probably the user will
> not going to notice it, but it is going to happen.

For register store/restore there is already much implemented thanks to
Janusz's register cache workaround for OMAP1510 :-)

For FIFO I was thinking, if possible, to drain it out before going to
suspend.

-- 
Jarkko

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

* Re: system suspend and live audio streams
  2012-04-16 10:40   ` Peter Ujfalusi
  2012-04-16 12:24     ` Mark Brown
  2012-04-16 16:10     ` Jarkko Nikula
@ 2012-04-17 10:21     ` Grazvydas Ignotas
  2 siblings, 0 replies; 6+ messages in thread
From: Grazvydas Ignotas @ 2012-04-17 10:21 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: alsa-devel, Jarkko Nikula

On Mon, Apr 16, 2012 at 1:40 PM, Peter Ujfalusi <peter.ujfalusi@ti.com> wrote:
> On 04/15/2012 10:18 PM, Jarkko Nikula wrote:
>> On 04/14/2012 06:40 PM, Grazvydas Ignotas wrote:
>>> Hi,
>>>
>>> Currently on OMAP the system fails to suspend properly if there are
>>> audio streams active (PER and CORE don't enter low power states). I
>>> wonder if this is expected to be handled by the driver and can be
>>> considered a bug, or is it audio daemon's/system's responsibility to
>>> stop all audio streams before kernel to is asked to start suspending?
>
> Did the suspend/resume worked in the past during audio activity?

I don't think so.

>> I don't know immediately does this require any major changes for McBSP
>> register access that are done in function calls before omap_mcbsp_start
>> (IRCC hwmod might set already ICLK gating for register access) but some
>> code is needed to deal with McBSP register cache restore (due OMAP
>> OFFMODE that might be hit) and most probably for McBSP FIFO draining as
>> well.
>
> What we need to do is to have proper register store/restore for McBSP to
> support suspend during audio activity. But. Even with that if the McBSP
> is hitting OFF mode we will loose the McBSP FIFO content (invalidated).
> This means we are going to have missing samples. Probably the user will
> not going to notice it, but it is going to happen.

Could we maybe first get it working with RET (I think it's currently
default for suspend to RAM), where register contents are not lost
AFAIK? What needs to be done there, transmitter stopped and clocks
disabled I guess, anything else? I wonder if ongoing DMA needs to be
handled somehow too.
For our use case FIFO loss, if it happens, shouldn't be a big deal.


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

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

end of thread, other threads:[~2012-04-17 10:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-14 15:40 system suspend and live audio streams Grazvydas Ignotas
2012-04-15 19:18 ` Jarkko Nikula
2012-04-16 10:40   ` Peter Ujfalusi
2012-04-16 12:24     ` Mark Brown
2012-04-16 16:10     ` Jarkko Nikula
2012-04-17 10:21     ` Grazvydas Ignotas

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.