summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorZidan Wang <zidan.wang@freescale.com>2015-03-31 21:03:53 +0800
committerJason Liu <r64343@freescale.com>2015-05-08 16:33:55 +0800
commit06fe60409a2de3192cee78331fcb8baca337db69 (patch)
tree452f2e232d0de98b79aa577510c61262e2f30a78 /sound
parentcc186e50082f981b6d96b85ab269a574c129fb0b (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) {