From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69AFEC169C4 for ; Mon, 11 Feb 2019 15:12:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2FED7222A7 for ; Mon, 11 Feb 2019 15:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897929; bh=RmUYbN3dtLB0wrBAgT4mbgZeijK7kMC9EgVAtAzyi6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CCe+sVkS8tW+mB9LdsEnsnGaD7/J2V0RnZsA1sJDN3qWt8B4kigPjQpHGqLgH287H VPtXetqeTQ0f/hqd7JalINFD1jV+6hq0BH/kRq6zikcJeM7IfiJjQEDV+nu+dAPLPj xPD24KmcT4g2mE7TQUT7u2EHPPSb5LyS2tIqIiLM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391443AbfBKPKf (ORCPT ); Mon, 11 Feb 2019 10:10:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:60670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391819AbfBKPKf (ORCPT ); Mon, 11 Feb 2019 10:10:35 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 2CB16222B2; Mon, 11 Feb 2019 15:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897834; bh=RmUYbN3dtLB0wrBAgT4mbgZeijK7kMC9EgVAtAzyi6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m45+lZoAOc/C/sNIx9dk7/r9l/UM6Whp/OsGt1EVEKQPNO5B5v7zZ6ituQn/f7QIE PvYJaS5xc0qAwjHIMB264/35FEIXCrQGYflylxVUvEZZ5kcSBjf3ln1G9/dqvWUl7Y poPnFNZo9veb7hYc+rg/RCB66tZrvKwK4ctz+0bY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Takashi Iwai Subject: [PATCH 4.9 114/137] ALSA: compress: Fix stop handling on compressed capture streams Date: Mon, 11 Feb 2019 15:19:55 +0100 Message-Id: <20190211141822.748959984@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141811.964925535@linuxfoundation.org> References: <20190211141811.964925535@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Charles Keepax commit 4f2ab5e1d13d6aa77c55f4914659784efd776eb4 upstream. It is normal user behaviour to start, stop, then start a stream again without closing it. Currently this works for compressed playback streams but not capture ones. The states on a compressed capture stream go directly from OPEN to PREPARED, unlike a playback stream which moves to SETUP and waits for a write of data before moving to PREPARED. Currently however, when a stop is sent the state is set to SETUP for both types of streams. This leaves a capture stream in the situation where a new start can't be sent as that requires the state to be PREPARED and a new set_params can't be sent as that requires the state to be OPEN. The only option being to close the stream, and then reopen. Correct this issues by allowing snd_compr_drain_notify to set the state depending on the stream direction, as we already do in set_params. Fixes: 49bb6402f1aa ("ALSA: compress_core: Add support for capture streams") Signed-off-by: Charles Keepax Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- include/sound/compress_driver.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/include/sound/compress_driver.h +++ b/include/sound/compress_driver.h @@ -185,7 +185,11 @@ static inline void snd_compr_drain_notif if (snd_BUG_ON(!stream)) return; - stream->runtime->state = SNDRV_PCM_STATE_SETUP; + if (stream->direction == SND_COMPRESS_PLAYBACK) + stream->runtime->state = SNDRV_PCM_STATE_SETUP; + else + stream->runtime->state = SNDRV_PCM_STATE_PREPARED; + wake_up(&stream->runtime->sleep); }