All of lore.kernel.org
 help / color / mirror / Atom feed
* How to propagate parameters from FE to BE with compressed audio interfaces
@ 2018-11-14 15:35 Daniel Baluta
  2018-11-14 16:51 ` Pierre-Louis Bossart
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Baluta @ 2018-11-14 15:35 UTC (permalink / raw)
  To: vkoul, liam.r.girdwood; +Cc: S.j. Wang, alsa-devel

Hello,

soc_compr_set_params_fe calls dpcm_be_dai_hw_params in order to setup
BE hw_params.

Is there a way to transfer parameters like for example the rate from FE
to BE?

In soc_compr_set_params_fe there is this code:

*
* Create an empty hw_params for the BE as the machine driver must
* fix this up to match DSP decoder and ASRC configuration.
* I.e. machine driver fixup for compressed BE is mandatory.
*/
memset(&fe->dpcm[fe_substream->stream].hw_params, 0,
       sizeof(struct snd_pcm_hw_params));

So, information about parameters is just ignored.

The only way we can setup hw_params for BE is via 
be_hw_params_fixup() but this function doesn't have any information
from FE.

My use case is something like this:

FE:
    - cpu: FSL SAI DAI interface
    - platform: DSP 
    - codec: dummy codec
BE:
    - cpu: dummy
    - platform: dummy
    - codec: cs42888.

codec could handle 44100Hz and 48000Hz streams, but the BE doesn't have
any way to know what is the rate cplay sets to FE.

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

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

* Re: How to propagate parameters from FE to BE with compressed audio interfaces
  2018-11-14 15:35 How to propagate parameters from FE to BE with compressed audio interfaces Daniel Baluta
@ 2018-11-14 16:51 ` Pierre-Louis Bossart
  2018-11-16  7:04   ` Daniel Baluta
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre-Louis Bossart @ 2018-11-14 16:51 UTC (permalink / raw)
  To: Daniel Baluta, vkoul, liam.r.girdwood; +Cc: S.j. Wang, alsa-devel

Hi Daniel,

On 11/14/18 9:35 AM, Daniel Baluta wrote:
> Hello,
>
> soc_compr_set_params_fe calls dpcm_be_dai_hw_params in order to setup
> BE hw_params.
>
> Is there a way to transfer parameters like for example the rate from FE
> to BE?
>
> In soc_compr_set_params_fe there is this code:
>
> *
> * Create an empty hw_params for the BE as the machine driver must
> * fix this up to match DSP decoder and ASRC configuration.
> * I.e. machine driver fixup for compressed BE is mandatory.
> */
> memset(&fe->dpcm[fe_substream->stream].hw_params, 0,
>         sizeof(struct snd_pcm_hw_params));
>
> So, information about parameters is just ignored.
>
> The only way we can setup hw_params for BE is via
> be_hw_params_fixup() but this function doesn't have any information
> from FE.
>
> My use case is something like this:
>
> FE:
>      - cpu: FSL SAI DAI interface
>      - platform: DSP
>      - codec: dummy codec
> BE:
>      - cpu: dummy
>      - platform: dummy
>      - codec: cs42888.
>
> codec could handle 44100Hz and 48000Hz streams, but the BE doesn't have
> any way to know what is the rate cplay sets to FE.

I don't think we planned for the case you mention, but IIRC it was 
intentional.

In our implementations and the non-Intel ones I am familiar with, the BE 
typically handles data that is mixed between PCM channels (for 
tone/alerts/low latency) and decompressed data. So the rate adaptation 
of the decoder output is handled inside the DSP and the BE is configured 
at a set rate. I also don't remember when was the last time we supported 
44.1 kHz, maybe 2011?

You *could* add support for dynamic BE reconfigurations but then it 
creates a headache for the mixer usages. Not to mention that decoders 
support rates that the BE may not support so SRC is likely required 
anyways. And I forget schemes like AAC+ implicit signaling where you 
first have to decode before figuring out if you have valid SBR data 
which will result in a 2x upsampling of the output - in other words you 
may not necessarily know what the output frequency of the decoder is 
just by looking up the file so doing a configuration at the DPCM level 
is complicated at best.

-Pierre

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

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

* Re: How to propagate parameters from FE to BE with compressed audio interfaces
  2018-11-14 16:51 ` Pierre-Louis Bossart
@ 2018-11-16  7:04   ` Daniel Baluta
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Baluta @ 2018-11-16  7:04 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: vkoul, Linux-ALSA, Daniel Baluta, S.j. Wang, Liam Girdwood

On Wed, Nov 14, 2018 at 6:52 PM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
>
> Hi Daniel,
>
> On 11/14/18 9:35 AM, Daniel Baluta wrote:
> > Hello,
> >
> > soc_compr_set_params_fe calls dpcm_be_dai_hw_params in order to setup
> > BE hw_params.
> >
> > Is there a way to transfer parameters like for example the rate from FE
> > to BE?
> >
> > In soc_compr_set_params_fe there is this code:
> >
> > *
> > * Create an empty hw_params for the BE as the machine driver must
> > * fix this up to match DSP decoder and ASRC configuration.
> > * I.e. machine driver fixup for compressed BE is mandatory.
> > */
> > memset(&fe->dpcm[fe_substream->stream].hw_params, 0,
> >         sizeof(struct snd_pcm_hw_params));
> >
> > So, information about parameters is just ignored.
> >
> > The only way we can setup hw_params for BE is via
> > be_hw_params_fixup() but this function doesn't have any information
> > from FE.
> >
> > My use case is something like this:
> >
> > FE:
> >      - cpu: FSL SAI DAI interface
> >      - platform: DSP
> >      - codec: dummy codec
> > BE:
> >      - cpu: dummy
> >      - platform: dummy
> >      - codec: cs42888.
> >
> > codec could handle 44100Hz and 48000Hz streams, but the BE doesn't have
> > any way to know what is the rate cplay sets to FE.
>
> I don't think we planned for the case you mention, but IIRC it was
> intentional.
>
> In our implementations and the non-Intel ones I am familiar with, the BE
> typically handles data that is mixed between PCM channels (for
> tone/alerts/low latency) and decompressed data. So the rate adaptation
> of the decoder output is handled inside the DSP and the BE is configured
> at a set rate. I also don't remember when was the last time we supported
> 44.1 kHz, maybe 2011?
>
Got your point. I will use (A)SRC to handle the rate conversion.

Thanks a lot Pierre!

Daniel.

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

end of thread, other threads:[~2018-11-16  7:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 15:35 How to propagate parameters from FE to BE with compressed audio interfaces Daniel Baluta
2018-11-14 16:51 ` Pierre-Louis Bossart
2018-11-16  7:04   ` Daniel Baluta

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.