ASoC: cs47l35: Add AEC2 Loopback support
authorPaul Handrigan <Paul.Handrigan@cirrus.com>
Mon, 7 Aug 2017 21:42:59 +0000 (16:42 -0500)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:27 +0000 (20:22 +0300)
Add AEC2 Loopback support to have more than one AEC reference.

Change-Id: I601c34d53591669cb54aed5e32547722ddc79245
Signed-off-by: Paul Handrigan <Paul.Handrigan@cirrus.com>
sound/soc/codecs/cs47l35.c

index 159a1768e9f863fe2c9c57c96f5ff201f775e202..cea36a878726ea4d7d91fa07a8c576a693af9bd7 100644 (file)
@@ -509,15 +509,24 @@ static const unsigned int cs47l35_aec_loopback_values[] = {
        0, 1, 6, 8, 9,
 };
 
-static const struct soc_enum cs47l35_aec_loopback =
+static const struct soc_enum cs47l35_aec1_loopback =
        SOC_VALUE_ENUM_SINGLE(MADERA_DAC_AEC_CONTROL_1,
                              MADERA_AEC1_LOOPBACK_SRC_SHIFT, 0xf,
                              ARRAY_SIZE(cs47l35_aec_loopback_texts),
                              cs47l35_aec_loopback_texts,
                              cs47l35_aec_loopback_values);
 
-static const struct snd_kcontrol_new cs47l35_aec_loopback_mux =
-       SOC_DAPM_ENUM("AEC1 Loopback", cs47l35_aec_loopback);
+static const struct soc_enum cs47l35_aec2_loopback =
+       SOC_VALUE_ENUM_SINGLE(MADERA_DAC_AEC_CONTROL_2,
+                             MADERA_AEC2_LOOPBACK_SRC_SHIFT, 0xf,
+                             ARRAY_SIZE(cs47l35_aec_loopback_texts),
+                             cs47l35_aec_loopback_texts,
+                             cs47l35_aec_loopback_values);
+
+static const struct snd_kcontrol_new cs47l35_aec_loopback_mux[] = {
+       SOC_DAPM_ENUM("AEC1 Loopback", cs47l35_aec1_loopback),
+       SOC_DAPM_ENUM("AEC2 Loopback", cs47l35_aec2_loopback),
+};
 
 static const struct snd_soc_dapm_widget cs47l35_dapm_widgets[] = {
 SND_SOC_DAPM_SUPPLY("SYSCLK", MADERA_SYSTEM_CLOCK_1, MADERA_SYSCLK_ENA_SHIFT,
@@ -717,7 +726,11 @@ SND_SOC_DAPM_SIGGEN("HAPTICS"),
 
 SND_SOC_DAPM_MUX("AEC1 Loopback", MADERA_DAC_AEC_CONTROL_1,
                       MADERA_AEC1_LOOPBACK_ENA_SHIFT, 0,
-                      &cs47l35_aec_loopback_mux),
+                      &cs47l35_aec_loopback_mux[0]),
+
+SND_SOC_DAPM_MUX("AEC2 Loopback", MADERA_DAC_AEC_CONTROL_2,
+                      MADERA_AEC2_LOOPBACK_ENA_SHIFT, 0,
+                      &cs47l35_aec_loopback_mux[1]),
 
 SND_SOC_DAPM_PGA_E("IN1L PGA", MADERA_INPUT_ENABLES, MADERA_IN1L_ENA_SHIFT,
                   0, NULL, 0, madera_in_ev,
@@ -945,6 +958,7 @@ SND_SOC_DAPM_OUTPUT("MICSUPP"),
        { name, "Tone Generator 2", "Tone Generator 2" }, \
        { name, "Haptics", "HAPTICS" }, \
        { name, "AEC1", "AEC1 Loopback" }, \
+       { name, "AEC2", "AEC2 Loopback" }, \
        { name, "IN1L", "IN1L PGA" }, \
        { name, "IN1R", "IN1R PGA" }, \
        { name, "IN2L", "IN2L PGA" }, \
@@ -1269,10 +1283,13 @@ static const struct snd_soc_dapm_route cs47l35_dapm_routes[] = {
 
        { "AEC1 Loopback", "HPOUT1L", "OUT1L" },
        { "AEC1 Loopback", "HPOUT1R", "OUT1R" },
+       { "AEC2 Loopback", "HPOUT1L", "OUT1L" },
+       { "AEC2 Loopback", "HPOUT1R", "OUT1R" },
        { "HPOUT1 Demux", NULL, "OUT1L" },
        { "HPOUT1 Demux", NULL, "OUT1R" },
 
        { "AEC1 Loopback", "SPKOUT", "OUT4L" },
+       { "AEC2 Loopback", "SPKOUT", "OUT4L" },
        { "SPKOUTN", NULL, "OUT4L" },
        { "SPKOUTP", NULL, "OUT4L" },
 
@@ -1283,6 +1300,8 @@ static const struct snd_soc_dapm_route cs47l35_dapm_routes[] = {
 
        { "AEC1 Loopback", "SPKDAT1L", "OUT5L" },
        { "AEC1 Loopback", "SPKDAT1R", "OUT5R" },
+       { "AEC2 Loopback", "SPKDAT1L", "OUT5L" },
+       { "AEC2 Loopback", "SPKDAT1R", "OUT5R" },
        { "SPKDAT1L", NULL, "OUT5L" },
        { "SPKDAT1R", NULL, "OUT5R" },