From c97d6800dc0d589ba3e6f43366f6259476425c2b Mon Sep 17 00:00:00 2001 From: "yujie.wu" Date: Thu, 11 Apr 2019 10:38:54 +0800 Subject: [PATCH] audio: fix spdif not work on soundbar [1/1] PD#SWPL-6801 Problem: There is too much kernel print which blocks the system Solution: Add condition to remove the print log Verify: A113 Change-Id: I5762893b424e8201e2725f33854473097f1246b9 Signed-off-by: yujie.wu --- sound/soc/amlogic/auge/extn.c | 2 +- sound/soc/amlogic/auge/resample.c | 12 ++++++------ sound/soc/amlogic/auge/resample.h | 3 ++- sound/soc/amlogic/auge/spdif.c | 16 +++++++++------- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/sound/soc/amlogic/auge/extn.c b/sound/soc/amlogic/auge/extn.c index e90909d..d414ddda 100644 --- a/sound/soc/amlogic/auge/extn.c +++ b/sound/soc/amlogic/auge/extn.c @@ -395,7 +395,7 @@ static void extn_dai_shutdown( struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai) { - //resample_set(RESAMPLE_A, RATE_OFF); + //resample_set(RESAMPLE_A, RATE_OFF, false); } static int extn_dai_prepare( diff --git a/sound/soc/amlogic/auge/resample.c b/sound/soc/amlogic/auge/resample.c index 6b2fb6d..43481894 100644 --- a/sound/soc/amlogic/auge/resample.c +++ b/sound/soc/amlogic/auge/resample.c @@ -265,7 +265,8 @@ static int resample_get_enum( return 0; } -int resample_set(enum resample_idx id, enum samplerate_index index) +/* force set to new rate index whatever the resampler holds */ +int resample_set(enum resample_idx id, enum samplerate_index index, bool force) { int resample_rate = 0; struct audioresample *p_resample = get_audioresample(id); @@ -279,16 +280,15 @@ int resample_set(enum resample_idx id, enum samplerate_index index) return 0; } + if (index == p_resample->asrc_rate_idx && !force) + return 0; + pr_info("%s resample_%c to %s, last %s\n", __func__, (id == RESAMPLE_A) ? 'a' : 'b', auge_resample_texts[index], auge_resample_texts[p_resample->asrc_rate_idx]); -#if 0 - if (index == p_resample->asrc_rate_idx) - return 0; -#endif set_resample_rate_index(id, index); resample_rate = resample_idx2rate(index); @@ -313,7 +313,7 @@ int resample_set_inner_rate(enum resample_idx id) pr_debug("%s() index %d\n", __func__, id); - return resample_set(id, index); + return resample_set(id, index, true); } static int resample_set_enum( diff --git a/sound/soc/amlogic/auge/resample.h b/sound/soc/amlogic/auge/resample.h index b82aac3..c973522 100644 --- a/sound/soc/amlogic/auge/resample.h +++ b/sound/soc/amlogic/auge/resample.h @@ -21,7 +21,8 @@ extern int card_add_resample_kcontrols(struct snd_soc_card *card); -extern int resample_set(enum resample_idx id, enum samplerate_index index); +extern int resample_set(enum resample_idx id, + enum samplerate_index index, bool force); extern int get_resample_module_num(void); diff --git a/sound/soc/amlogic/auge/spdif.c b/sound/soc/amlogic/auge/spdif.c index e8bead0..375a3a0 100644 --- a/sound/soc/amlogic/auge/spdif.c +++ b/sound/soc/amlogic/auge/spdif.c @@ -483,10 +483,10 @@ static void spdifin_audio_type_work_func(struct work_struct *work) if (val & 0x2) /* nonpcm, resample disable */ - resample_set(p_spdif->asrc_id, RATE_OFF); + resample_set(p_spdif->asrc_id, RATE_OFF, false); else /* pcm, resample which rate ? */ - resample_set(p_spdif->asrc_id, p_spdif->auto_asrc); + resample_set(p_spdif->asrc_id, p_spdif->auto_asrc, false); } static void spdifin_audio_type_detect_init(struct aml_spdif *p_spdif) @@ -672,7 +672,7 @@ static void spdifin_status_event(struct aml_spdif *p_spdif) /* resample enable, by hw */ if (!spdifin_check_audiotype_by_sw(p_spdif)) resample_set(p_spdif->asrc_id, - p_spdif->auto_asrc); + p_spdif->auto_asrc, false); #endif extcon_set_state(p_spdif->edev, EXTCON_SPDIFIN_SAMPLERATE, 1); @@ -694,7 +694,7 @@ static void spdifin_status_event(struct aml_spdif *p_spdif) #ifdef __SPDIFIN_AUDIO_TYPE_HW__ /* resample disable, by hw */ if (!spdifin_check_audiotype_by_sw(p_spdif)) - resample_set(p_spdif->asrc_id, RATE_OFF); + resample_set(p_spdif->asrc_id, RATE_OFF, false); #endif #endif } @@ -728,7 +728,8 @@ static void spdifin_status_event(struct aml_spdif *p_spdif) #ifdef __SPDIFIN_AUDIO_TYPE_HW__ /* resample to 48k, by hw */ if (!spdifin_check_audiotype_by_sw(p_spdif)) - resample_set(p_spdif->asrc_id, p_spdif->auto_asrc); + resample_set(p_spdif->asrc_id, + p_spdif->auto_asrc, false); #endif } if (intrpt_status & 0x40) @@ -1097,7 +1098,8 @@ static int aml_dai_spdif_startup( #ifdef __SPDIFIN_AUDIO_TYPE_HW__ /* resample to 48k in default, by hw */ if (!spdifin_check_audiotype_by_sw(p_spdif)) - resample_set(p_spdif->asrc_id, p_spdif->auto_asrc); + resample_set(p_spdif->asrc_id, + p_spdif->auto_asrc, false); #endif } @@ -1128,7 +1130,7 @@ static void aml_dai_spdif_shutdown( #ifdef __SPDIFIN_AUDIO_TYPE_HW__ /* resample disabled, by hw */ if (!spdifin_check_audiotype_by_sw(p_spdif)) - resample_set(p_spdif->asrc_id, RATE_OFF); + resample_set(p_spdif->asrc_id, RATE_OFF, false); #endif clk_disable_unprepare(p_spdif->clk_spdifin); clk_disable_unprepare(p_spdif->fixed_clk); -- 2.7.4