Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd5f940f authored by Andrew Bresticker's avatar Andrew Bresticker Committed by Mark Brown
Browse files

ASoC: max98090: add digital mic mux to record path



The max98090 driver currently treats the digital mic enable as a supply
on the record path, causing the digital mic enable to always be turned on
when attempting to record.  This is incorrect, however, since the digital
mic enable is also a mux control where 0 selects the ADC output as input
to the record-path DSP and 1 selects the digital mic.  This patch adds
a virtual DMIC mux to the reocrd path so that we can switch between the
ADC and the digital mic for recording.

Signed-off-by: default avatarAndrew Bresticker <abrestic@chromium.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent f722406f
Loading
Loading
Loading
Loading
+18 −4
Original line number Original line Diff line number Diff line
@@ -857,6 +857,14 @@ static const struct soc_enum mic2_mux_enum =
static const struct snd_kcontrol_new max98090_mic2_mux =
static const struct snd_kcontrol_new max98090_mic2_mux =
	SOC_DAPM_ENUM("MIC2 Mux", mic2_mux_enum);
	SOC_DAPM_ENUM("MIC2 Mux", mic2_mux_enum);


static const char *dmic_mux_text[] = { "ADC", "DMIC" };

static const struct soc_enum dmic_mux_enum =
	SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(dmic_mux_text), dmic_mux_text);

static const struct snd_kcontrol_new max98090_dmic_mux =
	SOC_DAPM_ENUM_VIRT("DMIC Mux", dmic_mux_enum);

static const char *max98090_micpre_text[] = { "Off", "On" };
static const char *max98090_micpre_text[] = { "Off", "On" };


static const struct soc_enum max98090_pa1en_enum =
static const struct soc_enum max98090_pa1en_enum =
@@ -1144,6 +1152,9 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = {
	SND_SOC_DAPM_MUX("MIC2 Mux", SND_SOC_NOPM,
	SND_SOC_DAPM_MUX("MIC2 Mux", SND_SOC_NOPM,
		0, 0, &max98090_mic2_mux),
		0, 0, &max98090_mic2_mux),


	SND_SOC_DAPM_VIRT_MUX("DMIC Mux", SND_SOC_NOPM,
		0, 0, &max98090_dmic_mux),

	SND_SOC_DAPM_PGA_E("MIC1 Input", M98090_REG_MIC1_INPUT_LEVEL,
	SND_SOC_DAPM_PGA_E("MIC1 Input", M98090_REG_MIC1_INPUT_LEVEL,
		M98090_MIC_PA1EN_SHIFT, 0, NULL, 0, max98090_micinput_event,
		M98090_MIC_PA1EN_SHIFT, 0, NULL, 0, max98090_micinput_event,
		SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
		SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
@@ -1336,11 +1347,14 @@ static const struct snd_soc_dapm_route max98090_dapm_routes[] = {
	{"ADCL", NULL, "SHDN"},
	{"ADCL", NULL, "SHDN"},
	{"ADCR", NULL, "SHDN"},
	{"ADCR", NULL, "SHDN"},


	{"LBENL Mux", "Normal", "ADCL"},
	{"DMIC Mux", "ADC", "ADCL"},
	{"LBENL Mux", "Normal", "DMICL"},
	{"DMIC Mux", "ADC", "ADCR"},
	{"DMIC Mux", "DMIC", "DMICL"},
	{"DMIC Mux", "DMIC", "DMICR"},

	{"LBENL Mux", "Normal", "DMIC Mux"},
	{"LBENL Mux", "Loopback", "LTENL Mux"},
	{"LBENL Mux", "Loopback", "LTENL Mux"},
	{"LBENR Mux", "Normal", "ADCR"},
	{"LBENR Mux", "Normal", "DMIC Mux"},
	{"LBENR Mux", "Normal", "DMICR"},
	{"LBENR Mux", "Loopback", "LTENR Mux"},
	{"LBENR Mux", "Loopback", "LTENR Mux"},


	{"AIFOUTL", NULL, "LBENL Mux"},
	{"AIFOUTL", NULL, "LBENL Mux"},