Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2459157imj; Mon, 18 Feb 2019 06:24:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IbszVPuZG6mMA7mL5yAPbzDT3Byz4PKkRqKFn8NWrRFNaB/KNe9Vgd9q06JCpMxy8tnkCR4 X-Received: by 2002:a65:62ce:: with SMTP id m14mr19279260pgv.101.1550499874203; Mon, 18 Feb 2019 06:24:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550499874; cv=none; d=google.com; s=arc-20160816; b=Atm8mh7aazL6P5Cc/nImM4oGKWGvGgbZsYLYLM1mXBuO4QqvKbqFxUskqUDWpdpqZP OJfoSfwCovQ30sAoZw8bK7+rjoC86kZNA5tMn114xsiA9iF37hihTS3DxH9qHno38OSr sUbvGxNKaPYJP17fq2a8gGzY0wzrnHZi6pqsfmY9BSfw79XiFlCfqWBbAwj8h1q0qRu0 MQY6bRfojGD/ud1NX8QBcYcoUaOv/ZN7O5uIaPRf79T0cKL2eW53SOj3AUTRzxi8TqGo I1YjwUJN1RWBVe3AHy1Iq9bT2KVt+8h5CvnFb/5SAXX8ZBQz4ZisNddaeBjeejldjVs0 wNgQ== 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=FcD8YoJRRVbu3I7zvOqmUwD4x4b+G00urrDu35XFeHQ=; b=s4yPIGtqWmW55HRTsoxMaActmPf75rRFrGhtlJv35Rf0IeqpasOoBqG6NGy2g9yC3E SfSWLBomDNBaqwnCDVVYEUuAFRyKD0zcrWq0Q4d+mFhgdFkeO4jIU9uxjmVWYc+ApqLD 9sWN0zt+ZcDsgOBg59scXfpBrD9dDJbbrkgYIskRCpE+e2RFw9O+cb+y2KE3GvnhFIB2 MRTURCoUW5o5xmjRTRD4w4KoQ4Sm0xcf3LAtK/NdCaGenZfl0Omfu022An9IpypG9eHb WKijhCk/CoNsRTB6KG5uJiuhYyuIRkJ0ewi2uAGsDXDQjI6bXBPlHQllQAVLe+vWDOdb niuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VyGx2zT6; 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 d2si13525683pfe.159.2019.02.18.06.24.18; Mon, 18 Feb 2019 06:24:34 -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=VyGx2zT6; 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 S2390455AbfBROXd (ORCPT + 99 others); Mon, 18 Feb 2019 09:23:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:46932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389365AbfBROEa (ORCPT ); Mon, 18 Feb 2019 09:04:30 -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 1B6D0204FD; Mon, 18 Feb 2019 14:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498669; bh=it4Qq8QBI4t1i53hRWpcw58140Vhd1r0thootvU8Ca8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VyGx2zT6jND4sseUj4myF9tx9/OhTGzDHGhC7ZeEzF27cEEBlQD7wFt67DDaYfprd 4Qx3ij3NbPNrvFxmVu24okVJqx4C+BCo0x7Mumys4JJcC5E0bBVpLD0bfHUvIQJaLM jsEOxjt/T4v9thRVu5PrTN4lUTnRdXp+zIND1ew0= 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.4 083/143] ALSA: compress: Fix stop handling on compressed capture streams Date: Mon, 18 Feb 2019 14:43:31 +0100 Message-Id: <20190218133532.105669761@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133529.099444112@linuxfoundation.org> References: <20190218133529.099444112@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.4-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 @@ -178,7 +178,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); }