audio: Add binv setting [1/2]
authoryujie.wu <yujie.wu@amlogic.com>
Fri, 22 Feb 2019 05:47:22 +0000 (13:47 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 25 Feb 2019 05:06:26 +0000 (21:06 -0800)
PD#SWPL-4733

Problem:
  The Speaker has noise

Solution:
  The binv is not correct for TDM out c,
  we will use amixer to set it

Verify:
  A113

Change-Id: I7c8af8e00e3c8834533347947630a6944b7e2136
Signed-off-by: yujie.wu <yujie.wu@amlogic.com>
sound/soc/amlogic/auge/audio_utils.c

index d25bb7ad3d665c2605e24597a7834dee86b04d52..c710d16c596ee9b4eebc8791e593525507671b17 100644 (file)
@@ -669,6 +669,40 @@ static int audio_inskew_set_enum(
        return 0;
 }
 
+static const char *const tdmout_c_binv_texts[] = {
+       "0",
+       "1",
+};
+
+static const struct soc_enum tdmout_c_binv_enum =
+       SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(tdmout_c_binv_texts),
+                       tdmout_c_binv_texts);
+
+
+static int tdmout_c_binv_get_enum(
+       struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *ucontrol)
+{
+       unsigned int val;
+
+       val = audiobus_read(EE_AUDIO_CLK_TDMOUT_C_CTRL);
+       ucontrol->value.enumerated.item[0] = ((val >> 29) & 0x1);
+
+       return 0;
+}
+
+static int tdmout_c_binv_set_enum(
+       struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *ucontrol)
+{
+       int binv;
+
+       binv = ucontrol->value.enumerated.item[0];
+       audiobus_update_bits(EE_AUDIO_CLK_TDMOUT_C_CTRL, 0x1 << 29, binv << 29);
+
+       return 0;
+}
+
 
 
 #define SND_MIX(xname, type, xenum, xshift, xmask)   \
@@ -977,6 +1011,11 @@ static const struct snd_kcontrol_new snd_auge_controls[] = {
                     audio_inskew_enum,
                     audio_inskew_get_enum,
                     audio_inskew_set_enum),
+       /* tdmc out binv */
+       SOC_ENUM_EXT("tdmout_c binv set",
+                    tdmout_c_binv_enum,
+                    tdmout_c_binv_get_enum,
+                    tdmout_c_binv_set_enum),
 };