diff options
Diffstat (limited to 'sound/soc/omap/sdp4430.c')
-rw-r--r-- | sound/soc/omap/sdp4430.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index b80efb02bfca..cc3d792af5ea 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <plat/hardware.h> | 32 | #include <plat/hardware.h> |
33 | #include <plat/mux.h> | 33 | #include <plat/mux.h> |
34 | 34 | ||
35 | #include "mcpdm.h" | 35 | #include "omap-mcpdm.h" |
36 | #include "omap-pcm.h" | 36 | #include "omap-pcm.h" |
37 | #include "../codecs/twl6040.h" | 37 | #include "../codecs/twl6040.h" |
38 | 38 | ||
@@ -88,7 +88,7 @@ static const struct snd_soc_dapm_widget sdp4430_twl6040_dapm_widgets[] = { | |||
88 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | 88 | SND_SOC_DAPM_MIC("Headset Mic", NULL), |
89 | SND_SOC_DAPM_HP("Headset Stereophone", NULL), | 89 | SND_SOC_DAPM_HP("Headset Stereophone", NULL), |
90 | SND_SOC_DAPM_SPK("Earphone Spk", NULL), | 90 | SND_SOC_DAPM_SPK("Earphone Spk", NULL), |
91 | SND_SOC_DAPM_INPUT("Aux/FM Stereo In"), | 91 | SND_SOC_DAPM_INPUT("FM Stereo In"), |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static const struct snd_soc_dapm_route audio_map[] = { | 94 | static const struct snd_soc_dapm_route audio_map[] = { |
@@ -113,36 +113,22 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
113 | {"Earphone Spk", NULL, "EP"}, | 113 | {"Earphone Spk", NULL, "EP"}, |
114 | 114 | ||
115 | /* Aux/FM Stereo In: AFML, AFMR */ | 115 | /* Aux/FM Stereo In: AFML, AFMR */ |
116 | {"AFML", NULL, "Aux/FM Stereo In"}, | 116 | {"AFML", NULL, "FM Stereo In"}, |
117 | {"AFMR", NULL, "Aux/FM Stereo In"}, | 117 | {"AFMR", NULL, "FM Stereo In"}, |
118 | }; | 118 | }; |
119 | 119 | ||
120 | static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) | 120 | static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) |
121 | { | 121 | { |
122 | struct snd_soc_codec *codec = rtd->codec; | 122 | struct snd_soc_codec *codec = rtd->codec; |
123 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 123 | int ret, hs_trim; |
124 | int ret; | ||
125 | |||
126 | /* Add SDP4430 specific widgets */ | ||
127 | ret = snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets, | ||
128 | ARRAY_SIZE(sdp4430_twl6040_dapm_widgets)); | ||
129 | if (ret) | ||
130 | return ret; | ||
131 | |||
132 | /* Set up SDP4430 specific audio path audio_map */ | ||
133 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | ||
134 | 124 | ||
135 | /* SDP4430 connected pins */ | 125 | /* |
136 | snd_soc_dapm_enable_pin(dapm, "Ext Mic"); | 126 | * Configure McPDM offset cancellation based on the HSOTRIM value from |
137 | snd_soc_dapm_enable_pin(dapm, "Ext Spk"); | 127 | * twl6040. |
138 | snd_soc_dapm_enable_pin(dapm, "AFML"); | 128 | */ |
139 | snd_soc_dapm_enable_pin(dapm, "AFMR"); | 129 | hs_trim = twl6040_get_trim_value(codec, TWL6040_TRIM_HSOTRIM); |
140 | snd_soc_dapm_enable_pin(dapm, "Headset Mic"); | 130 | omap_mcpdm_configure_dn_offsets(rtd, TWL6040_HSF_TRIM_LEFT(hs_trim), |
141 | snd_soc_dapm_enable_pin(dapm, "Headset Stereophone"); | 131 | TWL6040_HSF_TRIM_RIGHT(hs_trim)); |
142 | |||
143 | ret = snd_soc_dapm_sync(dapm); | ||
144 | if (ret) | ||
145 | return ret; | ||
146 | 132 | ||
147 | /* Headset jack detection */ | 133 | /* Headset jack detection */ |
148 | ret = snd_soc_jack_new(codec, "Headset Jack", | 134 | ret = snd_soc_jack_new(codec, "Headset Jack", |
@@ -165,8 +151,8 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) | |||
165 | static struct snd_soc_dai_link sdp4430_dai = { | 151 | static struct snd_soc_dai_link sdp4430_dai = { |
166 | .name = "TWL6040", | 152 | .name = "TWL6040", |
167 | .stream_name = "TWL6040", | 153 | .stream_name = "TWL6040", |
168 | .cpu_dai_name ="omap-mcpdm-dai", | 154 | .cpu_dai_name = "omap-mcpdm", |
169 | .codec_dai_name = "twl6040-hifi", | 155 | .codec_dai_name = "twl6040-legacy", |
170 | .platform_name = "omap-pcm-audio", | 156 | .platform_name = "omap-pcm-audio", |
171 | .codec_name = "twl6040-codec", | 157 | .codec_name = "twl6040-codec", |
172 | .init = sdp4430_twl6040_init, | 158 | .init = sdp4430_twl6040_init, |
@@ -178,6 +164,11 @@ static struct snd_soc_card snd_soc_sdp4430 = { | |||
178 | .name = "SDP4430", | 164 | .name = "SDP4430", |
179 | .dai_link = &sdp4430_dai, | 165 | .dai_link = &sdp4430_dai, |
180 | .num_links = 1, | 166 | .num_links = 1, |
167 | |||
168 | .dapm_widgets = sdp4430_twl6040_dapm_widgets, | ||
169 | .num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets), | ||
170 | .dapm_routes = audio_map, | ||
171 | .num_dapm_routes = ARRAY_SIZE(audio_map), | ||
181 | }; | 172 | }; |
182 | 173 | ||
183 | static struct platform_device *sdp4430_snd_device; | 174 | static struct platform_device *sdp4430_snd_device; |