imx8mn: Using the easrc driver

Shengjiu Wang shengjiu.wang at gmail.com
Sat Apr 9 04:14:08 CEST 2022


On Sat, Apr 9, 2022 at 3:30 AM Fabio Estevam <festevam at gmail.com> wrote:

> Hi Shengjiu,
>
> I am running kernel 5.18-rc1 on an imx8mn-ddr4-evk board.
>
> The following playback devices are available:
>
> # aplay -l
> **** List of PLAYBACK Hardware Devices ****
> card 0: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0
> [S/PDIF PCM snd-soc-dummy-dai-0]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 1: wm8524audio [wm8524-audio], device 0: HiFi wm8524-hifi-0 [HiFi
> wm8524-hifi-0]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 1: wm8524audio [wm8524-audio], device 1: HiFi-ASRC-FE (*) []
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> #
>
> I would like to use the sample rate conversion (provided by the easrc
> driver):
>
> # aplay -D hw:1,1 /media/f2bjrop1.0.wav
> Playing WAVE '/media/f2bjrop1.0.wav' : Signed 16 bit Little Endian,
> Rate 16000 Hz, Mono
> Warning: rate is not accurate (requested = 16000Hz, got = 32000Hz)
>          please, try the plug plugin
>
> , but the playback does not play at the correct speed. It plays at a
> much faster rate.
>
> The f2bjrop1.0.wav file I got from:
> http://www.fit.vutbr.cz/~motlicek/speech_hnm.html
>
> What should be done for the easrc to convert the sampling rates properly?
>
>
> Maybe it is caused by this "constraint is not needed for back end
bitstream for
the sample rate is fixed by dts and the constraint is propagated to front
end
bitstream for they share the same snd_soc_pcm_runtime."

Please try the below change.  this change hasn't been upstreamed yet.

diff --git a/sound/soc/codecs/wm8524.c b/sound/soc/codecs/wm8524.c
index 81f858f6bd67..442a59857875 100644
--- a/sound/soc/codecs/wm8524.c
+++ b/sound/soc/codecs/wm8524.c
@@ -61,6 +61,7 @@ static int wm8524_startup(struct snd_pcm_substream
*substream,
 {
        struct snd_soc_component *component = dai->component;
        struct wm8524_priv *wm8524 =
snd_soc_component_get_drvdata(component);
+       struct snd_soc_pcm_runtime *rtd = substream->private_data;

        /* The set of sample rates that can be supported depends on the
         * MCLK supplied to the CODEC - enforce this.
@@ -71,9 +72,10 @@ static int wm8524_startup(struct snd_pcm_substream
*substream,
                return -EINVAL;
        }

-       snd_pcm_hw_constraint_list(substream->runtime, 0,
-                                  SNDRV_PCM_HW_PARAM_RATE,
-                                  &wm8524->rate_constraint);
+       if (!rtd->dai_link->be_hw_params_fixup)
+               snd_pcm_hw_constraint_list(substream->runtime, 0,
+                                          SNDRV_PCM_HW_PARAM_RATE,
+                                          &wm8524->rate_constraint);

        gpiod_set_value_cansleep(wm8524->mute, 1);

best regards
wang shengjiu


More information about the Alsa-devel mailing list