aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/twl4030.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2009-05-05 01:55:47 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-05-05 05:12:45 -0400
commit376f7839b72ec526173cafb5d8eadfc61e2effdf (patch)
tree95051381699410b3bbe2782374a87371b29a194d /sound/soc/codecs/twl4030.c
parenta195b51bc5abc745f12b7b2fe0e3422f55c1953f (diff)
ASoC: TWL4030: Add VIBRA output
This patch adds support for the VIBRA output on TWL4030 codec. The VIBRA output can be driven with audio data or with local vibrator driver. Add the needed DAPM elements and routes for the VIBRA output and controls for the VIBRA driver configuration. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.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.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 23bae74ebf0a..1a00e4b20390 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -396,6 +396,31 @@ static const struct soc_enum twl4030_handsfreer_enum =
396static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = 396static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control =
397SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); 397SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum);
398 398
399/* Vibra */
400/* Vibra audio path selection */
401static const char *twl4030_vibra_texts[] =
402 {"AudioL1", "AudioR1", "AudioL2", "AudioR2"};
403
404static const struct soc_enum twl4030_vibra_enum =
405 SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 2,
406 ARRAY_SIZE(twl4030_vibra_texts),
407 twl4030_vibra_texts);
408
409static const struct snd_kcontrol_new twl4030_dapm_vibra_control =
410SOC_DAPM_ENUM("Route", twl4030_vibra_enum);
411
412/* Vibra path selection: local vibrator (PWM) or audio driven */
413static const char *twl4030_vibrapath_texts[] =
414 {"Local vibrator", "Audio"};
415
416static const struct soc_enum twl4030_vibrapath_enum =
417 SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 4,
418 ARRAY_SIZE(twl4030_vibrapath_texts),
419 twl4030_vibrapath_texts);
420
421static const struct snd_kcontrol_new twl4030_dapm_vibrapath_control =
422SOC_DAPM_ENUM("Route", twl4030_vibrapath_enum);
423
399/* Left analog microphone selection */ 424/* Left analog microphone selection */
400static const char *twl4030_analoglmic_texts[] = 425static const char *twl4030_analoglmic_texts[] =
401 {"Off", "Main mic", "Headset mic", "AUXL", "Carkit mic"}; 426 {"Off", "Main mic", "Headset mic", "AUXL", "Carkit mic"};
@@ -867,6 +892,26 @@ static const struct soc_enum twl4030_rampdelay_enum =
867 ARRAY_SIZE(twl4030_rampdelay_texts), 892 ARRAY_SIZE(twl4030_rampdelay_texts),
868 twl4030_rampdelay_texts); 893 twl4030_rampdelay_texts);
869 894
895/* Vibra H-bridge direction mode */
896static const char *twl4030_vibradirmode_texts[] = {
897 "Vibra H-bridge direction", "Audio data MSB",
898};
899
900static const struct soc_enum twl4030_vibradirmode_enum =
901 SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 5,
902 ARRAY_SIZE(twl4030_vibradirmode_texts),
903 twl4030_vibradirmode_texts);
904
905/* Vibra H-bridge direction */
906static const char *twl4030_vibradir_texts[] = {
907 "Positive polarity", "Negative polarity",
908};
909
910static const struct soc_enum twl4030_vibradir_enum =
911 SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 1,
912 ARRAY_SIZE(twl4030_vibradir_texts),
913 twl4030_vibradir_texts);
914
870static const struct snd_kcontrol_new twl4030_snd_controls[] = { 915static const struct snd_kcontrol_new twl4030_snd_controls[] = {
871 /* Common playback gain controls */ 916 /* Common playback gain controls */
872 SOC_DOUBLE_R_TLV("DAC1 Digital Fine Playback Volume", 917 SOC_DOUBLE_R_TLV("DAC1 Digital Fine Playback Volume",
@@ -933,6 +978,9 @@ static const struct snd_kcontrol_new twl4030_snd_controls[] = {
933 0, 3, 5, 0, input_gain_tlv), 978 0, 3, 5, 0, input_gain_tlv),
934 979
935 SOC_ENUM("HS ramp delay", twl4030_rampdelay_enum), 980 SOC_ENUM("HS ramp delay", twl4030_rampdelay_enum),
981
982 SOC_ENUM("Vibra H-bridge mode", twl4030_vibradirmode_enum),
983 SOC_ENUM("Vibra H-bridge direction", twl4030_vibradir_enum),
936}; 984};
937 985
938static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { 986static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
@@ -960,6 +1008,7 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
960 SND_SOC_DAPM_OUTPUT("CARKITR"), 1008 SND_SOC_DAPM_OUTPUT("CARKITR"),
961 SND_SOC_DAPM_OUTPUT("HFL"), 1009 SND_SOC_DAPM_OUTPUT("HFL"),
962 SND_SOC_DAPM_OUTPUT("HFR"), 1010 SND_SOC_DAPM_OUTPUT("HFR"),
1011 SND_SOC_DAPM_OUTPUT("VIBRA"),
963 1012
964 /* DACs */ 1013 /* DACs */
965 SND_SOC_DAPM_DAC("DAC Right1", "Right Front Playback", 1014 SND_SOC_DAPM_DAC("DAC Right1", "Right Front Playback",
@@ -1060,6 +1109,11 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
1060 SND_SOC_DAPM_MUX_E("HandsfreeR Mux", TWL4030_REG_HFR_CTL, 5, 0, 1109 SND_SOC_DAPM_MUX_E("HandsfreeR Mux", TWL4030_REG_HFR_CTL, 5, 0,
1061 &twl4030_dapm_handsfreer_control, handsfree_event, 1110 &twl4030_dapm_handsfreer_control, handsfree_event,
1062 SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), 1111 SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD),
1112 /* Vibra */
1113 SND_SOC_DAPM_MUX("Vibra Mux", TWL4030_REG_VIBRA_CTL, 0, 0,
1114 &twl4030_dapm_vibra_control),
1115 SND_SOC_DAPM_MUX("Vibra Route", SND_SOC_NOPM, 0, 0,
1116 &twl4030_dapm_vibrapath_control),
1063 1117
1064 /* Introducing four virtual ADC, since TWL4030 have four channel for 1118 /* Introducing four virtual ADC, since TWL4030 have four channel for
1065 capture */ 1119 capture */
@@ -1161,6 +1215,11 @@ static const struct snd_soc_dapm_route intercon[] = {
1161 {"HandsfreeR Mux", "AudioR1", "ARXR1_APGA"}, 1215 {"HandsfreeR Mux", "AudioR1", "ARXR1_APGA"},
1162 {"HandsfreeR Mux", "AudioR2", "ARXR2_APGA"}, 1216 {"HandsfreeR Mux", "AudioR2", "ARXR2_APGA"},
1163 {"HandsfreeR Mux", "AudioL2", "ARXL2_APGA"}, 1217 {"HandsfreeR Mux", "AudioL2", "ARXL2_APGA"},
1218 /* Vibra */
1219 {"Vibra Mux", "AudioL1", "DAC Left1"},
1220 {"Vibra Mux", "AudioR1", "DAC Right1"},
1221 {"Vibra Mux", "AudioL2", "DAC Left2"},
1222 {"Vibra Mux", "AudioR2", "DAC Right2"},
1164 1223
1165 /* outputs */ 1224 /* outputs */
1166 {"OUTL", NULL, "ARXL2_APGA"}, 1225 {"OUTL", NULL, "ARXL2_APGA"},
@@ -1174,6 +1233,8 @@ static const struct snd_soc_dapm_route intercon[] = {
1174 {"CARKITR", NULL, "CarkitR Mixer"}, 1233 {"CARKITR", NULL, "CarkitR Mixer"},
1175 {"HFL", NULL, "HandsfreeL Mux"}, 1234 {"HFL", NULL, "HandsfreeL Mux"},
1176 {"HFR", NULL, "HandsfreeR Mux"}, 1235 {"HFR", NULL, "HandsfreeR Mux"},
1236 {"Vibra Route", "Audio", "Vibra Mux"},
1237 {"VIBRA", NULL, "Vibra Route"},
1177 1238
1178 /* Capture path */ 1239 /* Capture path */
1179 {"Analog Left Capture Route", "Main mic", "MAINMIC"}, 1240 {"Analog Left Capture Route", "Main mic", "MAINMIC"},