alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: core: Configure pin muxing via pinctrl when registering a DAI
@ 2012-09-21  7:54 Peter Ujfalusi
  2012-09-21 11:13 ` Mark Brown
  0 siblings, 1 reply; 24+ messages in thread
From: Peter Ujfalusi @ 2012-09-21  7:54 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: alsa-devel

pinctrl framework now becoming widely available for SoCs to configure pin
multiplexing.
Instead of adding the same code to all dai drivers the core can take care
of this transparently.
Do not make too much noise if pinctrl is not provided via DT for the dai
but just use dev_info().

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
Hi Mark, Liam,

I was about to add the pinctrl support for OMAP dais (McBSP/McPDM/DMIC/HDMI)
when I realized that I just kept duplicating the same code all over.
It is better to leave this to the core.

Regards,
Peter

 sound/soc/soc-core.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9a6daf9..37464c5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -33,6 +33,7 @@
 #include <linux/ctype.h>
 #include <linux/slab.h>
 #include <linux/of.h>
+#include <linux/pinctrl/consumer.h>
 #include <sound/ac97_codec.h>
 #include <sound/core.h>
 #include <sound/jack.h>
@@ -3686,6 +3687,19 @@ static inline char *fmt_multiple_name(struct device *dev,
 	return kstrdup(dai_drv->name, GFP_KERNEL);
 }
 
+/*
+ * Simple function to be used in snd_soc_dai_register_dai/s to set the default
+ * pinmuxing for the dai.
+ */
+static inline void snd_soc_configure_dai_pins(struct device *dev)
+{
+	struct pinctrl *pinctrl;
+
+	pinctrl = devm_pinctrl_get_select_default(dev);
+	if (IS_ERR(pinctrl))
+		dev_info(dev, "pins are not configured for the DAI\n");
+}
+
 /**
  * snd_soc_register_dai - Register a DAI with the ASoC core
  *
@@ -3734,6 +3748,8 @@ int snd_soc_register_dai(struct device *dev,
 
 	mutex_unlock(&client_mutex);
 
+	snd_soc_configure_dai_pins(dev);
+
 	pr_debug("Registered DAI '%s'\n", dai->name);
 
 	return 0;
@@ -3828,6 +3844,8 @@ int snd_soc_register_dais(struct device *dev,
 		pr_debug("Registered DAI '%s'\n", dai->name);
 	}
 
+	snd_soc_configure_dai_pins(dev);
+
 	return 0;
 
 err:
-- 
1.7.12

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

end of thread, other threads:[~2012-09-25 17:00 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21  7:54 [PATCH] ASoC: core: Configure pin muxing via pinctrl when registering a DAI Peter Ujfalusi
2012-09-21 11:13 ` Mark Brown
2012-09-21 13:16   ` Peter Ujfalusi
2012-09-21 14:55     ` Peter Ujfalusi
2012-09-22 15:23       ` Mark Brown
2012-09-21 16:23     ` Stephen Warren
2012-09-22 15:28       ` Mark Brown
2012-09-23  3:23         ` Stephen Warren
2012-09-24  9:20           ` Linus Walleij
2012-09-24 10:17             ` Mark Brown
2012-09-24 14:37               ` Linus Walleij
2012-09-25 11:11                 ` Mark Brown
2012-09-25 11:24                   ` Peter Ujfalusi
2012-09-25 11:43                     ` Linus Walleij
2012-09-25 11:43                     ` Mark Brown
2012-09-25 11:56                       ` Linus Walleij
2012-09-25 12:24                         ` Mark Brown
2012-09-25 17:00                     ` Stephen Warren
2012-09-24 15:41               ` Stephen Warren
2012-09-25 11:22                 ` Mark Brown
2012-09-24  8:34       ` Linus Walleij
2012-09-24 10:23         ` Mark Brown
2012-09-24 15:38         ` Stephen Warren
2012-09-22 15:18     ` 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).