dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: hdmi-codec: Allow driver to restrict sample size
@ 2017-07-17 14:02 srinivas.kandagatla
  2017-07-17 14:02 ` [PATCH 1/2] ASoC: hdmi-codec: Allow drivers to restrict sample sizes srinivas.kandagatla
  2017-07-17 14:02 ` [PATCH 2/2] drm/bridge: adv7511: restrict audio " srinivas.kandagatla
  0 siblings, 2 replies; 5+ messages in thread
From: srinivas.kandagatla @ 2017-07-17 14:02 UTC (permalink / raw)
  To: Jyri Sarha, Mark Brown, alsa-devel
  Cc: Archit Taneja, Andrzej Hajda, David Airlie, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, dri-devel, linux-kernel,
	Srinivas Kandagatla

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

This patch adds option to allow hdmi-codec drivers to restrict
the audio sample size based on the values that are suppored in hardware.

First patch is adding that formats option to hdmi_codec_pdata and
second patch is a fix in adv7511 codec driver which only supports
16 and 24 bit samples.

Srinivas Kandagatla (2):
  ASoC: hdmi-codec: Allow drivers to restrict sample sizes.
  drm/bridge: adv7511: restrict audio sample sizes

 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 2 ++
 include/sound/hdmi-codec.h                     | 1 +
 sound/soc/codecs/hdmi-codec.c                  | 3 +++
 3 files changed, 6 insertions(+)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] ASoC: hdmi-codec: Allow drivers to restrict sample sizes.
  2017-07-17 14:02 [PATCH 0/2] ASoC: hdmi-codec: Allow driver to restrict sample size srinivas.kandagatla
@ 2017-07-17 14:02 ` srinivas.kandagatla
  2017-07-27 10:34   ` Jyri Sarha
  2017-07-17 14:02 ` [PATCH 2/2] drm/bridge: adv7511: restrict audio " srinivas.kandagatla
  1 sibling, 1 reply; 5+ messages in thread
From: srinivas.kandagatla @ 2017-07-17 14:02 UTC (permalink / raw)
  To: Jyri Sarha, Mark Brown, alsa-devel
  Cc: Archit Taneja, Andrzej Hajda, David Airlie, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, dri-devel, linux-kernel,
	Srinivas Kandagatla

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

Currently hdmi client drivers does have means to limit the
sample sizes that it can only support. Having formats parameter
option would solve this.

This issue was noticed on DB410c board when adv7511 hdmi codec driver
failed to play a 32 bits audio samples, as it does not support them.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 include/sound/hdmi-codec.h    | 1 +
 sound/soc/codecs/hdmi-codec.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h
index 9483c55f871b..89fc4cce5785 100644
--- a/include/sound/hdmi-codec.h
+++ b/include/sound/hdmi-codec.h
@@ -104,6 +104,7 @@ struct hdmi_codec_pdata {
 	uint i2s:1;
 	uint spdif:1;
 	int max_i2s_channels;
+	u64 formats;
 	void *data;
 };
 
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 22ed0dc88f0a..1ece73f4be92 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -780,6 +780,9 @@ static int hdmi_codec_probe(struct platform_device *pdev)
 		hcp->daidrv[i] = hdmi_i2s_dai;
 		hcp->daidrv[i].playback.channels_max =
 			hcd->max_i2s_channels;
+
+		if (hcd->formats)
+			hcp->daidrv[i].playback.formats = hcd->formats;
 		i++;
 	}
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm/bridge: adv7511: restrict audio sample sizes
  2017-07-17 14:02 [PATCH 0/2] ASoC: hdmi-codec: Allow driver to restrict sample size srinivas.kandagatla
  2017-07-17 14:02 ` [PATCH 1/2] ASoC: hdmi-codec: Allow drivers to restrict sample sizes srinivas.kandagatla
@ 2017-07-17 14:02 ` srinivas.kandagatla
  1 sibling, 0 replies; 5+ messages in thread
From: srinivas.kandagatla @ 2017-07-17 14:02 UTC (permalink / raw)
  To: Jyri Sarha, Mark Brown, alsa-devel
  Cc: Archit Taneja, Andrzej Hajda, David Airlie, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, dri-devel, linux-kernel,
	Srinivas Kandagatla

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

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 <srinivas.kandagatla@linaro.org>
---
 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 = &adv7511_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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] ASoC: hdmi-codec: Allow drivers to restrict sample sizes.
  2017-07-17 14:02 ` [PATCH 1/2] ASoC: hdmi-codec: Allow drivers to restrict sample sizes srinivas.kandagatla
@ 2017-07-27 10:34   ` Jyri Sarha
  2017-07-27 12:04     ` Srinivas Kandagatla
  0 siblings, 1 reply; 5+ messages in thread
From: Jyri Sarha @ 2017-07-27 10:34 UTC (permalink / raw)
  To: srinivas.kandagatla, Mark Brown, alsa-devel
  Cc: Archit Taneja, David Airlie, linux-kernel, Liam Girdwood,
	dri-devel, Takashi Iwai, Andrzej Hajda

On 07/17/17 17:02, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> Currently hdmi client drivers does have means to limit the
> sample sizes that it can only support. Having formats parameter
> option would solve this.
> 
> This issue was noticed on DB410c board when adv7511 hdmi codec driver
> failed to play a 32 bits audio samples, as it does not support them.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

I left this feature out because I did not need it. All the HDMI encoders
I have used are able to take all the i2s formats I am able to send.

You should probably also update the comment above I2S_FORMATS
definition. Othewise:

Reviewed-by: Jyri Sarha <jsarha@ti.com>


> ---
>  include/sound/hdmi-codec.h    | 1 +
>  sound/soc/codecs/hdmi-codec.c | 3 +++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h
> index 9483c55f871b..89fc4cce5785 100644
> --- a/include/sound/hdmi-codec.h
> +++ b/include/sound/hdmi-codec.h
> @@ -104,6 +104,7 @@ struct hdmi_codec_pdata {
>  	uint i2s:1;
>  	uint spdif:1;
>  	int max_i2s_channels;
> +	u64 formats;
>  	void *data;
>  };
>  
> diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
> index 22ed0dc88f0a..1ece73f4be92 100644
> --- a/sound/soc/codecs/hdmi-codec.c
> +++ b/sound/soc/codecs/hdmi-codec.c
> @@ -780,6 +780,9 @@ static int hdmi_codec_probe(struct platform_device *pdev)
>  		hcp->daidrv[i] = hdmi_i2s_dai;
>  		hcp->daidrv[i].playback.channels_max =
>  			hcd->max_i2s_channels;
> +
> +		if (hcd->formats)
> +			hcp->daidrv[i].playback.formats = hcd->formats;
>  		i++;
>  	}
>  
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] ASoC: hdmi-codec: Allow drivers to restrict sample sizes.
  2017-07-27 10:34   ` Jyri Sarha
@ 2017-07-27 12:04     ` Srinivas Kandagatla
  0 siblings, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2017-07-27 12:04 UTC (permalink / raw)
  To: Jyri Sarha, Mark Brown, alsa-devel
  Cc: Archit Taneja, Andrzej Hajda, David Airlie, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood, dri-devel, linux-kernel



On 27/07/17 11:34, Jyri Sarha wrote:
> On 07/17/17 17:02, srinivas.kandagatla@linaro.org wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>
>> Currently hdmi client drivers does have means to limit the
>> sample sizes that it can only support. Having formats parameter
>> option would solve this.
>>
>> This issue was noticed on DB410c board when adv7511 hdmi codec driver
>> failed to play a 32 bits audio samples, as it does not support them.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> I left this feature out because I did not need it. All the HDMI encoders
> I have used are able to take all the i2s formats I am able to send.
> 
> You should probably also update the comment above I2S_FORMATS
> definition. Othewise:
Make sense, I will update it and send a v2 patch.


> 
> Reviewed-by: Jyri Sarha <jsarha@ti.com>

thanks
--srini
> 
> 
>> ---
>>   include/sound/hdmi-codec.h    | 1 +
>>   sound/soc/codecs/hdmi-codec.c | 3 +++
>>   2 files changed, 4 insertions(+)
>>
>> diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h
>> index 9483c55f871b..89fc4cce5785 100644
>> --- a/include/sound/hdmi-codec.h
>> +++ b/include/sound/hdmi-codec.h
>> @@ -104,6 +104,7 @@ struct hdmi_codec_pdata {
>>   	uint i2s:1;
>>   	uint spdif:1;
>>   	int max_i2s_channels;
>> +	u64 formats;
>>   	void *data;
>>   };
>>   
>> diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
>> index 22ed0dc88f0a..1ece73f4be92 100644
>> --- a/sound/soc/codecs/hdmi-codec.c
>> +++ b/sound/soc/codecs/hdmi-codec.c
>> @@ -780,6 +780,9 @@ static int hdmi_codec_probe(struct platform_device *pdev)
>>   		hcp->daidrv[i] = hdmi_i2s_dai;
>>   		hcp->daidrv[i].playback.channels_max =
>>   			hcd->max_i2s_channels;
>> +
>> +		if (hcd->formats)
>> +			hcp->daidrv[i].playback.formats = hcd->formats;
>>   		i++;
>>   	}
>>   
>>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-27 12:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17 14:02 [PATCH 0/2] ASoC: hdmi-codec: Allow driver to restrict sample size srinivas.kandagatla
2017-07-17 14:02 ` [PATCH 1/2] ASoC: hdmi-codec: Allow drivers to restrict sample sizes srinivas.kandagatla
2017-07-27 10:34   ` Jyri Sarha
2017-07-27 12:04     ` Srinivas Kandagatla
2017-07-17 14:02 ` [PATCH 2/2] drm/bridge: adv7511: restrict audio " srinivas.kandagatla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).