summaryrefslogtreecommitdiff
authoryujie.wu <yujie.wu@amlogic.com>2019-04-11 02:38:54 (GMT)
committer Jianxin Pan <jianxin.pan@amlogic.com>2019-05-20 02:55:50 (GMT)
commitf20dc57a19617f8edfcb24f649af99594b30618b (patch)
treef4e9cc5616816d1c84f0ee922a6640179056a273
parentd34c9b89175235ea616c6018a132d506fa3616b4 (diff)
downloadcommon-f20dc57a19617f8edfcb24f649af99594b30618b.zip
common-f20dc57a19617f8edfcb24f649af99594b30618b.tar.gz
common-f20dc57a19617f8edfcb24f649af99594b30618b.tar.bz2
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 <yujie.wu@amlogic.com>
Diffstat
-rw-r--r--sound/soc/amlogic/auge/extn.c2
-rw-r--r--sound/soc/amlogic/auge/resample.c12
-rw-r--r--sound/soc/amlogic/auge/resample.h3
-rw-r--r--sound/soc/amlogic/auge/spdif.c16
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 03ed3a9..acc4822 100644
--- a/sound/soc/amlogic/auge/spdif.c
+++ b/sound/soc/amlogic/auge/spdif.c
@@ -459,10 +459,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)
@@ -648,7 +648,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);
@@ -670,7 +670,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
}
@@ -704,7 +704,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)
@@ -1071,7 +1072,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
}
@@ -1102,7 +1104,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);