mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: simple-card: Add DAPM routes parse from device tree
@ 2013-12-23  4:57 Xiubo Li
  2013-12-31 12:38 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Xiubo Li @ 2013-12-23  4:57 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: rob, kuninori.morimoto.gx, fabio.estevam, alsa-devel, linux-doc,
	linux-kernel

Parses a simple DAPM route table from device tree.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 Documentation/devicetree/bindings/sound/simple-card.txt | 13 +++++++++++--
 sound/soc/generic/simple-card.c                         | 11 +++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index 769a346..2ee80c76 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -9,8 +9,13 @@ Required properties:
 Optional properties:
 
 - simple-audio-card,format		: CPU/CODEC common audio format.
-					"i2s", "right_j", "left_j" , "dsp_a"
-					"dsp_b", "ac97", "pdm", "msb", "lsb"
+					  "i2s", "right_j", "left_j" , "dsp_a"
+					  "dsp_b", "ac97", "pdm", "msb", "lsb"
+- simple-audio-routing			: A list of the connections between audio components.
+					  Each entry is a pair of strings, the first being the
+					  connection's sink, the second being the connection's
+					  source.
+
 Required subnodes:
 
 - simple-audio-card,cpu			: CPU   sub-node
@@ -38,6 +43,10 @@ Example:
 sound {
 	compatible = "simple-audio-card";
 	simple-audio-card,format = "left_j";
+	simple-audio-routing =
+		"MIC_IN", "Mic Jack",
+		"Headphone Jack", "HP_OUT",
+		"Ext Spk", "LINE_OUT";
 
 	simple-audio-card,cpu {
 		sound-dai = <&sh_fsi2 0>;
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 1d87db8..643c9ed 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -116,12 +116,18 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 {
 	struct device_node *np;
 	char *name;
-	int ret = 0;
+	int ret;
 
 	/* get CPU/CODEC common format via simple-audio-card,format */
 	info->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
 		(SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK);
 
+	/* DAPM routes */
+	ret = snd_soc_of_parse_audio_routing(&info->snd_card,
+					"simple-audio-routing");
+	if (ret)
+		return ret;
+
 	/* CPU sub-node */
 	ret = -EINVAL;
 	np = of_get_child_by_name(node, "simple-audio-card,cpu");
@@ -185,6 +191,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 		cinfo = devm_kzalloc(dev, sizeof(*cinfo), GFP_KERNEL);
 		if (cinfo) {
 			int ret;
+			cinfo->snd_card.dev = &pdev->dev;
 			ret = asoc_simple_card_parse_of(np, cinfo, dev,
 							&of_cpu,
 							&of_codec,
@@ -196,6 +203,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 			}
 		}
 	} else {
+		cinfo->snd_card.dev = &pdev->dev;
 		cinfo = pdev->dev.platform_data;
 	}
 
@@ -235,7 +243,6 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	cinfo->snd_card.owner		= THIS_MODULE;
 	cinfo->snd_card.dai_link	= &cinfo->snd_link;
 	cinfo->snd_card.num_links	= 1;
-	cinfo->snd_card.dev		= &pdev->dev;
 
 	return devm_snd_soc_register_card(&pdev->dev, &cinfo->snd_card);
 }
-- 
1.8.4



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

* Re: [PATCH] ASoC: simple-card: Add DAPM routes parse from device tree
  2013-12-23  4:57 [PATCH] ASoC: simple-card: Add DAPM routes parse from device tree Xiubo Li
@ 2013-12-31 12:38 ` Mark Brown
  2014-01-02  3:59   ` Li.Xiubo
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2013-12-31 12:38 UTC (permalink / raw)
  To: Xiubo Li
  Cc: lgirdwood, rob, kuninori.morimoto.gx, fabio.estevam, alsa-devel,
	linux-doc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

On Mon, Dec 23, 2013 at 12:57:01PM +0800, Xiubo Li wrote:
> Parses a simple DAPM route table from device tree.

I've applied this on the basis that it's using a generic feature and
won't do any harm but given that no off-CODEC widgets are defined I do
have to wonder when it'll actually be useful.

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

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

* RE: [PATCH] ASoC: simple-card: Add DAPM routes parse from device tree
  2013-12-31 12:38 ` Mark Brown
@ 2014-01-02  3:59   ` Li.Xiubo
  0 siblings, 0 replies; 3+ messages in thread
From: Li.Xiubo @ 2014-01-02  3:59 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, rob, kuninori.morimoto.gx, Fabio.Estevam, alsa-devel,
	linux-doc, linux-kernel


> Subject: Re: [PATCH] ASoC: simple-card: Add DAPM routes parse from device tree
> 
> On Mon, Dec 23, 2013 at 12:57:01PM +0800, Xiubo Li wrote:
> > Parses a simple DAPM route table from device tree.
> 
> I've applied this on the basis that it's using a generic feature and
> won't do any harm but given that no off-CODEC widgets are defined I do
> have to wonder when it'll actually be useful.

Yes, it will be useful for the Vybird and LS-1 boards and also many others.

And for the simple-card there still needs the off-CODEC widgets registering,
I'll send the followed patches later.


Thanks,

--
Best Regards,
Xiubo

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

end of thread, other threads:[~2014-01-02  3:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-23  4:57 [PATCH] ASoC: simple-card: Add DAPM routes parse from device tree Xiubo Li
2013-12-31 12:38 ` Mark Brown
2014-01-02  3:59   ` Li.Xiubo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®