]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ASoC: stm32: sai: fix exposed capabilities in spdif mode
authorOlivier Moysan <olivier.moysan@st.com>
Thu, 28 Feb 2019 13:19:22 +0000 (14:19 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1838459
[ Upstream commit b8468192971807c43a80d6e2c41f83141cb7b211 ]

Change capabilities exposed in SAI S/PDIF mode, to match
actually supported formats.
In S/PDIF mode only 32 bits stereo is supported.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
sound/soc/stm/stm32_sai_sub.c

index 8f10317d1864de4de6470ae4b901b2eb0308eaf5..a3c260c8206bfa5aad2804546425b01fc18100c2 100644 (file)
@@ -432,6 +432,14 @@ static int stm32_sai_startup(struct snd_pcm_substream *substream,
 
        sai->substream = substream;
 
+       if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) {
+               snd_pcm_hw_constraint_mask64(substream->runtime,
+                                            SNDRV_PCM_HW_PARAM_FORMAT,
+                                            SNDRV_PCM_FMTBIT_S32_LE);
+               snd_pcm_hw_constraint_single(substream->runtime,
+                                            SNDRV_PCM_HW_PARAM_CHANNELS, 2);
+       }
+
        ret = clk_prepare_enable(sai->sai_ck);
        if (ret < 0) {
                dev_err(cpu_dai->dev, "Failed to enable clock: %d\n", ret);