ASoc: hdmi_codec: fix startup error when multicodecs are used
authorzhangjun <zhangjun@rock-chips.com>
Thu, 18 May 2017 01:35:40 +0000 (09:35 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 19 May 2017 07:29:38 +0000 (15:29 +0800)
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 <zhangjun@rock-chips.com>
sound/soc/codecs/hdmi-codec.c

index 5e68357c293b449c7b34ce6eb61dc7af89007279..028d60c196ae6e261574f16cf6c0c7bd4d980f15 100644 (file)
@@ -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);