Add fsl_asoc_xlate_tdm_slot_mask()
Subsystems (4)
cover Add fsl_asoc_xlate_tdm_slot_mask()
Xiubo Li (4):
ASoC: core: remove the 'of_' prefix of of_xlate_tdm_slot_mask.
ASoC: fsl-utils: Add fsl_asoc_xlate_tdm_slot_mask() support.
ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support.
ASoC: imx-ssi: Add .xlate_tdm_slot_mask() support.
include/sound/soc-dai.h | 2 +- sound/soc/fsl/Kconfig | 2 ++ sound/soc/fsl/fsl_esai.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/soc-core.c | 10 +++++----- 7 files changed, 42 insertions(+), 7 deletions(-)
Signature · 1 line
1.8.4
PATCH 1/4 ASoC: core: remove the 'of_' prefix of of_xlate_tdm_slot_mask.
The 'of_' is not appropriate here for there hasn't any DT parsing.
--- include/sound/soc-dai.h | 2 +- sound/soc/soc-core.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
include/sound/soc-dai.h +1 -1
@@ -142,7 +142,7 @@ struct snd_soc_dai_ops {* Called by soc_card drivers, normally in their hw_params. */ int (*set_fmt)(struct snd_soc_dai *dai,unsigned int fmt); -int (*of_xlate_tdm_slot_mask)(unsigned int slots, +int (*xlate_tdm_slot_mask)(unsigned int slots,unsigned int *tx_mask,unsigned int *rx_mask); int (*set_tdm_slot)(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask,
sound/soc/soc-core.c +5 -5
@@ -3625,14 +3625,14 @@ int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)EXPORT_SYMBOL_GPL (snd_soc_dai_set_fmt);/** -* snd_soc_of_xlate_tdm_slot - generate tx/rx slot mask. +* snd_soc_xlate_tdm_slot - generate tx/rx slot mask. * @slots: Number of slots in use. * @tx_mask: bitmask representing active TX slots. * @rx_mask: bitmask representing active RX slots. * * Generates the TDM tx and rx slot default masks for DAI. */ -static int snd_soc_of_xlate_tdm_slot_mask (unsigned int slots, +static int snd_soc_xlate_tdm_slot_mask (unsigned int slots,unsigned int *tx_mask,unsigned int *rx_mask) {
@@ -3662,11 +3662,11 @@ static int snd_soc_of_xlate_tdm_slot_mask(unsigned int slots,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->of_xlate_tdm_slot_mask) - dai->driver->ops->of_xlate_tdm_slot_mask (slots, +if (dai->driver && dai->driver->ops->xlate_tdm_slot_mask) + dai->driver->ops->xlate_tdm_slot_mask (slots, &tx_mask, &rx_mask);else -snd_soc_of_xlate_tdm_slot_mask (slots, &tx_mask, &rx_mask); +snd_soc_xlate_tdm_slot_mask (slots, &tx_mask, &rx_mask);if (dai->driver && dai->driver->ops->set_tdm_slot) return dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask,
Signature · 1 line
1.8.4
PATCH 2/4 ASoC: fsl-utils: Add fsl_asoc_xlate_tdm_slot_mask() support.
In reply to Xiubo LiThis patch add fsl_asoc_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.
--- sound/soc/fsl/fsl_utils.c | 27 +++++++++++++++++++++++++++ sound/soc/fsl/fsl_utils.h | 4 +++- 2 files changed, 30 insertions(+), 1 deletion(-)
sound/soc/fsl/fsl_utils.c +27 -0
@@ -86,6 +86,33 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, }EXPORT_SYMBOL (fsl_asoc_get_dma_channel); +/** +* fsl_asoc_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_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_xlate_tdm_slot_mask); +MODULE_AUTHOR ("Timur Tabi <[email protected]>" );MODULE_DESCRIPTION ("Freescale ASoC utility code" );MODULE_LICENSE ("GPL v2" );
sound/soc/fsl/fsl_utils.h +3 -1
@@ -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_xlate_tdm_slot_mask (unsigned int slots, +unsigned int *tx_mask, +unsigned int *rx_mask);#endif /* _FSL_UTILS_H */
Signature · 1 line
1.8.4
PATCH 3/4 ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support.
In reply to Xiubo LiThis patch add .xlate_tdm_slot_mask support for ESAI, and this will generate the TDM slot TX and RX masks.
--- sound/soc/fsl/Kconfig | 1 + sound/soc/fsl/fsl_esai.c | 2 ++ 2 files changed, 3 insertions(+)
sound/soc/fsl/Kconfig +1 -0
@@ -13,6 +13,7 @@ config SND_SOC_FSL_SPDIF config SND_SOC_FSL_ESAI tristate select REGMAP_MMIO + select SND_SOC_FSL_UTILS config SND_SOC_FSL_UTILS tristate
sound/soc/fsl/fsl_esai.c +2 -0
@@ -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, + .xlate_tdm_slot_mask = fsl_asoc_xlate_tdm_slot_mask, .set_tdm_slot = fsl_esai_set_dai_tdm_slot, };
Signature · 1 line
1.8.4
PATCH 4/4 ASoC: imx-ssi: Add .xlate_tdm_slot_mask() support.
In reply to Xiubo LiThis patch add .xlate_tdm_slot_mask support for IMX SSI, and this will generate the TDM slot TX and RX masks.
--- sound/soc/fsl/Kconfig | 1 + sound/soc/fsl/imx-ssi.c | 2 ++ 2 files changed, 3 insertions(+)
sound/soc/fsl/Kconfig +1 -0
@@ -121,6 +121,7 @@ if SND_IMX_SOC config SND_SOC_IMX_SSI tristate + select SND_SOC_FSL_UTILS config SND_SOC_IMX_PCM_FIQ tristate
sound/soc/fsl/imx-ssi.c +2 -0
@@ -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, + .xlate_tdm_slot_mask = fsl_asoc_xlate_tdm_slot_mask, .set_tdm_slot = imx_ssi_set_dai_tdm_slot, .trigger = imx_ssi_trigger, };
Signature · 1 line
1.8.4
Mark Brown
maintainerQuoted 5 lines · Xiubo Li
Xiubo Li (4):
ASoC: core: remove the 'of_' prefix ofof_xlate_tdm_slot_mask.
ASoC: fsl-utils: Addfsl_asoc_xlate_tdm_slot_mask()support.
ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support.
ASoC: imx-ssi: Add .xlate_tdm_slot_mask() support.
This looks OK but I'll wait until after the merge window to apply it since that should happen any day now (due to my scripts that means after the merge window opens).
Quoted 10 lines
Subject: Re: [PATCH 0/4] Add
fsl_asoc_xlate_tdm_slot_mask()Quoted 5 lines · Xiubo Li
Xiubo Li (4):
ASoC: core: remove the 'of_' prefix ofof_xlate_tdm_slot_mask.
ASoC: fsl-utils: Addfsl_asoc_xlate_tdm_slot_mask()support.
ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support.
ASoC: imx-ssi: Add .xlate_tdm_slot_mask() support.
Quoted 3 lines
This looks OK but I'll wait until after the merge window to apply it since that should happen any day now (due to my scripts that means after the merge window opens).
Yes, That's okey.
:)
Thanks very much,
--
Best Regards,
Xiubo
Quoted 7 lines · Xiubo Li
Xiubo Li (4):
ASoC: core: remove the 'of_' prefix ofof_xlate_tdm_slot_mask.
ASoC: fsl-utils: Addfsl_asoc_xlate_tdm_slot_mask()support.
ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support.
ASoC: imx-ssi: Add .xlate_tdm_slot_mask() support.
Applied all, thanks.