Introduce for-dpcm DT property
Subsystems (4)
cover Introduce for-dpcm DT property
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(-)
Signature · 1 line
2.17.1
RFC PATCH 1/2 ASoC: simple-card: Introduce force-dpcm DT property
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.
--- 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(-)
include/sound/simple_card_utils.h +4 -0
@@ -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);
sound/soc/generic/simple-card-utils.c +17 -0
@@ -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,
sound/soc/generic/simple-card.c +23 -2
@@ -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 */
Signature · 1 line
2.17.1
RFC PATCH 2/2 ASoC: simple-card: Add documentation for force-dpcm property
In reply to Daniel BalutaThis 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.
--- Documentation/devicetree/bindings/sound/simple-card.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/sound/simple-card.txt +1 -0
@@ -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
Signature · 1 line
2.17.1
Mark Brown
maintainerRe: [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property
Quoted 5 lines · 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.
+- 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.
Re: [alsa-devel] [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property
Quoted 7 lines · Mark Brown
Quoted 3 lines · 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.
Quoted 5 lines
Quoted 1 line
+- 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.
Mark Brown
maintainerRe: [alsa-devel] [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property
Quoted 8 lines · Daniel Baluta
Quoted 3 lines · Mark Brown
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.
Kuninori Morimoto
maintainerRe: [alsa-devel] [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property
Hi
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
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
Kuninori Morimoto
maintainerRe: [alsa-devel] [RFC PATCH 2/2] ASoC: simple-card: Add documentation for force-dpcm property
Hi
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
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.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
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