mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiubo Li <Li.Xiubo@freescale.com>
To: <broonie@kernel.org>, <lgirdwood@gmail.com>, <lars@metafoo.de>
Cc: <linux-kernel@vger.kernel.org>, <alsa-devel@alsa-project.org>,
	<b47053@freescale.com>, Xiubo Li <Li.Xiubo@freescale.com>,
	Mark Brown <broonie@linaro.org>
Subject: [PATCH v3 3/3] ASoC: simple-card: add slot information parsing supports
Date: Fri, 14 Feb 2014 09:34:36 +0800	[thread overview]
Message-ID: <1392341676-4143-4-git-send-email-Li.Xiubo@freescale.com> (raw)
In-Reply-To: <1392341676-4143-1-git-send-email-Li.Xiubo@freescale.com>

For some CPU/CODEC DAI devices the slot information maybe needed. This
patch adds the slot information parsing for simple-card driver.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Mark Brown <broonie@linaro.org>
---
 .../devicetree/bindings/sound/simple-card.txt          |  5 +++++
 include/sound/simple_card.h                            |  2 ++
 sound/soc/generic/simple-card.c                        | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index 0527358..b30c222 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -18,6 +18,8 @@ Optional properties:
 					  Each entry is a pair of strings, the first being the
 					  connection's sink, the second being the connection's
 					  source.
+- dai-tdm-slot-num			: Please refer to tdm-slot.txt.
+- dai-tdm-slot-width			: Please refer to tdm-slot.txt.
 
 Required subnodes:
 
@@ -56,6 +58,9 @@ sound {
 		"Headphone Jack", "HP_OUT",
 		"External Speaker", "LINE_OUT";
 
+	dai-tdm-slot-num = <2>;
+	dai-tdm-slot-width = <8>;
+
 	simple-audio-card,cpu {
 		sound-dai = <&sh_fsi2 0>;
 	};
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index e1ac996..9b0ac77 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -18,6 +18,8 @@ struct asoc_simple_dai {
 	const char *name;
 	unsigned int fmt;
 	unsigned int sysclk;
+	int slots;
+	int slot_width;
 };
 
 struct asoc_simple_card_info {
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 4fe8abc..bdd176d 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -9,11 +9,14 @@
  * published by the Free Software Foundation.
  */
 #include <linux/clk.h>
+#include <linux/device.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
 #include <sound/simple_card.h>
+#include <sound/soc-dai.h>
+#include <sound/soc.h>
 
 struct simple_card_data {
 	struct snd_soc_card snd_card;
@@ -44,6 +47,16 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
 		}
 	}
 
+	if (set->slots) {
+		ret = snd_soc_dai_set_tdm_slot(dai, 0, 0,
+						set->slots,
+						set->slot_width);
+		if (ret && ret != -ENOTSUPP) {
+			dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
+			goto err;
+		}
+	}
+
 	ret = 0;
 
 err:
@@ -94,6 +107,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	if (ret < 0)
 		goto parse_error;
 
+	/* parse TDM slot */
+	ret = snd_soc_of_parse_tdm_slot(np, &dai->slots, &dai->slot_width);
+	if (ret)
+		goto parse_error;
+
 	/*
 	 * bitclock-inversion, frame-inversion
 	 * bitclock-master,    frame-master
-- 
1.8.4



  parent reply	other threads:[~2014-02-14  2:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14  1:34 [PATCH v3 0/3] Add TDM slot info OF " Xiubo Li
2014-02-14  1:34 ` [PATCH v3 1/3] ASoC: binding: add tdm-slot.txt Xiubo Li
2014-02-14  1:34 ` [PATCH v3 2/3] ASoC: core: add TDM slot parsing from DT supports Xiubo Li
2014-02-14  1:34 ` Xiubo Li [this message]
2014-02-23  5:27 ` [PATCH v3 0/3] Add TDM slot info OF parsing supports Mark Brown

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=1392341676-4143-4-git-send-email-Li.Xiubo@freescale.com \
    --to=li.xiubo@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b47053@freescale.com \
    --cc=broonie@kernel.org \
    --cc=broonie@linaro.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 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®