From patchwork Mon Jun 22 06:58:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 191301 Delivered-To: patch@linaro.org Received: by 2002:a92:1f07:0:0:0:0:0 with SMTP id i7csp783868ile; Sun, 21 Jun 2020 23:58:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNaB7cOsyP3yqab/uyJ5WF6p14iLRLbZS2CQ4++PoiUpSsA0HhPBTe3L1bnxH0mBH+KyC4 X-Received: by 2002:aa7:d8c2:: with SMTP id k2mr5464037eds.346.1592809113083; Sun, 21 Jun 2020 23:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592809113; cv=none; d=google.com; s=arc-20160816; b=z46QaGEOOU5EiwtqSGUy0asi8sY9Lvn03LW/Ex6tA96+h5/7+e6wUJ5dK1AKkmnxzr ev6nTkGWAx18c6kApgujqTSuaLrqyIpBMxcRRNkWUcJBkxe+SNZ93hp84kctkcUcDCTM a+5G0360VEC+3WYEAbmwBIGUL52uW+GaCmMut3CYZmgEZbaFLXfrC8BmQS8jJrSPwXI6 yNLm+6DkuY7vpFJM0y4fP1FR6gGMR8POr5/L9p23VOnMZ2dX2HpGPajybm6asK0XRR4X s5qRYDkf39ZSCUmkxr4QFzYU5GtjfMy99q6pbLnn/gaJ5KODai0GlbXgbvNiqknNbNcH W9pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oe2eW1rVnrJKOqIaQMyCiXAYIFN2mCDLW2OuPBXtYYM=; b=apcBBeLe5+vBoyi6DytweHiBNlk2YxQ7sJr9VzNhLTlOU0F0gcMTQO1WtvLhNd2W6g bOzEL40N8m95PiBi5l5dxaOCRJoTmExYWyoPGEjnxb2o8MDh/VLDs+jaRZsUfBTvXmcw HqBcViNTCVWo913tZAj5eaa6eZKjdQ+rFeFrZlZV8sdPy9mSf7pJJihyvuBbOoN+mL54 6GEMAcb2PMaZoy76CKzQIlCloNGluT+btANiqZR26Jj802lUWL6m+lz7QAqbfLyCDChH SRBrCDQhEF8vHTe7SBpXrz2T8/0AiC4d36/8PC2/6xEUHAozI/tVPgkIrvgYgU5fVL7g d4pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d8QdwWm0; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ss12si8480947ejb.188.2020.06.21.23.58.32; Sun, 21 Jun 2020 23:58:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d8QdwWm0; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731282AbgFVG6c (ORCPT + 16 others); Mon, 22 Jun 2020 02:58:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:43734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbgFVG6b (ORCPT ); Mon, 22 Jun 2020 02:58:31 -0400 Received: from localhost.localdomain (unknown [171.61.66.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3ADF325439; Mon, 22 Jun 2020 06:58:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592809110; bh=cJaK9Ij0LnW3uaf90F+DxG2K4hVeM1atFzhGIhfMpbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d8QdwWm0SMOkokdDVPicskvy40K7ynMncLQaHXxFnQTMFTimJ01a1vQMX/PSZ/nO8 jGkKLCigR4/9ZePJBXqxvd0G4tHPH4Mbkxak3bGmivigI2FCilVmdOIfQdAjKHo9UL vj+ZjHlaPIvWK8xVXL1q22/fztbcgByVRAs0Gxyg= From: Vinod Koul To: Takashi Iwai , Jaroslav Kysela Cc: linux-arm-msm@vger.kernel.org, Bjorn Andersson , Vinod Koul , Srinivas Kandagatla , Pierre-Louis Bossart , Charles Keepax , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] ALSA: compress: document the compress audio state machine Date: Mon, 22 Jun 2020 12:28:09 +0530 Message-Id: <20200622065811.221485-2-vkoul@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200622065811.221485-1-vkoul@kernel.org> References: <20200622065811.221485-1-vkoul@kernel.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org So we had some discussions of the stream states, so I thought it is a good idea to document the state transitions, so add it documentation Signed-off-by: Vinod Koul --- .../sound/designs/compress-offload.rst | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) -- 2.26.2 diff --git a/Documentation/sound/designs/compress-offload.rst b/Documentation/sound/designs/compress-offload.rst index ad4bfbdacc83..6f86db82298b 100644 --- a/Documentation/sound/designs/compress-offload.rst +++ b/Documentation/sound/designs/compress-offload.rst @@ -151,6 +151,58 @@ Modifications include: - Addition of encoding options when required (derived from OpenMAX IL) - Addition of rateControlSupported (missing in OpenMAX AL) +State Machine +============= + +The compressed audio stream state machine is described below :: + + +----------+ + | | + | OPEN | + | | + +----------+ + | + | + | compr_set_params() + | + v + compr_free() +----------+ + +-------------------------------------| | + | | SETUP | + | +------------------------>| |<---------------------------------+ + | | compr_drain_notify() +----------+ | + | | | | + | | | | + | | | compr_write() | + | | | | + | | v | + | | +----------+ | + | | | | | + | | | PREPARE | | + | | | | | + | | +----------+ | + | | | | + | | | | + | | | compr_start() | + | | | | + | | v | + | +----------+ +----------+ compr_pause() +----------+ | + | | | compr_drain() | |---------------->| | | + | | DRAIN |<-------------------| RUNNING | | PAUSE | | + | | | | |<----------------| | | + | +----------+ +----------+ compr_resume() +----------+ | + | | | | | + | | | | | + | | | | | + | | | | compr_stop() | + | | | +------------------------------------+ + | | +----------+ | + | | | | | + +-----------+------>| |<-------+ + compr_free() | FREE | compr_free() + | | + +----------+ + Gapless Playback ================ From patchwork Mon Jun 22 06:58:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 191302 Delivered-To: patch@linaro.org Received: by 2002:a92:1f07:0:0:0:0:0 with SMTP id i7csp783897ile; Sun, 21 Jun 2020 23:58:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLmPkK67Ms705Q2piT360KhCEhP4ObcMNykAqjUbW8XQXVPbl/EIenx5AdlThlrKnzDSYn X-Received: by 2002:a05:6402:308b:: with SMTP id de11mr15633268edb.181.1592809117311; Sun, 21 Jun 2020 23:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592809117; cv=none; d=google.com; s=arc-20160816; b=Ug188IP1OzNLMoHaMASwaoyuJJM/0Q55Pr5eswwz3kfBecbnSP2Q/LtnJM0wNiWP8W MSNNd7qWYdiq+hrxa8HaD0FYPNYGQowmflzz3yZU4tX0Jty/AXVMTVK3PWbl+VCcBANi Fp4NszNm8Fp7upxmmVuiMd2wbNB4+jFCSCGem1GMFoT5b/LtO7gJRayf8Ep8/KmJcE3D 8M+OumbcLd7P0h+QTE/LlPaEdsb92+zXTibvc7kMKDLLVpmJTCdGDEAemPwPhquyqu/X JaTpXKaHapcNU3gXcK/AKtyiEi8jVF8eF+N90U6/byr2VCWLoLVkvDbktlpJnaU4L2KY zN5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FZ8jOJvv89xEFRHUd9gn5Q8ZF7wewt3A0Kyy1GJRPI4=; b=hDYCZKAAPxg+p7iTsSEema475JtpG4Y2HyzSloKqrlJpbhnEQDPqSEka3TPvHsW4Wx fZu4MOdAtV+Rzy4OziGg+1Y3hOrCl++zNsPOXhH5OHSKa1J4Alep+UZ3+nTDqtvpEw9M cafDncBl871MuEHIcq604mXCtVhkbo+0Av5RnDcrSlWvfZBBE5GInuSIvXZfrAkEBKh5 JfayB8rKRbffGrCwfg1OYaMzd/KXf+Jf+7bIqoPL1IFDbiOLhydbXC9F/Dseve+MVuYP TAIRqxO8AdhiZtDpT8nvi//9tx3uIZvkEfptubrdqysUWN2CKcE55izy0eB+ZCRxsq+M WChg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XUubVqh7; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ss12si8480947ejb.188.2020.06.21.23.58.37; Sun, 21 Jun 2020 23:58:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XUubVqh7; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731303AbgFVG6g (ORCPT + 16 others); Mon, 22 Jun 2020 02:58:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:43806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbgFVG6g (ORCPT ); Mon, 22 Jun 2020 02:58:36 -0400 Received: from localhost.localdomain (unknown [171.61.66.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9D6E42543C; Mon, 22 Jun 2020 06:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592809115; bh=GqFAi7Q4sHYSuj6BAxMwU4DVplPmfDCh76OdL45s+EM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XUubVqh7SwrB1MbftvIpwdhMm7y6KHzJxeFvVNTH/tD6Xxo5XFxARiUaBkZM8W1kz r50RblSeNtI1MSjlbdZWVJ4r6EGHDEE4S8YxivgVlaOwL0dE1m6u9AM9MRE19IlpgE 7T81WWPH0+y6mERjA2wlJwJ3tM4TTSV9pa3hQ3rI= From: Vinod Koul To: Takashi Iwai , Jaroslav Kysela Cc: linux-arm-msm@vger.kernel.org, Bjorn Andersson , Vinod Koul , Srinivas Kandagatla , Pierre-Louis Bossart , Charles Keepax , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] ALSA: compress: document the compress gapless audio state machine Date: Mon, 22 Jun 2020 12:28:10 +0530 Message-Id: <20200622065811.221485-3-vkoul@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200622065811.221485-1-vkoul@kernel.org> References: <20200622065811.221485-1-vkoul@kernel.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Also documented the galpess transitions. Please note that these are not really stream states, but show how the stream steps in gapless mode Signed-off-by: Vinod Koul --- .../sound/designs/compress-offload.rst | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) -- 2.26.2 diff --git a/Documentation/sound/designs/compress-offload.rst b/Documentation/sound/designs/compress-offload.rst index 6f86db82298b..0bebfd33b933 100644 --- a/Documentation/sound/designs/compress-offload.rst +++ b/Documentation/sound/designs/compress-offload.rst @@ -251,6 +251,38 @@ Sequence flow for gapless would be: (note: order for partial_drain and write for next track can be reversed as well) +Gapless Playback SM +=================== + +For Gapless, we move from running state to partial drain and back, along +with setting of meta_data and signalling for next track :: + + + +----------+ + compr_drain_notify() | | + +------------------------>| RUNNING | + | | | + | +----------+ + | | + | | + | | compr_next_track() + | | + | V + | +----------+ + | | | + | |NEXT_TRACK| + | | | + | +----------+ + | | + | | + | | compr_partial_drain() + | | + | V + | +----------+ + | | | + +------------------------ | PARTIAL_ | + | DRAIN | + +----------+ Not supported ============= From patchwork Mon Jun 22 06:58:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 191303 Delivered-To: patch@linaro.org Received: by 2002:a92:1f07:0:0:0:0:0 with SMTP id i7csp783922ile; Sun, 21 Jun 2020 23:58:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoQnM0DEVI9SBVwQa7JLYupCnATi+SiXMDtmCQ/1Al+RJs3e4VjNqYABIZg/6W0QGC9ZHs X-Received: by 2002:a17:906:3154:: with SMTP id e20mr15078328eje.171.1592809120529; Sun, 21 Jun 2020 23:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592809120; cv=none; d=google.com; s=arc-20160816; b=g19a0IBMQtTO0YYLSukeDFXap9Fr5qnOPJfIlS8ejPlSmJuTmmtRIJmsGLs/YLM3Z/ uHfKilNFOeVRJSaGZF/1s8JL1zoC0ERc989vy11IGQ/Xmqarzymb3C9SURrhFWbpgn5S jQUMC9ZSP6PTQPXJ7i0IVnOWXChDMopILVNypDRl8EFRSyq5y4XZps9/kshIWEUPTolL 44ZPVJ6s6AAZBdQXDKQTRcwB0izsdaPvBx4E/LeO3grSOeck7QFGRTx/DoywJ3MdpiwI YwLZAGGMdmGnIuaNQrqu+Iwa50ZWv4CHpRzn/K2J04g3pXWshKjvF5yfEC562H7kFk8v DU3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=ghrX2EdKAi4P5QCDRpbyux829aGHL/9eu4hTpYb8p5U=; b=ealyRWw3gbKbvoLNiUFX2/b/gc6TJuFhqa6BNoiNiDrCMniSUtvGYqicFlVjYAIkd4 F6Lddum4RDQ4q4hhH3N+v9QqRYGD0+AGEP5nJXbi9rZzGRbTp017dK3Vd3OruGvv7uHz 7Vi4Nz7LxpEJG5RlHN2APeAhzAcbK+WubjCb2mgRdPAka7DtwK77cjRpFs0q8OQtpWHl MCxot1eV/JlxnXAMTa/Axj9+auSj2Vz07xBmqaOoEY2HPlGGcm1mOWspjLgHQcSt2TWs pVhdwxOtkfttfa1XEF3IBOEkmkOWxFhTLnlVSxzEYD9D9ndy4x5meeviz05Ky9znrqOZ 4pug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=default header.b=ni4vPRF6; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ss12si8480947ejb.188.2020.06.21.23.58.40; Sun, 21 Jun 2020 23:58:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=default header.b=ni4vPRF6; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731314AbgFVG6j (ORCPT + 16 others); Mon, 22 Jun 2020 02:58:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:43854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbgFVG6i (ORCPT ); Mon, 22 Jun 2020 02:58:38 -0400 Received: from localhost.localdomain (unknown [171.61.66.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0BABF2543D; Mon, 22 Jun 2020 06:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592809117; bh=UQA6roE5vMe7DuXL5wfFwW1a+4Izllpm3Vh8e3+Lxlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ni4vPRF6mN1e4+i/fWwpy7wzPUbjCqt8oPVW4xbAYGGsyJHD4FJ/vZkSe7KEfu5Xw vIMol42e5KZdCikaSEgD6d/63cEeR9l9r+LmGBTuazzM9Dq2vXOepYmXGLIE2EoQig wRTL5dFg13uRUVddL+0nyqDrOzGTadRXEZCoyT+Y= From: Vinod Koul Cc: linux-arm-msm@vger.kernel.org, Bjorn Andersson , Vinod Koul , Srinivas Kandagatla Subject: [PATCH v2 3/3] ALSA: compress: fix partial_drain completion state Date: Mon, 22 Jun 2020 12:28:11 +0530 Message-Id: <20200622065811.221485-4-vkoul@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200622065811.221485-1-vkoul@kernel.org> References: <20200622065811.221485-1-vkoul@kernel.org> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On partial_drain completion we should be in SNDRV_PCM_STATE_RUNNING state, so set that for partially draining streams in snd_compr_drain_notify() and use a flag for partially draining streams While at it, add locks for stream state change in snd_compr_drain_notify() as well. Fixes: f44f2a5417b2 ("ALSA: compress: fix drain calls blocking other compress functions (v6)") Reported-by: Srinivas Kandagatla Reviewed-by: Srinivas Kandagatla Tested-by: Srinivas Kandagatla Signed-off-by: Vinod Koul --- include/sound/compress_driver.h | 12 +++++++++++- sound/core/compress_offload.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) -- 2.26.2 diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h index 3df8d8c90191..93a5897201ea 100644 --- a/include/sound/compress_driver.h +++ b/include/sound/compress_driver.h @@ -66,6 +66,7 @@ struct snd_compr_runtime { * @direction: stream direction, playback/recording * @metadata_set: metadata set flag, true when set * @next_track: has userspace signal next track transition, true when set + * @partial_drain: undergoing partial_drain for stream, true when set * @private_data: pointer to DSP private data * @dma_buffer: allocated buffer if any */ @@ -78,6 +79,7 @@ struct snd_compr_stream { enum snd_compr_direction direction; bool metadata_set; bool next_track; + bool partial_drain; void *private_data; struct snd_dma_buffer dma_buffer; }; @@ -187,7 +189,15 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream) if (snd_BUG_ON(!stream)) return; - stream->runtime->state = SNDRV_PCM_STATE_SETUP; + mutex_lock(&stream->device->lock); + /* for partial_drain case we are back to running state on success */ + if (stream->partial_drain) { + stream->runtime->state = SNDRV_PCM_STATE_RUNNING; + stream->partial_drain = false; /* clear this flag as well */ + } else { + stream->runtime->state = SNDRV_PCM_STATE_SETUP; + } + mutex_unlock(&stream->device->lock); wake_up(&stream->runtime->sleep); } diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index e618580feac4..1c4b2cf450a0 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -803,6 +803,9 @@ static int snd_compr_stop(struct snd_compr_stream *stream) retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP); if (!retval) { + /* clear flags and stop any drain wait */ + stream->partial_drain = false; + stream->metadata_set = false; snd_compr_drain_notify(stream); stream->runtime->total_bytes_available = 0; stream->runtime->total_bytes_transferred = 0; @@ -960,6 +963,7 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream) if (stream->next_track == false) return -EPERM; + stream->partial_drain = true; retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_PARTIAL_DRAIN); if (retval) { pr_debug("Partial drain returned failure\n");