diff --git a/sound/soc/amlogic/auge/tdm.c b/sound/soc/amlogic/auge/tdm.c index 15cc01fd8c6c..5bf2933b4bea 100644 --- a/sound/soc/amlogic/auge/tdm.c +++ b/sound/soc/amlogic/auge/tdm.c @@ -1265,6 +1265,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, @@ -1565,6 +1591,9 @@ static int aml_tdm_platform_probe(struct platform_device *pdev) if (ret < 0) p_tdm->mclk_pad = -1; /* not use mclk in defalut. */ + /*set default clk for output*/ + aml_set_default_tdm_clk(p_tdm); + p_tdm->dev = dev; /* For debug to disable share buffer */ p_tdm->en_share = 1;