diff mbox series

ASoC: hdmi-codec: fix inverted tx in shutdown/startup

Message ID 167839464271.26.16975349743399016667@mailman-core.alsa-project.org
State New
Headers show
Series ASoC: hdmi-codec: fix inverted tx in shutdown/startup | expand

Commit Message

Emil Abildgaard Svendsen March 9, 2023, 3:21 p.m. UTC
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@bang-olufsen.dk>
Link: https://lore.kernel.org/r/20230308125503.3917903-1-emas@bang-olufsen.dk
---
 sound/soc/codecs/hdmi-codec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

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;