Skip to contentSkip to conversation

ASoC: sdp440: No need to call snd_soc_dapm_enable_pin at init time

PATCH New Peter Ujfalusi 1 participant 2 messages Oct 7, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ASoC: sdp440: No need to call snd_soc_dapm_enable_pin at init time

All DAPM widgets are connected after they have added. Machine driver only need to mark not connected pins.

---
 sound/soc/omap/sdp4430.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
sound/soc/omap/sdp4430.c +0 -8
index 10972fb..3069226 100644
@@ -132,14 +132,6 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
 	/* Set up SDP4430 specific audio path audio_map */
 	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
 
-	/* SDP4430 connected pins */
-	snd_soc_dapm_enable_pin(dapm, "Ext Mic");
-	snd_soc_dapm_enable_pin(dapm, "Ext Spk");
-	snd_soc_dapm_enable_pin(dapm, "AFML");
-	snd_soc_dapm_enable_pin(dapm, "AFMR");
-	snd_soc_dapm_enable_pin(dapm, "Headset Mic");
-	snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
-
 	ret = snd_soc_dapm_new_widgets(dapm);
 	if (ret)
 		return ret;
Signature · 1 line
1.7.7
#1 lore raw

PATCH 2/2 ASoC: sdp4430: Let the core to register DAPM widgets/routes

Pass the DAPM widgets/routes via the snd_soc_card struct to core. In this way the machine driver does not need to handle the DAPM widgets/routes.

---
 sound/soc/omap/sdp4430.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)
sound/soc/omap/sdp4430.c +5 -14
index 3069226..cc3d792 100644
@@ -120,22 +120,8 @@ static const struct snd_soc_dapm_route audio_map[] = {
 static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_codec *codec = rtd->codec;
-	struct snd_soc_dapm_context *dapm = &codec->dapm;
 	int ret, hs_trim;
 
-	/* Add SDP4430 specific widgets */
-	ret = snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets,
-				ARRAY_SIZE(sdp4430_twl6040_dapm_widgets));
-	if (ret)
-		return ret;
-
-	/* Set up SDP4430 specific audio path audio_map */
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
-	ret = snd_soc_dapm_new_widgets(dapm);
-	if (ret)
-		return ret;
-
 	/*
 	 * Configure McPDM offset cancellation based on the HSOTRIM value from
 	 * twl6040.
@@ -178,6 +164,11 @@ static struct snd_soc_card snd_soc_sdp4430 = {
 	.name = "SDP4430",
 	.dai_link = &sdp4430_dai,
 	.num_links = 1,
+
+	.dapm_widgets = sdp4430_twl6040_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets),
+	.dapm_routes = audio_map,
+	.num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
 static struct platform_device *sdp4430_snd_device;
Signature · 1 line
1.7.7