aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorBenoît Thébaudeau <benoit@wsystem.com>2015-09-29 11:59:14 -0400
committerMark Brown <broonie@kernel.org>2015-09-29 12:28:33 -0400
commitb7b01d345b83602a42b6ff02cacb9d9ada5ecd0a (patch)
treee39569eef86c3634caee44909a453d14503a3447 /sound/soc
parent6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff)
ASoC: imx-ssi: Fix DAI hardware signal inversions
SND_SOC_DAIFMT_{IB|NB}_{IF|NF} are defined as inverting or not BCLK or FRM relatively to what is standard for the specified DAI hardware audio format. Consequently, the absolute polarities of these signals cannot be derived only from these settings as this driver did. The format has to be taken into account too. This fixes inverted left/right channels in I²S mode. Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/fsl/imx-ssi.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 48b2d24dd1f0..b95132e2f9dc 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -95,7 +95,8 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
95 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 95 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
96 case SND_SOC_DAIFMT_I2S: 96 case SND_SOC_DAIFMT_I2S:
97 /* data on rising edge of bclk, frame low 1clk before data */ 97 /* data on rising edge of bclk, frame low 1clk before data */
98 strcr |= SSI_STCR_TFSI | SSI_STCR_TEFS | SSI_STCR_TXBIT0; 98 strcr |= SSI_STCR_TXBIT0 | SSI_STCR_TSCKP | SSI_STCR_TFSI |
99 SSI_STCR_TEFS;
99 scr |= SSI_SCR_NET; 100 scr |= SSI_SCR_NET;
100 if (ssi->flags & IMX_SSI_USE_I2S_SLAVE) { 101 if (ssi->flags & IMX_SSI_USE_I2S_SLAVE) {
101 scr &= ~SSI_I2S_MODE_MASK; 102 scr &= ~SSI_I2S_MODE_MASK;
@@ -104,33 +105,31 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
104 break; 105 break;
105 case SND_SOC_DAIFMT_LEFT_J: 106 case SND_SOC_DAIFMT_LEFT_J:
106 /* data on rising edge of bclk, frame high with data */ 107 /* data on rising edge of bclk, frame high with data */
107 strcr |= SSI_STCR_TXBIT0; 108 strcr |= SSI_STCR_TXBIT0 | SSI_STCR_TSCKP;
108 break; 109 break;
109 case SND_SOC_DAIFMT_DSP_B: 110 case SND_SOC_DAIFMT_DSP_B:
110 /* data on rising edge of bclk, frame high with data */ 111 /* data on rising edge of bclk, frame high with data */
111 strcr |= SSI_STCR_TFSL | SSI_STCR_TXBIT0; 112 strcr |= SSI_STCR_TXBIT0 | SSI_STCR_TSCKP | SSI_STCR_TFSL;
112 break; 113 break;
113 case SND_SOC_DAIFMT_DSP_A: 114 case SND_SOC_DAIFMT_DSP_A:
114 /* data on rising edge of bclk, frame high 1clk before data */ 115 /* data on rising edge of bclk, frame high 1clk before data */
115 strcr |= SSI_STCR_TFSL | SSI_STCR_TXBIT0 | SSI_STCR_TEFS; 116 strcr |= SSI_STCR_TXBIT0 | SSI_STCR_TSCKP | SSI_STCR_TFSL |
117 SSI_STCR_TEFS;
116 break; 118 break;
117 } 119 }
118 120
119 /* DAI clock inversion */ 121 /* DAI clock inversion */
120 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { 122 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
121 case SND_SOC_DAIFMT_IB_IF: 123 case SND_SOC_DAIFMT_IB_IF:
122 strcr |= SSI_STCR_TFSI; 124 strcr ^= SSI_STCR_TSCKP | SSI_STCR_TFSI;
123 strcr &= ~SSI_STCR_TSCKP;
124 break; 125 break;
125 case SND_SOC_DAIFMT_IB_NF: 126 case SND_SOC_DAIFMT_IB_NF:
126 strcr &= ~(SSI_STCR_TSCKP | SSI_STCR_TFSI); 127 strcr ^= SSI_STCR_TSCKP;
127 break; 128 break;
128 case SND_SOC_DAIFMT_NB_IF: 129 case SND_SOC_DAIFMT_NB_IF:
129 strcr |= SSI_STCR_TFSI | SSI_STCR_TSCKP; 130 strcr ^= SSI_STCR_TFSI;
130 break; 131 break;
131 case SND_SOC_DAIFMT_NB_NF: 132 case SND_SOC_DAIFMT_NB_NF:
132 strcr &= ~SSI_STCR_TFSI;
133 strcr |= SSI_STCR_TSCKP;
134 break; 133 break;
135 } 134 }
136 135