ASoC: tlv320aic3x: Correct S24_3LE support
Subsystems (3)
PATCH 1/1 ASoC: tlv320aic3x: Correct S24_3LE support
Correct the hw_params callback to configure the codec correctly in case of S24_3LE format.S24_LE is not defined as supported format for the codec.
--- sound/soc/codecs/tlv320aic3x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/tlv320aic3x.c +1 -1
@@ -879,7 +879,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream,case SNDRV_PCM_FORMAT_S20_3LE : data |= (0x01 <<4 );break ; -case SNDRV_PCM_FORMAT_S24_LE : +case SNDRV_PCM_FORMAT_S24_3LE : data |= (0x02 <<4 );break ;case SNDRV_PCM_FORMAT_S32_LE :
Signature · 1 line
2.0.0
Mark Brown
maintainerQuoted 3 lines · Peter Ujfalusi
Correct the
hw_paramscallback to configure the codec correctly in case ofS24_3LEformat.S24_LEis not defined as supported format for the codec.
These should both be supported by the time things get down to the wire - the memory layout shouldn't matter. I really need to get round to doing the rest of the conversions to use params_width() which should ensure this.
Quoted 8 lines · Mark Brown
Quoted 3 lines · Peter Ujfalusi
Correct the
hw_paramscallback to configure the codec correctly in case ofS24_3LEformat.S24_LEis not defined as supported format for the codec.These should both be supported by the time things get down to the wire - the memory layout shouldn't matter.
The codec itself has support for 16, 20, 24 and 32 bits data. The AIC3X_FORMATS is correct:
#define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
While in hw_params the switch was not handling the S24_3LE but it was defined as S24_LE. So the code was not correct: It advertised that it supportsd S24_3LE and was not handling it, but it was handling S24_LE which would not happen with this codec driver since the format is not supported - as it was defined by the AIC3X_FORMATS.
This is a fix for the current driver.
Quoted 3 lines
I really need to get round to doing
the rest of the conversions to useparams_width()which should ensure this.
Not sure how this would work at the end to be honest for all platforms and codecs. How should the bitclock need to be configured for S24_3LE, S24_LE and S32_LE msbits=24? They are at the end have 24bits audio data but in memory they are stored in different ways.
Aic3x for example need to be configured to 24bit mode (24 clocks/channel if it is master) so it is going to 'pull' that amount from the CPU side. This can not be used with OMAP's sDMA/McBSP but davinci's eDMA/McASP can support it. I can even get daVinci to 'extract' the valid 24 bits from the 32bit sample coming via eDMA (mask/rotate/reverse operation).
So I still think that this is a bit more complicated than it looks
Signature · 1 line
Péter
Mark Brown
maintainerQuoted 11 lines · Peter Ujfalusi
AIC3X_FORMATSis correct:#define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)While in
hw_paramsthe switch was not handling theS24_3LEbut it was defined asS24_LE. So the code was not correct: It advertised that it supportsdS24_3LEand was not handling it, but it was handlingS24_LEwhich would not happen with this codec driver since the format is not supported - as it was defined by theAIC3X_FORMATS.This is a fix for the current driver.
Yes, but the fix should be to support both.
Quoted 8 lines
Quoted 3 lines
I really need to get round to doing
the rest of the conversions to useparams_width()which should ensure this.Not sure how this would work at the end to be honest for all platforms and codecs. How should the bitclock need to be configured for
S24_3LE,S24_LEandS32_LEmsbits=24? They are at the end have 24bits audio data but in memory they are stored in different ways.
The number of bits on the wire should be the number specified in the format.
Quoted 5 lines
Aic3x for example need to be configured to 24bit mode (24 clocks/channel if it is master) so it is going to 'pull' that amount from the CPU side. This can not be used with OMAP's sDMA/McBSP but davinci's eDMA/McASP can support it. I can even get daVinci to 'extract' the valid 24 bits from the 32bit sample coming via eDMA (mask/rotate/reverse operation).
Sure, so it only supports exactly 24 bit sample formats in master mode. That's what's expected by default.
Quoted 1 line
So I still think that this is a bit more complicated than it looks
I'm not seeing anything particularly hard here. The main thing is that we ought to do something for dealing with extra BCLKs (eg, a device that can tolerate extra BCLKs can have the other end generating more data quite happily).
Quoted 12 lines · Mark Brown
Quoted 9 lines · Peter Ujfalusi
AIC3X_FORMATSis correct:#define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)While in
hw_paramsthe switch was not handling theS24_3LEbut it was defined asS24_LE. So the code was not correct: It advertised that it supportsdS24_3LEand was not handling it, but it was handlingS24_LEwhich would not happen with this codec driver since the format is not supported - as it was defined by theAIC3X_FORMATS.
Quoted 3 lines
Quoted 1 line
This is a fix for the current driver.
Yes, but the fix should be to support both.
I would rather fix the S24_3LE with this patch and add the S24_LE with a separate one. But IMHO the S24_LE support is not obvious.
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
I really need to get round to doing
the rest of the conversions to useparams_width()which should ensure this.Not sure how this would work at the end to be honest for all platforms and codecs. How should the bitclock need to be configured for
S24_3LE,S24_LEandS32_LEmsbits=24? They are at the end have 24bits audio data but in memory they are stored in different ways.The number of bits on the wire should be the number specified in the format.
So you are saying that for S24_3LE, S24_LE and S32_LE (msbits=24) we should have 24 bits on the wire?
At least twl4030/5030 expects the 24bit data on the wire with 32 clocks (24 bits data + 8bits padding).
OMAP McBSP can only support 24bit audio with S32_LE (msbits=24) and it needs to have 32 clock cycle on the bus to do this due to system constraints.
So if we say that S32_LE (msbits=24) should have 24 bits on the wire neither OMAP McBSP nor twl4030/5030 could do that.
Not sure about other SoCs, but I would not be so surprised that they also want to shift out all the bits they have got form the main memory, ie 24 bits in case of S24_3LE, 32bits in case of S24_LE or S32_LE (msbits=24).
Quoted 16 lines
Quoted 5 lines
Aic3x for example need to be configured to 24bit mode (24 clocks/channel if it is master) so it is going to 'pull' that amount from the CPU side. This can not be used with OMAP's sDMA/McBSP but davinci's eDMA/McASP can support it. I can even get daVinci to 'extract' the valid 24 bits from the 32bit sample coming via eDMA (mask/rotate/reverse operation).
Sure, so it only supports exactly 24 bit sample formats in master mode. That's what's expected by default.
Quoted 1 line
So I still think that this is a bit more complicated than it looks
I'm not seeing anything particularly hard here. The main thing is that we ought to do something for dealing with extra BCLKs (eg, a device that can tolerate extra BCLKs can have the other end generating more data quite happily).
Signature · 1 line
Péter
Mark Brown
maintainerQuoted 7 lines · Peter Ujfalusi
Quoted 2 lines · Mark Brown
The number of bits on the wire should be the number specified in the format.
So you are saying that for
S24_3LE,S24_LEandS32_LE(msbits=24) we should have 24 bits on the wire?
No - when the format is S32_LE then that's 32 bits.