[v2,1/2] ASoC: hdmi-codec: Allow drivers to restrict sample sizes.

Message ID 20170731224944.9986-2-srinivas.kandagatla@linaro.org
State New
Headers show
Series
  • ASoC: hdmi-codec: Allow driver to restrict sample size
Related show

Commit Message

Srinivas Kandagatla July 31, 2017, 10:49 p.m.
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>
Reviewed-by: Jyri Sarha <jsarha@ti.com>
---
 include/sound/hdmi-codec.h    | 1 +
 sound/soc/codecs/hdmi-codec.c | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

Patch

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..a7b4d6757ff1 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -653,9 +653,8 @@  static const struct snd_soc_dai_ops hdmi_dai_ops = {
  * This list is only for formats allowed on the I2S bus. So there is
  * some formats listed that are not supported by HDMI interface. For
  * instance allowing the 32-bit formats enables 24-precision with CPU
- * DAIs that do not support 24-bit formats. If the extra formats cause
- * problems, we should add the video side driver an option to disable
- * them.
+ * DAIs that do not support 24-bit formats. Driver can either use this
+ * list or specify supported formats in formats field of hdmi_codec_pdata.
  */
 #define I2S_FORMATS	(SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |\
 			 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S20_3BE |\
@@ -780,6 +779,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++;
 	}