aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-11-08 02:48:42 -0500
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:47:10 -0400
commite0d6baa6d6ff98759c5b36573dc66dfbcf9fd275 (patch)
tree15d0bc2af4d3e68f36e670e69bfb3e770869954d
parent08d503704239dccf4d8a3a36c2335401d462f585 (diff)
ENGR00286961-2 ASoC: fsl_ssi: Move DC configuration to set_dai_tdm_slot()
DC indicates Frame Rate Divider. By setting it we can get a desired time slot numbers. Thus it should be more plausible to set DC in set_dai_tdm_slot() instead of hw_params(). Acked-by: Wang Shengjiu <b02247@freescale.com> Signed-off-by: Nicolin Chen <b42378@freescale.com>
-rw-r--r--sound/soc/fsl/fsl_ssi.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index a75043d4cc61..6d7ea1f1c402 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -461,7 +461,6 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
461 snd_pcm_format_width(params_format(hw_params)); 461 snd_pcm_format_width(params_format(hw_params));
462 u32 wl = CCSR_SSI_SxCCR_WL(sample_size); 462 u32 wl = CCSR_SSI_SxCCR_WL(sample_size);
463 int enabled = read_ssi(&ssi->scr) & CCSR_SSI_SCR_SSIEN; 463 int enabled = read_ssi(&ssi->scr) & CCSR_SSI_SCR_SSIEN;
464 u32 dc = CCSR_SSI_SxCCR_DC(params_channels(hw_params));
465 int ret; 464 int ret;
466 465
467 /* 466 /*
@@ -491,13 +490,10 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
491 490
492 /* In synchronous mode, the SSI uses STCCR for capture */ 491 /* In synchronous mode, the SSI uses STCCR for capture */
493 if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) || 492 if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ||
494 ssi_private->cpu_dai_drv.symmetric_rates) { 493 ssi_private->cpu_dai_drv.symmetric_rates)
495 write_ssi_mask(&ssi->stccr, CCSR_SSI_SxCCR_WL_MASK, wl); 494 write_ssi_mask(&ssi->stccr, CCSR_SSI_SxCCR_WL_MASK, wl);
496 write_ssi_mask(&ssi->stccr, CCSR_SSI_SxCCR_DC_MASK, dc); 495 else
497 } else {
498 write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl); 496 write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl);
499 write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, dc);
500 }
501 497
502 return 0; 498 return 0;
503} 499}
@@ -743,6 +739,28 @@ static int fsl_ssi_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
743 return 0; 739 return 0;
744} 740}
745 741
742static int fsl_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask,
743 u32 rx_mask, int slots, int slot_width)
744{
745 struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
746 struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
747
748 write_ssi_mask(&ssi->stccr, CCSR_SSI_SxCCR_DC_MASK,
749 CCSR_SSI_SxCCR_DC(slots));
750 write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_DC_MASK,
751 CCSR_SSI_SxCCR_DC(slots));
752
753 /* The register SxMSKs need SSI to provide essential clock due to
754 * hardware design. So we here temporarily enable SSI to set them.
755 */
756 write_ssi_mask(&ssi->scr, 0, CCSR_SSI_SCR_SSIEN);
757 write_ssi(tx_mask, &ssi->stmsk);
758 write_ssi(rx_mask, &ssi->srmsk);
759 write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
760
761 return 0;
762}
763
746/** 764/**
747 * fsl_ssi_shutdown: shutdown the SSI 765 * fsl_ssi_shutdown: shutdown the SSI
748 * 766 *
@@ -793,6 +811,7 @@ static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
793 .hw_params = fsl_ssi_hw_params, 811 .hw_params = fsl_ssi_hw_params,
794 .set_fmt = fsl_ssi_set_dai_fmt, 812 .set_fmt = fsl_ssi_set_dai_fmt,
795 .set_sysclk = fsl_ssi_set_dai_sysclk, 813 .set_sysclk = fsl_ssi_set_dai_sysclk,
814 .set_tdm_slot = fsl_ssi_set_dai_tdm_slot,
796 .shutdown = fsl_ssi_shutdown, 815 .shutdown = fsl_ssi_shutdown,
797 .trigger = fsl_ssi_trigger, 816 .trigger = fsl_ssi_trigger,
798}; 817};