aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/omap3pandora.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/omap3pandora.c')
-rw-r--r--sound/soc/omap/omap3pandora.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index cf604a2faa18..076bec606d78 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -121,7 +121,7 @@ static int omap3pandora_hp_event(struct snd_soc_dapm_widget *w,
121 * |A| <~~clk~~+ 121 * |A| <~~clk~~+
122 * |P| <--- TWL4030 <--------- Line In and MICs 122 * |P| <--- TWL4030 <--------- Line In and MICs
123 */ 123 */
124static const struct snd_soc_dapm_widget omap3pandora_out_dapm_widgets[] = { 124static const struct snd_soc_dapm_widget omap3pandora_dapm_widgets[] = {
125 SND_SOC_DAPM_DAC_E("PCM DAC", "HiFi Playback", SND_SOC_NOPM, 125 SND_SOC_DAPM_DAC_E("PCM DAC", "HiFi Playback", SND_SOC_NOPM,
126 0, 0, omap3pandora_dac_event, 126 0, 0, omap3pandora_dac_event,
127 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 127 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
@@ -130,22 +130,18 @@ static const struct snd_soc_dapm_widget omap3pandora_out_dapm_widgets[] = {
130 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 130 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
131 SND_SOC_DAPM_HP("Headphone Jack", NULL), 131 SND_SOC_DAPM_HP("Headphone Jack", NULL),
132 SND_SOC_DAPM_LINE("Line Out", NULL), 132 SND_SOC_DAPM_LINE("Line Out", NULL),
133};
134 133
135static const struct snd_soc_dapm_widget omap3pandora_in_dapm_widgets[] = {
136 SND_SOC_DAPM_MIC("Mic (internal)", NULL), 134 SND_SOC_DAPM_MIC("Mic (internal)", NULL),
137 SND_SOC_DAPM_MIC("Mic (external)", NULL), 135 SND_SOC_DAPM_MIC("Mic (external)", NULL),
138 SND_SOC_DAPM_LINE("Line In", NULL), 136 SND_SOC_DAPM_LINE("Line In", NULL),
139}; 137};
140 138
141static const struct snd_soc_dapm_route omap3pandora_out_map[] = { 139static const struct snd_soc_dapm_route omap3pandora_map[] = {
142 {"PCM DAC", NULL, "APLL Enable"}, 140 {"PCM DAC", NULL, "APLL Enable"},
143 {"Headphone Amplifier", NULL, "PCM DAC"}, 141 {"Headphone Amplifier", NULL, "PCM DAC"},
144 {"Line Out", NULL, "PCM DAC"}, 142 {"Line Out", NULL, "PCM DAC"},
145 {"Headphone Jack", NULL, "Headphone Amplifier"}, 143 {"Headphone Jack", NULL, "Headphone Amplifier"},
146};
147 144
148static const struct snd_soc_dapm_route omap3pandora_in_map[] = {
149 {"AUXL", NULL, "Line In"}, 145 {"AUXL", NULL, "Line In"},
150 {"AUXR", NULL, "Line In"}, 146 {"AUXR", NULL, "Line In"},
151 147
@@ -160,7 +156,6 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
160{ 156{
161 struct snd_soc_codec *codec = rtd->codec; 157 struct snd_soc_codec *codec = rtd->codec;
162 struct snd_soc_dapm_context *dapm = &codec->dapm; 158 struct snd_soc_dapm_context *dapm = &codec->dapm;
163 int ret;
164 159
165 /* All TWL4030 output pins are floating */ 160 /* All TWL4030 output pins are floating */
166 snd_soc_dapm_nc_pin(dapm, "EARPIECE"); 161 snd_soc_dapm_nc_pin(dapm, "EARPIECE");
@@ -174,20 +169,13 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
174 snd_soc_dapm_nc_pin(dapm, "HFR"); 169 snd_soc_dapm_nc_pin(dapm, "HFR");
175 snd_soc_dapm_nc_pin(dapm, "VIBRA"); 170 snd_soc_dapm_nc_pin(dapm, "VIBRA");
176 171
177 ret = snd_soc_dapm_new_controls(dapm, omap3pandora_out_dapm_widgets, 172 return 0;
178 ARRAY_SIZE(omap3pandora_out_dapm_widgets));
179 if (ret < 0)
180 return ret;
181
182 return snd_soc_dapm_add_routes(dapm, omap3pandora_out_map,
183 ARRAY_SIZE(omap3pandora_out_map));
184} 173}
185 174
186static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) 175static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
187{ 176{
188 struct snd_soc_codec *codec = rtd->codec; 177 struct snd_soc_codec *codec = rtd->codec;
189 struct snd_soc_dapm_context *dapm = &codec->dapm; 178 struct snd_soc_dapm_context *dapm = &codec->dapm;
190 int ret;
191 179
192 /* Not comnnected */ 180 /* Not comnnected */
193 snd_soc_dapm_nc_pin(dapm, "HSMIC"); 181 snd_soc_dapm_nc_pin(dapm, "HSMIC");
@@ -195,13 +183,7 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
195 snd_soc_dapm_nc_pin(dapm, "DIGIMIC0"); 183 snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
196 snd_soc_dapm_nc_pin(dapm, "DIGIMIC1"); 184 snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");
197 185
198 ret = snd_soc_dapm_new_controls(dapm, omap3pandora_in_dapm_widgets, 186 return 0;
199 ARRAY_SIZE(omap3pandora_in_dapm_widgets));
200 if (ret < 0)
201 return ret;
202
203 return snd_soc_dapm_add_routes(dapm, omap3pandora_in_map,
204 ARRAY_SIZE(omap3pandora_in_map));
205} 187}
206 188
207static struct snd_soc_ops omap3pandora_ops = { 189static struct snd_soc_ops omap3pandora_ops = {
@@ -215,7 +197,7 @@ static struct snd_soc_dai_link omap3pandora_dai[] = {
215 .stream_name = "HiFi Out", 197 .stream_name = "HiFi Out",
216 .cpu_dai_name = "omap-mcbsp.2", 198 .cpu_dai_name = "omap-mcbsp.2",
217 .codec_dai_name = "twl4030-hifi", 199 .codec_dai_name = "twl4030-hifi",
218 .platform_name = "omap-pcm-audio", 200 .platform_name = "omap-mcbsp.2",
219 .codec_name = "twl4030-codec", 201 .codec_name = "twl4030-codec",
220 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | 202 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
221 SND_SOC_DAIFMT_CBS_CFS, 203 SND_SOC_DAIFMT_CBS_CFS,
@@ -226,7 +208,7 @@ static struct snd_soc_dai_link omap3pandora_dai[] = {
226 .stream_name = "Line/Mic In", 208 .stream_name = "Line/Mic In",
227 .cpu_dai_name = "omap-mcbsp.4", 209 .cpu_dai_name = "omap-mcbsp.4",
228 .codec_dai_name = "twl4030-hifi", 210 .codec_dai_name = "twl4030-hifi",
229 .platform_name = "omap-pcm-audio", 211 .platform_name = "omap-mcbsp.4",
230 .codec_name = "twl4030-codec", 212 .codec_name = "twl4030-codec",
231 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | 213 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
232 SND_SOC_DAIFMT_CBS_CFS, 214 SND_SOC_DAIFMT_CBS_CFS,
@@ -241,6 +223,11 @@ static struct snd_soc_card snd_soc_card_omap3pandora = {
241 .owner = THIS_MODULE, 223 .owner = THIS_MODULE,
242 .dai_link = omap3pandora_dai, 224 .dai_link = omap3pandora_dai,
243 .num_links = ARRAY_SIZE(omap3pandora_dai), 225 .num_links = ARRAY_SIZE(omap3pandora_dai),
226
227 .dapm_widgets = omap3pandora_dapm_widgets,
228 .num_dapm_widgets = ARRAY_SIZE(omap3pandora_dapm_widgets),
229 .dapm_routes = omap3pandora_map,
230 .num_dapm_routes = ARRAY_SIZE(omap3pandora_map),
244}; 231};
245 232
246static struct platform_device *omap3pandora_snd_device; 233static struct platform_device *omap3pandora_snd_device;