All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiubo Li <Li.Xiubo@freescale.com>
To: <broonie@kernel.org>, <lgirdwood@gmail.com>
Cc: <kuninori.morimoto.gx@renesas.com>, <alsa-devel@alsa-project.org>,
	<linux-kernel@vger.kernel.org>, <tiwai@suse.de>, <perex@perex.cz>,
	Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH v2 2/3] ASoC: core: add slot information parsing supports
Date: Wed, 12 Feb 2014 15:45:11 +0800	[thread overview]
Message-ID: <1392191112-27028-3-git-send-email-Li.Xiubo@freescale.com> (raw)
In-Reply-To: <1392191112-27028-1-git-send-email-Li.Xiubo@freescale.com>

For some CPU/CODEC DAI devices the slot infomation maybe needed. This
patch adds the slot parsing from DT supports.

The style of the slot information in DT should be:
	<tx_mask, rx_mask, slots, slot_width>

For instance:
	simple-slot-info = <0xffffffc 0xffffffc 2 0>;

Please refer to tdm-slot.txt for more detail.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 include/sound/soc.h  | 10 ++++++++++
 sound/soc/soc-core.c | 23 +++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 21d025e..1aa85d0 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1110,6 +1110,13 @@ struct soc_enum {
 	const unsigned int *values;
 };
 
+struct soc_slot_info {
+	unsigned int tx_mask;
+	unsigned int rx_mask;
+	int slots;
+	int slot_width;
+};
+
 /* codec IO */
 unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
 unsigned int snd_soc_write(struct snd_soc_codec *codec,
@@ -1190,6 +1197,9 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card,
 			       const char *propname);
 int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
 					  const char *propname);
+int snd_soc_of_parse_slot_info(struct device_node *np,
+			      struct soc_slot_info *info,
+			      const char *propname);
 int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 				   const char *propname);
 unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index abee5f4..3ad4b88 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4558,6 +4558,29 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_simple_widgets);
 
+int snd_soc_of_parse_slot_info(struct device_node *np,
+			       struct soc_slot_info *info,
+			       const char *propname)
+{
+	u32 out_value[4];
+	int ret;
+
+	if (!info)
+		return -EINVAL;
+
+	ret = of_property_read_u32_array(np, propname, out_value, 4);
+	if (ret)
+		return ret;
+
+	info->tx_mask = out_value[0];
+	info->rx_mask = out_value[1];
+	info->slots = out_value[2];
+	info->slot_width = out_value[3];
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_of_parse_slot_info);
+
 int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 				   const char *propname)
 {
-- 
1.8.4



WARNING: multiple messages have this Message-ID (diff)
From: Xiubo Li <Li.Xiubo@freescale.com>
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: kuninori.morimoto.gx@renesas.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, tiwai@suse.de, perex@perex.cz,
	Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH v2 2/3] ASoC: core: add slot information parsing supports
Date: Wed, 12 Feb 2014 15:45:11 +0800	[thread overview]
Message-ID: <1392191112-27028-3-git-send-email-Li.Xiubo@freescale.com> (raw)
In-Reply-To: <1392191112-27028-1-git-send-email-Li.Xiubo@freescale.com>

For some CPU/CODEC DAI devices the slot infomation maybe needed. This
patch adds the slot parsing from DT supports.

The style of the slot information in DT should be:
	<tx_mask, rx_mask, slots, slot_width>

For instance:
	simple-slot-info = <0xffffffc 0xffffffc 2 0>;

Please refer to tdm-slot.txt for more detail.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 include/sound/soc.h  | 10 ++++++++++
 sound/soc/soc-core.c | 23 +++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 21d025e..1aa85d0 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1110,6 +1110,13 @@ struct soc_enum {
 	const unsigned int *values;
 };
 
+struct soc_slot_info {
+	unsigned int tx_mask;
+	unsigned int rx_mask;
+	int slots;
+	int slot_width;
+};
+
 /* codec IO */
 unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
 unsigned int snd_soc_write(struct snd_soc_codec *codec,
@@ -1190,6 +1197,9 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card,
 			       const char *propname);
 int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
 					  const char *propname);
+int snd_soc_of_parse_slot_info(struct device_node *np,
+			      struct soc_slot_info *info,
+			      const char *propname);
 int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 				   const char *propname);
 unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index abee5f4..3ad4b88 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4558,6 +4558,29 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_simple_widgets);
 
+int snd_soc_of_parse_slot_info(struct device_node *np,
+			       struct soc_slot_info *info,
+			       const char *propname)
+{
+	u32 out_value[4];
+	int ret;
+
+	if (!info)
+		return -EINVAL;
+
+	ret = of_property_read_u32_array(np, propname, out_value, 4);
+	if (ret)
+		return ret;
+
+	info->tx_mask = out_value[0];
+	info->rx_mask = out_value[1];
+	info->slots = out_value[2];
+	info->slot_width = out_value[3];
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_of_parse_slot_info);
+
 int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 				   const char *propname)
 {
-- 
1.8.4

  parent reply	other threads:[~2014-02-12  8:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12  7:45 [PATCH v2 0/3] Add tdm slot support Xiubo Li
2014-02-12  7:45 ` Xiubo Li
2014-02-12  7:45 ` [PATCH v2 1/3] ASoC: binding: add tdm-slot.txt Xiubo Li
2014-02-12  7:45   ` Xiubo Li
2014-02-12  9:26   ` [alsa-devel] " Lars-Peter Clausen
2014-02-12 11:10     ` Mark Brown
2014-02-13  7:32       ` Li.Xiubo
2014-02-12  7:45 ` Xiubo Li [this message]
2014-02-12  7:45   ` [PATCH v2 2/3] ASoC: core: add slot information parsing supports Xiubo Li
2014-02-12  7:45 ` [PATCH v2 3/3] ASoC: simple-card: " Xiubo Li
2014-02-12  7:45   ` Xiubo Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392191112-27028-3-git-send-email-Li.Xiubo@freescale.com \
    --to=li.xiubo@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.