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: <timur@tabi.org>, <tiwai@suse.de>, <lars@metafoo.de>,
	<Guangyu.Chen@freescale.com>, <fabio.estevam@freescale.com>,
	<shawn.guo@linaro.org>, <denis@eukrea.com>, <mpa@pengutronix.de>,
	<s.hauer@pengutronix.de>, <moinejf@free.fr>,
	<kuninori.morimoto.gx@renesas.com>, <alsa-devel@alsa-project.org>,
	<linux-kernel@vger.kernel.org>, Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH 02/10] ASoC: fsl-utils: Add fsl_asoc_of_xlate_tdm_slot_mask() support.
Date: Wed, 26 Feb 2014 11:59:27 +0800	[thread overview]
Message-ID: <1393387175-15539-3-git-send-email-Li.Xiubo@freescale.com> (raw)
In-Reply-To: <1393387175-15539-1-git-send-email-Li.Xiubo@freescale.com>

This patch add fsl_asoc_of_xlate_tdm_slot_mask() support for utils.
For the some spcified DAI driver, this will be used to generate the
TDM slot TX/RX mask. And the TX/RX mask will use a 0 bit for an active
slot as default, and the default active bits are at the LSB of
the masks.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/fsl/fsl_utils.c | 27 +++++++++++++++++++++++++++
 sound/soc/fsl/fsl_utils.h |  4 +++-
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/fsl_utils.c b/sound/soc/fsl/fsl_utils.c
index b9e42b5..b536eb1 100644
--- a/sound/soc/fsl/fsl_utils.c
+++ b/sound/soc/fsl/fsl_utils.c
@@ -86,6 +86,33 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np,
 }
 EXPORT_SYMBOL(fsl_asoc_get_dma_channel);
 
+/**
+ * fsl_asoc_of_xlate_tdm_slot_mask - generate TDM slot TX/RX mask.
+ *
+ * @slots: Number of slots in use.
+ * @tx_mask: bitmask representing active TX slots.
+ * @rx_mask: bitmask representing active RX slots.
+ *
+ * This function used to generate the TDM slot TX/RX mask. And the TX/RX
+ * mask will use a 0 bit for an active slot as default, and the default
+ * active bits are at the LSB of the mask value.
+ */
+int fsl_asoc_of_xlate_tdm_slot_mask(unsigned int slots,
+				    unsigned int *tx_mask,
+				    unsigned int *rx_mask)
+{
+	if (!slots)
+		return -EINVAL;
+
+	if (tx_mask)
+		*tx_mask = ~((1 << slots) - 1);
+	if (rx_mask)
+		*rx_mask = ~((1 << slots) - 1);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(fsl_asoc_of_xlate_tdm_slot_mask);
+
 MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
 MODULE_DESCRIPTION("Freescale ASoC utility code");
 MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/fsl/fsl_utils.h b/sound/soc/fsl/fsl_utils.h
index b295112..01b01f9 100644
--- a/sound/soc/fsl/fsl_utils.h
+++ b/sound/soc/fsl/fsl_utils.h
@@ -22,5 +22,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, const char *name,
 			     struct snd_soc_dai_link *dai,
 			     unsigned int *dma_channel_id,
 			     unsigned int *dma_id);
-
+int fsl_asoc_of_xlate_tdm_slot_mask(unsigned int slots,
+				    unsigned int *tx_mask,
+				    unsigned int *rx_mask);
 #endif /* _FSL_UTILS_H */
-- 
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: fabio.estevam@freescale.com, moinejf@free.fr,
	alsa-devel@alsa-project.org, lars@metafoo.de,
	kuninori.morimoto.gx@renesas.com, tiwai@suse.de,
	s.hauer@pengutronix.de, timur@tabi.org,
	linux-kernel@vger.kernel.org, denis@eukrea.com,
	Xiubo Li <Li.Xiubo@freescale.com>,
	Guangyu.Chen@freescale.com, mpa@pengutronix.de,
	shawn.guo@linaro.org
Subject: [PATCH 02/10] ASoC: fsl-utils: Add fsl_asoc_of_xlate_tdm_slot_mask() support.
Date: Wed, 26 Feb 2014 11:59:27 +0800	[thread overview]
Message-ID: <1393387175-15539-3-git-send-email-Li.Xiubo@freescale.com> (raw)
In-Reply-To: <1393387175-15539-1-git-send-email-Li.Xiubo@freescale.com>

This patch add fsl_asoc_of_xlate_tdm_slot_mask() support for utils.
For the some spcified DAI driver, this will be used to generate the
TDM slot TX/RX mask. And the TX/RX mask will use a 0 bit for an active
slot as default, and the default active bits are at the LSB of
the masks.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/fsl/fsl_utils.c | 27 +++++++++++++++++++++++++++
 sound/soc/fsl/fsl_utils.h |  4 +++-
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/fsl_utils.c b/sound/soc/fsl/fsl_utils.c
index b9e42b5..b536eb1 100644
--- a/sound/soc/fsl/fsl_utils.c
+++ b/sound/soc/fsl/fsl_utils.c
@@ -86,6 +86,33 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np,
 }
 EXPORT_SYMBOL(fsl_asoc_get_dma_channel);
 
+/**
+ * fsl_asoc_of_xlate_tdm_slot_mask - generate TDM slot TX/RX mask.
+ *
+ * @slots: Number of slots in use.
+ * @tx_mask: bitmask representing active TX slots.
+ * @rx_mask: bitmask representing active RX slots.
+ *
+ * This function used to generate the TDM slot TX/RX mask. And the TX/RX
+ * mask will use a 0 bit for an active slot as default, and the default
+ * active bits are at the LSB of the mask value.
+ */
+int fsl_asoc_of_xlate_tdm_slot_mask(unsigned int slots,
+				    unsigned int *tx_mask,
+				    unsigned int *rx_mask)
+{
+	if (!slots)
+		return -EINVAL;
+
+	if (tx_mask)
+		*tx_mask = ~((1 << slots) - 1);
+	if (rx_mask)
+		*rx_mask = ~((1 << slots) - 1);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(fsl_asoc_of_xlate_tdm_slot_mask);
+
 MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
 MODULE_DESCRIPTION("Freescale ASoC utility code");
 MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/fsl/fsl_utils.h b/sound/soc/fsl/fsl_utils.h
index b295112..01b01f9 100644
--- a/sound/soc/fsl/fsl_utils.h
+++ b/sound/soc/fsl/fsl_utils.h
@@ -22,5 +22,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, const char *name,
 			     struct snd_soc_dai_link *dai,
 			     unsigned int *dma_channel_id,
 			     unsigned int *dma_id);
-
+int fsl_asoc_of_xlate_tdm_slot_mask(unsigned int slots,
+				    unsigned int *tx_mask,
+				    unsigned int *rx_mask);
 #endif /* _FSL_UTILS_H */
-- 
1.8.4

  parent reply	other threads:[~2014-02-26  5:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting Xiubo Li
2014-02-26  3:59 ` Xiubo Li
2014-02-26  3:59 ` [PATCH 01/10] ASoC: core: Add snd_soc_dai_set_tdm_slot_xlate() Xiubo Li
2014-02-26  3:59   ` Xiubo Li
2014-03-01 13:19   ` [alsa-devel] " Lars-Peter Clausen
2014-03-05  3:39     ` Mark Brown
2014-03-05  3:55       ` Li.Xiubo
2014-03-05  3:55         ` Li.Xiubo
2014-03-05  6:30         ` [alsa-devel] " Mark Brown
2014-03-05  6:30           ` Mark Brown
2014-02-26  3:59 ` Xiubo Li [this message]
2014-02-26  3:59   ` [PATCH 02/10] ASoC: fsl-utils: Add fsl_asoc_of_xlate_tdm_slot_mask() support Xiubo Li
2014-02-26  3:59 ` [PATCH 03/10] ASoC: fsl-esai: Add .of_xlate_tdm_slot_mask() support Xiubo Li
2014-02-26  3:59   ` Xiubo Li
2014-02-26  3:59 ` [PATCH 04/10] ASoC: fsl-ssi: " Xiubo Li
2014-02-26  3:59   ` Xiubo Li
2014-02-26  3:59 ` [PATCH 05/10] ASoC: imx-ssi: " Xiubo Li
2014-02-26  3:59   ` Xiubo Li
2014-02-26  3:59 ` [PATCH 06/10] ASoC: simple-card: Use snd_soc_dai_set_tdm_slot_xlate() Xiubo Li
2014-02-26  3:59   ` Xiubo Li
2014-02-26  3:59 ` [PATCH 07/10] ASoC: blackfin: bf5xx-ad1836: " Xiubo Li
2014-02-26  3:59   ` Xiubo Li
2014-02-26  3:59 ` [PATCH 08/10] ASoC: blackfin: bf5xx-ad193x: " Xiubo Li
2014-02-26  3:59   ` Xiubo Li
2014-02-26  3:59 ` [PATCH 09/10] ASoC: fsl: eukrea-tlv320: " Xiubo Li
2014-02-26  3:59   ` Xiubo Li
2014-02-26  3:59 ` [PATCH 10/10] ASoC: fsl: wm1133-ev1: " Xiubo Li
2014-02-26  3:59   ` 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=1393387175-15539-3-git-send-email-Li.Xiubo@freescale.com \
    --to=li.xiubo@freescale.com \
    --cc=Guangyu.Chen@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=denis@eukrea.com \
    --cc=fabio.estevam@freescale.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=moinejf@free.fr \
    --cc=mpa@pengutronix.de \
    --cc=s.hauer@pengutronix.de \
    --cc=shawn.guo@linaro.org \
    --cc=timur@tabi.org \
    --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.