devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] Introduce for-dpcm DT property
@ 2019-10-13 19:00 Daniel Baluta
  2019-10-13 19:00 ` [RFC PATCH 1/2] ASoC: simple-card: Introduce force-dpcm " Daniel Baluta
  2019-10-13 19:00 ` [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property Daniel Baluta
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Baluta @ 2019-10-13 19:00 UTC (permalink / raw)
  To: perex, tiwai, broonie, kuninori.morimoto.gx
  Cc: lgirdwood, robh+dt, alsa-devel, devicetree, linux-kernel,
	linux-imx, Daniel Baluta

We need to be able to create DPCM links even if we have a single CPU DAI
or just a dummy CPU DAI.

Daniel Baluta (2):
  ASoC: simple-card: Introduce force-dpcm DT property
  ASoC: simple-card: Add documentation for force-dpcm property

 .../devicetree/bindings/sound/simple-card.txt |  1 +
 include/sound/simple_card_utils.h             |  4 +++
 sound/soc/generic/simple-card-utils.c         | 17 +++++++++++++
 sound/soc/generic/simple-card.c               | 25 +++++++++++++++++--
 4 files changed, 45 insertions(+), 2 deletions(-)

-- 
2.17.1

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

* [RFC PATCH 1/2] ASoC: simple-card: Introduce force-dpcm DT property
  2019-10-13 19:00 [RFC PATCH 0/2] Introduce for-dpcm DT property Daniel Baluta
@ 2019-10-13 19:00 ` Daniel Baluta
  2019-10-13 19:00 ` [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property Daniel Baluta
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Baluta @ 2019-10-13 19:00 UTC (permalink / raw)
  To: perex, tiwai, broonie, kuninori.morimoto.gx
  Cc: lgirdwood, robh+dt, alsa-devel, devicetree, linux-kernel,
	linux-imx, Daniel Baluta

Until now dai_link uses dynamic PCM in the following conditions:
	* it is dpcm_selectable (this means compatible string is simple-scu-card)
	* it has convert-xxx property
	* or it has more than one CPU DAIs

Our use case requires to be able to build a DPCM link with just 1 CPU.
Add force-dpcm DT property to realize this.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 include/sound/simple_card_utils.h     |  4 ++++
 sound/soc/generic/simple-card-utils.c | 17 +++++++++++++++++
 sound/soc/generic/simple-card.c       | 25 +++++++++++++++++++++++--
 3 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index 985a5f583de4..0578bbfa4a24 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -48,6 +48,7 @@ struct asoc_simple_priv {
 		struct asoc_simple_data adata;
 		struct snd_soc_codec_conf *codec_conf;
 		unsigned int mclk_fs;
+		unsigned int force_dpcm;
 	} *dai_props;
 	struct asoc_simple_jack hp_jack;
 	struct asoc_simple_jack mic_jack;
@@ -120,6 +121,9 @@ void asoc_simple_convert_fixup(struct asoc_simple_data *data,
 void asoc_simple_parse_convert(struct device *dev,
 			       struct device_node *np, char *prefix,
 			       struct asoc_simple_data *data);
+void asoc_simple_parse_force_dpcm(struct device *dev,
+				  struct device_node *np, char *prefix,
+				  unsigned int *force_dpcm);
 
 int asoc_simple_parse_routing(struct snd_soc_card *card,
 				      char *prefix);
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 9b794775df53..2f03a73f8a8a 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -52,6 +52,23 @@ void asoc_simple_parse_convert(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(asoc_simple_parse_convert);
 
+void asoc_simple_parse_force_dpcm(struct device *dev,
+			       struct device_node *np,
+			       char *prefix,
+			       unsigned int *force_dpcm)
+{
+	char prop[128];
+
+	if (!prefix)
+		prefix = "";
+
+	/* dpcm property */
+	snprintf(prop, sizeof(prop), "%s%s", prefix, "force-dpcm");
+	if (of_find_property(np, prop, NULL))
+		*force_dpcm = 1;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_parse_force_dpcm);
+
 int asoc_simple_parse_daifmt(struct device *dev,
 			     struct device_node *node,
 			     struct device_node *codec,
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index fc9c753db8dd..e40e22c8813b 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -92,6 +92,21 @@ static void simple_parse_convert(struct device *dev,
 	of_node_put(node);
 }
 
+static void simple_parse_force_dpcm(struct device *dev,
+				 struct device_node *np,
+				 unsigned int *force_dpcm)
+{
+	struct device_node *top = dev->of_node;
+	struct device_node *node = of_get_parent(np);
+
+	asoc_simple_parse_force_dpcm(dev, top,  PREFIX, force_dpcm);
+	asoc_simple_parse_force_dpcm(dev, node, PREFIX, force_dpcm);
+	asoc_simple_parse_force_dpcm(dev, node, NULL,   force_dpcm);
+	asoc_simple_parse_force_dpcm(dev, np,   NULL,   force_dpcm);
+
+	of_node_put(node);
+}
+
 static void simple_parse_mclk_fs(struct device_node *top,
 				 struct device_node *cpu,
 				 struct device_node *codec,
@@ -372,6 +387,7 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
 		struct asoc_simple_data adata;
 		struct device_node *codec;
 		struct device_node *np;
+		unsigned int force_dpcm = 0;
 		int num = of_get_child_count(node);
 
 		/* get codec */
@@ -387,15 +403,20 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
 		for_each_child_of_node(node, np)
 			simple_parse_convert(dev, np, &adata);
 
+		/* get force-dpcm property */
+		for_each_child_of_node(node, np)
+			simple_parse_force_dpcm(dev, np, &force_dpcm);
+
 		/* loop for all CPU/Codec node */
 		for_each_child_of_node(node, np) {
 			/*
 			 * It is DPCM
 			 * if it has many CPUs,
-			 * or has convert-xxx property
+			 * or it has convert-xxx property
+			 * or it has force-dpcm property
 			 */
 			if (dpcm_selectable &&
-			    (num > 2 ||
+			    (num > 2 || force_dpcm ||
 			     adata.convert_rate || adata.convert_channels))
 				ret = func_dpcm(priv, np, codec, li, is_top);
 			/* else normal sound */
-- 
2.17.1

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

* [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property
  2019-10-13 19:00 [RFC PATCH 0/2] Introduce for-dpcm DT property Daniel Baluta
  2019-10-13 19:00 ` [RFC PATCH 1/2] ASoC: simple-card: Introduce force-dpcm " Daniel Baluta
@ 2019-10-13 19:00 ` Daniel Baluta
  2019-10-14 11:56   ` Mark Brown
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel Baluta @ 2019-10-13 19:00 UTC (permalink / raw)
  To: perex, tiwai, broonie, kuninori.morimoto.gx
  Cc: lgirdwood, robh+dt, alsa-devel, devicetree, linux-kernel,
	linux-imx, Daniel Baluta

This property can be global in which case all links created will be DPCM
or present in certian dai-link subnode in which case only that specific
link is forced to be DPCM.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 Documentation/devicetree/bindings/sound/simple-card.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index 79954cd6e37b..15e6f5329857 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -63,6 +63,7 @@ Optional dai-link subnode properties:
 - mclk-fs             			: Multiplication factor between stream
 					  rate and codec mclk, applied only for
 					  the dai-link.
+- force-dpcm				: Indicates dai-link is always DPCM.
 
 For backward compatibility the frame-master and bitclock-master
 properties can be used as booleans in codec subnode to indicate if the
-- 
2.17.1

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

* Re: [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property
  2019-10-13 19:00 ` [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property Daniel Baluta
@ 2019-10-14 11:56   ` Mark Brown
  2019-10-14 13:17     ` [alsa-devel] " Daniel Baluta
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2019-10-14 11:56 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: perex, tiwai, kuninori.morimoto.gx, lgirdwood, robh+dt,
	alsa-devel, devicetree, linux-kernel, linux-imx

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

On Sun, Oct 13, 2019 at 10:00:14PM +0300, Daniel Baluta wrote:

> This property can be global in which case all links created will be DPCM
> or present in certian dai-link subnode in which case only that specific
> link is forced to be DPCM.

> +- force-dpcm				: Indicates dai-link is always DPCM.

DPCM is an implementation detail of Linux (and one that we want to phase
out going forwards too), we shouldn't be putting it in the DT bindings
where it becomes an ABI.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [alsa-devel] [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property
  2019-10-14 11:56   ` Mark Brown
@ 2019-10-14 13:17     ` Daniel Baluta
  2019-10-14 16:10       ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Baluta @ 2019-10-14 13:17 UTC (permalink / raw)
  To: Mark Brown
  Cc: Daniel Baluta, Devicetree List, Linux-ALSA, Kuninori Morimoto,
	Linux Kernel Mailing List, Liam Girdwood, Takashi Iwai,
	Rob Herring, dl-linux-imx, Guido Roncarolo, Jerome Laclavere

On Mon, Oct 14, 2019 at 2:57 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Sun, Oct 13, 2019 at 10:00:14PM +0300, Daniel Baluta wrote:
>
> > This property can be global in which case all links created will be DPCM
> > or present in certian dai-link subnode in which case only that specific
> > link is forced to be DPCM.
>
> > +- force-dpcm                         : Indicates dai-link is always DPCM.
>
> DPCM is an implementation detail of Linux (and one that we want to phase
> out going forwards too), we shouldn't be putting it in the DT bindings
> where it becomes an ABI.

Hi Mark,

I see your point. This is way I marked the patch series as RFC. I need to find
another way to reuse simple-card as machine driver for SOF.

thanks,
Daniel.

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

* Re: [alsa-devel] [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property
  2019-10-14 13:17     ` [alsa-devel] " Daniel Baluta
@ 2019-10-14 16:10       ` Mark Brown
  2019-10-15  1:02         ` Kuninori Morimoto
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2019-10-14 16:10 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: Daniel Baluta, Devicetree List, Linux-ALSA, Kuninori Morimoto,
	Linux Kernel Mailing List, Liam Girdwood, Takashi Iwai,
	Rob Herring, dl-linux-imx, Guido Roncarolo, Jerome Laclavere

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

On Mon, Oct 14, 2019 at 04:17:31PM +0300, Daniel Baluta wrote:
> On Mon, Oct 14, 2019 at 2:57 PM Mark Brown <broonie@kernel.org> wrote:

> > DPCM is an implementation detail of Linux (and one that we want to phase
> > out going forwards too), we shouldn't be putting it in the DT bindings
> > where it becomes an ABI.

> I see your point. This is way I marked the patch series as RFC. I need to find
> another way to reuse simple-card as machine driver for SOF.

Have a look at the way the Renesas systems are using this and the audio
graph card - they have DPCM.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [alsa-devel] [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property
  2019-10-14 16:10       ` Mark Brown
@ 2019-10-15  1:02         ` Kuninori Morimoto
  2019-10-15  1:18           ` Kuninori Morimoto
  0 siblings, 1 reply; 8+ messages in thread
From: Kuninori Morimoto @ 2019-10-15  1:02 UTC (permalink / raw)
  To: Mark Brown
  Cc: Daniel Baluta, Daniel Baluta, Devicetree List, Linux-ALSA,
	Linux Kernel Mailing List, Liam Girdwood, Takashi Iwai,
	Rob Herring, dl-linux-imx, Guido Roncarolo, Jerome Laclavere


Hi

> > > DPCM is an implementation detail of Linux (and one that we want to phase
> > > out going forwards too), we shouldn't be putting it in the DT bindings
> > > where it becomes an ABI.
> 
> > I see your point. This is way I marked the patch series as RFC. I need to find
> > another way to reuse simple-card as machine driver for SOF.
> 
> Have a look at the way the Renesas systems are using this and the audio
> graph card - they have DPCM.

Indeed we (= Renesas) are using this as DPCM, but unfortunately
it is not upstreamed. Using local patch.

Thank you for your help !!
Best regards
---
Kuninori Morimoto

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

* Re: [alsa-devel] [RFC PATCH 2/2] ASoC: simple-card: Add        documentation for force-dpcm property
  2019-10-15  1:02         ` Kuninori Morimoto
@ 2019-10-15  1:18           ` Kuninori Morimoto
  0 siblings, 0 replies; 8+ messages in thread
From: Kuninori Morimoto @ 2019-10-15  1:18 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Devicetree List, Daniel Baluta, Linux-ALSA,
	Takashi Iwai, Liam Girdwood, Linux Kernel Mailing List,
	Rob Herring, Jerome Laclavere, dl-linux-imx, Daniel Baluta,
	Guido Roncarolo


Hi

> > > > DPCM is an implementation detail of Linux (and one that we want to phase
> > > > out going forwards too), we shouldn't be putting it in the DT bindings
> > > > where it becomes an ABI.
> > 
> > > I see your point. This is way I marked the patch series as RFC. I need to find
> > > another way to reuse simple-card as machine driver for SOF.
> > 
> > Have a look at the way the Renesas systems are using this and the audio
> > graph card - they have DPCM.
> 
> Indeed we (= Renesas) are using this as DPCM, but unfortunately
> it is not upstreamed. Using local patch.

I mean DT part.

Thank you for your help !!
Best regards
---
Kuninori Morimoto

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

end of thread, other threads:[~2019-10-15  1:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-13 19:00 [RFC PATCH 0/2] Introduce for-dpcm DT property Daniel Baluta
2019-10-13 19:00 ` [RFC PATCH 1/2] ASoC: simple-card: Introduce force-dpcm " Daniel Baluta
2019-10-13 19:00 ` [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property Daniel Baluta
2019-10-14 11:56   ` Mark Brown
2019-10-14 13:17     ` [alsa-devel] " Daniel Baluta
2019-10-14 16:10       ` Mark Brown
2019-10-15  1:02         ` Kuninori Morimoto
2019-10-15  1:18           ` Kuninori Morimoto

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).