From patchwork Mon Feb 26 11:17:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 129626 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp83871lja; Mon, 26 Feb 2018 03:17:49 -0800 (PST) X-Google-Smtp-Source: AH8x227IWsvE/zjZQMN+18oEWM/H1wH3rgho0kNPARTLt0und3aHCM/IAn1IUFbnLhoYbzpLGwhb X-Received: by 10.223.135.17 with SMTP id a17mr8849121wra.126.1519643869578; Mon, 26 Feb 2018 03:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519643869; cv=none; d=google.com; s=arc-20160816; b=rOrm6RcWY2Aw6WSVMBMjg/CE6cr5UREmLTEql15fqt7NZkOVkKIJww+jT55AVdVGgN KYcAPxDEdGfZoS8+9tw2nlxdk1ojSn1rp/81J18Ny3YxhKmmyLrsyMlj9w2LFi9wUyXm UZqrV3dc7UZr0tImHggDgVinxMH8J10D0kGX3st7J5AaN1UKFco6hh7YN4CTM72pOKYD yvNiuFbvG/99/P6BBXa8L5jJ4vNTc3nDzI4lNwy+TJWH7ZANzlVqkH5PLqmnYcNbhdMg h4wOEGfxWC75GvGBozW5WQ67vBC+0tVKmyMAEhqwh5gWbdvBuXfphzXQZFWXg7H1KkiL ThBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=M8ptkNrkTHrDq5dzKzn7GhkhdCK8C/jm2cjReQRk1no=; b=jNvd71ynMCeyx7fXfgHAgCfMMp0p2Fc5SAQqZOPBj2S6VZnwAJQQ+wbxOJ9C46PK8q dA2nSZuMFOjbc0/zESb+oHRrshT0gaUpQyBkBrUByypnP0dPwdulIH4GPycRKQlwqxiH yG2FfxzI2Hx0neSJ5OiJmhoaKVyX90HKKdQ5jxgy2S1iFP0Go/wsdZZMFCXSLBOyerlc xnXi3n3pz2tYS2rtH5JsBJrtTDN9CJ7xLk09IiARSv68IY02/ArR7zdZybq85Z2fQJNT xc/Dbrt7ngGhDmv4321Pqx+QJB69xEgopXbf2lOVmYhCsQnD9Y3jRHmXBr2ci7YmTfzY rQ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=FVK/ujPi; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id v21si3067089wmc.154.2018.02.26.03.17.49; Mon, 26 Feb 2018 03:17:49 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=FVK/ujPi; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6A474267A67; Mon, 26 Feb 2018 12:17:33 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 650C8267A57; Mon, 26 Feb 2018 12:17:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 13F57267A57 for ; Mon, 26 Feb 2018 12:17:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=CdHUxmiZSvBcVij24cpsSarcO/XrJld4FiD4z59S5AQ=; b=FVK/ujPi6t5G OLDCSTAkOVhMh/cmD688g7mbAlv5vol1wXdUp/eHmA9oT7tGr4o+eWA9lGxXo1iF0K1/NII5lS8lE CKsB+wWFFm379Z+iiBKGWfR89dNcm1mqTxlUSwoH5gY7YSSOM6rIEQh4ju7z1J394ScWenJDpC6v4 ZwEVg=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqGmZ-0007vP-7r; Mon, 26 Feb 2018 11:17:23 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1eqGmY-0005Sc-OJ; Mon, 26 Feb 2018 11:17:22 +0000 From: Mark Brown To: Charles Keepax In-Reply-To: <20180226104947.32037-1-ckeepax@opensource.cirrus.com> Message-Id: Date: Mon, 26 Feb 2018 11:17:22 +0000 Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com Subject: [alsa-devel] Applied "ASoC: wm_adsp: Support streams which can start/stop with DSP active" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: wm_adsp: Support streams which can start/stop with DSP active has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 61fc060c40e6b92350c08a210619fc7d93c61e42 Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Mon, 26 Feb 2018 10:49:47 +0000 Subject: [PATCH] ASoC: wm_adsp: Support streams which can start/stop with DSP active Clear the buffer data structure on each trigger start such that the buffer is in a sensible state even if the DSP itself didn't restart. This is necessary to support voice control streams which can trigger multiple times without reloading the firmware. Signed-off-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm_adsp.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) -- 2.16.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 0060aeb63a9f..ab91f1320ad5 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -3258,6 +3258,13 @@ static int wm_adsp_buffer_populate(struct wm_adsp_compr_buf *buf) return 0; } +static void wm_adsp_buffer_clear(struct wm_adsp_compr_buf *buf) +{ + buf->irq_count = 0xFFFFFFFF; + buf->read_index = -1; + buf->avail = 0; +} + static int wm_adsp_buffer_init(struct wm_adsp *dsp) { struct wm_adsp_compr_buf *buf; @@ -3268,8 +3275,8 @@ static int wm_adsp_buffer_init(struct wm_adsp *dsp) return -ENOMEM; buf->dsp = dsp; - buf->read_index = -1; - buf->irq_count = 0xFFFFFFFF; + + wm_adsp_buffer_clear(buf); ret = wm_adsp_buffer_locate(buf); if (ret < 0) { @@ -3327,16 +3334,17 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd) switch (cmd) { case SNDRV_PCM_TRIGGER_START: - if (wm_adsp_compr_attached(compr)) - break; - - ret = wm_adsp_compr_attach(compr); - if (ret < 0) { - adsp_err(dsp, "Failed to link buffer and stream: %d\n", - ret); - break; + if (!wm_adsp_compr_attached(compr)) { + ret = wm_adsp_compr_attach(compr); + if (ret < 0) { + adsp_err(dsp, "Failed to link buffer and stream: %d\n", + ret); + break; + } } + wm_adsp_buffer_clear(compr->buf); + /* Trigger the IRQ at one fragment of data */ ret = wm_adsp_buffer_write(compr->buf, HOST_BUFFER_FIELD(high_water_mark),