aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/twl4030.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2009-05-18 09:02:04 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-05-20 04:52:51 -0400
commit4005d39a5f5549f1f6afe88abceed78b2ab225b6 (patch)
treec8eed85f991d91646a0b3e8d8e6353b08c18f822 /sound/soc/codecs/twl4030.c
parente24805dd85283ac0912b9c400768a4d171b400ff (diff)
ASoC: TWL4030: Change DAPM routings and controls for DACs and PGAs
Restructuring the twl4030 codec's DAPM routing to be able to handle the power sequences correctly. The twl4030 codec internal implementation have this order: DAC -> Analog PGA -> Mixer/Mux While the ASoC framework expects the following order: DAC -> Mixer -> Analog PGA This patch moves the Analog PGA handling from SND_SOC_DAPM_PGA to _MIXER and adds two levels of mixer to handle the digital and analog loopback functionality. Now the analog loopback does not powers on any of the DACs. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Tested-by: Anuj Aggarwal <anuj.aggarwal@ti.com> Tested-by: Jarkko Nikula <jhnikula@gmail.com> Tested-by: Misael Lopez Cruz <x0052729@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/twl4030.c')
-rw-r--r--sound/soc/codecs/twl4030.c141
1 files changed, 71 insertions, 70 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 731534c19b7f..99fe44f70507 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -1051,18 +1051,6 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
1051 SND_SOC_DAPM_DAC("DAC Voice", "Voice Playback", 1051 SND_SOC_DAPM_DAC("DAC Voice", "Voice Playback",
1052 SND_SOC_NOPM, 0, 0), 1052 SND_SOC_NOPM, 0, 0),
1053 1053
1054 /* Analog PGAs */
1055 SND_SOC_DAPM_PGA("ARXR1_APGA", TWL4030_REG_ARXR1_APGA_CTL,
1056 0, 0, NULL, 0),
1057 SND_SOC_DAPM_PGA("ARXL1_APGA", TWL4030_REG_ARXL1_APGA_CTL,
1058 0, 0, NULL, 0),
1059 SND_SOC_DAPM_PGA("ARXR2_APGA", TWL4030_REG_ARXR2_APGA_CTL,
1060 0, 0, NULL, 0),
1061 SND_SOC_DAPM_PGA("ARXL2_APGA", TWL4030_REG_ARXL2_APGA_CTL,
1062 0, 0, NULL, 0),
1063 SND_SOC_DAPM_PGA("VDL_APGA", TWL4030_REG_VDL_APGA_CTL,
1064 0, 0, NULL, 0),
1065
1066 /* Analog bypasses */ 1054 /* Analog bypasses */
1067 SND_SOC_DAPM_SWITCH_E("Right1 Analog Loopback", SND_SOC_NOPM, 0, 0, 1055 SND_SOC_DAPM_SWITCH_E("Right1 Analog Loopback", SND_SOC_NOPM, 0, 0,
1068 &twl4030_dapm_abypassr1_control, bypass_event, 1056 &twl4030_dapm_abypassr1_control, bypass_event,
@@ -1091,16 +1079,29 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
1091 &twl4030_dapm_dbypassv_control, bypass_event, 1079 &twl4030_dapm_dbypassv_control, bypass_event,
1092 SND_SOC_DAPM_POST_REG), 1080 SND_SOC_DAPM_POST_REG),
1093 1081
1094 SND_SOC_DAPM_MIXER("Analog R1 Playback Mixer", TWL4030_REG_AVDAC_CTL, 1082 /* Digital mixers, power control for the physical DACs */
1095 0, 0, NULL, 0), 1083 SND_SOC_DAPM_MIXER("Digital R1 Playback Mixer",
1096 SND_SOC_DAPM_MIXER("Analog L1 Playback Mixer", TWL4030_REG_AVDAC_CTL, 1084 TWL4030_REG_AVDAC_CTL, 0, 0, NULL, 0),
1097 1, 0, NULL, 0), 1085 SND_SOC_DAPM_MIXER("Digital L1 Playback Mixer",
1098 SND_SOC_DAPM_MIXER("Analog R2 Playback Mixer", TWL4030_REG_AVDAC_CTL, 1086 TWL4030_REG_AVDAC_CTL, 1, 0, NULL, 0),
1099 2, 0, NULL, 0), 1087 SND_SOC_DAPM_MIXER("Digital R2 Playback Mixer",
1100 SND_SOC_DAPM_MIXER("Analog L2 Playback Mixer", TWL4030_REG_AVDAC_CTL, 1088 TWL4030_REG_AVDAC_CTL, 2, 0, NULL, 0),
1101 3, 0, NULL, 0), 1089 SND_SOC_DAPM_MIXER("Digital L2 Playback Mixer",
1102 SND_SOC_DAPM_MIXER("Analog Voice Playback Mixer", TWL4030_REG_AVDAC_CTL, 1090 TWL4030_REG_AVDAC_CTL, 3, 0, NULL, 0),
1103 4, 0, NULL, 0), 1091 SND_SOC_DAPM_MIXER("Digital Voice Playback Mixer",
1092 TWL4030_REG_AVDAC_CTL, 4, 0, NULL, 0),
1093
1094 /* Analog mixers, power control for the physical PGAs */
1095 SND_SOC_DAPM_MIXER("Analog R1 Playback Mixer",
1096 TWL4030_REG_ARXR1_APGA_CTL, 0, 0, NULL, 0),
1097 SND_SOC_DAPM_MIXER("Analog L1 Playback Mixer",
1098 TWL4030_REG_ARXL1_APGA_CTL, 0, 0, NULL, 0),
1099 SND_SOC_DAPM_MIXER("Analog R2 Playback Mixer",
1100 TWL4030_REG_ARXR2_APGA_CTL, 0, 0, NULL, 0),
1101 SND_SOC_DAPM_MIXER("Analog L2 Playback Mixer",
1102 TWL4030_REG_ARXL2_APGA_CTL, 0, 0, NULL, 0),
1103 SND_SOC_DAPM_MIXER("Analog Voice Playback Mixer",
1104 TWL4030_REG_VDL_APGA_CTL, 0, 0, NULL, 0),
1104 1105
1105 /* Output MIXER controls */ 1106 /* Output MIXER controls */
1106 /* Earpiece */ 1107 /* Earpiece */
@@ -1194,60 +1195,60 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
1194}; 1195};
1195 1196
1196static const struct snd_soc_dapm_route intercon[] = { 1197static const struct snd_soc_dapm_route intercon[] = {
1197 {"Analog L1 Playback Mixer", NULL, "DAC Left1"}, 1198 {"Digital L1 Playback Mixer", NULL, "DAC Left1"},
1198 {"Analog R1 Playback Mixer", NULL, "DAC Right1"}, 1199 {"Digital R1 Playback Mixer", NULL, "DAC Right1"},
1199 {"Analog L2 Playback Mixer", NULL, "DAC Left2"}, 1200 {"Digital L2 Playback Mixer", NULL, "DAC Left2"},
1200 {"Analog R2 Playback Mixer", NULL, "DAC Right2"}, 1201 {"Digital R2 Playback Mixer", NULL, "DAC Right2"},
1201 {"Analog Voice Playback Mixer", NULL, "DAC Voice"}, 1202 {"Digital Voice Playback Mixer", NULL, "DAC Voice"},
1202 1203
1203 {"ARXL1_APGA", NULL, "Analog L1 Playback Mixer"}, 1204 {"Analog L1 Playback Mixer", NULL, "Digital L1 Playback Mixer"},
1204 {"ARXR1_APGA", NULL, "Analog R1 Playback Mixer"}, 1205 {"Analog R1 Playback Mixer", NULL, "Digital R1 Playback Mixer"},
1205 {"ARXL2_APGA", NULL, "Analog L2 Playback Mixer"}, 1206 {"Analog L2 Playback Mixer", NULL, "Digital L2 Playback Mixer"},
1206 {"ARXR2_APGA", NULL, "Analog R2 Playback Mixer"}, 1207 {"Analog R2 Playback Mixer", NULL, "Digital R2 Playback Mixer"},
1207 {"VDL_APGA", NULL, "Analog Voice Playback Mixer"}, 1208 {"Analog Voice Playback Mixer", NULL, "Digital Voice Playback Mixer"},
1208 1209
1209 /* Internal playback routings */ 1210 /* Internal playback routings */
1210 /* Earpiece */ 1211 /* Earpiece */
1211 {"Earpiece Mixer", "Voice", "VDL_APGA"}, 1212 {"Earpiece Mixer", "Voice", "Analog Voice Playback Mixer"},
1212 {"Earpiece Mixer", "AudioL1", "ARXL1_APGA"}, 1213 {"Earpiece Mixer", "AudioL1", "Analog L1 Playback Mixer"},
1213 {"Earpiece Mixer", "AudioL2", "ARXL2_APGA"}, 1214 {"Earpiece Mixer", "AudioL2", "Analog L2 Playback Mixer"},
1214 {"Earpiece Mixer", "AudioR1", "ARXR1_APGA"}, 1215 {"Earpiece Mixer", "AudioR1", "Analog R1 Playback Mixer"},
1215 /* PreDrivL */ 1216 /* PreDrivL */
1216 {"PredriveL Mixer", "Voice", "VDL_APGA"}, 1217 {"PredriveL Mixer", "Voice", "Analog Voice Playback Mixer"},
1217 {"PredriveL Mixer", "AudioL1", "ARXL1_APGA"}, 1218 {"PredriveL Mixer", "AudioL1", "Analog L1 Playback Mixer"},
1218 {"PredriveL Mixer", "AudioL2", "ARXL2_APGA"}, 1219 {"PredriveL Mixer", "AudioL2", "Analog L2 Playback Mixer"},
1219 {"PredriveL Mixer", "AudioR2", "ARXR2_APGA"}, 1220 {"PredriveL Mixer", "AudioR2", "Analog R2 Playback Mixer"},
1220 /* PreDrivR */ 1221 /* PreDrivR */
1221 {"PredriveR Mixer", "Voice", "VDL_APGA"}, 1222 {"PredriveR Mixer", "Voice", "Analog Voice Playback Mixer"},
1222 {"PredriveR Mixer", "AudioR1", "ARXR1_APGA"}, 1223 {"PredriveR Mixer", "AudioR1", "Analog R1 Playback Mixer"},
1223 {"PredriveR Mixer", "AudioR2", "ARXR2_APGA"}, 1224 {"PredriveR Mixer", "AudioR2", "Analog R2 Playback Mixer"},
1224 {"PredriveR Mixer", "AudioL2", "ARXL2_APGA"}, 1225 {"PredriveR Mixer", "AudioL2", "Analog L2 Playback Mixer"},
1225 /* HeadsetL */ 1226 /* HeadsetL */
1226 {"HeadsetL Mixer", "Voice", "VDL_APGA"}, 1227 {"HeadsetL Mixer", "Voice", "Analog Voice Playback Mixer"},
1227 {"HeadsetL Mixer", "AudioL1", "ARXL1_APGA"}, 1228 {"HeadsetL Mixer", "AudioL1", "Analog L1 Playback Mixer"},
1228 {"HeadsetL Mixer", "AudioL2", "ARXL2_APGA"}, 1229 {"HeadsetL Mixer", "AudioL2", "Analog L2 Playback Mixer"},
1229 /* HeadsetR */ 1230 /* HeadsetR */
1230 {"HeadsetR Mixer", "Voice", "VDL_APGA"}, 1231 {"HeadsetR Mixer", "Voice", "Analog Voice Playback Mixer"},
1231 {"HeadsetR Mixer", "AudioR1", "ARXR1_APGA"}, 1232 {"HeadsetR Mixer", "AudioR1", "Analog R1 Playback Mixer"},
1232 {"HeadsetR Mixer", "AudioR2", "ARXR2_APGA"}, 1233 {"HeadsetR Mixer", "AudioR2", "Analog R2 Playback Mixer"},
1233 /* CarkitL */ 1234 /* CarkitL */
1234 {"CarkitL Mixer", "Voice", "VDL_APGA"}, 1235 {"CarkitL Mixer", "Voice", "Analog Voice Playback Mixer"},
1235 {"CarkitL Mixer", "AudioL1", "ARXL1_APGA"}, 1236 {"CarkitL Mixer", "AudioL1", "Analog L1 Playback Mixer"},
1236 {"CarkitL Mixer", "AudioL2", "ARXL2_APGA"}, 1237 {"CarkitL Mixer", "AudioL2", "Analog L2 Playback Mixer"},
1237 /* CarkitR */ 1238 /* CarkitR */
1238 {"CarkitR Mixer", "Voice", "VDL_APGA"}, 1239 {"CarkitR Mixer", "Voice", "Analog Voice Playback Mixer"},
1239 {"CarkitR Mixer", "AudioR1", "ARXR1_APGA"}, 1240 {"CarkitR Mixer", "AudioR1", "Analog R1 Playback Mixer"},
1240 {"CarkitR Mixer", "AudioR2", "ARXR2_APGA"}, 1241 {"CarkitR Mixer", "AudioR2", "Analog R2 Playback Mixer"},
1241 /* HandsfreeL */ 1242 /* HandsfreeL */
1242 {"HandsfreeL Mux", "Voice", "VDL_APGA"}, 1243 {"HandsfreeL Mux", "Voice", "Analog Voice Playback Mixer"},
1243 {"HandsfreeL Mux", "AudioL1", "ARXL1_APGA"}, 1244 {"HandsfreeL Mux", "AudioL1", "Analog L1 Playback Mixer"},
1244 {"HandsfreeL Mux", "AudioL2", "ARXL2_APGA"}, 1245 {"HandsfreeL Mux", "AudioL2", "Analog L2 Playback Mixer"},
1245 {"HandsfreeL Mux", "AudioR2", "ARXR2_APGA"}, 1246 {"HandsfreeL Mux", "AudioR2", "Analog R2 Playback Mixer"},
1246 /* HandsfreeR */ 1247 /* HandsfreeR */
1247 {"HandsfreeR Mux", "Voice", "VDL_APGA"}, 1248 {"HandsfreeR Mux", "Voice", "Analog Voice Playback Mixer"},
1248 {"HandsfreeR Mux", "AudioR1", "ARXR1_APGA"}, 1249 {"HandsfreeR Mux", "AudioR1", "Analog R1 Playback Mixer"},
1249 {"HandsfreeR Mux", "AudioR2", "ARXR2_APGA"}, 1250 {"HandsfreeR Mux", "AudioR2", "Analog R2 Playback Mixer"},
1250 {"HandsfreeR Mux", "AudioL2", "ARXL2_APGA"}, 1251 {"HandsfreeR Mux", "AudioL2", "Analog L2 Playback Mixer"},
1251 /* Vibra */ 1252 /* Vibra */
1252 {"Vibra Mux", "AudioL1", "DAC Left1"}, 1253 {"Vibra Mux", "AudioL1", "DAC Left1"},
1253 {"Vibra Mux", "AudioR1", "DAC Right1"}, 1254 {"Vibra Mux", "AudioR1", "DAC Right1"},
@@ -1255,8 +1256,8 @@ static const struct snd_soc_dapm_route intercon[] = {
1255 {"Vibra Mux", "AudioR2", "DAC Right2"}, 1256 {"Vibra Mux", "AudioR2", "DAC Right2"},
1256 1257
1257 /* outputs */ 1258 /* outputs */
1258 {"OUTL", NULL, "ARXL2_APGA"}, 1259 {"OUTL", NULL, "Analog L2 Playback Mixer"},
1259 {"OUTR", NULL, "ARXR2_APGA"}, 1260 {"OUTR", NULL, "Analog R2 Playback Mixer"},
1260 {"EARPIECE", NULL, "Earpiece Mixer"}, 1261 {"EARPIECE", NULL, "Earpiece Mixer"},
1261 {"PREDRIVEL", NULL, "PredriveL Mixer"}, 1262 {"PREDRIVEL", NULL, "PredriveL Mixer"},
1262 {"PREDRIVER", NULL, "PredriveR Mixer"}, 1263 {"PREDRIVER", NULL, "PredriveR Mixer"},
@@ -1320,9 +1321,9 @@ static const struct snd_soc_dapm_route intercon[] = {
1320 {"Left Digital Loopback", "Volume", "TX1 Capture Route"}, 1321 {"Left Digital Loopback", "Volume", "TX1 Capture Route"},
1321 {"Voice Digital Loopback", "Volume", "TX2 Capture Route"}, 1322 {"Voice Digital Loopback", "Volume", "TX2 Capture Route"},
1322 1323
1323 {"Analog R2 Playback Mixer", NULL, "Right Digital Loopback"}, 1324 {"Digital R2 Playback Mixer", NULL, "Right Digital Loopback"},
1324 {"Analog L2 Playback Mixer", NULL, "Left Digital Loopback"}, 1325 {"Digital L2 Playback Mixer", NULL, "Left Digital Loopback"},
1325 {"Analog Voice Playback Mixer", NULL, "Voice Digital Loopback"}, 1326 {"Digital Voice Playback Mixer", NULL, "Voice Digital Loopback"},
1326 1327
1327}; 1328};
1328 1329