alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: sam9g20_wm8731: Convert to table based DAPM setup
@ 2014-03-08 14:47 Lars-Peter Clausen
  2014-03-10  3:42 ` Bo Shen
  2014-03-10 10:32 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-03-08 14:47 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, Lars-Peter Clausen, Bo Shen

Use table based setup to register the DAPM widgets and routes. This on one hand
makes the code a bit shorter and cleaner and on the other hand the board level
DAPM elements get registered in the card's DAPM context rather than in the
CODEC's DAPM context.

While we are at it also remove the snd_soc_dapm_enable_pin() in the init
callback. Pins are enabled by default.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/atmel/sam9g20_wm8731.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index f15bff1..174bd54 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -155,25 +155,14 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
 		return ret;
 	}
 
-	/* Add specific widgets */
-	snd_soc_dapm_new_controls(dapm, at91sam9g20ek_dapm_widgets,
-				  ARRAY_SIZE(at91sam9g20ek_dapm_widgets));
-	/* Set up specific audio path interconnects */
-	snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
-
 	/* not connected */
 	snd_soc_dapm_nc_pin(dapm, "RLINEIN");
 	snd_soc_dapm_nc_pin(dapm, "LLINEIN");
 
-#ifdef ENABLE_MIC_INPUT
-	snd_soc_dapm_enable_pin(dapm, "Int Mic");
-#else
-	snd_soc_dapm_nc_pin(dapm, "Int Mic");
+#ifndef ENABLE_MIC_INPUT
+	snd_soc_dapm_nc_pin(&rtd->card->dapm, "Int Mic");
 #endif
 
-	/* always connected */
-	snd_soc_dapm_enable_pin(dapm, "Ext Spk");
-
 	return 0;
 }
 
@@ -194,6 +183,11 @@ static struct snd_soc_card snd_soc_at91sam9g20ek = {
 	.dai_link = &at91sam9g20ek_dai,
 	.num_links = 1,
 	.set_bias_level = at91sam9g20ek_set_bias_level,
+
+	.dapm_widgets = at91sam9g20ek_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(at91sam9g20ek_dapm_widgets),
+	.dapm_routes = intercon,
+	.num_dapm_routes = ARRAY_SIZE(intercon),
 };
 
 static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: sam9g20_wm8731: Convert to table based DAPM setup
  2014-03-08 14:47 [PATCH] ASoC: sam9g20_wm8731: Convert to table based DAPM setup Lars-Peter Clausen
@ 2014-03-10  3:42 ` Bo Shen
  2014-03-10 10:32 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Bo Shen @ 2014-03-10  3:42 UTC (permalink / raw)
  To: Lars-Peter Clausen, Mark Brown, Liam Girdwood; +Cc: alsa-devel

Hi Lars,

On 03/08/2014 10:47 PM, Lars-Peter Clausen wrote:
> Use table based setup to register the DAPM widgets and routes. This on one hand
> makes the code a bit shorter and cleaner and on the other hand the board level
> DAPM elements get registered in the card's DAPM context rather than in the
> CODEC's DAPM context.
>
> While we are at it also remove the snd_soc_dapm_enable_pin() in the init
> callback. Pins are enabled by default.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>   sound/soc/atmel/sam9g20_wm8731.c | 20 +++++++-------------
>   1 file changed, 7 insertions(+), 13 deletions(-)

Thanks for your work.
Tested OK on sam9g20ek board with dt and non-dt kernel.

Tested-by: Bo Shen <voice.shen@atmel.com>
Acked-by: Bo Shen <voice.shen@atmel.com>

> diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
> index f15bff1..174bd54 100644
> --- a/sound/soc/atmel/sam9g20_wm8731.c
> +++ b/sound/soc/atmel/sam9g20_wm8731.c
> @@ -155,25 +155,14 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
>   		return ret;
>   	}
>
> -	/* Add specific widgets */
> -	snd_soc_dapm_new_controls(dapm, at91sam9g20ek_dapm_widgets,
> -				  ARRAY_SIZE(at91sam9g20ek_dapm_widgets));
> -	/* Set up specific audio path interconnects */
> -	snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
> -
>   	/* not connected */
>   	snd_soc_dapm_nc_pin(dapm, "RLINEIN");
>   	snd_soc_dapm_nc_pin(dapm, "LLINEIN");
>
> -#ifdef ENABLE_MIC_INPUT
> -	snd_soc_dapm_enable_pin(dapm, "Int Mic");
> -#else
> -	snd_soc_dapm_nc_pin(dapm, "Int Mic");
> +#ifndef ENABLE_MIC_INPUT
> +	snd_soc_dapm_nc_pin(&rtd->card->dapm, "Int Mic");
>   #endif
>
> -	/* always connected */
> -	snd_soc_dapm_enable_pin(dapm, "Ext Spk");
> -
>   	return 0;
>   }
>
> @@ -194,6 +183,11 @@ static struct snd_soc_card snd_soc_at91sam9g20ek = {
>   	.dai_link = &at91sam9g20ek_dai,
>   	.num_links = 1,
>   	.set_bias_level = at91sam9g20ek_set_bias_level,
> +
> +	.dapm_widgets = at91sam9g20ek_dapm_widgets,
> +	.num_dapm_widgets = ARRAY_SIZE(at91sam9g20ek_dapm_widgets),
> +	.dapm_routes = intercon,
> +	.num_dapm_routes = ARRAY_SIZE(intercon),
>   };
>
>   static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
>

Best Regards,
Bo Shen

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: sam9g20_wm8731: Convert to table based DAPM setup
  2014-03-08 14:47 [PATCH] ASoC: sam9g20_wm8731: Convert to table based DAPM setup Lars-Peter Clausen
  2014-03-10  3:42 ` Bo Shen
@ 2014-03-10 10:32 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-03-10 10:32 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: alsa-devel, Liam Girdwood, Bo Shen


[-- Attachment #1.1: Type: text/plain, Size: 350 bytes --]

On Sat, Mar 08, 2014 at 03:47:22PM +0100, Lars-Peter Clausen wrote:
> Use table based setup to register the DAPM widgets and routes. This on one hand
> makes the code a bit shorter and cleaner and on the other hand the board level
> DAPM elements get registered in the card's DAPM context rather than in the
> CODEC's DAPM context.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-10 10:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-08 14:47 [PATCH] ASoC: sam9g20_wm8731: Convert to table based DAPM setup Lars-Peter Clausen
2014-03-10  3:42 ` Bo Shen
2014-03-10 10:32 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).