cb9bbe350aa5268e6065b6cf267a1d6957d48fa7
[openwrt/staging/linusw.git] /
1 From ab79274c7bab8e16822077ae0850e6cf9b2ec1b4 Mon Sep 17 00:00:00 2001
2 From: Sia Jee Heng <jee.heng.sia@intel.com>
3 Date: Thu, 4 Feb 2021 09:42:55 +0800
4 Subject: [PATCH] ASoC: codec: hdmi-codec: Support IEC958 encoded PCM
5 format
6
7 Existing hdmi-codec driver only support standard pcm format.
8 Support of IEC958 encoded format pass from ALSA IEC958 plugin is needed
9 so that the IEC958 encoded data can be streamed to the HDMI chip.
10
11 Signed-off-by: Sia Jee Heng <jee.heng.sia@intel.com>
12 Link: https://lore.kernel.org/r/20210204014258.10197-2-jee.heng.sia@intel.com
13 Signed-off-by: Mark Brown <broonie@kernel.org>
14 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
15 ---
16 include/sound/hdmi-codec.h | 5 +++++
17 sound/soc/codecs/hdmi-codec.c | 4 +++-
18 2 files changed, 8 insertions(+), 1 deletion(-)
19
20 --- a/include/sound/hdmi-codec.h
21 +++ b/include/sound/hdmi-codec.h
22 @@ -34,6 +34,11 @@ struct hdmi_codec_daifmt {
23 unsigned int frame_clk_inv:1;
24 unsigned int bit_clk_master:1;
25 unsigned int frame_clk_master:1;
26 + /* bit_fmt could be standard PCM format or
27 + * IEC958 encoded format. ALSA IEC958 plugin will pass
28 + * IEC958_SUBFRAME format to the underneath driver.
29 + */
30 + snd_pcm_format_t bit_fmt;
31 };
32
33 /*
34 --- a/sound/soc/codecs/hdmi-codec.c
35 +++ b/sound/soc/codecs/hdmi-codec.c
36 @@ -487,6 +487,7 @@ static int hdmi_codec_hw_params(struct s
37 hp.sample_rate = params_rate(params);
38 hp.channels = params_channels(params);
39
40 + cf->bit_fmt = params_format(params);
41 return hcp->hcd.ops->hw_params(dai->dev->parent, hcp->hcd.data,
42 cf, &hp);
43 }
44 @@ -615,7 +616,8 @@ static const struct snd_soc_dai_ops hdmi
45 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S20_3BE |\
46 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_3BE |\
47 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE |\
48 - SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE)
49 + SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE |\
50 + SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)
51
52 static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
53 struct snd_soc_dai *dai)