audio: fix spdif not work on soundbar [1/1]
authoryujie.wu <yujie.wu@amlogic.com>
Thu, 11 Apr 2019 02:38:54 +0000 (10:38 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 20 May 2019 02:55:50 +0000 (19:55 -0700)
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>
sound/soc/amlogic/auge/extn.c
sound/soc/amlogic/auge/resample.c
sound/soc/amlogic/auge/resample.h
sound/soc/amlogic/auge/spdif.c

index e90909d..d414ddd 100644 (file)
@@ -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(
index 6b2fb6d..4348189 100644 (file)
@@ -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(
index b82aac3..c973522 100644 (file)
@@ -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);
 
index 03ed3a9..acc4822 100644 (file)
@@ -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);