[alsa-devel] Need help fixing pop/click artifacts in an ASOC driver

Mark Brown broonie at kernel.org
Fri Dec 21 11:57:41 CET 2018


On Thu, Dec 20, 2018 at 10:41:40PM +0200, Dimitris Papavasiliou wrote:
> On 12/20/18 5:36 PM, Mark Brown wrote:

> > Install one PCM hardware configuration chosen from a configuration
> > space and snd_pcm_prepare it.

> As far as I can see there's no other way to call hw_params from
> userspace, except for snd_pcm_set_params, which is just a wrapper that
> calls snd_pcm_hw_params internally, so I suppose calling hw_params to
> configure the stream, must inevitably lead to the device being powered
> up.

OK, that's fun...

> Unfortunately the documentation ("Writing an ALSA Driver") on the
> prepare callback even warns explicitly, to:

> > Be careful that this callback will be called many times at each
> > setup, too.

> I'm not sure if this implies that configuring the card in multiple
> steps when setting up the stream is expected behavior, but it could be
> interpreted that way.

It's certainly possible if there needs to be negotation about the
parameters (but then you wouldn't prepare as the stream as you'd fail to
set the parameters) but it's not normal.  The repeated configurations
used to be much more common as OSS had separate calls to set each
parameter rather than the atomic configuration that ALSA has so you got
a hw_params() call for each OSS ioctl(), with native ALSA applications
it is more usual to get it right first time.

> Should we then accept, that some pops will be generated and hope that
> they'll be suppressed by the digital_mute callback?

It's probably easiest.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20181221/56ac90d2/attachment.sig>


More information about the Alsa-devel mailing list