summarylogtreecommitdiffstats
path: root/0016-cleanup-controls.patch
blob: 1a458c0da3246e7204ef38bd8c899365fef5e9d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
index d19d84bee1ef..a84864df9299 100644
--- a/sound/soc/codecs/tas2783-sdw.c
+++ b/sound/soc/codecs/tas2783-sdw.c
@@ -890,12 +890,17 @@ static const struct snd_soc_dapm_widget tas_dapm_widgets[] = {
 	SND_SOC_DAPM_DAC("FU21", NULL, SND_SOC_NOPM, 0, 0),
 	SND_SOC_DAPM_DAC("FU23", NULL, SND_SOC_NOPM, 0, 0),
 
+    /* I/V Sense PGAs */
+    SND_SOC_DAPM_PGA("I Sense", TAS2783_ISNS_CONF, 6, 0, NULL, 0),
+    SND_SOC_DAPM_PGA("V Sense", TAS2783_VSNS_CONF, 6, 0, NULL, 0),
+	SND_SOC_DAPM_SIGGEN("I Gen"),
+	SND_SOC_DAPM_SIGGEN("V Gen"),
+
 	SND_SOC_DAPM_REG(snd_soc_dapm_supply, "Speaker Power",
 	     SDW_SDCA_CTL(FUNC_NUM_SMART_AMP, TAS2783_SDCA_ENT_PDE23, TAS2783_SDCA_CTL_REQ_POW_STATE, 0),
 	     0, 0x3, TAS2783_SDCA_POW_STATE_ON, TAS2783_SDCA_POW_STATE_OFF),
 
 	SND_SOC_DAPM_OUTPUT("SPK"),
-	SND_SOC_DAPM_INPUT("DMIC"),
 };
 
 static const struct snd_soc_dapm_route tas_audio_map[] = {
@@ -908,9 +913,12 @@ static const struct snd_soc_dapm_route tas_audio_map[] = {
 	{"SPK", NULL, "FU21"},
 	{"SPK", NULL, "FU23"},
 
-	{"ASI", NULL, "Speaker Power"},
+    { "I Sense", NULL, "I Gen" },
+    { "V Sense", NULL, "V Gen" },
+    { "ASI OUT", NULL, "I Sense" },
+    { "ASI OUT", NULL, "V Sense" },
 
-	{"ASI OUT", NULL, "DMIC"},
+	{"ASI", NULL, "Speaker Power"},
 };
 
 static s32 tas_set_sdw_stream(struct snd_soc_dai *dai,
@@ -1001,14 +1009,14 @@ static struct snd_soc_dai_driver tas_dai_driver[] = {
 		.playback = {
 			.stream_name	= "Playback",
 			.channels_min	= 1,
-			.channels_max	= 4,
+			.channels_max	= 1,
 			.rates		= TAS2783_DEVICE_RATES,
 			.formats	= TAS2783_DEVICE_FORMATS,
 		},
 		.capture = {
 			.stream_name	= "Capture",
 			.channels_min	= 1,
-			.channels_max	= 4,
+			.channels_max	= 1,
 			.rates		= TAS2783_DEVICE_RATES,
 			.formats	= TAS2783_DEVICE_FORMATS,
 		},
diff --git a/sound/soc/codecs/tas2783.h b/sound/soc/codecs/tas2783.h
index bf34319c9a9f..550298ecc17d 100644
--- a/sound/soc/codecs/tas2783.h
+++ b/sound/soc/codecs/tas2783.h
@@ -34,6 +34,9 @@
 #define TAS2783_AMP_LEVEL	TASDEV_REG_SDW(0x0, 0x00, 0x03)
 #define TAS2783_AMP_LEVEL_MASK	GENMASK(5, 1)
 
+#define TAS2783_VSNS_CONF	TASDEV_REG_SDW(0x0, 0x00, 0x0E)
+#define TAS2783_ISNS_CONF	TASDEV_REG_SDW(0x0, 0x00, 0x0F)
+
 #define PRAM_ADDR_START		TASDEV_REG_SDW(0x8c, 0x01, 0x8)
 #define PRAM_ADDR_END		TASDEV_REG_SDW(0x8c, 0xff, 0x7f)
 #define YRAM_ADDR_START		TASDEV_REG_SDW(0x00, 0x02, 0x8)
diff --git a/sound/soc/sdw_utils/soc_sdw_ti_amp.c b/sound/soc/sdw_utils/soc_sdw_ti_amp.c
index e26462c87261..ee12a189a243 100644
--- a/sound/soc/sdw_utils/soc_sdw_ti_amp.c
+++ b/sound/soc/sdw_utils/soc_sdw_ti_amp.c
@@ -18,8 +18,7 @@ int asoc_sdw_ti_spk_rtd_init(struct snd_soc_pcm_runtime *rtd,
 	struct snd_soc_card *card = rtd->card;
 	struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
 	char widget_name[16];
-	char speaker[16];
-	struct snd_soc_dapm_route route = {speaker, NULL, widget_name};
+	struct snd_soc_dapm_route route = {"Speaker", NULL, widget_name};
 	struct snd_soc_dai *codec_dai;
 	const char *prefix;
 	int i, ret = 0;
@@ -29,27 +28,11 @@ int asoc_sdw_ti_spk_rtd_init(struct snd_soc_pcm_runtime *rtd,
 			continue;
 
 		prefix = codec_dai->component->name_prefix;
-		if (!strncmp(prefix, "tas2783-1", strlen("tas2783-1"))) {
-			strscpy(speaker, "Left Spk", sizeof(speaker));
-		} else if (!strncmp(prefix, "tas2783-2", strlen("tas2783-2"))) {
-			strscpy(speaker, "Right Spk", sizeof(speaker));
-		} else if (!strncmp(prefix, "tas2783-3", strlen("tas2783-3"))) {
-			strscpy(speaker, "Left Spk2", sizeof(speaker));
-		} else if (!strncmp(prefix, "tas2783-4", strlen("tas2783-4"))) {
-			strscpy(speaker, "Right Spk2", sizeof(speaker));
-		} else {
-			ret = -EINVAL;
-			dev_err(card->dev, "unhandled prefix %s", prefix);
-			break;
-		}
-
 		snprintf(widget_name, sizeof(widget_name), "%s SPK", prefix);
-
 		ret = snd_soc_dapm_add_routes(dapm, &route, 1);
 		if (ret)
 			return ret;
 	}
-
 	return ret;
 }
 EXPORT_SYMBOL_NS(asoc_sdw_ti_spk_rtd_init, "SND_SOC_SDW_UTILS");
diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c
index 46dffc5a104c..15ea494798b7 100644
--- a/sound/soc/sdw_utils/soc_sdw_utils.c
+++ b/sound/soc/sdw_utils/soc_sdw_utils.c
@@ -84,10 +84,10 @@ struct asoc_sdw_codec_info codec_info_list[] = {
 				.dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_AMP_IN_DAI_ID},
 				.init = asoc_sdw_ti_amp_init,
 				.rtd_init = asoc_sdw_ti_spk_rtd_init,
-				.controls = lr_4spk_controls,
-				.num_controls = ARRAY_SIZE(lr_4spk_controls),
-				.widgets = lr_4spk_widgets,
-				.num_widgets = ARRAY_SIZE(lr_4spk_widgets),
+				.controls = generic_spk_controls,
+				.num_controls = ARRAY_SIZE(generic_spk_controls),
+				.widgets = generic_spk_widgets,
+				.num_widgets = ARRAY_SIZE(generic_spk_widgets),
 			},
 		},
 		.dai_num = 1,
-- 
2.54.0