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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Begin Message ---
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 ---

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux