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: