From 6ead1ca51d3864f78e50c34f2f571467f0984ccf Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Fri, 19 Aug 2022 22:01:23 +0200
Subject: [PATCH 328/463] ASoC: codecs: rt5640: Fix output mixer input channel
 list

It did not match the RT5640 datasheet. Now it does.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 sound/soc/codecs/rt5640.c | 14 +++++++-------
 sound/soc/codecs/rt5640.h | 16 ++++++----------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 16f3425a3e35c..0588d4052b82a 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -651,8 +651,8 @@ static const struct snd_kcontrol_new rt5640_spk_r_mix[] = {
 };
 
 static const struct snd_kcontrol_new rt5640_out_l_mix[] = {
-	SOC_DAPM_SINGLE("SPK MIXL Switch", RT5640_OUT_L3_MIXER,
-			RT5640_M_SM_L_OM_L_SFT, 1, 1),
+	SOC_DAPM_SINGLE("BST3 Switch", RT5640_OUT_L3_MIXER,
+			RT5640_M_BST3_OM_L_SFT, 1, 1),
 	SOC_DAPM_SINGLE("BST1 Switch", RT5640_OUT_L3_MIXER,
 			RT5640_M_BST1_OM_L_SFT, 1, 1),
 	SOC_DAPM_SINGLE("INL Switch", RT5640_OUT_L3_MIXER,
@@ -668,10 +668,10 @@ static const struct snd_kcontrol_new rt5640_out_l_mix[] = {
 };
 
 static const struct snd_kcontrol_new rt5640_out_r_mix[] = {
-	SOC_DAPM_SINGLE("SPK MIXR Switch", RT5640_OUT_R3_MIXER,
-			RT5640_M_SM_L_OM_R_SFT, 1, 1),
 	SOC_DAPM_SINGLE("BST2 Switch", RT5640_OUT_R3_MIXER,
-			RT5640_M_BST4_OM_R_SFT, 1, 1),
+			RT5640_M_BST2_OM_R_SFT, 1, 1),
+	SOC_DAPM_SINGLE("BST3 Switch", RT5640_OUT_R3_MIXER,
+			RT5640_M_BST3_OM_R_SFT, 1, 1),
 	SOC_DAPM_SINGLE("BST1 Switch", RT5640_OUT_R3_MIXER,
 			RT5640_M_BST1_OM_R_SFT, 1, 1),
 	SOC_DAPM_SINGLE("INR Switch", RT5640_OUT_R3_MIXER,
@@ -1603,8 +1603,8 @@ static const struct snd_soc_dapm_route rt5640_specific_dapm_routes[] = {
 	{"SPK MIXL", "DAC L2 Switch", "DAC L2"},
 	{"SPK MIXR", "DAC R2 Switch", "DAC R2"},
 
-	{"OUT MIXL", "SPK MIXL Switch", "SPK MIXL"},
-	{"OUT MIXR", "SPK MIXR Switch", "SPK MIXR"},
+	{"OUT MIXL", "BST3 Switch", "BST3"},
+	{"OUT MIXR", "BST3 Switch", "BST3"},
 
 	{"OUT MIXL", "DAC R2 Switch", "DAC R2"},
 	{"OUT MIXL", "DAC L2 Switch", "DAC L2"},
diff --git a/sound/soc/codecs/rt5640.h b/sound/soc/codecs/rt5640.h
index 94b9a502f7f9d..ea5e29b0abec6 100644
--- a/sound/soc/codecs/rt5640.h
+++ b/sound/soc/codecs/rt5640.h
@@ -654,12 +654,8 @@
 #define RT5640_G_DAC_L1_OM_L_SFT		7
 
 /* Output Left Mixer Control 3 (0x4f) */
-#define RT5640_M_SM_L_OM_L			(0x1 << 8)
-#define RT5640_M_SM_L_OM_L_SFT			8
-#define RT5640_M_BST3_OM_L			(0x1 << 7)
-#define RT5640_M_BST3_OM_L_SFT			7
-#define RT5640_M_BST2_OM_L			(0x1 << 6)
-#define RT5640_M_BST2_OM_L_SFT			6
+#define RT5640_M_BST3_OM_L			(0x1 << 6)
+#define RT5640_M_BST3_OM_L_SFT			6
 #define RT5640_M_BST1_OM_L			(0x1 << 5)
 #define RT5640_M_BST1_OM_L_SFT			5
 #define RT5640_M_IN_L_OM_L			(0x1 << 4)
@@ -694,12 +690,12 @@
 #define RT5640_G_DAC_R1_OM_R_SFT		7
 
 /* Output Right Mixer Control 3 (0x52) */
-#define RT5640_M_SM_L_OM_R			(0x1 << 8)
-#define RT5640_M_SM_L_OM_R_SFT			8
 #define RT5640_M_BST4_OM_R			(0x1 << 7)
 #define RT5640_M_BST4_OM_R_SFT			7
-#define RT5640_M_BST2_OM_R			(0x1 << 6)
-#define RT5640_M_BST2_OM_R_SFT			6
+#define RT5640_M_BST2_OM_R			(0x1 << 7)
+#define RT5640_M_BST2_OM_R_SFT			7
+#define RT5640_M_BST3_OM_R			(0x1 << 6)
+#define RT5640_M_BST3_OM_R_SFT			6
 #define RT5640_M_BST1_OM_R			(0x1 << 5)
 #define RT5640_M_BST1_OM_R_SFT			5
 #define RT5640_M_IN_R_OM_R			(0x1 << 4)
-- 
2.46.0

