Browse Source

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: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 991a1f269c)
isee-imx_3.14.28.y
Shengjiu Wang 6 years ago
committed by Nitin Garg
parent
commit
3bf7b16d3f
2 changed files with 18 additions and 2 deletions
  1. +16
    -2
      sound/soc/fsl/fsl_sai.c
  2. +2
    -0
      sound/soc/fsl/fsl_sai.h

+ 16
- 2
sound/soc/fsl/fsl_sai.c View File

@ -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,
@ -717,6 +729,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);


+ 2
- 0
sound/soc/fsl/fsl_sai.h View File

@ -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;


Loading…
Cancel
Save