Audio mem2mem devices aka asymmetric sample rate converters
Sascha Hauer
sha at pengutronix.de
Thu Jun 2 13:21:06 CEST 2022
Hi All,
I am currently looking into getting the asymmetric sample rate converters
(ASRC) found on some i.MX SoCs to do something useful.
The ASRC units are completely independent units, i.e. independent of the rest
of the audio subsystem. They can read from memory using the SDMA engine,
convert sample rates and/or audio formats and write back to memory also using
the SDMA engine. The ASRC on the i.MX8MN has four contexts to convert up to
four streams simultanously. I am not aware of any other non i.MX SoCs having
such a unit, but I am pretty sure they exist on other SoCs as well.
There are likely two usecases for such a unit. First would be to offload sample
rate and format conversions to hardware. The other would be to synchronize
different audio sources/sinks with different master clocks to each other when
the master clocks drift away.
How would such units be integrated into ASoC? I can think of two ways. First
would be to create an separate audio card from them which records on one end
and plays back with a different sample rate / format on the other end, in the
v4l2 world that would be a classical mem2mem device. Is Alsa/ASoc prepared for
something like this? Would it be feasible to go into such a direction? I
haven't found any examples for this in the tree.
The other way is to attach the ASRC to an existing audio card. That is done
with the existing in-tree sound/soc/fsl/fsl_asrc.c and
sound/soc/fsl/fsl_easrc.c drivers. This approach feels somehow limited as it's
not possible to just do conversions without playing/recording something. OTOH
userspace is unaffected which might be an advantage. What nags me with that
approach is that it's currently not integrated into the simple-audio-card or
audio-graph-card bindings. Currently the driver can only be used in conjunction
with the fsl,imx-audio-* card driver. It seems backward to integrate such a
generic ASRC unit into a special purpose audio card driver. The ASoC core is
fully unaware of the ASRC with this approach currently which also doesn't look
very appealing. OTOH I don't know if ASoC could handle this. Can ASoC handle
for example a chain of DAIs when there are different sample rates and formats
in that chain?
Currently I don't really know how to proceed. It would be great if you could
share some thoughts to this topic.
Thanks,
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the Alsa-devel
mailing list