Patch "ASoC: hdmi-codec: only startup/shutdown on supported streams" has been added to the 6.2-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    ASoC: hdmi-codec: only startup/shutdown on supported streams

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-hdmi-codec-only-startup-shutdown-on-supported-s.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit aa11ea032fee5c0c59f01bacc82872346ce5d0a2
Author: Emil Abildgaard Svendsen <EMAS@xxxxxxxxxxxxxxx>
Date:   Thu Mar 9 06:54:41 2023 +0000

    ASoC: hdmi-codec: only startup/shutdown on supported streams
    
    [ Upstream commit e041a2a550582106cba6a7c862c90dfc2ad14492 ]
    
    Currently only one stream is supported. This isn't usally a problem
    until you have a multi codec audio card. Because the audio card will run
    startup and shutdown on both capture and playback streams. So if your
    hdmi-codec only support either playback or capture. Then ALSA can't open
    for playback and capture.
    
    This patch will ignore if startup and shutdown are called with a non
    supported stream. Thus, allowing an audio card like this:
    
               +-+
     cpu1 <--@-| |-> codec1 (HDMI-CODEC)
               | |<- codec2 (NOT HDMI-CODEC)
               +-+
    
    Signed-off-by: Emil Svendsen <emas@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230309065432.4150700-2-emas@xxxxxxxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 74cbbe16f9aec..a22f2ec95901f 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -428,8 +428,13 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
 {
 	struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
 	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool has_capture = !hcp->hcd.no_i2s_capture;
+	bool has_playback = !hcp->hcd.no_i2s_playback;
 	int ret = 0;
 
+	if (!((has_playback && tx) || (has_capture && !tx)))
+		return 0;
+
 	mutex_lock(&hcp->lock);
 	if (hcp->busy) {
 		dev_err(dai->dev, "Only one simultaneous stream supported!\n");
@@ -468,6 +473,12 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream,
 				struct snd_soc_dai *dai)
 {
 	struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
+	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool has_capture = !hcp->hcd.no_i2s_capture;
+	bool has_playback = !hcp->hcd.no_i2s_playback;
+
+	if (!((has_playback && tx) || (has_capture && !tx)))
+		return;
 
 	hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
 	hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux