From: zhangjun Date: Thu, 18 May 2017 01:35:40 +0000 (+0800) Subject: ASoc: hdmi_codec: fix startup error when multicodecs are used X-Git-Tag: release-20171130_firefly~4^2~540 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3244d204d45b22ac4ec4d8f987a027a403d405dc;p=firefly-linux-kernel-4.4.55.git 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 --- 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);