alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: davinci-evm: Register machine level DAPM elements with the card
@ 2014-03-03  7:20 Lars-Peter Clausen
  2014-03-10 17:41 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Lars-Peter Clausen @ 2014-03-03  7:20 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: Peter Ujfalusi, alsa-devel, Lars-Peter Clausen

Machine level DAPM widgets and routes should be registered in the card's DAPM
context, rather than in the CODEC's context.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/davinci/davinci-evm.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 5e3bc3c..8d10244 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -95,23 +95,24 @@ static const struct snd_soc_dapm_route audio_map[] = {
 /* Logic for a aic3x as connected on a davinci-evm */
 static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
 {
+	struct snd_soc_card *card = rtd->card;
 	struct snd_soc_codec *codec = rtd->codec;
 	struct snd_soc_dapm_context *dapm = &codec->dapm;
 	struct device_node *np = codec->card->dev->of_node;
 	int ret;
 
 	/* Add davinci-evm specific widgets */
-	snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
+	snd_soc_dapm_new_controls(&card->dapm, aic3x_dapm_widgets,
 				  ARRAY_SIZE(aic3x_dapm_widgets));
 
 	if (np) {
-		ret = snd_soc_of_parse_audio_routing(codec->card,
-							"ti,audio-routing");
+		ret = snd_soc_of_parse_audio_routing(card, "ti,audio-routing");
 		if (ret)
 			return ret;
 	} else {
 		/* Set up davinci-evm specific audio path audio_map */
-		snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
+		snd_soc_dapm_add_routes(&card->dapm, audio_map,
+					ARRAY_SIZE(audio_map));
 	}
 
 	/* not connected */
@@ -120,10 +121,10 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
 	snd_soc_dapm_disable_pin(dapm, "HPRCOM");
 
 	/* always connected */
-	snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
-	snd_soc_dapm_enable_pin(dapm, "Line Out");
-	snd_soc_dapm_enable_pin(dapm, "Mic Jack");
-	snd_soc_dapm_enable_pin(dapm, "Line In");
+	snd_soc_dapm_enable_pin(&card->dapm, "Headphone Jack");
+	snd_soc_dapm_enable_pin(&card->dapm, "Line Out");
+	snd_soc_dapm_enable_pin(&card->dapm, "Mic Jack");
+	snd_soc_dapm_enable_pin(&card->dapm, "Line In");
 
 	return 0;
 }
-- 
1.8.0

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

* Re: [PATCH] ASoC: davinci-evm: Register machine level DAPM elements with the card
  2014-03-03  7:20 [PATCH] ASoC: davinci-evm: Register machine level DAPM elements with the card Lars-Peter Clausen
@ 2014-03-10 17:41 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-03-10 17:41 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Peter Ujfalusi, alsa-devel, Liam Girdwood


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

On Mon, Mar 03, 2014 at 08:20:55AM +0100, Lars-Peter Clausen wrote:
> Machine level DAPM widgets and routes should be registered in the card's DAPM
> context, rather than in the CODEC's context.

>  static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
>  {
> +	struct snd_soc_card *card = rtd->card;
>  	struct snd_soc_codec *codec = rtd->codec;
>  	struct snd_soc_dapm_context *dapm = &codec->dapm;

My first thought is why are we looking at the CODEC DAPM context at all
here and shouldn't we just change to using that here?  Yes, it does mean
that we look for the CODEC pins in the card DAPM but they kind of are
card widgets provided by the CODEC - or we could make those be the
"non-default" context.

While we're at it the not connected pins should be changed to _nc_pin()
on the off chance that we ever get round to doing the core changes to
mask inaccessible routes/options.

> -	snd_soc_dapm_enable_pin(dapm, "Line In");
> +	snd_soc_dapm_enable_pin(&card->dapm, "Headphone Jack");
> +	snd_soc_dapm_enable_pin(&card->dapm, "Line Out");
> +	snd_soc_dapm_enable_pin(&card->dapm, "Mic Jack");
> +	snd_soc_dapm_enable_pin(&card->dapm, "Line In");

The enables could just be dropped, it's the default.

[-- 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] 2+ messages in thread

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-03  7:20 [PATCH] ASoC: davinci-evm: Register machine level DAPM elements with the card Lars-Peter Clausen
2014-03-10 17:41 ` 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).