summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@freescale.com>2014-12-16 10:09:50 +0800
committerShengjiu Wang <shengjiu.wang@freescale.com>2014-12-17 17:30:26 +0800
commit991a1f269ce4e4d0daa2cf5615169891acca0607 (patch)
tree550c9cfae6ec287fdae74a65783fc9fd544184fe /sound
parenteda24c2656d55582722b68e7de57a7cdaff005fb (diff)
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_sai.c18
-rw-r--r--sound/soc/fsl/fsl_sai.h2
2 files changed, 18 insertions, 2 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 73622e7a2b8f..33ce076f9d07 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -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);
diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h
index 078ceb2ec899..bbcc7b6b6ff6 100644
--- a/sound/soc/fsl/fsl_sai.h
+++ b/sound/soc/fsl/fsl_sai.h
@@ -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;