From 016fb39c98a71539d9abd5ee66cc1103a32fbb34 Mon Sep 17 00:00:00 2001 From: Mike Dunn Date: Sat, 29 Dec 2012 10:53:17 -0800 Subject: ASoC: palm27x: fix widgets and routes in dai_link init ASoC core code now handles creation of controls and routing based on contents of struct snd_soc_card, so remove calls to snd_soc_dapm_new_controls() and snd_soc_dapm_add_routes() from the snd_soc_dai_link init function, and add widget and route definitions to struct snd_soc_card. Signed-off-by: Mike Dunn Signed-off-by: Mark Brown --- sound/soc/pxa/palm27x.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index 2074e2daf9c6..bb062e6b9db5 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c @@ -79,17 +79,6 @@ static int palm27x_ac97_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dapm_context *dapm = &codec->dapm; int err; - /* add palm27x specific widgets */ - err = snd_soc_dapm_new_controls(dapm, palm27x_dapm_widgets, - ARRAY_SIZE(palm27x_dapm_widgets)); - if (err) - return err; - - /* set up palm27x specific audio path audio_map */ - err = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - if (err) - return err; - /* connected pins */ if (machine_is_palmld()) snd_soc_dapm_enable_pin(dapm, "MIC1"); @@ -149,6 +138,10 @@ static struct snd_soc_card palm27x_asoc = { .owner = THIS_MODULE, .dai_link = palm27x_dai, .num_links = ARRAY_SIZE(palm27x_dai), + .dapm_widgets = palm27x_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(palm27x_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map) }; static struct platform_device *palm27x_snd_device; -- cgit v1.2.3 From 01a61f490cab732542753db69e17e5db657d185a Mon Sep 17 00:00:00 2001 From: Mike Dunn Date: Sat, 29 Dec 2012 10:53:18 -0800 Subject: ASoC: palm27x: register card in platform_driver probe Remove creation of an soc-audio device from the machine platform_driver probe function, and add a call to snd_soc_register_card() instead. The current code still works, but this mechanism has been deprecated, if I'm not mistaken. The ASoC core code produces the warning "ASoC: machine Palm/PXA27x should use snd_soc_register_card()" Signed-off-by: Mike Dunn Signed-off-by: Mark Brown --- sound/soc/pxa/palm27x.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index bb062e6b9db5..e1ffcdd9a649 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c @@ -144,8 +144,6 @@ static struct snd_soc_card palm27x_asoc = { .num_dapm_routes = ARRAY_SIZE(audio_map) }; -static struct platform_device *palm27x_snd_device; - static int palm27x_asoc_probe(struct platform_device *pdev) { int ret; @@ -162,27 +160,18 @@ static int palm27x_asoc_probe(struct platform_device *pdev) hs_jack_gpios[0].gpio = ((struct palm27x_asoc_info *) (pdev->dev.platform_data))->jack_gpio; - palm27x_snd_device = platform_device_alloc("soc-audio", -1); - if (!palm27x_snd_device) - return -ENOMEM; - - platform_set_drvdata(palm27x_snd_device, &palm27x_asoc); - ret = platform_device_add(palm27x_snd_device); - - if (ret != 0) - goto put_device; - - return 0; - -put_device: - platform_device_put(palm27x_snd_device); + palm27x_asoc.dev = &pdev->dev; + ret = snd_soc_register_card(&palm27x_asoc); + if (ret) + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); return ret; } static int palm27x_asoc_remove(struct platform_device *pdev) { - platform_device_unregister(palm27x_snd_device); + snd_soc_unregister_card(&palm27x_asoc); return 0; } -- cgit v1.2.3