All of lore.kernel.org
 help / color / mirror / Atom feed
* ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled
@ 2016-08-15  9:43 ` wens Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: wens Tsai @ 2016-08-15  9:43 UTC (permalink / raw)
  To: Maxime Ripard, Mark Brown, Liam Girdwood, Code Kipper
  Cc: Linux-ALSA, linux-arm-kernel, linux-kernel

Hi everyone,

In the sun4i-codec driver, we control the DAC digital enable bits with a
supply widget, which in turn supplies the DAC source widgets. DAPM will
disable the supply if there are no usable playback paths. And it just so
happens that the default value for various playback switches is the off
setting.

Any user getting codec support for the first time has to enable a proper
playback path before getting sound out of the hardware. This is expected.

What is unexpected is any attempt to play anything under this state makes
the playback software (in my case mpg321) stall, and later report an I/O
error. My guess is that the DAC is still disabled by DAPM, so it doesn't
send any DRQs, and thus the DMA engine is not consuming any data from
userspace.

I think we should just enable the digital bits of the DAC/ADC all the
time. Or maybe transfer and then discard data if the DAC is off. Not
sure if this is doable though. I expect playback software to work, and
not block, regardless of the hardware status.

Any thoughts on this? sun4i-codec seems to be one of the rarer kinds of
hardware where the DAC is directly tied to the system bus, without an I2S
interface in between. And I don't see any DAI drivers using DAPM.


Regards
ChenYu

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

* ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled
@ 2016-08-15  9:43 ` wens Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: wens Tsai @ 2016-08-15  9:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi everyone,

In the sun4i-codec driver, we control the DAC digital enable bits with a
supply widget, which in turn supplies the DAC source widgets. DAPM will
disable the supply if there are no usable playback paths. And it just so
happens that the default value for various playback switches is the off
setting.

Any user getting codec support for the first time has to enable a proper
playback path before getting sound out of the hardware. This is expected.

What is unexpected is any attempt to play anything under this state makes
the playback software (in my case mpg321) stall, and later report an I/O
error. My guess is that the DAC is still disabled by DAPM, so it doesn't
send any DRQs, and thus the DMA engine is not consuming any data from
userspace.

I think we should just enable the digital bits of the DAC/ADC all the
time. Or maybe transfer and then discard data if the DAC is off. Not
sure if this is doable though. I expect playback software to work, and
not block, regardless of the hardware status.

Any thoughts on this? sun4i-codec seems to be one of the rarer kinds of
hardware where the DAC is directly tied to the system bus, without an I2S
interface in between. And I don't see any DAI drivers using DAPM.


Regards
ChenYu

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

* Re: ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled
  2016-08-15  9:43 ` wens Tsai
@ 2016-08-15 11:42   ` Mark Brown
  -1 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2016-08-15 11:42 UTC (permalink / raw)
  To: wens Tsai
  Cc: Maxime Ripard, Liam Girdwood, Code Kipper, Linux-ALSA,
	linux-arm-kernel, linux-kernel

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

On Mon, Aug 15, 2016 at 05:43:55PM +0800, wens Tsai wrote:

> What is unexpected is any attempt to play anything under this state makes
> the playback software (in my case mpg321) stall, and later report an I/O
> error. My guess is that the DAC is still disabled by DAPM, so it doesn't
> send any DRQs, and thus the DMA engine is not consuming any data from
> userspace.

This is normal for ASoC - like you say it'll be becasue the hardware
isn't powered up.

> I think we should just enable the digital bits of the DAC/ADC all the
> time. Or maybe transfer and then discard data if the DAC is off. Not
> sure if this is doable though. I expect playback software to work, and
> not block, regardless of the hardware status.

Powering things up all the time will have a major effect on battery life
for systems that care about that.  The expectation is that systems with
this sort of hardware won't normally be offering end users direct
control of the routing, it'll be something that's handled during system
integration.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled
@ 2016-08-15 11:42   ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2016-08-15 11:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 15, 2016 at 05:43:55PM +0800, wens Tsai wrote:

> What is unexpected is any attempt to play anything under this state makes
> the playback software (in my case mpg321) stall, and later report an I/O
> error. My guess is that the DAC is still disabled by DAPM, so it doesn't
> send any DRQs, and thus the DMA engine is not consuming any data from
> userspace.

This is normal for ASoC - like you say it'll be becasue the hardware
isn't powered up.

> I think we should just enable the digital bits of the DAC/ADC all the
> time. Or maybe transfer and then discard data if the DAC is off. Not
> sure if this is doable though. I expect playback software to work, and
> not block, regardless of the hardware status.

Powering things up all the time will have a major effect on battery life
for systems that care about that.  The expectation is that systems with
this sort of hardware won't normally be offering end users direct
control of the routing, it'll be something that's handled during system
integration.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160815/63de4d34/attachment.sig>

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

* Re: ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled
  2016-08-15 11:42   ` Mark Brown
@ 2016-08-16  4:45     ` wens Tsai
  -1 siblings, 0 replies; 10+ messages in thread
From: wens Tsai @ 2016-08-16  4:45 UTC (permalink / raw)
  To: Mark Brown
  Cc: Maxime Ripard, Liam Girdwood, Code Kipper, Linux-ALSA,
	linux-arm-kernel, linux-kernel

On Mon, Aug 15, 2016 at 7:42 PM, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Aug 15, 2016 at 05:43:55PM +0800, wens Tsai wrote:
>
>> What is unexpected is any attempt to play anything under this state makes
>> the playback software (in my case mpg321) stall, and later report an I/O
>> error. My guess is that the DAC is still disabled by DAPM, so it doesn't
>> send any DRQs, and thus the DMA engine is not consuming any data from
>> userspace.
>
> This is normal for ASoC - like you say it'll be becasue the hardware
> isn't powered up.
>
>> I think we should just enable the digital bits of the DAC/ADC all the
>> time. Or maybe transfer and then discard data if the DAC is off. Not
>> sure if this is doable though. I expect playback software to work, and
>> not block, regardless of the hardware status.
>
> Powering things up all the time will have a major effect on battery life
> for systems that care about that.  The expectation is that systems with
> this sort of hardware won't normally be offering end users direct
> control of the routing, it'll be something that's handled during system
> integration.

Ok. So I guess one solution would be to move the mute controls out of
DAPM, and maybe change some other mux like paths into actual muxes, so
there's at least one usable path at all times.

IIRC there was a patch doing something like this. I'll look into it.

Regards
ChenYu

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

* ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled
@ 2016-08-16  4:45     ` wens Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: wens Tsai @ 2016-08-16  4:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 15, 2016 at 7:42 PM, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Aug 15, 2016 at 05:43:55PM +0800, wens Tsai wrote:
>
>> What is unexpected is any attempt to play anything under this state makes
>> the playback software (in my case mpg321) stall, and later report an I/O
>> error. My guess is that the DAC is still disabled by DAPM, so it doesn't
>> send any DRQs, and thus the DMA engine is not consuming any data from
>> userspace.
>
> This is normal for ASoC - like you say it'll be becasue the hardware
> isn't powered up.
>
>> I think we should just enable the digital bits of the DAC/ADC all the
>> time. Or maybe transfer and then discard data if the DAC is off. Not
>> sure if this is doable though. I expect playback software to work, and
>> not block, regardless of the hardware status.
>
> Powering things up all the time will have a major effect on battery life
> for systems that care about that.  The expectation is that systems with
> this sort of hardware won't normally be offering end users direct
> control of the routing, it'll be something that's handled during system
> integration.

Ok. So I guess one solution would be to move the mute controls out of
DAPM, and maybe change some other mux like paths into actual muxes, so
there's at least one usable path at all times.

IIRC there was a patch doing something like this. I'll look into it.

Regards
ChenYu

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

* Re: ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled
  2016-08-16  4:45     ` wens Tsai
@ 2016-08-22  9:18       ` Maxime Ripard
  -1 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2016-08-22  9:18 UTC (permalink / raw)
  To: wens Tsai
  Cc: Mark Brown, Liam Girdwood, Code Kipper, Linux-ALSA,
	linux-arm-kernel, linux-kernel

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

On Tue, Aug 16, 2016 at 12:45:39PM +0800, wens Tsai wrote:
> On Mon, Aug 15, 2016 at 7:42 PM, Mark Brown <broonie@kernel.org> wrote:
> > On Mon, Aug 15, 2016 at 05:43:55PM +0800, wens Tsai wrote:
> >
> >> What is unexpected is any attempt to play anything under this state makes
> >> the playback software (in my case mpg321) stall, and later report an I/O
> >> error. My guess is that the DAC is still disabled by DAPM, so it doesn't
> >> send any DRQs, and thus the DMA engine is not consuming any data from
> >> userspace.
> >
> > This is normal for ASoC - like you say it'll be becasue the hardware
> > isn't powered up.
> >
> >> I think we should just enable the digital bits of the DAC/ADC all the
> >> time. Or maybe transfer and then discard data if the DAC is off. Not
> >> sure if this is doable though. I expect playback software to work, and
> >> not block, regardless of the hardware status.
> >
> > Powering things up all the time will have a major effect on battery life
> > for systems that care about that.  The expectation is that systems with
> > this sort of hardware won't normally be offering end users direct
> > control of the routing, it'll be something that's handled during system
> > integration.
> 
> Ok. So I guess one solution would be to move the mute controls out of
> DAPM, and maybe change some other mux like paths into actual muxes, so
> there's at least one usable path at all times.

I'm not sure that's even a requirement. IIRC, but Mark might correct
me, you just need to expose whatever the reset state is.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled
@ 2016-08-22  9:18       ` Maxime Ripard
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2016-08-22  9:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 16, 2016 at 12:45:39PM +0800, wens Tsai wrote:
> On Mon, Aug 15, 2016 at 7:42 PM, Mark Brown <broonie@kernel.org> wrote:
> > On Mon, Aug 15, 2016 at 05:43:55PM +0800, wens Tsai wrote:
> >
> >> What is unexpected is any attempt to play anything under this state makes
> >> the playback software (in my case mpg321) stall, and later report an I/O
> >> error. My guess is that the DAC is still disabled by DAPM, so it doesn't
> >> send any DRQs, and thus the DMA engine is not consuming any data from
> >> userspace.
> >
> > This is normal for ASoC - like you say it'll be becasue the hardware
> > isn't powered up.
> >
> >> I think we should just enable the digital bits of the DAC/ADC all the
> >> time. Or maybe transfer and then discard data if the DAC is off. Not
> >> sure if this is doable though. I expect playback software to work, and
> >> not block, regardless of the hardware status.
> >
> > Powering things up all the time will have a major effect on battery life
> > for systems that care about that.  The expectation is that systems with
> > this sort of hardware won't normally be offering end users direct
> > control of the routing, it'll be something that's handled during system
> > integration.
> 
> Ok. So I guess one solution would be to move the mute controls out of
> DAPM, and maybe change some other mux like paths into actual muxes, so
> there's at least one usable path at all times.

I'm not sure that's even a requirement. IIRC, but Mark might correct
me, you just need to expose whatever the reset state is.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160822/3402858b/attachment.sig>

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

* Re: ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled
  2016-08-22  9:18       ` Maxime Ripard
@ 2016-08-22 10:41         ` Mark Brown
  -1 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2016-08-22 10:41 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: wens Tsai, Liam Girdwood, Code Kipper, Linux-ALSA,
	linux-arm-kernel, linux-kernel

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

On Mon, Aug 22, 2016 at 11:18:15AM +0200, Maxime Ripard wrote:
> On Tue, Aug 16, 2016 at 12:45:39PM +0800, wens Tsai wrote:

> > Ok. So I guess one solution would be to move the mute controls out of
> > DAPM, and maybe change some other mux like paths into actual muxes, so
> > there's at least one usable path at all times.

> I'm not sure that's even a requirement. IIRC, but Mark might correct
> me, you just need to expose whatever the reset state is.

Yes, this results in some inconvenience but avoids problems caused by
configuration changes for one board affecting another adversely - if we
just go with the hardware defaults it's something fixed externally.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled
@ 2016-08-22 10:41         ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2016-08-22 10:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 22, 2016 at 11:18:15AM +0200, Maxime Ripard wrote:
> On Tue, Aug 16, 2016 at 12:45:39PM +0800, wens Tsai wrote:

> > Ok. So I guess one solution would be to move the mute controls out of
> > DAPM, and maybe change some other mux like paths into actual muxes, so
> > there's at least one usable path at all times.

> I'm not sure that's even a requirement. IIRC, but Mark might correct
> me, you just need to expose whatever the reset state is.

Yes, this results in some inconvenience but avoids problems caused by
configuration changes for one board affecting another adversely - if we
just go with the hardware defaults it's something fixed externally.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160822/7057a38a/attachment.sig>

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

end of thread, other threads:[~2016-08-22 10:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-15  9:43 ASoC: sun4i-codec: playback stall and I/O error with DAPM paths all disabled wens Tsai
2016-08-15  9:43 ` wens Tsai
2016-08-15 11:42 ` Mark Brown
2016-08-15 11:42   ` Mark Brown
2016-08-16  4:45   ` wens Tsai
2016-08-16  4:45     ` wens Tsai
2016-08-22  9:18     ` Maxime Ripard
2016-08-22  9:18       ` Maxime Ripard
2016-08-22 10:41       ` Mark Brown
2016-08-22 10:41         ` Mark Brown

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.