From patchwork Mon Sep 30 06:01:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1169128 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46hWxT4XhKz9sPd; Mon, 30 Sep 2019 16:01:33 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1iEokU-0006zu-6e; Mon, 30 Sep 2019 06:01:30 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iEokR-0006yl-KF for kernel-team@lists.ubuntu.com; Mon, 30 Sep 2019 06:01:27 +0000 Received: from [114.253.242.92] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iEokQ-0006XT-RT for kernel-team@lists.ubuntu.com; Mon, 30 Sep 2019 06:01:27 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-B-OSP1][PATCH 3/4] ALSA: sof: refine stop-start sequence for driver and FW Date: Mon, 30 Sep 2019 14:01:02 +0800 Message-Id: <20190930060103.7125-4-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190930060103.7125-1-hui.wang@canonical.com> References: <20190930060103.7125-1-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Pan Xiuli BugLink: https://bugs.launchpad.net/bugs/1845904 Stop FW first, then stop HDA controller Start HDA contorller first, then start FW Signed-off-by: Pan Xiuli Signed-off-by: Rander Wang (cherry picked from commit 2424b716fd1df0518f07ce9f205b20c3289a99be git://github.com/thesofproject/linux.git) Signed-off-by: Hui Wang --- sound/soc/sof/pcm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index c0f29eb8645d..38cc7eeb4476 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -314,6 +314,7 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd) struct snd_sof_pcm *spcm; struct sof_ipc_stream stream; struct sof_ipc_reply reply; + bool ipc_first = false; int ret; /* nothing to do for BE */ @@ -334,6 +335,7 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd) switch (cmd) { case SNDRV_PCM_TRIGGER_PAUSE_PUSH: stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_PAUSE; + ipc_first = true; break; case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_RELEASE; @@ -354,18 +356,23 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_STOP: stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_STOP; + ipc_first = true; break; default: dev_err(sdev->dev, "error: unhandled trigger cmd %d\n", cmd); return -EINVAL; } - snd_sof_pcm_platform_trigger(sdev, substream, cmd); + if (!ipc_first) + snd_sof_pcm_platform_trigger(sdev, substream, cmd); /* send IPC to the DSP */ ret = sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd, &stream, sizeof(stream), &reply, sizeof(reply)); + if (ipc_first) + snd_sof_pcm_platform_trigger(sdev, substream, cmd); + if (ret < 0 || cmd != SNDRV_PCM_TRIGGER_SUSPEND) return ret;