Re: [PATCH] CHROMIUM: ASoC: amd: acp: Add tdm support for codecs in machine driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks,

On 11/1/22 20:01, Mark Brown wrote:

On Tue, Nov 01, 2022 at 03:15:08PM +0530, Venkata Prasad Potturu wrote:

On 10/28/22 16:28, Mark Brown wrote:
+static int tdm_mode = 0;
+module_param_named(tdm_mode, tdm_mode, int, 0444);
+MODULE_PARM_DESC(tdm_mode, "Set 1 for tdm mode, set 0 for i2s mode");
Why is this a module parameter - how would a user decide to set this?
Is it something that someone might want to change at runtime?
While inserting this module we need to pass tdm_mode variable as 0 or 1 like
below.
sudo insmod/lib/modules/$(uname
-r)/kernel/sound/soc/amd/acp/snd-acp-mach.ko *tdm_mode=1*
Right, that's what the code does but why is this something that should
be controlled in this fashion?

This machine driver is common for TDM mode and I2S mode, user can select TDM mode or I2S mode.

Based on tdm_mode parameter we are configuring tdm/i2s format and tdm slot configuration like below.

    if (tdm_mode)
        fmt = SND_SOC_DAIFMT_DSP_A;
    else
        fmt = SND_SOC_DAIFMT_I2S;

    ret = snd_soc_dai_set_fmt(cpu_dai, fmt | SND_SOC_DAIFMT_NB_NF
                   | SND_SOC_DAIFMT_CBP_CFP);

    if (tdm_mode) {
        /**
         * As codec supports slot 4 and slot 5 for playback
         * and slot 6 and slot 7 for capture.
         */
        ret = snd_soc_dai_set_tdm_slot(cpu_dai, SLOT4 | SLOT5, SLOT6 | SLOT7,
                           TDM_CHANNELS, BIT_WIDTH);
        if (ret && ret != -ENOTSUPP) {
            dev_err(rtd->dev, "set TDM slot err: %d\n", ret);
            return ret;
        }
    }

   if (tdm_mode) {
        /**
         * As codec supports slot 4 and slot 5 for playback and slot 6 for capture.
         */
        ret = snd_soc_dai_set_tdm_slot(codec_dai, SLOT6, SLOT4 | SLOT5,
                           TDM_CHANNELS, BIT_WIDTH);
        if (ret < 0) {
            dev_warn(rtd->dev, "set TDM slot err:%d\n", ret);
            return ret;
        }
    }



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux