From 3244d204d45b22ac4ec4d8f987a027a403d405dc Mon Sep 17 00:00:00 2001 From: zhangjun Date: Thu, 18 May 2017 09:35:40 +0800 Subject: [PATCH] ASoc: hdmi_codec: fix startup error when multicodecs are used due to playback and capture will call startup at the same time when voip call, but hdmi_codec driver only support playback [ 51.134149] hdmi-audio-codec hdmi-audio-codec.6.auto: hdmi_codec_startup() [ 51.134179] hdmi-audio-codec hdmi-audio-codec.6.auto: Only one simultaneous stream supported! [ 51.134197] hdmi-audio-codec hdmi-audio-codec.6.auto: ASoC: can't open codec i2s-hifi: -22 [ 51.143250] hdmi-audio-codec hdmi-audio-codec.6.auto: hdmi_codec_startup() [ 51.143277] hdmi-audio-codec hdmi-audio-codec.6.auto: Only one simultaneous stream supported! [ 51.143294] hdmi-audio-codec hdmi-audio-codec.6.auto: ASoC: can't open codec i2s-hifi: -22 [ 51.157546] hdmi-audio-codec hdmi-audio-codec.6.auto: hdmi_codec_startup() [ 51.157584] hdmi-audio-codec hdmi-audio-codec.6.auto: Only one simultaneous stream supported! [ 51.157603] hdmi-audio-codec hdmi-audio-codec.6.auto: ASoC: can't open codec i2s-hifi: -22 Change-Id: I970695dbe19f070579aacd044e6a01c44e687a2e Signed-off-by: zhangjun --- sound/soc/codecs/hdmi-codec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 5e68357c293b..028d60c196ae 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -154,9 +154,13 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, { struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); int ret; + bool playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); dev_dbg(dai->dev, "%s()\n", __func__); + if (!playback) + return 0; + ret = hdmi_codec_new_stream(substream, dai); if (ret) return ret; @@ -188,9 +192,13 @@ 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 playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); dev_dbg(dai->dev, "%s()\n", __func__); + if (!playback) + return; + WARN_ON(hcp->current_stream != substream); hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data); -- 2.34.1