audio: add 10ms delay before pdn enable [1/1]
authorZhe Wang <Zhe.Wang@amlogic.com>
Sun, 28 Apr 2019 03:22:14 +0000 (11:22 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Mon, 29 Apr 2019 10:42:31 +0000 (03:42 -0700)
PD#SWPL-7680

Problem:
the pwn signal is self excitable

Solution:
1)add 10ms delay before pdn enable
2)set default clk for extern codec

Verify:
HW verify

Change-Id: I031b20851ee1eeb65215075fc8abe783ceddf42b
Signed-off-by: Zhe Wang <Zhe.Wang@amlogic.com>
sound/soc/amlogic/auge/tdm.c
sound/soc/codecs/amlogic/ad82584f.c

index 669fd83..290b00d 100644 (file)
@@ -1262,6 +1262,32 @@ static int aml_dai_tdm_mute_stream(struct snd_soc_dai *cpu_dai,
        return 0;
 }
 
+static int aml_set_default_tdm_clk(struct aml_tdm *tdm)
+{
+       unsigned int mclk = 12288000;
+       unsigned int ratio = aml_mpll_mclk_ratio(mclk);
+       unsigned int lrclk_hi;
+
+       /*set default i2s clk for codec sequence*/
+       tdm->setting.bclk_lrclk_ratio = 64;
+       tdm->setting.sysclk_bclk_ratio = 4;
+       tdm->clk_sel = 0;
+       lrclk_hi = tdm->setting.bclk_lrclk_ratio - 1;
+
+       aml_tdm_set_lrclkdiv(tdm->actrl, tdm->clk_sel,
+               tdm->setting.sysclk_bclk_ratio - 1);
+
+       aml_tdm_set_bclk_ratio(tdm->actrl,
+               tdm->clk_sel, lrclk_hi/2, lrclk_hi);
+
+       clk_prepare_enable(tdm->mclk);
+       clk_set_rate(tdm->clk, mclk*ratio);
+       clk_set_rate(tdm->mclk, mclk);
+
+       return 0;
+}
+
+
 static struct snd_soc_dai_ops aml_dai_tdm_ops = {
        .prepare = aml_dai_tdm_prepare,
        .trigger = aml_dai_tdm_trigger,
@@ -1556,6 +1582,9 @@ static int aml_tdm_platform_probe(struct platform_device *pdev)
                /*return PTR_ERR(p_tdm->pin_ctl);*/
        }
 
+       /*set default clk for output*/
+       aml_set_default_tdm_clk(p_tdm);
+
        /* mclk pad ctrl */
        ret = of_property_read_u32(node, "mclk_pad",
                        &p_tdm->mclk_pad);
index 3fd69a6..0c4bf79 100644 (file)
@@ -773,7 +773,7 @@ static int reset_ad82584f_GPIO(struct snd_soc_codec *codec)
                return -1;
 
        gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_LOW);
-       mdelay(1);
+       mdelay(10);
        gpio_direction_output(pdata->reset_pin, GPIOF_OUT_INIT_HIGH);
        mdelay(1);