build/patch/kernel/meson64-dev/0085-WIP-ASoC-meson-add-2-8-channel-constraints.patch
2020-09-01 12:59:15 +02:00

62 lines
1.9 KiB
Diff

From 6f010e1f35e82ba7d05e7738b391b8b7b53eb1cf Mon Sep 17 00:00:00 2001
From: Neil Armstrong <narmstrong@baylibre.com>
Date: Thu, 20 Feb 2020 15:58:14 +0000
Subject: [PATCH 085/101] WIP: ASoC: meson: add 2/8 channel constraints
The audio hardware can output in 2 or 8 channels only, so we need must
ensure we start in only these two configurations.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
sound/soc/meson/aiu-fifo-i2s.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/sound/soc/meson/aiu-fifo-i2s.c b/sound/soc/meson/aiu-fifo-i2s.c
index 9a5271ce80fe..87e0c85eacc8 100644
--- a/sound/soc/meson/aiu-fifo-i2s.c
+++ b/sound/soc/meson/aiu-fifo-i2s.c
@@ -118,15 +118,40 @@ static int aiu_fifo_i2s_hw_params(struct snd_pcm_substream *substream,
snd_soc_component_update_bits(component, AIU_MEM_I2S_MASKS,
AIU_MEM_I2S_MASKS_IRQ_BLOCK, val);
+ snd_soc_component_write(component, AIU_RST_SOFT,
+ AIU_RST_SOFT_I2S_FAST);
+ snd_soc_component_read(component, AIU_I2S_SYNC, &val);
+
return 0;
}
+static const unsigned int channels_2_8[] = {
+ 2, 8
+};
+
+static const struct snd_pcm_hw_constraint_list hw_constraints_2_8_channels = {
+ .count = ARRAY_SIZE(channels_2_8),
+ .list = channels_2_8,
+ .mask = 0,
+};
+
+static int aiu_fifo_i2s_startup(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ /* Make sure either 2ch or 8ch is selected */
+ snd_pcm_hw_constraint_list(substream->runtime, 0,
+ SNDRV_PCM_HW_PARAM_CHANNELS,
+ &hw_constraints_2_8_channels);
+
+ return aiu_fifo_startup(substream, dai);
+}
+
const struct snd_soc_dai_ops aiu_fifo_i2s_dai_ops = {
.trigger = aiu_fifo_i2s_trigger,
.prepare = aiu_fifo_i2s_prepare,
.hw_params = aiu_fifo_i2s_hw_params,
.hw_free = aiu_fifo_hw_free,
- .startup = aiu_fifo_startup,
+ .startup = aiu_fifo_i2s_startup,
.shutdown = aiu_fifo_shutdown,
};
--
2.17.1