From 4389dbd8ec41bf41282b41aa0d83133f1dd4d264 Mon Sep 17 00:00:00 2001 From: Shunhua Lan Date: Thu, 20 Jun 2024 17:17:35 +0800 Subject: [PATCH] ASoC: es8323: Add a switch for dapm route to control "Speaker/Headphone Power" widgets "Right Mixer" -> "Right Out 1" -> "OUT1" -> "ROUT1" -> "Speaker Power" "Left Mixer" -> "Left Out 1" -> "OUT1" -> "LOUT1" -> "Speaker Power" Change-Id: I31b8dc4e3ae0cfe7d28c5ad811851912914c2aca Signed-off-by: Shunhua Lan --- sound/soc/codecs/es8323.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/es8323.c b/sound/soc/codecs/es8323.c index 36c961b2bb67..bf35eaec413c 100644 --- a/sound/soc/codecs/es8323.c +++ b/sound/soc/codecs/es8323.c @@ -237,6 +237,12 @@ static const struct snd_kcontrol_new es8323_right_mixer_controls[] = { SOC_DAPM_SINGLE("Right Bypass Switch", ES8323_DACCONTROL20, 6, 1, 0), }; +static const struct snd_kcontrol_new es8323_out1_switch = + SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0); + +static const struct snd_kcontrol_new es8323_out2_switch = + SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0); + static const struct snd_soc_dapm_widget es8323_dapm_widgets[] = { SND_SOC_DAPM_INPUT("LINPUT1"), SND_SOC_DAPM_INPUT("LINPUT2"), @@ -286,6 +292,8 @@ static const struct snd_soc_dapm_widget es8323_dapm_widgets[] = { SND_SOC_DAPM_PGA("LAMP", ES8323_ADCCONTROL1, 4, 0, NULL, 0), SND_SOC_DAPM_PGA("RAMP", ES8323_ADCCONTROL1, 0, 0, NULL, 0), + SND_SOC_DAPM_SWITCH("OUT1", SND_SOC_NOPM, 0, 0, &es8323_out1_switch), + SND_SOC_DAPM_SWITCH("OUT2", SND_SOC_NOPM, 0, 0, &es8323_out2_switch), SND_SOC_DAPM_OUTPUT("LOUT1"), SND_SOC_DAPM_OUTPUT("ROUT1"), SND_SOC_DAPM_OUTPUT("LOUT2"), @@ -341,14 +349,20 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Right Mixer", "Right Bypass Switch", "Right Line Mux"}, {"Left Out 1", NULL, "Left Mixer"}, - {"LOUT1", NULL, "Left Out 1"}, + {"OUT1", "Switch", "Left Out 1"}, + {"LOUT1", NULL, "OUT1"}, + {"Right Out 1", NULL, "Right Mixer"}, - {"ROUT1", NULL, "Right Out 1"}, + {"OUT1", "Switch", "Right Out 1"}, + {"ROUT1", NULL, "OUT1"}, {"Left Out 2", NULL, "Left Mixer"}, - {"LOUT2", NULL, "Left Out 2"}, + {"OUT2", "Switch", "Left Out 2"}, + {"LOUT2", NULL, "OUT2"}, + {"Right Out 2", NULL, "Right Mixer"}, - {"ROUT2", NULL, "Right Out 2"}, + {"OUT2", "Switch", "Right Out 2"}, + {"ROUT2", NULL, "OUT2"}, }; struct _coeff_div {