audio: external tdm-loopback [1/1]
authorShuai Li <shuai.li@amlogic.com>
Tue, 29 Oct 2019 06:27:20 +0000 (14:27 +0800)
committerzihuan.ling <zihuan.ling@amlogic.com>
Fri, 1 Nov 2019 08:45:28 +0000 (16:45 +0800)
PD#SH-1626

Problem:
Can not record ADC's i2s output from Loopback

Solution:
1. Fix the wrong reg config in TDM OE pin.
2. move the lr/sclk pad configuration to probe.

Verify:
SM1.

Change-Id: I01f419e4b0ba72fb7295641c6e7d9a189754c9d7
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
sound/soc/amlogic/auge/tdm.c
sound/soc/amlogic/auge/tdm_hw.c

index 57eec3d7c963446a4d2ded685109d282fd93827c..7aa5ef74cc4b85442bc91d3518b9ce0b21ad24b2 100644 (file)
@@ -958,12 +958,6 @@ static int aml_dai_tdm_hw_params(struct snd_pcm_substream *substream,
        if (ret)
                return ret;
 
-       if (p_tdm->chipinfo && (!p_tdm->chipinfo->no_mclkpad_ctrl)) {
-               ret = aml_tdm_set_clk_pad(p_tdm);
-               if (ret)
-                       return ret;
-       }
-
        /* Must enabe channel number for VAD */
        if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE)
                && (vad_tdm_is_running(p_tdm->id)))
@@ -1730,6 +1724,12 @@ static int aml_tdm_platform_probe(struct platform_device *pdev)
                }
        }
 
+       if (p_tdm->chipinfo && (!p_tdm->chipinfo->no_mclkpad_ctrl)) {
+               ret = aml_tdm_set_clk_pad(p_tdm);
+               if (ret)
+                       dev_warn_once(&pdev->dev, "clk_pad set failed\n");
+       }
+
        /* complete mclk for tdm */
        if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MINOR) == 0xa)
                meson_clk_measure((1<<16) | 0x67);
index 3c557cc8456f5116de9eed36efb32036d6433dac..8f124e785b5462bea36db3be48aaadd42f86a5d4 100644 (file)
@@ -463,14 +463,11 @@ void aml_tdm_set_oe_v1(
        struct aml_audio_controller *actrl,
        int index, int force_oe, int oe_val)
 {
-       unsigned int reg, offset;
-
-       offset = EE_AUDIO_TDMOUT_B_CTRL0 - EE_AUDIO_TDMOUT_A_CTRL0;
-       reg = EE_AUDIO_TDMOUT_A_CTRL0 + offset * index;
-
        if (force_oe) {
-               offset = EE_AUDIO_TDMOUT_B_CTRL2 - EE_AUDIO_TDMOUT_A_CTRL2;
-               reg = EE_AUDIO_TDMOUT_A_CTRL2 + offset * index;
+               unsigned int reg, offset;
+
+               offset = EE_AUDIO_TDMOUT_B_CTRL0 - EE_AUDIO_TDMOUT_A_CTRL0;
+               reg = EE_AUDIO_TDMOUT_A_CTRL0 + offset * index;
 
                aml_audiobus_update_bits(actrl, reg, 0xf << 24, force_oe << 24);
 
@@ -484,9 +481,9 @@ void aml_tdm_set_oe_v2(
        struct aml_audio_controller *actrl,
        int index, int force_oe, int oe_val)
 {
-       unsigned int reg, offset;
-
        if (force_oe) {
+               unsigned int reg, offset;
+
                offset = EE_AUDIO_TDMOUT_B_CTRL2 - EE_AUDIO_TDMOUT_A_CTRL2;
                reg = EE_AUDIO_TDMOUT_A_CTRL2 + offset * index;