AnsweredAssumed Answered

Does the ASoC ALSA driver modify the volume on Playback DAI?

Question asked by Florian Ulivi on Oct 24, 2017
Latest reply on Nov 7, 2017 by Florian Ulivi

Hello,

 

we have a problem with audio playback. The sound comes out clipped and our tests indicate it happens before the codec receives the audio signal. If I use a low volume input sample and crank up the codec amplification, everything is fine. If I use a normal volume input sample and set all codec amplification to the lowest settings, there is noises suggesting clipping. Hence, we assume the problem on the ALSA side of things.

Does anyone know how to check whether the signal amplitude is modified in software? Or any suggestions how to tackle this problem?

 

Our setup consists of:

  • a custom base board carrying  a Compulab UCM-iMX7 Soc, with an i.MX7,
  • use the kernel tagged with rel_imx_4.1.15_1.2.0_ga, and
  • have an audio codec (Microsemi zl38060) connected to SAI3.

 

Here is an excerpt from our device tree: 

 

/ {
   zl380xx: zl380-codec {
        #sound-dai-cells = <0>;
        compatible = "ms,zl38060";
        status = "okay";
    };

    /delete-node/sound;

    sound_intercom {
        compatible = "simple-audio-card";
        simple-audio-card,name = "imx7-zl38060";
        simple-audio-card,format = "dsp_a";
        simple-audio-card,bitclock-master = <&sound_sai3_master>;
        simple-audio-card,frame-master = <&sound_sai3_master>;

        assigned-clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_SRC>,
                          <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
        assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
        assigned-clock-rates = <0>, <12288000>;

        sound_sai3_master: simple-audio-card,cpu {
            sound-dai = <&sai3 0>;
            dai-tdm-slot-num = <2>;
            dai-tdm-slot-width = <16>;
            system-clock-direction = "out";
        };

        simple-audio-card,codec {
            sound-dai = <&zl380xx 0>;
            system-clock-type = "mclk";
            system-clock-frequency = <12288000>;
        };
    };
};

&sai3 { /* Audio DAI */
    #sound-dai-cells = <0>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sai3>;
    assigned-clocks = <&clks IMX7D_SAI3_ROOT_SRC>,
                      <&clks IMX7D_SAI3_ROOT_CLK>;
    assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
    assigned-clock-rates = <0>, <36864000>;
    status = "okay";
};

The codec kernel module registers the snd_soc_dai_driver as follows.

#define zl380xx_DAI_RATES       (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_48000)
#define zl380xx_DAI_FORMATS     (SNDRV_PCM_FMTBIT_S16_LE)
#define zl380xx_DAI_CHANNEL_MIN 1
#define zl380xx_DAI_CHANNEL_MAX 2

static struct snd_soc_dai_driver zl380xx_dai = {
    .name = "zl380xx-dai",
    .playback = {
        .stream_name = "Playback",
        .channels_min = zl380xx_DAI_CHANNEL_MIN,
        .channels_max = zl380xx_DAI_CHANNEL_MAX,
        .rates = zl380xx_DAI_RATES,
        .formats = zl380xx_DAI_FORMATS,
    },
    .capture = {
        .stream_name = "Capture",
        .channels_min = zl380xx_DAI_CHANNEL_MIN,
        .channels_max = zl380xx_DAI_CHANNEL_MAX,
        .rates = zl380xx_DAI_RATES,
        .formats = zl380xx_DAI_FORMATS,
    }
};

 

Kind regards,

Florian

 

alsa

Outcomes