aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2013-07-31 13:00:32 -0400
committerMark Brown <broonie@linaro.org>2013-07-31 15:03:00 -0400
commit8fe120b5a665fc869c23f86e4964b801f6e53486 (patch)
treeb8cca9c398055fd937f466782e003ac350b00817 /sound/soc/omap
parent6e20b0d760759fd8c90a7b6ccfd6662e3edb94ed (diff)
ASoC: omap-abe-twl6040: Remove support for pdata (legacy boot)
Just recently OMAP4 legacy boot support has been removed. No reason to keep the code used by the legacy boot (pdata based) since neither OMAP4 or OMAP5 can boot in this mode. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/omap')
-rw-r--r--sound/soc/omap/omap-abe-twl6040.c133
1 files changed, 41 insertions, 92 deletions
diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c
index 70cd5c7b2e14..ebb13906b3a0 100644
--- a/sound/soc/omap/omap-abe-twl6040.c
+++ b/sound/soc/omap/omap-abe-twl6040.c
@@ -23,7 +23,6 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/mfd/twl6040.h> 25#include <linux/mfd/twl6040.h>
26#include <linux/platform_data/omap-abe-twl6040.h>
27#include <linux/module.h> 26#include <linux/module.h>
28#include <linux/of.h> 27#include <linux/of.h>
29 28
@@ -166,19 +165,10 @@ static const struct snd_soc_dapm_route audio_map[] = {
166 {"AFMR", NULL, "Line In"}, 165 {"AFMR", NULL, "Line In"},
167}; 166};
168 167
169static inline void twl6040_disconnect_pin(struct snd_soc_dapm_context *dapm,
170 int connected, char *pin)
171{
172 if (!connected)
173 snd_soc_dapm_disable_pin(dapm, pin);
174}
175
176static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) 168static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd)
177{ 169{
178 struct snd_soc_codec *codec = rtd->codec; 170 struct snd_soc_codec *codec = rtd->codec;
179 struct snd_soc_card *card = codec->card; 171 struct snd_soc_card *card = codec->card;
180 struct snd_soc_dapm_context *dapm = &codec->dapm;
181 struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev);
182 struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); 172 struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card);
183 int hs_trim; 173 int hs_trim;
184 int ret = 0; 174 int ret = 0;
@@ -203,24 +193,6 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd)
203 twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); 193 twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET);
204 } 194 }
205 195
206 /*
207 * NULL pdata means we booted with DT. In this case the routing is
208 * provided and the card is fully routed, no need to mark pins.
209 */
210 if (!pdata)
211 return ret;
212
213 /* Disable not connected paths if not used */
214 twl6040_disconnect_pin(dapm, pdata->has_hs, "Headset Stereophone");
215 twl6040_disconnect_pin(dapm, pdata->has_hf, "Ext Spk");
216 twl6040_disconnect_pin(dapm, pdata->has_ep, "Earphone Spk");
217 twl6040_disconnect_pin(dapm, pdata->has_aux, "Line Out");
218 twl6040_disconnect_pin(dapm, pdata->has_vibra, "Vibrator");
219 twl6040_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic");
220 twl6040_disconnect_pin(dapm, pdata->has_mainmic, "Main Handset Mic");
221 twl6040_disconnect_pin(dapm, pdata->has_submic, "Sub Handset Mic");
222 twl6040_disconnect_pin(dapm, pdata->has_afm, "Line In");
223
224 return ret; 196 return ret;
225} 197}
226 198
@@ -274,13 +246,18 @@ static struct snd_soc_card omap_abe_card = {
274 246
275static int omap_abe_probe(struct platform_device *pdev) 247static int omap_abe_probe(struct platform_device *pdev)
276{ 248{
277 struct omap_abe_twl6040_data *pdata = dev_get_platdata(&pdev->dev);
278 struct device_node *node = pdev->dev.of_node; 249 struct device_node *node = pdev->dev.of_node;
279 struct snd_soc_card *card = &omap_abe_card; 250 struct snd_soc_card *card = &omap_abe_card;
251 struct device_node *dai_node;
280 struct abe_twl6040 *priv; 252 struct abe_twl6040 *priv;
281 int num_links = 0; 253 int num_links = 0;
282 int ret = 0; 254 int ret = 0;
283 255
256 if (!node) {
257 dev_err(&pdev->dev, "of node is missing.\n");
258 return -ENODEV;
259 }
260
284 card->dev = &pdev->dev; 261 card->dev = &pdev->dev;
285 262
286 priv = devm_kzalloc(&pdev->dev, sizeof(struct abe_twl6040), GFP_KERNEL); 263 priv = devm_kzalloc(&pdev->dev, sizeof(struct abe_twl6040), GFP_KERNEL);
@@ -289,78 +266,50 @@ static int omap_abe_probe(struct platform_device *pdev)
289 266
290 priv->dmic_codec_dev = ERR_PTR(-EINVAL); 267 priv->dmic_codec_dev = ERR_PTR(-EINVAL);
291 268
292 if (node) { 269 if (snd_soc_of_parse_card_name(card, "ti,model")) {
293 struct device_node *dai_node; 270 dev_err(&pdev->dev, "Card name is not provided\n");
294 271 return -ENODEV;
295 if (snd_soc_of_parse_card_name(card, "ti,model")) { 272 }
296 dev_err(&pdev->dev, "Card name is not provided\n");
297 return -ENODEV;
298 }
299 273
300 ret = snd_soc_of_parse_audio_routing(card, 274 ret = snd_soc_of_parse_audio_routing(card, "ti,audio-routing");
301 "ti,audio-routing"); 275 if (ret) {
302 if (ret) { 276 dev_err(&pdev->dev, "Error while parsing DAPM routing\n");
303 dev_err(&pdev->dev, 277 return ret;
304 "Error while parsing DAPM routing\n"); 278 }
305 return ret;
306 }
307 279
308 dai_node = of_parse_phandle(node, "ti,mcpdm", 0); 280 dai_node = of_parse_phandle(node, "ti,mcpdm", 0);
309 if (!dai_node) { 281 if (!dai_node) {
310 dev_err(&pdev->dev, "McPDM node is not provided\n"); 282 dev_err(&pdev->dev, "McPDM node is not provided\n");
311 return -EINVAL; 283 return -EINVAL;
312 } 284 }
313 abe_twl6040_dai_links[0].cpu_dai_name = NULL; 285 abe_twl6040_dai_links[0].cpu_dai_name = NULL;
314 abe_twl6040_dai_links[0].cpu_of_node = dai_node; 286 abe_twl6040_dai_links[0].cpu_of_node = dai_node;
315 287
316 dai_node = of_parse_phandle(node, "ti,dmic", 0); 288 dai_node = of_parse_phandle(node, "ti,dmic", 0);
317 if (dai_node) { 289 if (dai_node) {
318 num_links = 2; 290 num_links = 2;
319 abe_twl6040_dai_links[1].cpu_dai_name = NULL; 291 abe_twl6040_dai_links[1].cpu_dai_name = NULL;
320 abe_twl6040_dai_links[1].cpu_of_node = dai_node; 292 abe_twl6040_dai_links[1].cpu_of_node = dai_node;
321 293
322 priv->dmic_codec_dev = platform_device_register_simple( 294 priv->dmic_codec_dev = platform_device_register_simple(
323 "dmic-codec", -1, NULL, 0); 295 "dmic-codec", -1, NULL, 0);
324 if (IS_ERR(priv->dmic_codec_dev)) { 296 if (IS_ERR(priv->dmic_codec_dev)) {
325 dev_err(&pdev->dev, 297 dev_err(&pdev->dev, "Can't instantiate dmic-codec\n");
326 "Can't instantiate dmic-codec\n"); 298 return PTR_ERR(priv->dmic_codec_dev);
327 return PTR_ERR(priv->dmic_codec_dev);
328 }
329 } else {
330 num_links = 1;
331 }
332
333 priv->jack_detection = of_property_read_bool(node,
334 "ti,jack-detection");
335 of_property_read_u32(node, "ti,mclk-freq",
336 &priv->mclk_freq);
337 if (!priv->mclk_freq) {
338 dev_err(&pdev->dev, "MCLK frequency not provided\n");
339 ret = -EINVAL;
340 goto err_unregister;
341 } 299 }
342
343 omap_abe_card.fully_routed = 1;
344 } else if (pdata) {
345 if (pdata->card_name) {
346 card->name = pdata->card_name;
347 } else {
348 dev_err(&pdev->dev, "Card name is not provided\n");
349 return -ENODEV;
350 }
351
352 if (pdata->has_dmic)
353 num_links = 2;
354 else
355 num_links = 1;
356
357 priv->jack_detection = pdata->jack_detection;
358 priv->mclk_freq = pdata->mclk_freq;
359 } else { 300 } else {
360 dev_err(&pdev->dev, "Missing pdata\n"); 301 num_links = 1;
361 return -ENODEV; 302 }
303
304 priv->jack_detection = of_property_read_bool(node, "ti,jack-detection");
305 of_property_read_u32(node, "ti,mclk-freq", &priv->mclk_freq);
306 if (!priv->mclk_freq) {
307 dev_err(&pdev->dev, "MCLK frequency not provided\n");
308 ret = -EINVAL;
309 goto err_unregister;
362 } 310 }
363 311
312 card->fully_routed = 1;
364 313
365 if (!priv->mclk_freq) { 314 if (!priv->mclk_freq) {
366 dev_err(&pdev->dev, "MCLK frequency missing\n"); 315 dev_err(&pdev->dev, "MCLK frequency missing\n");