Skip to contentSkip to conversation

ASoC: tlv320aic3x: Fix mono

PATCH In review Benoît Thébaudeau 2 participants 11 messages Jan 25, 2013 – Jan 30, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: tlv320aic3x: Fix mono

The TLV320AIC3x DAI supports only stereo. This patch fixes mono support for this codec by allowing only stereo at codec level.

Tested with imx-ssi and TLV320AIC3104.

---
 sound/soc/codecs/tlv320aic3x.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/tlv320aic3x.c +2 -2
index 5708a97..4989143 100644
@@ -1210,13 +1210,13 @@ static struct snd_soc_dai_driver aic3x_dai = {
 	.name = "tlv320aic3x-hifi",
 	.playback = {
 		.stream_name = "Playback",
-		.channels_min = 1,
+		.channels_min = 2,
 		.channels_max = 2,
 		.rates = AIC3X_RATES,
 		.formats = AIC3X_FORMATS,},
 	.capture = {
 		.stream_name = "Capture",
-		.channels_min = 1,
+		.channels_min = 2,
 		.channels_max = 2,
 		.rates = AIC3X_RATES,
 		.formats = AIC3X_FORMATS,},
Signature · 6 lines
1.7.10.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#1 lore raw
Quoted 2 lines · Benoît Thébaudeau

The TLV320AIC3x DAI supports only stereo. This patch fixes mono support for this codec by allowing only stereo at codec level.

So, this doesn't actually fix mono - it removes support for it. It's a bit surprising that this is a requirement actually, the device seems to support DSP modes which usually do mono totally happily (I2S style modes have problems due to the clocking). I'd like to see some confirmation that there's not some other issue in your system...

#2 lore raw
Quoted 6 lines · Mark Brown
Quoted 3 lines · Benoît Thébaudeau

The TLV320AIC3x DAI supports only stereo. This patch fixes mono support for this
codec by allowing only stereo at codec level.

So, this doesn't actually fix mono - it removes support for it.

Yes, for this driver, but this fixes mono for the whole system, meaning that e.g. it fixes mono playback support with players like MPlayer. I will reword if you prefer.

Quoted 5 lines

It's a
bit surprising that this is a requirement actually, the device seems to support DSP modes which usually do mono totally happily (I2S style modes have problems due to the clocking). I'd like to see some confirmation that there's not some other issue in your system...

I've only tested with I²S (imx-ssi). But for all the available DAI modes, the data sheet gives the encoding for both stereo channels (from p. 21), and nowhere it says that mono is an option for DAI:
http://www.ti.com/lit/ds/symlink/tlv320aic3104.pdf

I will retest with DSP modes if you prefer.

The idea was the same as for this commit:
http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=commitdiff;h=37f45cc54cb03cac4a6b865b32bc705bb0cb1d29
Even though the MC13783 only supports I²S and MSB justified modes, and there may be an issue specific to it:
http://cache.freescale.com/files/rf_if/doc/data_sheet/MC13783.pdf?pspll=1

Best regards,
Benoît
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw
Quoted 7 lines · Benoît Thébaudeau
Quoted 1 line · Mark Brown

So, this doesn't actually fix mono - it removes support for it.

Yes, for this driver, but this fixes mono for the whole system, meaning that e.g. it fixes mono playback support with players like MPlayer. I will reword if you prefer.

Yes, please.

Quoted 3 lines

I've only tested with I²S (imx-ssi). But for all the available DAI modes, the data sheet gives the encoding for both stereo channels (from p. 21), and nowhere it says that mono is an option for DAI:

I2S isn't really relevant here, it's not possible to clock I2S as a mono interface.

Quoted 1 line

I will retest with DSP modes if you prefer.

Yes, please.

#4 lore raw
Quoted 8 lines · Mark Brown
Quoted 6 lines · Benoît Thébaudeau

On Saturday, January 26, 2013 9:55:14 AM, Mark Brown wrote:
I've only tested with I²S (imx-ssi). But for all the available DAI modes, the
data sheet gives the encoding for both stereo channels (from p. 21), and nowhere
it says that mono is an option for DAI:

Quoted 6 lines

I2S isn't really relevant here, it's not possible to clock I2S as a mono interface.

Quoted 1 line

I will retest with DSP modes if you prefer.

Yes, please.

I have now tested all the DAI formats compatible with both imx-ssi and tlv320aic3x, i.e.:
- I2S | NB_NF | CBM_CFM,

 - DSP_A | IB_NF | CBM_CFM,
 - DSP_B | IB_NF | CBM_CFM,

- LEFT_J | NB_NF | CBM_CFM.

In all cases, stereo works just fine.

As to mono, setting .channels_min to 2 also always works fine (as expected, but not interesting here).

For mono with .channels_min = 1 (i.e. without this patch), I have tried with:

1) snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffc, 0xffffffc, 2, 0); -> all DAI formats: wrong sample rate for L/R, playing twice too fast

2) snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffe, 0xffffffe, 1, 0); -> all DAI formats: nothing on R, wrong sample rate for L, playing twice too fast, plus loud noise superimposed for LEFT_J

So, I don't see how to avoid this patch.

I will send a reworded update.

Best regards,
Benoît
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw
Quoted 6 lines · Benoît Thébaudeau

1) snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffc, 0xffffffc, 2, 0); -> all DAI formats: wrong sample rate for L/R, playing twice too fast

2) snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffe, 0xffffffe, 1, 0); -> all DAI formats: nothing on R, wrong sample rate for L, playing twice too fast, plus loud noise superimposed for LEFT_J

Why are you having to call this in the first place?

Anyway, I guess we do have a hardware limiation here so I'll apply the patch when you resend it.

#6 lore raw
Quoted 11 lines · Mark Brown
Quoted 7 lines · Benoît Thébaudeau

1) snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffc, 0xffffffc, 2, 0); -> all DAI formats: wrong sample rate for L/R, playing twice too fast

2) snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffe, 0xffffffe, 1, 0); -> all DAI formats: nothing on R, wrong sample rate for L, playing twice too
fast, plus loud noise superimposed for LEFT_J

Why are you having to call this in the first place?

For I²S, because the reference manual of the i.MX25 says that SSI.STCCR.DC should be set to 1 (i.e. 2 channels) in this mode. This also allowed to test several settings for mono.

For DSP modes, because stereo doesn't work without this call (right channel missing).

Quoted 2 lines

Anyway, I guess we do have a hardware limiation here so I'll apply the patch when you resend it.

OK. I have just resent it.

Best regards,
Benoît
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#7 lore raw
Quoted 10 lines · Benoît Thébaudeau
Quoted 1 line · Mark Brown

Why are you having to call this in the first place?

For I²S, because the reference manual of the i.MX25 says that SSI.STCCR.DC should be set to 1 (i.e. 2 channels) in this mode. This also allowed to test several settings for mono.

For DSP modes, because stereo doesn't work without this call (right channel missing).

So why does the driver not just do this automatically?

#8 lore raw
Quoted 10 lines · Mark Brown
Quoted 8 lines · Benoît Thébaudeau
Quoted 1 line · Mark Brown

Why are you having to call this in the first place?

For I²S, because the reference manual of the i.MX25 says that SSI.STCCR.DC should be set to 1 (i.e. 2 channels) in this mode. This also allowed to test
several settings for mono.

Quoted 4 lines
Quoted 2 lines

For DSP modes, because stereo doesn't work without this call (right channel missing).

So why does the driver not just do this automatically?

I don't know. I add Fabio and Sascha to Cc in case they know.

I think that it's either to let the users of imx-ssi do weird things if they have to (but implementing a default setup would not prevent users to change it by calling snd_soc_dai_set_tdm_slot(), so...), or rather because nobody had enough time or all the test configurations to work on this so far. It's marked as TODO in sound/soc/fsl/wm1133-ev1.c.

Best regards,
Benoît
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#9 lore raw

PATCH v2 1/1 ASoC: tlv320aic3x: Remove mono support

In reply to Benoît Thébaudeau

Playing a mono stream on the TLV320AIC3x results in too fast playback rate.

Remove mono support so that mono streams can be played correctly on this codec.

Tested with imx-ssi (i.MX25) and TLV320AIC3104.

---
Changes for v2:
- Reword patch description as mono removal rather than as mono fix.

---
 sound/soc/codecs/tlv320aic3x.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/tlv320aic3x.c +2 -2
index 5708a97..4989143 100644
@@ -1210,13 +1210,13 @@ static struct snd_soc_dai_driver aic3x_dai = {
 	.name = "tlv320aic3x-hifi",
 	.playback = {
 		.stream_name = "Playback",
-		.channels_min = 1,
+		.channels_min = 2,
 		.channels_max = 2,
 		.rates = AIC3X_RATES,
 		.formats = AIC3X_FORMATS,},
 	.capture = {
 		.stream_name = "Capture",
-		.channels_min = 1,
+		.channels_min = 2,
 		.channels_max = 2,
 		.rates = AIC3X_RATES,
 		.formats = AIC3X_FORMATS,},
Signature · 6 lines
1.7.10.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Applied
#10 lore raw

Re: [PATCH v2] ASoC: tlv320aic3x: Remove mono support

Quoted 3 lines · Benoît Thébaudeau

Playing a mono stream on the TLV320AIC3x results in too fast playback rate.

Remove mono support so that mono streams can be played correctly on this codec.

Applied, thanks.