Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2716188imj; Mon, 11 Feb 2019 07:25:23 -0800 (PST) X-Google-Smtp-Source: AHgI3IZnWX1Dxmlc2LJeyIONQsMusRYTvzf86wo6lmx8Tv6DvIJk08PYdyC9VXTHe1nPGWKXKZTZ X-Received: by 2002:a17:902:d708:: with SMTP id w8mr30642348ply.294.1549898722981; Mon, 11 Feb 2019 07:25:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898722; cv=none; d=google.com; s=arc-20160816; b=dN+KKwbHNwBV+z5qLAwMqcDgz+5YwtLpq76N74w7rnoiG3ued9I0AKOuKyBTfjiUaO 3AxPnQ77BwxKBD8CYhbvfJf2OA59ParmekFs66P9VvRmKIONH64/KcnoCUJxfeyRVexe NfaoFL4vxTPicmmIdj48vrWsp8f/f0ETR5g00++gerJqOLNscErmFeWj0rQQ3/lbtwOZ d7aNpcwn3InzssKsKT0OIAfFrfMd2udyUcVCe9RR1nNQyN3Zet6BzfKBc1yXtYQG+kDs wDyl3v/T2cVnDDpG4za53ngD+tp3+WMeiyhcpYEk40VF+399viApeYnxzL11koWbO1nf DKOA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LIVbKZ/2emZvGX3OXHXDNReJ1y8NPXAuImEvvfGExe0=; b=G331PtlDGJtB882GxEfX6q9SrfUSxEgXOyr+AY2812nr2ZNfdLnA7KbZJuw5rUHYp7 phCPLCxFVfnT7rjog16F1T80qnUCNgLHt8Ti1BC3jNirWyStjQa8GqRbY8Vi05e5ylbZ ptsDf/Y/ND3kKT85cAB8lL72W3l6jfNmog8zoFmVc/XD8ZN69JY+vqLFYuO7JVjn+Gtk RsCKBdNwa0Pp00/2Ct3Gtj0cBkmrOs5UkRhV0XYlWQcWJ9sUhlGRsqbTkIGNdjWsrRKw wK2BtJcvRKlj5KaQgxXWwtjPP1f8nF9vFPHfJ431Mb5Qy2Q3a9l9vB/ny/b2Gjyp4QUt 7/9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q6FrcNzj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si2152596plh.91.2019.02.11.07.25.07; Mon, 11 Feb 2019 07:25:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q6FrcNzj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387829AbfBKPYW (ORCPT + 99 others); Mon, 11 Feb 2019 10:24:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:50852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390439AbfBKPCh (ORCPT ); Mon, 11 Feb 2019 10:02:37 -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 25151222A7; Mon, 11 Feb 2019 15:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897356; bh=u8wOfgbRPwfzjAx5qdRTCPp/pdcCDwJi9A+JwUD9wuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6FrcNzjNzGDc3mbuYJ9uRdWmT8FTrnIZfb7Bi42wnBz9zhcjkwL6uLwYvDiy8xng /VGGcd6urwHvi7JvpcD1uY232gi9bjCN1fmMCdrKm0gcFwVSZU4JxMwREWPi6OMvMS vSR+o0cQhR+bO5v4UMlEMxhzTJVHu6PHnXS61g8I= 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.14 175/205] ALSA: compress: Fix stop handling on compressed capture streams Date: Mon, 11 Feb 2019 15:19:33 +0100 Message-Id: <20190211141839.817450732@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-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 @@ -186,7 +186,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); }