Skip to content

[BUG IMX] Loopback implementation using demux #3818

@giuzan

Description

@giuzan

Premise

I think that the loopback feature could be very useful in SOF. With loopback I basically mean a capture PCM from which we can read the samples that are written in playback. You can find this functionality in ALSA, known as ALSA Loopback. I think that performing the loopback job inside the DSP would be very useful. Developers who want to integrate its own echo canceller block can really take advantage of this feature.

I think that I have found a good example of that in sof-apl-demux-pcm512x.m4 topology.

I tried to port that topology into imx8 cs42888. You can find the m4 file here https://github.com/giuzan/sof/blob/c5f4111078e052597e233d3770d773f02f18f1e2/tools/topology/sof-imx8-cs42888-demux.m4.

The topology I build is shown in the following picture:

sof-imx8-cs42888-demux

Unfortunately, I experienced an issue (see description below). It is the reason why I opened this [BUG]. If you think that the loopback topic is beyond this issue, please let me know if it should be treated as a proposed [FEATURE].

Describe the bug

If you run the command
arecord -D hw:1,1 -c 2 -r 48000 -f S16_LE record.wav
the following error is printed
arecord: pcm_read:2149: read error: Input/output error

Moreover, if you arecord during an aplay, the playback stream stops until the arecord does not exit after the error.

To reproduce

arecord -D hw:1,1 -c 2 -r 48000 -f S16_LE record.wav

or

aplay -D hw:1,0 file.wav & arecord -D hw:1,1 -c 2 -r 48000 -f S16_LE record.wav

Reproduction rate

100%

Expected behavior

The file record.wav recorded through the capture pipeline should contain the samples processed by the playback pipeline.

Impact

I cannot implement loopback for echo cancellation.

Environment

  1. Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
  2. Name of the topology file
    • Topology: sof-imx8-cs42888-demux.m4
  3. Name of the platform(s) on which the bug is observed.
    • Platform: i.MX8QM

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions