Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f573945 authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

ASoC: wcd9306: unvote pm runtime after slim disconnect port



Codec shutdown removes vote for pm runtime and subsequent call
to slim disconnect port would cause failure as it would race
with pm suspend call. Unvote for pm runtime only when there are
no active dais and remove the vote once the slim ports get
closed successfully at the end of audio session.

CRs-fixed: 566520
Change-Id: I97f216986145fbc1efb3a940842e8ef279b30724
Signed-off-by: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent 6badacdb
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -3199,13 +3199,27 @@ static void tapan_shutdown(struct snd_pcm_substream *substream,
		struct snd_soc_dai *dai)
{
	struct wcd9xxx *tapan_core = dev_get_drvdata(dai->codec->dev->parent);
	struct tapan_priv *tapan = snd_soc_codec_get_drvdata(dai->codec);
	u32 active = 0;

	dev_dbg(dai->codec->dev, "%s(): substream = %s  stream = %d\n",
		 __func__, substream->name, substream->stream);

	if (dai->id <= NUM_CODEC_DAIS) {
		if (tapan->dai[dai->id].ch_mask) {
			active = 1;
			dev_dbg(dai->codec->dev, "%s(): Codec DAI: chmask[%d] = 0x%lx\n",
				 __func__, dai->id,
				 tapan->dai[dai->id].ch_mask);
		}
	}
	if ((tapan_core != NULL) &&
	    (tapan_core->dev != NULL) &&
	    (tapan_core->dev->parent != NULL)) {
	    (tapan_core->dev->parent != NULL) &&
	    (active == 0)) {
		pm_runtime_mark_last_busy(tapan_core->dev->parent);
		pm_runtime_put(tapan_core->dev->parent);
		dev_dbg(dai->codec->dev, "%s: unvote requested", __func__);
	}
}

@@ -3965,6 +3979,13 @@ static int tapan_codec_enable_slimrx(struct snd_soc_dapm_widget *w,
			dev_dbg(codec->dev, "%s: Disconnect RX port, ret = %d\n",
				 __func__, ret);
		}
		if ((core != NULL) &&
		    (core->dev != NULL) &&
		    (core->dev->parent != NULL)) {
			pm_runtime_mark_last_busy(core->dev->parent);
			pm_runtime_put(core->dev->parent);
			dev_dbg(codec->dev, "%s: unvote requested", __func__);
		}
		break;
	}
	return ret;
@@ -4012,6 +4033,13 @@ static int tapan_codec_enable_slimtx(struct snd_soc_dapm_widget *w,
			dev_dbg(codec->dev, "%s: Disconnect RX port, ret = %d\n",
				 __func__, ret);
		}
		if ((core != NULL) &&
		    (core->dev != NULL) &&
		    (core->dev->parent != NULL)) {
			pm_runtime_mark_last_busy(core->dev->parent);
			pm_runtime_put(core->dev->parent);
			dev_dbg(codec->dev, "%s: unvote requested", __func__);
		}
		break;
	}
	return ret;