summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorZidan Wang <zidan.wang@freescale.com>2015-03-31 21:03:53 +0800
committerFrank Li <Frank.Li@freescale.com>2015-04-24 23:03:11 +0800
commit12a3fc5db91e454f4c1b8e28fd39f119eb67102f (patch)
tree1732e5eb77984cb4a56e088f5a91af2b295e78ca /sound
parent7d58e665e2caf4243edbcd3b3f8991acbd43f059 (diff)
MLK-10108-1: ASoC: fsl_sai: Add tdm slot operation for SAI master mode
Add tdm slot operation for SAI master mode. When using SAI as master mode, we should use set_tdm_slot() helper function to set tdm slots in machine driver. SAI will generate BCLK depends on sample rate, slots and slot width. And there may be unused BCLK cycles before each LRCLK transition. Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_sai.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index c4337288bf3e..b28f88b5e0ab 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -394,10 +394,13 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
unsigned int channels = params_channels(params);
u32 word_width = snd_pcm_format_width(params_format(params));
u32 val_cr4 = 0, val_cr5 = 0;
+ u32 slot_width = word_width;
int ret;
if (!sai->is_slave_mode) {
- ret = fsl_sai_set_bclk(cpu_dai, tx, sai->slots * word_width * params_rate(params));
+ slot_width = sai->slot_width;
+ ret = fsl_sai_set_bclk(cpu_dai, tx, sai->slots * slot_width * params_rate(params));
+
if (ret)
return ret;
@@ -409,14 +412,13 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
sai->mclk_streams |= BIT(substream->stream);
}
-
}
if (!sai->is_dsp_mode)
- val_cr4 |= FSL_SAI_CR4_SYWD(word_width);
+ val_cr4 |= FSL_SAI_CR4_SYWD(slot_width);
- val_cr5 |= FSL_SAI_CR5_WNW(word_width);
- val_cr5 |= FSL_SAI_CR5_W0W(word_width);
+ val_cr5 |= FSL_SAI_CR5_WNW(slot_width);
+ val_cr5 |= FSL_SAI_CR5_W0W(slot_width);
if (sai->is_lsb_first)
val_cr5 |= FSL_SAI_CR5_FBT(0);
@@ -770,6 +772,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
}
sai->slots = 2;
+ sai->slot_width = 32;
irq = platform_get_irq(pdev, 0);
if (irq < 0) {