--- Begin Message ---
- To: "broonie@xxxxxxxxxx" <broonie@xxxxxxxxxx>, "lgirdwood@xxxxxxxxx" <lgirdwood@xxxxxxxxx>, "tiwai@xxxxxxxx" <tiwai@xxxxxxxx>
- Subject: [PATCH] ASoC: hdmi-codec: fix inverted tx in shutdown/startup
- From: Emil Abildgaard Svendsen <EMAS@xxxxxxxxxxxxxxx>
- Date: Thu, 9 Mar 2023 15:21:59 +0000
- Cc: Alvin Šipraga <ALSI@xxxxxxxxxxxxxxx>, "alsa-devel@xxxxxxxxxxxxxxxx" <alsa-devel@xxxxxxxxxxxxxxxx>, "linux-patches@xxxxxxxxxxxxxxx" <linux-patches@xxxxxxxxxxxxxxx>, Emil Abildgaard Svendsen <EMAS@xxxxxxxxxxxxxxx>
Fix ignore logic on shutdown and startup.
It broke single cpu single hdmi-codec with a single supported stream
direction. Inverting TX fixes it.
Truth table for when to ignore.
+--------------+----+--------+-----+ +--------+-----+
| has_playback | has_capture | TX | | Before | Now |
+--------------+-------------+-----+ +--------+-----+
| 0 | 0 | 0 | | 1 | 1 |
+--------------+-------------+-----+ +--------+-----+
| 0 | 0 | 1 | | 1 | 1 |
+--------------+-------------+-----+ +--------+-----+
| 0 | 1 | 0 | | 1 | 0 |
+--------------+-------------+-----+ +--------+-----+
| 0 | 1 | 1 | | 0 | 1 |
+--------------+-------------+-----+ +--------+-----+
| 1 | 0 | 0 | | 0 | 1 |
+--------------+-------------+-----+ +--------+-----+
| 1 | 0 | 1 | | 1 | 0 |
+--------------+-------------+-----+ +--------+-----+
| 1 | 1 | 0 | | 0 | 0 |
+--------------+-------------+-----+ +--------+-----+
| 1 | 1 | 1 | | 0 | 0 |
+--------------+-------------+-----+ +--------+-----+
Signed-off-by: Emil Svendsen <emas@xxxxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20230308125503.3917903-1-emas@xxxxxxxxxxxxxxx
---
sound/soc/codecs/hdmi-codec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index e111d9e60233..6d980fbc4207 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -432,7 +432,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
bool has_playback = !hcp->hcd.no_i2s_playback;
int ret = 0;
- if (!((has_playback && !tx) || (has_capture && tx)))
+ if (!((has_playback && tx) || (has_capture && !tx)))
return 0;
mutex_lock(&hcp->lock);
@@ -477,7 +477,7 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream,
bool has_capture = !hcp->hcd.no_i2s_capture;
bool has_playback = !hcp->hcd.no_i2s_playback;
- if (!((has_playback && !tx) || (has_capture && tx)))
+ if (!((has_playback && tx) || (has_capture && !tx)))
return;
hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
--
2.34.1
--- End Message ---