alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] Fix simple-card *-master DT parameter handling
@ 2014-03-10 11:28 Jyri Sarha
  2014-03-10 11:28 ` [PATCH RFC 1/2] ASoC: core: Add is_cpu_dai_node-parameter to snd_soc_of_parse_daifmt() Jyri Sarha
  2014-03-10 11:28 ` [PATCH RFC 2/2] ASoC: simple-card: Take snd_soc_of_parse_daifmt() change in to account Jyri Sarha
  0 siblings, 2 replies; 3+ messages in thread
From: Jyri Sarha @ 2014-03-10 11:28 UTC (permalink / raw)
  To: alsa-devel, devicetree, linux-omap
  Cc: liam.r.girdwood, detheridge, Jyri Sarha, peter.ujfalusi, broonie,
	bcousson

The schematics of bitclock-master and frame-master DT parameters
should depend on whether they are found from a cpu-dai or codec
sub-node.

- bitclock-master in cpu-dai node means Codec-Bitclock-Slave
- frame-master in cpu-dai node means Codec-Frame-Slave
- bitclock-master in codec node means Codec-Bitclock-Master
- frame-master in codec node means Codec-Frame-Master

For example in a cpu-dai mode bitclock-master parameter should produce
SND_SOC_DAIFMT_CBS_* daifmt flags and a codec node
SND_SOC_DAIFMT_CBM_* flags.

Best regards,
Jyri

Jyri Sarha (2):
  ASoC: core: Add is_cpu_dai_node-parameter to
    snd_soc_of_parse_daifmt()
  ASoC: simple-card: Take snd_soc_of_parse_daifmt() change in to
    account

 sound/soc/generic/simple-card.c |   13 ++++++++-----
 sound/soc/soc-core.c            |    8 +++++++-
 2 files changed, 15 insertions(+), 6 deletions(-)

-- 
1.7.9.5

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

* [PATCH RFC 1/2] ASoC: core: Add is_cpu_dai_node-parameter to snd_soc_of_parse_daifmt()
  2014-03-10 11:28 [PATCH RFC 0/2] Fix simple-card *-master DT parameter handling Jyri Sarha
@ 2014-03-10 11:28 ` Jyri Sarha
  2014-03-10 11:28 ` [PATCH RFC 2/2] ASoC: simple-card: Take snd_soc_of_parse_daifmt() change in to account Jyri Sarha
  1 sibling, 0 replies; 3+ messages in thread
From: Jyri Sarha @ 2014-03-10 11:28 UTC (permalink / raw)
  To: alsa-devel, devicetree, linux-omap
  Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson, detheridge,
	Jyri Sarha

The schematics of bitclock-master and frame-master DT parameters
should be inversed when parsing a cpu-dai node.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 sound/soc/soc-core.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 8ddb15c..dfff75f 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4613,7 +4613,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing);
 
 unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
-				     const char *prefix)
+				     const char *prefix,
+				     bool is_cpu_dai_node)
 {
 	int ret, i;
 	char prop[128];
@@ -4700,6 +4701,11 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
 	snprintf(prop, sizeof(prop), "%sframe-master", prefix);
 	frame = !!of_get_property(np, prop, NULL);
 
+	if (is_cpu_dai_node) {
+		bit = !bit;
+		frame = !frame;
+	}
+
 	switch ((bit << 4) + frame) {
 	case 0x11:
 		format |= SND_SOC_DAIFMT_CBM_CFM;
-- 
1.7.9.5


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

* [PATCH RFC 2/2] ASoC: simple-card: Take snd_soc_of_parse_daifmt() change in to account
  2014-03-10 11:28 [PATCH RFC 0/2] Fix simple-card *-master DT parameter handling Jyri Sarha
  2014-03-10 11:28 ` [PATCH RFC 1/2] ASoC: core: Add is_cpu_dai_node-parameter to snd_soc_of_parse_daifmt() Jyri Sarha
@ 2014-03-10 11:28 ` Jyri Sarha
  1 sibling, 0 replies; 3+ messages in thread
From: Jyri Sarha @ 2014-03-10 11:28 UTC (permalink / raw)
  To: alsa-devel, devicetree, linux-omap
  Cc: peter.ujfalusi, broonie, liam.r.girdwood, bcousson, detheridge,
	Jyri Sarha

snd_soc_of_parse_daifmt() needs to know if it is parsing a cpu-dai node.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 sound/soc/generic/simple-card.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 7cabcc5..7cbbf44 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -87,7 +87,8 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 			      unsigned int daifmt,
 			      struct asoc_simple_dai *dai,
 			      const struct device_node **p_node,
-			      const char **name)
+			      const char **name,
+			      bool is_cpu_dai_node)
 {
 	struct device_node *node;
 	struct clk *clk;
@@ -117,7 +118,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	 * bitclock-master,    frame-master
 	 * and specific "format" if it has
 	 */
-	dai->fmt = snd_soc_of_parse_daifmt(np, NULL);
+	dai->fmt = snd_soc_of_parse_daifmt(np, NULL, is_cpu_dai_node);
 	dai->fmt |= daifmt;
 
 	/*
@@ -165,7 +166,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name");
 
 	/* get CPU/CODEC common format via simple-audio-card,format */
-	priv->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
+	priv->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,", 0) &
 		(SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK);
 
 	/* off-codec widgets */
@@ -191,7 +192,8 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 		ret = asoc_simple_card_sub_parse_of(np, priv->daifmt,
 						  &priv->cpu_dai,
 						  &dai_link->cpu_of_node,
-						  &dai_link->cpu_dai_name);
+						  &dai_link->cpu_dai_name,
+						  true);
 	if (ret < 0)
 		return ret;
 
@@ -202,7 +204,8 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 		ret = asoc_simple_card_sub_parse_of(np, priv->daifmt,
 						  &priv->codec_dai,
 						  &dai_link->codec_of_node,
-						  &dai_link->codec_dai_name);
+						  &dai_link->codec_dai_name,
+						  false);
 	if (ret < 0)
 		return ret;
 
-- 
1.7.9.5


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

end of thread, other threads:[~2014-03-10 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-10 11:28 [PATCH RFC 0/2] Fix simple-card *-master DT parameter handling Jyri Sarha
2014-03-10 11:28 ` [PATCH RFC 1/2] ASoC: core: Add is_cpu_dai_node-parameter to snd_soc_of_parse_daifmt() Jyri Sarha
2014-03-10 11:28 ` [PATCH RFC 2/2] ASoC: simple-card: Take snd_soc_of_parse_daifmt() change in to account Jyri Sarha

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