From e50d47a5ee07e92b05f544b42d1623f7aa0e4cd4 Mon Sep 17 00:00:00 2001 From: Shuai Li Date: Fri, 10 May 2019 13:51:43 +0800 Subject: [PATCH] audio: support 48k out & 16k loopback [1/1] PD#SWPL-7741 Problem: Enable the loopback function. Fix 48k output & 16k loopback abnormal. Solution: Fix the resample source. DO not touch output clk at loopback driver. Verify: Sm1, AC213 Change-Id: I210083813e9e6ec834941da333f8ce076e9afbcf Signed-off-by: Shuai Li --- sound/soc/amlogic/auge/ddr_mngr.c | 5 ++--- sound/soc/amlogic/auge/ddr_mngr.h | 2 +- sound/soc/amlogic/auge/loopback.c | 22 +++++++++++----------- sound/soc/amlogic/auge/resample_hw.c | 2 +- sound/soc/amlogic/auge/resample_hw.h | 2 +- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/sound/soc/amlogic/auge/ddr_mngr.c b/sound/soc/amlogic/auge/ddr_mngr.c index baa4fa7..da98f08 100644 --- a/sound/soc/amlogic/auge/ddr_mngr.c +++ b/sound/soc/amlogic/auge/ddr_mngr.c @@ -566,7 +566,6 @@ static void aml_resample_enable( if (to->chipinfo && to->chipinfo->asrc_src_sel_ctrl) { /* fix asrc_src_sel */ - /* switch (p_attach_resample->attach_module) { case LOOPBACK_A: to->asrc_src_sel = ASRC_LOOPBACK_A; @@ -578,8 +577,8 @@ static void aml_resample_enable( to->asrc_src_sel = to->fifo_id; break; } - */ - to->asrc_src_sel = p_attach_resample->attach_module; + + /*to->asrc_src_sel = p_attach_resample->attach_module;*/ } pr_info("toddr %d selects data to %s resample_%c for module:%s\n", diff --git a/sound/soc/amlogic/auge/ddr_mngr.h b/sound/soc/amlogic/auge/ddr_mngr.h index c9e2203..a47a002 100644 --- a/sound/soc/amlogic/auge/ddr_mngr.h +++ b/sound/soc/amlogic/auge/ddr_mngr.h @@ -173,7 +173,7 @@ struct toddr { enum toddr_src src; unsigned int fifo_id; - enum toddr_src asrc_src_sel; + enum resample_src asrc_src_sel; int is_lb; /* check whether for loopback */ int irq; diff --git a/sound/soc/amlogic/auge/loopback.c b/sound/soc/amlogic/auge/loopback.c index 95178bd..31fe198 100644 --- a/sound/soc/amlogic/auge/loopback.c +++ b/sound/soc/amlogic/auge/loopback.c @@ -364,7 +364,7 @@ static void datain_pdm_shutdown(struct loopback *p_loopback) clk_disable_unprepare(p_loopback->pdm_dclk_srcpll); clk_disable_unprepare(p_loopback->pdm_clk_gate); } - +#if 0 static int tdminlb_startup(struct loopback *p_loopback) { int ret; @@ -394,7 +394,7 @@ static void tdminlb_shutdown(struct loopback *p_loopback) clk_disable_unprepare(p_loopback->tdminlb_mclk); clk_disable_unprepare(p_loopback->tdminlb_mpll); } - +#endif static int loopback_dai_startup( struct snd_pcm_substream *ss, struct snd_soc_dai *dai) @@ -431,7 +431,7 @@ static int loopback_dai_startup( /* datalb */ switch (p_loopback->datalb_src) { case TDMINLB_TDMOUTA ... TDMINLB_PAD_TDMINC: - tdminlb_startup(p_loopback); + /*tdminlb_startup(p_loopback);*/ break; case SPDIFINLB_SPDIFOUTA ... SPDIFINLB_SPDIFOUTB: break; @@ -473,7 +473,7 @@ static void loopback_dai_shutdown( /* datalb */ switch (p_loopback->datalb_src) { case TDMINLB_TDMOUTA ... TDMINLB_PAD_TDMINC: - tdminlb_shutdown(p_loopback); + /*tdminlb_shutdown(p_loopback);*/ break; case SPDIFINLB_SPDIFOUTA ... SPDIFINLB_SPDIFOUTB: break; @@ -486,8 +486,8 @@ static void loopback_dai_shutdown( static void loopback_set_clk(struct loopback *p_loopback, int rate, bool enable) { - unsigned int mul = 2; - unsigned int mpll_freq, mclk_freq; + /* unsigned int mul = 2; */ + /* unsigned int mpll_freq, mclk_freq; */ /* assume datain_lb in i2s format, 2ch, 32bit */ unsigned int bit_depth = 32, i2s_ch = 2; unsigned int sclk_div = 4 - 1; @@ -496,7 +496,7 @@ static void loopback_set_clk(struct loopback *p_loopback, /* lb_datain clk is set * prepare clocks for tdmin_lb */ - +#if 0 /* mpll, mclk */ if (p_loopback->datalb_src >= 3) { mclk_freq = rate * p_loopback->mclk_fs_ratio; @@ -511,7 +511,7 @@ static void loopback_set_clk(struct loopback *p_loopback, clk_get_rate(p_loopback->tdminlb_mclk), clk_get_rate(p_loopback->tdminlb_mpll)); } - +#endif #ifdef __PTM_TDM_CLK__ ratio = 18 * 2; #endif @@ -810,7 +810,7 @@ static void datain_pdm_set_clk(struct loopback *p_loopback) clk_get_rate(p_loopback->pdm_sysclk), clk_get_rate(p_loopback->pdm_dclk)); } - +#if 0 static void datalb_tdminlb_set_clk(struct loopback *p_loopback) { int mpll_freq = p_loopback->sysclk_freq * 2; @@ -822,7 +822,7 @@ static void datalb_tdminlb_set_clk(struct loopback *p_loopback) clk_get_rate(p_loopback->tdminlb_mpll), clk_get_rate(p_loopback->tdminlb_mclk)); } - +#endif static int loopback_dai_hw_params( struct snd_pcm_substream *ss, struct snd_pcm_hw_params *params, @@ -862,7 +862,7 @@ static int loopback_dai_hw_params( /* datalb */ switch (p_loopback->datalb_src) { case TDMINLB_TDMOUTA ... TDMINLB_PAD_TDMINC: - datalb_tdminlb_set_clk(p_loopback); + /*datalb_tdminlb_set_clk(p_loopback);*/ break; case SPDIFINLB_SPDIFOUTA ... SPDIFINLB_SPDIFOUTB: break; diff --git a/sound/soc/amlogic/auge/resample_hw.c b/sound/soc/amlogic/auge/resample_hw.c index 73c7dd3..97a21b9 100644 --- a/sound/soc/amlogic/auge/resample_hw.c +++ b/sound/soc/amlogic/auge/resample_hw.c @@ -127,7 +127,7 @@ void resample_src_select(int src) src << 29); } /* for tl1 and after */ -void resample_src_select_ab(enum resample_idx id, enum toddr_src src) +void resample_src_select_ab(enum resample_idx id, enum resample_src src) { int offset = EE_AUDIO_RESAMPLEB_CTRL3 - EE_AUDIO_RESAMPLEA_CTRL3; int reg = EE_AUDIO_RESAMPLEA_CTRL3 + offset * id; diff --git a/sound/soc/amlogic/auge/resample_hw.h b/sound/soc/amlogic/auge/resample_hw.h index 61b0629..d3d7090 100644 --- a/sound/soc/amlogic/auge/resample_hw.h +++ b/sound/soc/amlogic/auge/resample_hw.h @@ -36,7 +36,7 @@ extern int resample_disable(enum resample_idx id); extern int resample_set_hw_param(enum resample_idx id, enum samplerate_index rate_index); extern void resample_src_select(int src); -extern void resample_src_select_ab(enum resample_idx id, enum toddr_src src); +extern void resample_src_select_ab(enum resample_idx id, enum resample_src src); extern void resample_format_set(enum resample_idx id, int ch_num, int bits); extern int resample_ctrl_read(enum resample_idx id); -- 2.7.4