ASoC: imx-ssi: Fix DAI hardware signal inversions
Subsystems (4)
PATCH 1/1 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.
--- sound/soc/fsl/imx-ssi.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
sound/soc/fsl/imx-ssi.c +9 -10
@@ -95,7 +95,8 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {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 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSI | +SSI_STCR_TEFS ; scr |=SSI_SCR_NET ;if (ssi->flags &IMX_SSI_USE_I2S_SLAVE ) { 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)break ;case SND_SOC_DAIFMT_LEFT_J :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TXBIT0 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP ;break ;case SND_SOC_DAIFMT_DSP_B :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSL ;break ;case SND_SOC_DAIFMT_DSP_A :/* data on rising edge of bclk, frame high 1clk before data */ - strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 |SSI_STCR_TEFS ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSL | +SSI_STCR_TEFS ;break ; }/* DAI clock inversion */ switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {case SND_SOC_DAIFMT_IB_IF : - strcr |=SSI_STCR_TFSI ; - strcr &= ~SSI_STCR_TSCKP ; + strcr ^=SSI_STCR_TSCKP |SSI_STCR_TFSI ;break ;case SND_SOC_DAIFMT_IB_NF : - strcr &= ~(SSI_STCR_TSCKP |SSI_STCR_TFSI ); + strcr ^=SSI_STCR_TSCKP ;break ;case SND_SOC_DAIFMT_NB_IF : - strcr |=SSI_STCR_TFSI |SSI_STCR_TSCKP ; + strcr ^=SSI_STCR_TFSI ;break ;case SND_SOC_DAIFMT_NB_NF : - strcr &= ~SSI_STCR_TFSI ; - strcr |=SSI_STCR_TSCKP ;break ; }
Signature · 6 lines
2.1.4 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 9 lines · Benoît Thébaudeau
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 <[email protected]>
Looks like the same configurations of fsl_ssi, so it should be fine:
Quoted 62 lines
--- sound/soc/fsl/imx-ssi.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)sound/soc/fsl/imx-ssi.c +9
-10@@ -95,7 +95,8 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {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 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSI | +SSI_STCR_TEFS ; scr |=SSI_SCR_NET ;if (ssi->flags &IMX_SSI_USE_I2S_SLAVE ) { 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)break ;case SND_SOC_DAIFMT_LEFT_J :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TXBIT0 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP ;break ;case SND_SOC_DAIFMT_DSP_B :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSL ;break ;case SND_SOC_DAIFMT_DSP_A :/* data on rising edge of bclk, frame high 1clk before data */ - strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 |SSI_STCR_TEFS ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSL | +SSI_STCR_TEFS ;break ; }/* DAI clock inversion */ switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {case SND_SOC_DAIFMT_IB_IF : - strcr |=SSI_STCR_TFSI ; - strcr &= ~SSI_STCR_TSCKP ; + strcr ^=SSI_STCR_TSCKP |SSI_STCR_TFSI ;break ;case SND_SOC_DAIFMT_IB_NF : - strcr &= ~(SSI_STCR_TSCKP |SSI_STCR_TFSI ); + strcr ^=SSI_STCR_TSCKP ;break ;case SND_SOC_DAIFMT_NB_IF : - strcr |=SSI_STCR_TFSI |SSI_STCR_TSCKP ; + strcr ^=SSI_STCR_TFSI ;break ;case SND_SOC_DAIFMT_NB_NF : - strcr &= ~SSI_STCR_TFSI ; - strcr |=SSI_STCR_TSCKP ;break ; }Signature · 1 line
2.1.4
Quoted 1 line · Nicolin Chen
Looks like the same configurations of
fsl_ssi, so it should be fine:
I'm so glad I ignored the IMX driver when I wrote fsl_ssi.c. :-)
Hi all,
Quoted 74 lines · Nicolin Chen
Quoted 9 lines · Benoît Thébaudeau
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 <[email protected]>Looks like the same configurations of
fsl_ssi, so it should be fine:Acked-by Nicolin Chen <[email protected]>Quoted 59 lines
--- sound/soc/fsl/imx-ssi.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)sound/soc/fsl/imx-ssi.c +9
-10@@ -95,7 +95,8 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {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 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSI | +SSI_STCR_TEFS ; scr |=SSI_SCR_NET ;if (ssi->flags &IMX_SSI_USE_I2S_SLAVE ) { 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)break ;case SND_SOC_DAIFMT_LEFT_J :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TXBIT0 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP ;break ;case SND_SOC_DAIFMT_DSP_B :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSL ;break ;case SND_SOC_DAIFMT_DSP_A :/* data on rising edge of bclk, frame high 1clk before data */ - strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 |SSI_STCR_TEFS ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSL | +SSI_STCR_TEFS ;break ; }/* DAI clock inversion */ switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {case SND_SOC_DAIFMT_IB_IF : - strcr |=SSI_STCR_TFSI ; - strcr &= ~SSI_STCR_TSCKP ; + strcr ^=SSI_STCR_TSCKP |SSI_STCR_TFSI ;break ;case SND_SOC_DAIFMT_IB_NF : - strcr &= ~(SSI_STCR_TSCKP |SSI_STCR_TFSI ); + strcr ^=SSI_STCR_TSCKP ;break ;case SND_SOC_DAIFMT_NB_IF : - strcr |=SSI_STCR_TFSI |SSI_STCR_TSCKP ; + strcr ^=SSI_STCR_TFSI ;break ;case SND_SOC_DAIFMT_NB_NF : - strcr &= ~SSI_STCR_TFSI ; - strcr |=SSI_STCR_TSCKP ;break ; }
Quoted 3 lines
Quoted 3 lines
--
2.1.4
Adding the ASoC maintainers to the Cc list.
Best regards,
Benoît
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerQuoted 7 lines · Benoît Thébaudeau
Quoted 5 lines
sound/soc/fsl/imx-ssi.c static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) · line 134
Quoted 5 lines
case
SND_SOC_DAIFMT_NB_NF:sound/soc/fsl/imx-ssi.c +0
-2- strcr &= ~SSI_STCR_TFSI ; - strcr |=SSI_STCR_TSCKP ;break ; }Adding the ASoC maintainers to the Cc list.
Please send patches directly to maintainers as covered in SubmittingPatches, I can't do anything with a quoted reply to an e-mail.
PATCH RESEND 1/1 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.
--- sound/soc/fsl/imx-ssi.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
sound/soc/fsl/imx-ssi.c +9 -10
@@ -95,7 +95,8 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {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 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSI | +SSI_STCR_TEFS ; scr |=SSI_SCR_NET ;if (ssi->flags &IMX_SSI_USE_I2S_SLAVE ) { 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)break ;case SND_SOC_DAIFMT_LEFT_J :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TXBIT0 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP ;break ;case SND_SOC_DAIFMT_DSP_B :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSL ;break ;case SND_SOC_DAIFMT_DSP_A :/* data on rising edge of bclk, frame high 1clk before data */ - strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 |SSI_STCR_TEFS ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSL | +SSI_STCR_TEFS ;break ; }/* DAI clock inversion */ switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {case SND_SOC_DAIFMT_IB_IF : - strcr |=SSI_STCR_TFSI ; - strcr &= ~SSI_STCR_TSCKP ; + strcr ^=SSI_STCR_TSCKP |SSI_STCR_TFSI ;break ;case SND_SOC_DAIFMT_IB_NF : - strcr &= ~(SSI_STCR_TSCKP |SSI_STCR_TFSI ); + strcr ^=SSI_STCR_TSCKP ;break ;case SND_SOC_DAIFMT_NB_IF : - strcr |=SSI_STCR_TFSI |SSI_STCR_TSCKP ; + strcr ^=SSI_STCR_TFSI ;break ;case SND_SOC_DAIFMT_NB_NF : - strcr &= ~SSI_STCR_TFSI ; - strcr |=SSI_STCR_TSCKP ;break ; }
Signature · 6 lines
2.1.4 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerApplied "ASoC: imx-ssi: Fix DAI hardware signal inversions" to the asoc tree
In reply to Benoît ThébaudeauThe patch
ASoC: imx-ssi: Fix DAI hardware signal inversions
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
b7b01d345b83602a42b6ff02cacb9d9ada5ecd0aMon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= <[email protected]>
Date: Tue, 29 Sep 2015 17:59:14 +0200
Subject: [PATCH] ASoC: imx-ssi: Fix DAI hardware signal inversions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
--- sound/soc/fsl/imx-ssi.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
sound/soc/fsl/imx-ssi.c +9 -10
@@ -95,7 +95,8 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {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 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSI | +SSI_STCR_TEFS ; scr |=SSI_SCR_NET ;if (ssi->flags &IMX_SSI_USE_I2S_SLAVE ) { 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)break ;case SND_SOC_DAIFMT_LEFT_J :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TXBIT0 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP ;break ;case SND_SOC_DAIFMT_DSP_B :/* data on rising edge of bclk, frame high with data */ - strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSL ;break ;case SND_SOC_DAIFMT_DSP_A :/* data on rising edge of bclk, frame high 1clk before data */ - strcr |=SSI_STCR_TFSL |SSI_STCR_TXBIT0 |SSI_STCR_TEFS ; + strcr |=SSI_STCR_TXBIT0 |SSI_STCR_TSCKP |SSI_STCR_TFSL | +SSI_STCR_TEFS ;break ; }/* DAI clock inversion */ switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {case SND_SOC_DAIFMT_IB_IF : - strcr |=SSI_STCR_TFSI ; - strcr &= ~SSI_STCR_TSCKP ; + strcr ^=SSI_STCR_TSCKP |SSI_STCR_TFSI ;break ;case SND_SOC_DAIFMT_IB_NF : - strcr &= ~(SSI_STCR_TSCKP |SSI_STCR_TFSI ); + strcr ^=SSI_STCR_TSCKP ;break ;case SND_SOC_DAIFMT_NB_IF : - strcr |=SSI_STCR_TFSI |SSI_STCR_TSCKP ; + strcr ^=SSI_STCR_TFSI ;break ;case SND_SOC_DAIFMT_NB_NF : - strcr &= ~SSI_STCR_TFSI ; - strcr |=SSI_STCR_TSCKP ;break ; }
Signature · 1 line
2.5.0