audio: enable hw resmaple pause thd [1/1]
authorShuai Li <shuai.li@amlogic.com>
Thu, 18 Apr 2019 10:15:54 +0000 (18:15 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Sun, 21 Apr 2019 11:39:26 +0000 (04:39 -0700)
PD#TV-4638

Problem:
Speaker output high frequency howling
after change from pattern 615 to pattern 1 on chroma22294.
The hw resampler keeps sending noise if it has no input.

Solution:
Enable the hw resample pause thd by default.

Verify:
TL1 X301.

Change-Id: I076d1b80c6482661fdc3fd5808f1cc231666d07e
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
sound/soc/amlogic/auge/resample.c
sound/soc/amlogic/auge/resample_hw.c
sound/soc/amlogic/auge/resample_hw.h

index 8678361..90791ef 100644 (file)
@@ -440,11 +440,11 @@ static const struct snd_kcontrol_new asrc_a_controls[] = {
                     resample_set_enum),
        SOC_SINGLE_EXT_TLV("Hw resample pause enable",
                         EE_AUDIO_RESAMPLEA_CTRL2, 24, 0x1, 0,
-                        mixer_audiobus_read, mixer_audiobus_write,
+                        mixer_audiobus_read, NULL,
                         NULL),
        SOC_SINGLE_EXT_TLV("Hw resample pause thd",
-                        EE_AUDIO_RESAMPLEA_CTRL2, 0, 0xffffff, 0,
-                        mixer_audiobus_read, mixer_audiobus_write,
+                        EE_AUDIO_RESAMPLEA_CTRL2, 11, 0x1fff, 0,
+                        mixer_audiobus_read, NULL,
                         NULL),
        SOC_ENUM_EXT("Hw resample module",
                     auge_resample_module_enum,
@@ -459,11 +459,11 @@ static const struct snd_kcontrol_new asrc_b_controls[] = {
                     resample_set_enum),
        SOC_SINGLE_EXT_TLV("Hw resample b pause enable",
                         EE_AUDIO_RESAMPLEB_CTRL2, 24, 0x1, 0,
-                        mixer_audiobus_read, mixer_audiobus_write,
+                        mixer_audiobus_read, NULL,
                         NULL),
        SOC_SINGLE_EXT_TLV("Hw resample b pause thd",
-                        EE_AUDIO_RESAMPLEB_CTRL2, 0, 0xffffff, 0,
-                        mixer_audiobus_read, mixer_audiobus_write,
+                        EE_AUDIO_RESAMPLEB_CTRL2, 11, 0x1fff, 0,
+                        mixer_audiobus_read, NULL,
                         NULL),
        SOC_ENUM_EXT("Hw resample b module",
                     auge_resample_module_enum,
index 03ca3aa..73c7dd3 100644 (file)
@@ -115,6 +115,7 @@ int resample_set_hw_param(enum resample_idx id,
        reg = EE_AUDIO_RESAMPLEA_CTRL2 + offset * id;
        audiobus_update_bits(reg,
                        1 << 25, 1 << 25);
+       resample_set_hw_pause_thd(id, 128);
 
        return 0;
 }
@@ -160,3 +161,13 @@ void resample_ctrl_write(enum resample_idx id, int value)
 
        audiobus_write(reg, value);
 }
+
+int resample_set_hw_pause_thd(enum resample_idx id, unsigned int thd)
+{
+       int offset = EE_AUDIO_RESAMPLEB_CTRL2 - EE_AUDIO_RESAMPLEA_CTRL2;
+       int reg = EE_AUDIO_RESAMPLEA_CTRL2 + offset * id;
+
+       audiobus_write(reg, 1 << 24 | thd << 11);
+
+       return 0;
+}
index 5d7c3dd..61b0629 100644 (file)
@@ -41,5 +41,6 @@ extern void resample_format_set(enum resample_idx id, int ch_num, int bits);
 
 extern int resample_ctrl_read(enum resample_idx id);
 extern void resample_ctrl_write(enum resample_idx id, int value);
+int resample_set_hw_pause_thd(enum resample_idx id, unsigned int thd);
 
 #endif