Commit 991a1f26 by Shengjiu Wang

MLK-10001: ASoC: fsl_sai: no sound for mono wav in master mode

The bclk caculation should according to the slot num, not the channels. Because sometime we have two slots, but only one slot is enabled for mono channel. As when the codec wm8962 works on mono mode, it needs two slots I2S signal. So here set the default slots of sai to 2, and add function set_tdm_slots for future usage. Signed-off-by: 's avatarShengjiu Wang <shengjiu.wang@freescale.com>
parent eda24c26
......@@ -115,6 +115,17 @@ out:
return IRQ_HANDLED;
}
static int fsl_sai_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask,
u32 rx_mask, int slots, int slot_width)
{
struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
sai->slots = slots;
sai->slot_width = slot_width;
return 0;
}
static int fsl_sai_set_dai_sysclk_tr(struct snd_soc_dai *cpu_dai,
int clk_id, unsigned int freq, int fsl_dir)
{
......@@ -361,7 +372,7 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
int ret;
if (!sai->is_slave_mode) {
ret = fsl_sai_set_bclk(cpu_dai, tx, 2 * word_width * params_rate(params));
ret = fsl_sai_set_bclk(cpu_dai, tx, sai->slots * word_width * params_rate(params));
if (ret)
return ret;
......@@ -387,7 +398,7 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
else
val_cr5 |= FSL_SAI_CR5_FBT(word_width - 1);
val_cr4 |= FSL_SAI_CR4_FRSZ(channels);
val_cr4 |= FSL_SAI_CR4_FRSZ(sai->slots);
regmap_update_bits(sai->regmap, FSL_SAI_xCR4(tx),
FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK,
......@@ -530,6 +541,7 @@ static void fsl_sai_shutdown(struct snd_pcm_substream *substream,
static const struct snd_soc_dai_ops fsl_sai_pcm_dai_ops = {
.set_sysclk = fsl_sai_set_dai_sysclk,
.set_fmt = fsl_sai_set_dai_fmt,
.set_tdm_slot = fsl_sai_set_dai_tdm_slot,
.hw_params = fsl_sai_hw_params,
.hw_free = fsl_sai_hw_free,
.trigger = fsl_sai_trigger,
......@@ -715,6 +727,8 @@ static int fsl_sai_probe(struct platform_device *pdev)
}
}
sai->slots = 2;
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "no irq for node %s\n", np->full_name);
......
......@@ -143,6 +143,8 @@ struct fsl_sai {
unsigned int mclk_id;
unsigned int mclk_streams;
unsigned int slots;
unsigned int slot_width;
struct snd_dmaengine_dai_dma_data dma_params_rx;
struct snd_dmaengine_dai_dma_data dma_params_tx;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment