linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] Simplify the code of TDM slot setting
@ 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
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li


Xiubo Li (10):
  ASoC: core: Add snd_soc_dai_set_tdm_slot_xlate().
  ASoC: fsl-utils: Add fsl_asoc_of_xlate_tdm_slot_mask() support.
  ASoC: fsl-esai: Add .of_xlate_tdm_slot_mask() support.
  ASoC: fsl-ssi: Add .of_xlate_tdm_slot_mask() support.
  ASoC: imx-ssi: Add .of_xlate_tdm_slot_mask() support.
  ASoC: simple-card: Use snd_soc_dai_set_tdm_slot_xlate()
  ASoC: blackfin: bf5xx-ad1836: Use snd_soc_dai_set_tdm_slot_xlate()
  ASoC: blackfin: bf5xx-ad193x: Use snd_soc_dai_set_tdm_slot_xlate()
  ASoC: fsl: eukrea-tlv320: Use snd_soc_dai_set_tdm_slot_xlate()
  ASoC: fsl: wm1133-ev1: Use snd_soc_dai_set_tdm_slot_xlate()

 include/sound/soc-dai.h           |  3 +++
 sound/soc/blackfin/bf5xx-ad1836.c |  2 +-
 sound/soc/blackfin/bf5xx-ad193x.c |  4 ++--
 sound/soc/fsl/Kconfig             |  3 +++
 sound/soc/fsl/eukrea-tlv320.c     |  2 +-
 sound/soc/fsl/fsl_esai.c          |  2 ++
 sound/soc/fsl/fsl_ssi.c           |  2 ++
 sound/soc/fsl/fsl_utils.c         | 27 +++++++++++++++++++++++++++
 sound/soc/fsl/fsl_utils.h         |  4 +++-
 sound/soc/fsl/imx-ssi.c           |  2 ++
 sound/soc/fsl/wm1133-ev1.c        | 11 +----------
 sound/soc/generic/simple-card.c   |  7 +++----
 sound/soc/soc-core.c              | 33 ++++++++++++++++++++++++++++-----
 13 files changed, 78 insertions(+), 24 deletions(-)

-- 
1.8.4



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

* [PATCH 01/10] ASoC: core: Add snd_soc_dai_set_tdm_slot_xlate().
  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-03-01 13:19   ` [alsa-devel] " Lars-Peter Clausen
  2014-02-26  3:59 ` [PATCH 02/10] ASoC: fsl-utils: Add fsl_asoc_of_xlate_tdm_slot_mask() support Xiubo Li
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li

For most cases the rx_mask and tx_mask params have no use for
snd_soc_dai_set_tdm_slot(), because they could be generated by
{XXX_ .}of_xlate_tdm_slot_mask().

This patch add snd_soc_dai_set_tdm_slot_xlate() which will replace
the snd_soc_dai_set_tdm_slot() in some use cases to simplify the
code. And for some CODECs or CPU DAI devices there needed much more
work to support the .of_xlate_tdm_slot_mask feature.

This patch can be applied to most use case of the current DAI drivers.

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

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index d86e0fc..68569ee 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -110,6 +110,9 @@ int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
 /* Digital Audio interface formatting */
 int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
 
+int snd_soc_dai_set_tdm_slot_xlate(struct snd_soc_dai *dai,
+				   unsigned int slots,
+				   unsigned int slot_width);
 int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
 	unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width);
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 0911856..e5a535b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3687,19 +3687,20 @@ static int snd_soc_of_xlate_tdm_slot_mask(unsigned int slots,
 }
 
 /**
- * snd_soc_dai_set_tdm_slot - configure DAI TDM.
+ * snd_soc_dai_set_tdm_slot_xlate - configure DAI TDM with of xlate.
  * @dai: DAI
- * @tx_mask: bitmask representing active TX slots.
- * @rx_mask: bitmask representing active RX slots.
  * @slots: Number of slots in use.
  * @slot_width: Width in bits for each slot.
  *
  * Configures a DAI for TDM operation. Both mask and slots are codec and DAI
  * specific.
  */
-int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
-	unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
+int snd_soc_dai_set_tdm_slot_xlate(struct snd_soc_dai *dai,
+				   unsigned int slots,
+				   unsigned int slot_width)
 {
+	unsigned int tx_mask, rx_mask;
+
 	if (dai->driver && dai->driver->ops->of_xlate_tdm_slot_mask)
 		dai->driver->ops->of_xlate_tdm_slot_mask(slots,
 						&tx_mask, &rx_mask);
@@ -3712,6 +3713,28 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
 	else
 		return -ENOTSUPP;
 }
+EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot_xlate);
+
+/**
+ * snd_soc_dai_set_tdm_slot - configure DAI TDM.
+ * @dai: DAI
+ * @tx_mask: bitmask representing active TX slots.
+ * @rx_mask: bitmask representing active RX slots.
+ * @slots: Number of slots in use.
+ * @slot_width: Width in bits for each slot.
+ *
+ * Configures a DAI for TDM operation. Both mask and slots are codec and DAI
+ * specific.
+ */
+int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
+	unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
+{
+	if (dai->driver && dai->driver->ops->set_tdm_slot)
+		return dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask,
+				slots, slot_width);
+	else
+		return -ENOTSUPP;
+}
 EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot);
 
 /**
-- 
1.8.4



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

* [PATCH 02/10] ASoC: fsl-utils: Add fsl_asoc_of_xlate_tdm_slot_mask() support.
  2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting 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-02-26  3:59 ` [PATCH 03/10] ASoC: fsl-esai: Add .of_xlate_tdm_slot_mask() support Xiubo Li
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li

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



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

* [PATCH 03/10] ASoC: fsl-esai: Add .of_xlate_tdm_slot_mask() support.
  2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting 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 ` [PATCH 02/10] ASoC: fsl-utils: Add fsl_asoc_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
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li

This patch add .of_xlate_tdm_slot_mask support for ESAI, and this will
generate the TDM slot TX and RX masks.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/fsl/Kconfig    | 1 +
 sound/soc/fsl/fsl_esai.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index f397144..6abb68e 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -13,6 +13,7 @@ config SND_SOC_FSL_SPDIF
 config SND_SOC_FSL_ESAI
 	tristate "ALSA SoC support for the Freescale ESAI device"
 	select REGMAP_MMIO
+	select SND_SOC_FSL_UTILS
 
 config SND_SOC_FSL_UTILS
 	tristate
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 0ba3700..912104f 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -18,6 +18,7 @@
 
 #include "fsl_esai.h"
 #include "imx-pcm.h"
+#include "fsl_utils.h"
 
 #define FSL_ESAI_RATES		SNDRV_PCM_RATE_8000_192000
 #define FSL_ESAI_FORMATS	(SNDRV_PCM_FMTBIT_S8 | \
@@ -581,6 +582,7 @@ static struct snd_soc_dai_ops fsl_esai_dai_ops = {
 	.hw_params = fsl_esai_hw_params,
 	.set_sysclk = fsl_esai_set_dai_sysclk,
 	.set_fmt = fsl_esai_set_dai_fmt,
+	.of_xlate_tdm_slot_mask = fsl_asoc_of_xlate_tdm_slot_mask,
 	.set_tdm_slot = fsl_esai_set_dai_tdm_slot,
 };
 
-- 
1.8.4



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

* [PATCH 04/10] ASoC: fsl-ssi: Add .of_xlate_tdm_slot_mask() support.
  2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting Xiubo Li
                   ` (2 preceding siblings ...)
  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 05/10] ASoC: imx-ssi: " Xiubo Li
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li

This patch add .of_xlate_tdm_slot_mask support for SSI, and this will
generate the TDM slot TX and RX masks.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/fsl/Kconfig   | 1 +
 sound/soc/fsl/fsl_ssi.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 6abb68e..7472308 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -5,6 +5,7 @@ config SND_SOC_FSL_SAI
 
 config SND_SOC_FSL_SSI
 	tristate
+	select SND_SOC_FSL_UTILS
 
 config SND_SOC_FSL_SPDIF
 	tristate "ALSA SoC support for the Freescale SPDIF device"
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 5428a1f..80ca76c 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -53,6 +53,7 @@
 
 #include "fsl_ssi.h"
 #include "imx-pcm.h"
+#include "fsl_utils.h"
 
 #ifdef PPC
 #define read_ssi(addr)			 in_be32(addr)
@@ -1136,6 +1137,7 @@ static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
 	.hw_params	= fsl_ssi_hw_params,
 	.set_fmt	= fsl_ssi_set_dai_fmt,
 	.set_sysclk	= fsl_ssi_set_dai_sysclk,
+	.of_xlate_tdm_slot_mask	= fsl_asoc_of_xlate_tdm_slot_mask,
 	.set_tdm_slot	= fsl_ssi_set_dai_tdm_slot,
 	.trigger	= fsl_ssi_trigger,
 };
-- 
1.8.4



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

* [PATCH 05/10] ASoC: imx-ssi: Add .of_xlate_tdm_slot_mask() support.
  2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting Xiubo Li
                   ` (3 preceding siblings ...)
  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 06/10] ASoC: simple-card: Use snd_soc_dai_set_tdm_slot_xlate() Xiubo Li
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li

This patch add .of_xlate_tdm_slot_mask support for IMX SSI, and this
will generate the TDM slot TX and RX masks.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/fsl/Kconfig   | 1 +
 sound/soc/fsl/imx-ssi.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 7472308..67833dd 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -122,6 +122,7 @@ if SND_IMX_SOC
 
 config SND_SOC_IMX_SSI
 	tristate
+	select SND_SOC_FSL_UTILS
 
 config SND_SOC_IMX_PCM_FIQ
 	tristate
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index df552fa..52d4b7a 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -50,6 +50,7 @@
 #include <linux/platform_data/asoc-imx-ssi.h>
 
 #include "imx-ssi.h"
+#include "fsl_utils.h"
 
 #define SSI_SACNT_DEFAULT (SSI_SACNT_AC97EN | SSI_SACNT_FV)
 
@@ -339,6 +340,7 @@ static const struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = {
 	.set_fmt	= imx_ssi_set_dai_fmt,
 	.set_clkdiv	= imx_ssi_set_dai_clkdiv,
 	.set_sysclk	= imx_ssi_set_dai_sysclk,
+	.of_xlate_tdm_slot_mask = fsl_asoc_of_xlate_tdm_slot_mask,
 	.set_tdm_slot	= imx_ssi_set_dai_tdm_slot,
 	.trigger	= imx_ssi_trigger,
 };
-- 
1.8.4



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

* [PATCH 06/10] ASoC: simple-card: Use snd_soc_dai_set_tdm_slot_xlate()
  2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting Xiubo Li
                   ` (4 preceding siblings ...)
  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 07/10] ASoC: blackfin: bf5xx-ad1836: " Xiubo Li
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li

Use snd_soc_dai_set_tdm_slot_xlate instead of snd_soc_dai_set_tdm_slot.

This will use the DAI driver specified .of_xlate_tdm_slot_mask to generate
the TDM slot TX/RX mask, or the default snd_soc_of_xlate_tdm_slot_mask will
be used instead if it's absent.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/generic/simple-card.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index bdd176d..22efa83 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -48,11 +48,10 @@ 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);
+		ret = snd_soc_dai_set_tdm_slot_xlate(dai, set->slots,
+						     set->slot_width);
 		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
+			dev_err(dai->dev, "simple-card: set_tdm_slot_xlate error\n");
 			goto err;
 		}
 	}
-- 
1.8.4



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

* [PATCH 07/10] ASoC: blackfin: bf5xx-ad1836: Use snd_soc_dai_set_tdm_slot_xlate()
  2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting Xiubo Li
                   ` (5 preceding siblings ...)
  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 08/10] ASoC: blackfin: bf5xx-ad193x: " Xiubo Li
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li

Use snd_soc_dai_set_tdm_slot_xlate instead of snd_soc_dai_set_tdm_slot.
This will use the default snd_soc_of_xlate_tdm_slot_mask to generate
the TDM slot TX/RX mask using the slot parameter.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/blackfin/bf5xx-ad1836.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/blackfin/bf5xx-ad1836.c b/sound/soc/blackfin/bf5xx-ad1836.c
index 8fcfc4e..b1908ce 100644
--- a/sound/soc/blackfin/bf5xx-ad1836.c
+++ b/sound/soc/blackfin/bf5xx-ad1836.c
@@ -44,7 +44,7 @@ static int bf5xx_ad1836_init(struct snd_soc_pcm_runtime *rtd)
 	if (ret < 0)
 		return ret;
 
-	ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0xFF, 0xFF, 8, 32);
+	ret = snd_soc_dai_set_tdm_slot_xlate(cpu_dai, 8, 32);
 	if (ret < 0)
 		return ret;
 
-- 
1.8.4



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

* [PATCH 08/10] ASoC: blackfin: bf5xx-ad193x: Use snd_soc_dai_set_tdm_slot_xlate()
  2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting Xiubo Li
                   ` (6 preceding siblings ...)
  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 09/10] ASoC: fsl: eukrea-tlv320: " Xiubo Li
  2014-02-26  3:59 ` [PATCH 10/10] ASoC: fsl: wm1133-ev1: " Xiubo Li
  9 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li

Use snd_soc_dai_set_tdm_slot_xlate instead of snd_soc_dai_set_tdm_slot.
This will use the default snd_soc_of_xlate_tdm_slot_mask to generate
the TDM slot TX/RX mask using the slot parameter.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/blackfin/bf5xx-ad193x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/blackfin/bf5xx-ad193x.c b/sound/soc/blackfin/bf5xx-ad193x.c
index 603ad1f..f622faa 100644
--- a/sound/soc/blackfin/bf5xx-ad193x.c
+++ b/sound/soc/blackfin/bf5xx-ad193x.c
@@ -53,11 +53,11 @@ static int bf5xx_ad193x_link_init(struct snd_soc_pcm_runtime *rtd)
 		return ret;
 
 	/* set codec DAI slots, 8 channels, all channels are enabled */
-	ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xFF, 0xFF, 8, 32);
+	ret = snd_soc_dai_set_tdm_slot_xlate(codec_dai, 8, 32);
 	if (ret < 0)
 		return ret;
 
-	ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0xFF, 0xFF, 8, 32);
+	ret = snd_soc_dai_set_tdm_slot_xlate(cpu_dai, 8, 32);
 	if (ret < 0)
 		return ret;
 
-- 
1.8.4



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

* [PATCH 09/10] ASoC: fsl: eukrea-tlv320: Use snd_soc_dai_set_tdm_slot_xlate()
  2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting Xiubo Li
                   ` (7 preceding siblings ...)
  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 10/10] ASoC: fsl: wm1133-ev1: " Xiubo Li
  9 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li

Use snd_soc_dai_set_tdm_slot_xlate instead of snd_soc_dai_set_tdm_slot.
This will use the default snd_soc_of_xlate_tdm_slot_mask to generate
the TDM slot TX/RX mask using the slot parameter.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/fsl/eukrea-tlv320.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c
index 5983740..3965023 100644
--- a/sound/soc/fsl/eukrea-tlv320.c
+++ b/sound/soc/fsl/eukrea-tlv320.c
@@ -63,7 +63,7 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
 			"Failed to set the codec sysclk.\n");
 		return ret;
 	}
-	snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffc, 0xffffffc, 2, 0);
+	snd_soc_dai_set_tdm_slot_xlate(cpu_dai, 2, 0);
 
 	ret = snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0,
 				SND_SOC_CLOCK_IN);
-- 
1.8.4



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

* [PATCH 10/10] ASoC: fsl: wm1133-ev1: Use snd_soc_dai_set_tdm_slot_xlate()
  2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting Xiubo Li
                   ` (8 preceding siblings ...)
  2014-02-26  3:59 ` [PATCH 09/10] ASoC: fsl: eukrea-tlv320: " Xiubo Li
@ 2014-02-26  3:59 ` Xiubo Li
  9 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-02-26  3:59 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: timur, tiwai, lars, Guangyu.Chen, fabio.estevam, shawn.guo,
	denis, mpa, s.hauer, moinejf, kuninori.morimoto.gx, alsa-devel,
	linux-kernel, Xiubo Li

Use snd_soc_dai_set_tdm_slot_xlate instead of snd_soc_dai_set_tdm_slot.
This will use the default snd_soc_of_xlate_tdm_slot_mask to generate
the TDM slot TX/RX mask using the slot parameter.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/fsl/wm1133-ev1.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/sound/soc/fsl/wm1133-ev1.c b/sound/soc/fsl/wm1133-ev1.c
index fce6325..4519b08 100644
--- a/sound/soc/fsl/wm1133-ev1.c
+++ b/sound/soc/fsl/wm1133-ev1.c
@@ -114,16 +114,7 @@ static int wm1133_ev1_hw_params(struct snd_pcm_substream *substream,
 	snd_soc_dai_set_fmt(cpu_dai, dai_format);
 
 	/* TODO: The SSI driver should figure this out for us */
-	switch (channels) {
-	case 2:
-		snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffc, 0xffffffc, 2, 0);
-		break;
-	case 1:
-		snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffe, 0xffffffe, 1, 0);
-		break;
-	default:
-		return -EINVAL;
-	}
+	snd_soc_dai_set_tdm_slot_xlate(cpu_dai, channels, 0);
 
 	/* set MCLK as the codec system clock for DAC and ADC */
 	snd_soc_dai_set_sysclk(codec_dai, WM8350_MCLK_SEL_PLL_MCLK,
-- 
1.8.4



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

* Re: [alsa-devel] [PATCH 01/10] ASoC: core: Add snd_soc_dai_set_tdm_slot_xlate().
  2014-02-26  3:59 ` [PATCH 01/10] ASoC: core: Add snd_soc_dai_set_tdm_slot_xlate() Xiubo Li
@ 2014-03-01 13:19   ` Lars-Peter Clausen
  2014-03-05  3:39     ` Mark Brown
  0 siblings, 1 reply; 15+ messages in thread
From: Lars-Peter Clausen @ 2014-03-01 13:19 UTC (permalink / raw)
  To: Xiubo Li
  Cc: broonie, lgirdwood, fabio.estevam, moinejf, alsa-devel,
	kuninori.morimoto.gx, tiwai, s.hauer, timur, linux-kernel, denis,
	Guangyu.Chen, mpa, shawn.guo

On 02/26/2014 04:59 AM, Xiubo Li wrote:
> For most cases the rx_mask and tx_mask params have no use for
> snd_soc_dai_set_tdm_slot(), because they could be generated by
> {XXX_ .}of_xlate_tdm_slot_mask().
>
> This patch add snd_soc_dai_set_tdm_slot_xlate() which will replace
> the snd_soc_dai_set_tdm_slot() in some use cases to simplify the
> code. And for some CODECs or CPU DAI devices there needed much more
> work to support the .of_xlate_tdm_slot_mask feature.
>
> This patch can be applied to most use case of the current DAI drivers.

Hi,

I'm not quite sure I fully understand what this patch is trying to solve. It 
adds a variant snd_soc_dai_set_tdm_slot() that instead of taking a rx and tx 
mask calculates the masks based on the number of slots? In that case I don't 
really see how the xlate in the name relates to that. xlate is something 
you'd typically expect in a devicetree context. Maybe one should be called 
snd_soc_dai_set_tdm_slot() and the other snd_soc_dai_set_tdm_slot_and_masks()?

But another question is do we really need this? I don't see the problem that 
is solved by this patchset.

- Lars

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

* Re: [alsa-devel] [PATCH 01/10] ASoC: core: Add snd_soc_dai_set_tdm_slot_xlate().
  2014-03-01 13:19   ` [alsa-devel] " Lars-Peter Clausen
@ 2014-03-05  3:39     ` Mark Brown
  2014-03-05  3:55       ` Li.Xiubo
  0 siblings, 1 reply; 15+ messages in thread
From: Mark Brown @ 2014-03-05  3:39 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Xiubo Li, lgirdwood, fabio.estevam, moinejf, alsa-devel,
	kuninori.morimoto.gx, tiwai, s.hauer, timur, linux-kernel, denis,
	Guangyu.Chen, mpa, shawn.guo

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

On Sat, Mar 01, 2014 at 02:19:44PM +0100, Lars-Peter Clausen wrote:

> I'm not quite sure I fully understand what this patch is trying to
> solve. It adds a variant snd_soc_dai_set_tdm_slot() that instead of
> taking a rx and tx mask calculates the masks based on the number of
> slots? In that case I don't really see how the xlate in the name
> relates to that. xlate is something you'd typically expect in a
> devicetree context. Maybe one should be called
> snd_soc_dai_set_tdm_slot() and the other
> snd_soc_dai_set_tdm_slot_and_masks()?

> But another question is do we really need this? I don't see the
> problem that is solved by this patchset.

My understanding is that the patch set aims to provide a way of using
the TDM features of drivers from DT, providing a standardised format for
expressing the TDM setup in the DT.  I've not looked at the actual code
yet though.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* RE: [alsa-devel] [PATCH 01/10] ASoC: core: Add snd_soc_dai_set_tdm_slot_xlate().
  2014-03-05  3:39     ` Mark Brown
@ 2014-03-05  3:55       ` Li.Xiubo
  2014-03-05  6:30         ` Mark Brown
  0 siblings, 1 reply; 15+ messages in thread
From: Li.Xiubo @ 2014-03-05  3:55 UTC (permalink / raw)
  To: Mark Brown, Lars-Peter Clausen
  Cc: lgirdwood, Fabio.Estevam, moinejf, alsa-devel,
	kuninori.morimoto.gx, tiwai, s.hauer, timur, linux-kernel, denis,
	guangyu.chen, mpa, shawn.guo


> Subject: Re: [alsa-devel] [PATCH 01/10] ASoC: core: Add
> snd_soc_dai_set_tdm_slot_xlate().
> 
> On Sat, Mar 01, 2014 at 02:19:44PM +0100, Lars-Peter Clausen wrote:
> 
> > I'm not quite sure I fully understand what this patch is trying to
> > solve. It adds a variant snd_soc_dai_set_tdm_slot() that instead of
> > taking a rx and tx mask calculates the masks based on the number of
> > slots? In that case I don't really see how the xlate in the name
> > relates to that. xlate is something you'd typically expect in a
> > devicetree context. Maybe one should be called
> > snd_soc_dai_set_tdm_slot() and the other
> > snd_soc_dai_set_tdm_slot_and_masks()?
> 
> > But another question is do we really need this? I don't see the
> > problem that is solved by this patchset.
> 
> My understanding is that the patch set aims to provide a way of using
> the TDM features of drivers from DT, providing a standardised format for
> expressing the TDM setup in the DT.  I've not looked at the actual code
> yet though.

@Lars,

Sorry for late, many mails had been discard by my outlook, including the
Last one.

@Mark, @Lars,

This adds the function of snd_soc_dai_set_tdm_slot_xlate, which is almost
One new signature of snd_soc_dai_set_tdm_slot discarding the mask
Parameters, which could be generated by itself.

And I want to provide one standard method for the drivers who are parsing
The TDM information from the DT node. 


Thanks,

--
Best Regards,
Xiubo


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

* Re: [alsa-devel] [PATCH 01/10] ASoC: core: Add snd_soc_dai_set_tdm_slot_xlate().
  2014-03-05  3:55       ` Li.Xiubo
@ 2014-03-05  6:30         ` Mark Brown
  0 siblings, 0 replies; 15+ messages in thread
From: Mark Brown @ 2014-03-05  6:30 UTC (permalink / raw)
  To: Li.Xiubo
  Cc: Lars-Peter Clausen, lgirdwood, Fabio.Estevam, moinejf,
	alsa-devel, kuninori.morimoto.gx, tiwai, s.hauer, timur,
	linux-kernel, denis, guangyu.chen, mpa, shawn.guo

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

On Wed, Mar 05, 2014 at 03:55:50AM +0000, Li.Xiubo@freescale.com wrote:

> This adds the function of snd_soc_dai_set_tdm_slot_xlate, which is almost
> One new signature of snd_soc_dai_set_tdm_slot discarding the mask
> Parameters, which could be generated by itself.

Right, so that's not a bad thing but the _xlate() naming is confusing -
Lars' point was that if a function is called _xlate() it would usually
be an operation used as part of DT parsing, not something called from
non-DT code.  The new interface is probably a good thing but needs a
different name (perhaps _simple or something?) or we need to rename the
old one out of the way (it's slightly less flexible so we probably don't
want to remove it totally).

> And I want to provide one standard method for the drivers who are parsing
> The TDM information from the DT node. 

This is a good goal.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2014-03-05  7:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-26  3:59 [PATCH 00/10] Simplify the code of TDM slot setting Xiubo Li
2014-02-26  3:59 ` [PATCH 01/10] ASoC: core: Add snd_soc_dai_set_tdm_slot_xlate() 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  6:30         ` Mark Brown
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 ` [PATCH 04/10] ASoC: fsl-ssi: " Xiubo Li
2014-02-26  3:59 ` [PATCH 05/10] ASoC: imx-ssi: " 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 ` [PATCH 07/10] ASoC: blackfin: bf5xx-ad1836: " Xiubo Li
2014-02-26  3:59 ` [PATCH 08/10] ASoC: blackfin: bf5xx-ad193x: " Xiubo Li
2014-02-26  3:59 ` [PATCH 09/10] ASoC: fsl: eukrea-tlv320: " Xiubo Li
2014-02-26  3:59 ` [PATCH 10/10] ASoC: fsl: wm1133-ev1: " Xiubo Li

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