From: Gary Zhang Date: Wed, 7 Dec 2011 06:46:54 +0000 (+0800) Subject: ENGR00162797 SSI: add I2S mode for stereo playback X-Git-Tag: v3.0.35-fsl~1806 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=687d6b77391c45540096333c9c91e38bac641115;p=karo-tx-linux.git ENGR00162797 SSI: add I2S mode for stereo playback Former stereo playback uses network mode which does not suppot 24bit format well. Add I2S mode to do the same manner with codec. Signed-off-by: Gary Zhang --- diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index c67c20f5f8f1..5f0f6c7217ef 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c @@ -99,10 +99,6 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) case SND_SOC_DAIFMT_I2S: /* data on rising edge of bclk, frame low 1clk before data */ strcr |= SSI_STCR_TFSI | SSI_STCR_TEFS | SSI_STCR_TXBIT0; - if (ssi->flags & IMX_SSI_USE_I2S_SLAVE) { - scr &= ~SSI_I2S_MODE_MASK; - scr |= SSI_SCR_I2S_MODE_SLAVE; - } break; case SND_SOC_DAIFMT_LEFT_J: /* data on rising edge of bclk, frame high with data */ @@ -138,10 +134,21 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) /* DAI clock master masks */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { + case SND_SOC_DAIFMT_CBS_CFS: + strcr |= SSI_STCR_TFDIR | SSI_STCR_TXDIR; + if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_I2S) { + scr &= ~SSI_I2S_MODE_MASK; + scr |= SSI_SCR_I2S_MODE_MSTR; + } + break; case SND_SOC_DAIFMT_CBM_CFM: + strcr &= ~(SSI_STCR_TFDIR | SSI_STCR_TXDIR); + if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_I2S) { + scr &= ~SSI_I2S_MODE_MASK; + scr |= SSI_SCR_I2S_MODE_SLAVE; + } break; default: - /* Master mode not implemented, needs handling of clocks. */ return -EINVAL; } @@ -279,9 +286,10 @@ static int imx_ssi_hw_params(struct snd_pcm_substream *substream, scr = readl(ssi->base + SSI_SCR); - if (channels == 1) + if (channels == 1) { scr &= ~SSI_SCR_NET; - else + scr &= ~SSI_I2S_MODE_MASK; + } else scr |= SSI_SCR_NET; writel(scr, ssi->base + SSI_SCR);