Re: [alsa-devel] [PATCH v2 2/2] drm/bridge: adv7511: restrict audio sample sizes

2017-08-01 Thread Arnaud Pouliquen
Hello Srinivas,

On 08/01/2017 12:49 AM, srinivas.kandaga...@linaro.org wrote:
> From: Srinivas Kandagatla 
> 
> ADV7533 only supports audio samples word width from 16-24 bits.
> This patch restricts the audio sample sizes to the supported ones,
> so that sound card does not report wrong list of supported hwparms.
> 
> Without this patch aplay would fail when playing a 32 bit audio.
> 
> Signed-off-by: Srinivas Kandagatla 
> ---
>  drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c 
> b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
> index 67469c26bae8..d01d0aa0eef7 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
> @@ -214,6 +214,8 @@ static struct hdmi_codec_pdata codec_data = {
>   .ops = _codec_ops,
>   .max_i2s_channels = 2,
>   .i2s = 1,
> + .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |
> + SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE),
>  };

I'm not sure that this limitation is needed.
I already used ADV7513 and i did not observe this limitation.

I had a look to ADV7533 data-sheet. it should support 32 and 64 bits I2S
format bus, with 16 or 24 bits precision sample. So it should support
SNDRV_PCM_FMTBIT_S32_LE and SNDRV_PCM_FMTBIT_S32_BE

As example, if you configure bus in Left justified format with 24 bits
sample length, 32 bits application samples should be truncated to 24
bits samples at ADV7533 I2S interface level (LSB dropped).

Perhaps i missed something... but look like more an I2S bus
configuration issue in your DT card description, that that a miss in the
drivers.

Regards
Arnaud
>  
>  int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511)
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [alsa-devel] [PATCH v2 2/2] drm/bridge: adv7511: restrict audio sample sizes

2017-08-01 Thread Arnaud Pouliquen
Hello Srinivas,

On 08/01/2017 02:52 PM, Srinivas Kandagatla wrote:
 As example, if you configure bus in Left justified format with 24 bits
 sample length, 32 bits application samples should be truncated to 24
 bits samples at ADV7533 I2S interface level (LSB dropped).
>>
>>> May be we can do that to make the user happy but isn't this just truncate
>>> the resolution to 24Bit then?
>>
>>> And it's a false indication that we are supporting 32bit samples.
>>> Which am not very happy with.
>>
>> This is what the sample_bits field in the DAI structure is for.ya.
> But still reporting that driver supports 32 bit samples when it does not 
> really support all 32 bits, is kinda misleading to user.
> Isn't it?
> 
> And the driver would be end up with hacked up code for each case.

By experience, this is usual. As example, if you have a look to codec
ad193x (i take one randomly) it support 16, 20, 24 and 32 bits frames.
But if you have a look to AD1939 data-sheet it supports 24-bits conversion.
Some other examples could be 13-bits DAC/ADC with 16 bits samples.

In term of audio quality, truncation to a 24 bits sample should generate
an negligible additional error equal to the LSB bit: -20log(2^24)= -144dB.

It is just a personal opinion, but if have the choice between do
truncation in software (application or alsa-lib) and in hardware, i
would prefer the second one.

Regards
arnaud
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [alsa-devel] [PATCH v2 2/2] drm/bridge: adv7511: restrict audio sample sizes

2017-08-01 Thread Mark Brown
On Tue, Aug 01, 2017 at 01:52:35PM +0100, Srinivas Kandagatla wrote:
> On 01/08/17 13:28, Mark Brown wrote:

> > > And it's a false indication that we are supporting 32bit samples.
> > > Which am not very happy with.

> > This is what the sample_bits field in the DAI structure is for.ya.

> But still reporting that driver supports 32 bit samples when it does not
> really support all 32 bits, is kinda misleading to user.
> Isn't it?

No.  Please read what I wrote and look at what setting sample_bits does.


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [alsa-devel] [PATCH v2 2/2] drm/bridge: adv7511: restrict audio sample sizes

2017-08-01 Thread Srinivas Kandagatla



On 01/08/17 13:28, Mark Brown wrote:

On Tue, Aug 01, 2017 at 01:24:03PM +0100, Srinivas Kandagatla wrote:

On 01/08/17 09:42, Arnaud Pouliquen wrote:

On 08/01/2017 12:49 AM, srinivas.kandaga...@linaro.org wrote:



I already used ADV7513 and i did not observe this limitation.



I had a look to ADV7533 data-sheet. it should support 32 and 64 bits I2S



ADV7511_REG_AUDIO_CFG3(0x14) register definition in datasheet and the code
in this driver suggest that It only supports 16Bit and 24Bit samples.


The amount of data it pays attention to in the frame is not the same as
the size of the frame.

I agree.




format bus, with 16 or 24 bits precision sample. So it should support
SNDRV_PCM_FMTBIT_S32_LE and SNDRV_PCM_FMTBIT_S32_BE



As example, if you configure bus in Left justified format with 24 bits
sample length, 32 bits application samples should be truncated to 24
bits samples at ADV7533 I2S interface level (LSB dropped).



May be we can do that to make the user happy but isn't this just truncate
the resolution to 24Bit then?



And it's a false indication that we are supporting 32bit samples.
Which am not very happy with.


This is what the sample_bits field in the DAI structure is for.ya.
But still reporting that driver supports 32 bit samples when it does not 
really support all 32 bits, is kinda misleading to user.

Isn't it?

And the driver would be end up with hacked up code for each case.


--srini




___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [alsa-devel] [PATCH v2 2/2] drm/bridge: adv7511: restrict audio sample sizes

2017-08-01 Thread Mark Brown
On Tue, Aug 01, 2017 at 01:24:03PM +0100, Srinivas Kandagatla wrote:
> On 01/08/17 09:42, Arnaud Pouliquen wrote:
> > On 08/01/2017 12:49 AM, srinivas.kandaga...@linaro.org wrote:

> > I already used ADV7513 and i did not observe this limitation.

> > I had a look to ADV7533 data-sheet. it should support 32 and 64 bits I2S

> ADV7511_REG_AUDIO_CFG3(0x14) register definition in datasheet and the code
> in this driver suggest that It only supports 16Bit and 24Bit samples.

The amount of data it pays attention to in the frame is not the same as
the size of the frame.

> > format bus, with 16 or 24 bits precision sample. So it should support
> > SNDRV_PCM_FMTBIT_S32_LE and SNDRV_PCM_FMTBIT_S32_BE

> > As example, if you configure bus in Left justified format with 24 bits
> > sample length, 32 bits application samples should be truncated to 24
> > bits samples at ADV7533 I2S interface level (LSB dropped).

> May be we can do that to make the user happy but isn't this just truncate
> the resolution to 24Bit then?

> And it's a false indication that we are supporting 32bit samples.
> Which am not very happy with.

This is what the sample_bits field in the DAI structure is for.


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [alsa-devel] [PATCH v2 2/2] drm/bridge: adv7511: restrict audio sample sizes

2017-08-01 Thread Srinivas Kandagatla



On 01/08/17 09:42, Arnaud Pouliquen wrote:

Hello Srinivas,

On 08/01/2017 12:49 AM, srinivas.kandaga...@linaro.org wrote:

From: Srinivas Kandagatla 

ADV7533 only supports audio samples word width from 16-24 bits.
This patch restricts the audio sample sizes to the supported ones,
so that sound card does not report wrong list of supported hwparms.

Without this patch aplay would fail when playing a 32 bit audio.

Signed-off-by: Srinivas Kandagatla 
---
  drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c 
b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
index 67469c26bae8..d01d0aa0eef7 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
@@ -214,6 +214,8 @@ static struct hdmi_codec_pdata codec_data = {
.ops = _codec_ops,
.max_i2s_channels = 2,
.i2s = 1,
+   .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |
+   SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE),
  };


I'm not sure that this limitation is needed.
I already used ADV7513 and i did not observe this limitation.

I had a look to ADV7533 data-sheet. it should support 32 and 64 bits I2S


ADV7511_REG_AUDIO_CFG3(0x14) register definition in datasheet and the 
code in this driver suggest that It only supports 16Bit and 24Bit samples.



format bus, with 16 or 24 bits precision sample. So it should support
SNDRV_PCM_FMTBIT_S32_LE and SNDRV_PCM_FMTBIT_S32_BE

As example, if you configure bus in Left justified format with 24 bits
sample length, 32 bits application samples should be truncated to 24
bits samples at ADV7533 I2S interface level (LSB dropped).
May be we can do that to make the user happy but isn't this just 
truncate the resolution to 24Bit then?


And it's a false indication that we are supporting 32bit samples.
Which am not very happy with.




Perhaps i missed something... but look like more an I2S bus
configuration issue in your DT card description, that that a miss in the
drivers.


Nothing to do with DT or other driver, adv7533 audio driver does not 
support 32 bit sample size which is why it would return -EINVAL from

adv7511_hdmi_hw_params().

This patch is fixing the loose ends, by which I mean the card would 
report the exact supported sample sizes to user rather than every thing 
in the I2S_FORMATS list.



Thanks,
srini



Regards
Arnaud
  
  int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511)



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 2/2] drm/bridge: adv7511: restrict audio sample sizes

2017-07-31 Thread srinivas . kandagatla
From: Srinivas Kandagatla 

ADV7533 only supports audio samples word width from 16-24 bits.
This patch restricts the audio sample sizes to the supported ones,
so that sound card does not report wrong list of supported hwparms.

Without this patch aplay would fail when playing a 32 bit audio.

Signed-off-by: Srinivas Kandagatla 
---
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c 
b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
index 67469c26bae8..d01d0aa0eef7 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
@@ -214,6 +214,8 @@ static struct hdmi_codec_pdata codec_data = {
.ops = _codec_ops,
.max_i2s_channels = 2,
.i2s = 1,
+   .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |
+   SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE),
 };
 
 int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511)
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel