From: Xiaoming Sui Date: Mon, 15 Apr 2019 12:38:47 +0000 (+0800) Subject: avsync: spdif: fix the avsync for ms12 [1/4] X-Git-Tag: hardkernel-4.9.236-104~1372 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=349448751688332d06986aed766e2d51045739ed;p=platform%2Fkernel%2Flinux-amlogic.git avsync: spdif: fix the avsync for ms12 [1/4] PD#SWPL-5837 Problem: dtv is out of avsync when dolby ms12 certificate Solution: when the audio is played, recalculate the apts to sync pcrsrc when pcrmaster. Verify: X301 Change-Id: I199383aa1c0de1b4f0ec646d9d066910b3bb2b42 Signed-off-by: Xiaoming Sui --- diff --git a/sound/soc/amlogic/auge/spdif.c b/sound/soc/amlogic/auge/spdif.c index 3a51ab0..520c982 100644 --- a/sound/soc/amlogic/auge/spdif.c +++ b/sound/soc/amlogic/auge/spdif.c @@ -338,19 +338,35 @@ static int spdif_clk_set(struct snd_kcontrol *kcontrol, { struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol); struct aml_spdif *p_spdif = snd_soc_dai_get_drvdata(cpu_dai); + unsigned int mpll_freq = 0; + int ret; int sysclk = p_spdif->sysclk_freq; int value = ucontrol->value.enumerated.item[0]; - if (value > 2000000 || value < 0) { pr_err("Fine spdif sysclk setting range(0~2000000), %d\n", value); return 0; } - sysclk += (value - 1000000); - - aml_dai_set_spdif_sysclk(cpu_dai, 0, sysclk, 0); - + value = value - 1000000; + sysclk += value; + /* pr_info("spdif_set %d to %d,diff %d\n", + * p_spdif->sysclk_freq,sysclk,value); + */ + mpll_freq = sysclk * 4; + p_spdif->sysclk_freq = sysclk; + clk_set_rate(p_spdif->sysclk, mpll_freq); + clk_set_rate(p_spdif->clk_spdifout, p_spdif->sysclk_freq); + ret = clk_prepare_enable(p_spdif->sysclk); + if (ret) { + pr_err("Can't enable pcm sysclk clock: %d\n", ret); + return 0; + } + ret = clk_prepare_enable(p_spdif->clk_spdifout); + if (ret) { + pr_err("Can't enable clk_spdifout clock: %d\n", ret); + return 0; + } return 0; }