From patchwork Thu Mar 1 18:07:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 130368 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3113887edc; Thu, 1 Mar 2018 10:08:38 -0800 (PST) X-Google-Smtp-Source: AG47ELv185cn5suDfHofQv70l447pMjh6fQx5DYtKxjQ1tCTKAD5Xub7+SjaErijuB0v2ILKISAG X-Received: by 10.28.131.210 with SMTP id f201mr2647400wmd.117.1519927718410; Thu, 01 Mar 2018 10:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519927718; cv=none; d=google.com; s=arc-20160816; b=LyDru9un+iBFE9LjOFoOhQn7H6z8clPtL9qkVRIJsjRzhcoiBnnR5e670tW59TVkTZ S9EtbYvenjE+V8c7ET6NOmI/rrxmQl41uSQf6Fq4XaJvZEzZAiDroBXW+Q1AAE+x8N3z Ft0V53VqTCQe5zKGNfbi7bNlMelfLpZEPdwFfzV26XXmVEOUqHlO4StZaK3fPH7iAkcF +yxc7hm0G99oTO5J/QP9DJNja+/y2Pq7cCn7Lbe3a83AzD/fkR/KTM3KVie6eUL9UIne KAFV1BOe6BMGu12i+08tZec2LlGqhtf4VzhMWubL4kcXP4Izis9eD/n+QUWKjeM+Yisy 8bSw== 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=3LNvBGN2caXXuKwbpJFw0NntiC8BH18nAXUZx060iNE=; b=foH77HNT6ag1hmiCa5Sp/bVXI7k/us/4ThyLpU80u3a3qXZjBSRABF3xAdEtko3Rnq A3TBB9Lz7DxeBO/Vd8qQZ/wMDapCU/y2W6w/K/MBV5P5qTcn+mgW8VmMNVqs0P/Kz+VF GXZ4fZX/0F+Hf44123/qWOgtfiPmLh3S00unJDqF2/XVnQ8I3E7R6f2owKCzuDHYlEtF holDVU+sfcmSumP7lKsU5b4OU34a+KPOpf/LrLYJobfoEG+Uuuf1dkHUgWH3Iqjin1in B5c8ziikfStESuW7rl5yd+lBqXwekLLRFFpinR6s+eoMjFJJGvXj4HP/xXPgQpXBDelT ZHKA== 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=BCnVN4Y6; 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 r134si2879572wmf.15.2018.03.01.10.08.38; Thu, 01 Mar 2018 10:08:38 -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=BCnVN4Y6; 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 7F63F267B6F; Thu, 1 Mar 2018 19:07:25 +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 2E365267B66; Thu, 1 Mar 2018 19:07:19 +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 4C623267B53 for ; Thu, 1 Mar 2018 19:07:14 +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=dPQzVt+M+htYthY4ZW3rDipXrBwuOiSw9p7+KgwWJbg=; b=BCnVN4Y6yeB5 30Hvt7QrsS935R9GvpPc5MrKKI6Ext4y0LJjqZ8A0hvRV/jdBGM47i3OTQ9u+kVQoAB50CCkq17CE 39NznD0xmvKk5kUj4RKefRZVckPJxuclyY4SpcIFPQL6vpUfg8CEMZsOpFI63ps4tdbfgIGJbcRD8 nNZl8=; 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 1erSbo-0005XP-GT; Thu, 01 Mar 2018 18:07:12 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1erSbo-0005wc-2D; Thu, 01 Mar 2018 18:07:12 +0000 From: Mark Brown To: Hans de Goede In-Reply-To: Message-Id: Date: Thu, 01 Mar 2018 18:07:12 +0000 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: Intel: sst: Add sst_realloc_stream() function" 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: Intel: sst: Add sst_realloc_stream() function 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 473858cad1ea3d4e6c287bad23961cd5fb7382d9 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 18 Feb 2018 23:01:42 +0100 Subject: [PATCH] ASoC: Intel: sst: Add sst_realloc_stream() function Move the struct snd_sst_alloc_mrfld alloc parameters from the stack into struct stream_info and add a new sst_realloc_stream() function which can re-alloc a stream with the same parameters as before. This is a preparation patch for fixing suspend/resume issues with some SST / DSP firmware versions. Signed-off-by: Hans de Goede Signed-off-by: Mark Brown --- sound/soc/intel/atom/sst/sst.h | 3 ++ sound/soc/intel/atom/sst/sst_stream.c | 88 +++++++++++++++++++++-------------- 2 files changed, 56 insertions(+), 35 deletions(-) -- 2.16.2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/intel/atom/sst/sst.h b/sound/soc/intel/atom/sst/sst.h index f4fd442080b2..a357cd615b59 100644 --- a/sound/soc/intel/atom/sst/sst.h +++ b/sound/soc/intel/atom/sst/sst.h @@ -180,6 +180,7 @@ struct sst_block { * @status : stream current state * @prev : stream prev state * @lock : stream mutex for protecting state + * @alloc_param : parameters used for stream (re-)allocation * @pcm_substream : PCM substream * @period_elapsed : PCM period elapsed callback * @sfreq : stream sampling freq @@ -189,6 +190,7 @@ struct stream_info { unsigned int status; unsigned int prev; struct mutex lock; + struct snd_sst_alloc_mrfld alloc_param; void *pcm_substream; void (*period_elapsed)(void *pcm_substream); @@ -429,6 +431,7 @@ struct intel_sst_ops { void (*post_download)(struct intel_sst_drv *sst); }; +int sst_realloc_stream(struct intel_sst_drv *sst_drv_ctx, int str_id); int sst_pause_stream(struct intel_sst_drv *sst_drv_ctx, int id); int sst_resume_stream(struct intel_sst_drv *sst_drv_ctx, int id); int sst_drop_stream(struct intel_sst_drv *sst_drv_ctx, int id); diff --git a/sound/soc/intel/atom/sst/sst_stream.c b/sound/soc/intel/atom/sst/sst_stream.c index 7cf5dd1993bc..fcedaa237505 100644 --- a/sound/soc/intel/atom/sst/sst_stream.c +++ b/sound/soc/intel/atom/sst/sst_stream.c @@ -35,29 +35,31 @@ int sst_alloc_stream_mrfld(struct intel_sst_drv *sst_drv_ctx, void *params) { - struct snd_sst_alloc_mrfld alloc_param; + struct snd_pcm_params *pcm_params; struct snd_sst_params *str_params; struct snd_sst_tstamp fw_tstamp; struct stream_info *str_info; - struct snd_sst_alloc_response *response; - unsigned int str_id, pipe_id, task_id; - int i, num_ch, ret = 0; - void *data = NULL; + int i, num_ch, str_id; dev_dbg(sst_drv_ctx->dev, "Enter\n"); str_params = (struct snd_sst_params *)params; - memset(&alloc_param, 0, sizeof(alloc_param)); - alloc_param.operation = str_params->ops; - alloc_param.codec_type = str_params->codec; - alloc_param.sg_count = str_params->aparams.sg_count; - alloc_param.ring_buf_info[0].addr = + str_id = str_params->stream_id; + str_info = get_stream_info(sst_drv_ctx, str_id); + if (!str_info) + return -EINVAL; + + memset(&str_info->alloc_param, 0, sizeof(str_info->alloc_param)); + str_info->alloc_param.operation = str_params->ops; + str_info->alloc_param.codec_type = str_params->codec; + str_info->alloc_param.sg_count = str_params->aparams.sg_count; + str_info->alloc_param.ring_buf_info[0].addr = str_params->aparams.ring_buf_info[0].addr; - alloc_param.ring_buf_info[0].size = + str_info->alloc_param.ring_buf_info[0].size = str_params->aparams.ring_buf_info[0].size; - alloc_param.frag_size = str_params->aparams.frag_size; + str_info->alloc_param.frag_size = str_params->aparams.frag_size; - memcpy(&alloc_param.codec_params, &str_params->sparams, + memcpy(&str_info->alloc_param.codec_params, &str_params->sparams, sizeof(struct snd_sst_stream_params)); /* @@ -67,46 +69,62 @@ int sst_alloc_stream_mrfld(struct intel_sst_drv *sst_drv_ctx, void *params) * Currently hardcoding as per FW reqm. */ num_ch = sst_get_num_channel(str_params); + pcm_params = &str_info->alloc_param.codec_params.uc.pcm_params; for (i = 0; i < 8; i++) { if (i < num_ch) - alloc_param.codec_params.uc.pcm_params.channel_map[i] = i; + pcm_params->channel_map[i] = i; else - alloc_param.codec_params.uc.pcm_params.channel_map[i] = 0xFF; + pcm_params->channel_map[i] = 0xff; } - str_id = str_params->stream_id; - str_info = get_stream_info(sst_drv_ctx, str_id); - if (str_info == NULL) { - dev_err(sst_drv_ctx->dev, "get stream info returned null\n"); - return -EINVAL; - } - - pipe_id = str_params->device_type; - task_id = str_params->task; sst_drv_ctx->streams[str_id].status = STREAM_INIT; sst_drv_ctx->streams[str_id].prev = STREAM_UN_INIT; - sst_drv_ctx->streams[str_id].pipe_id = pipe_id; - sst_drv_ctx->streams[str_id].task_id = task_id; + sst_drv_ctx->streams[str_id].pipe_id = str_params->device_type; + sst_drv_ctx->streams[str_id].task_id = str_params->task; sst_drv_ctx->streams[str_id].num_ch = num_ch; if (sst_drv_ctx->info.lpe_viewpt_rqd) - alloc_param.ts = sst_drv_ctx->info.mailbox_start + + str_info->alloc_param.ts = sst_drv_ctx->info.mailbox_start + sst_drv_ctx->tstamp + (str_id * sizeof(fw_tstamp)); else - alloc_param.ts = sst_drv_ctx->mailbox_add + + str_info->alloc_param.ts = sst_drv_ctx->mailbox_add + sst_drv_ctx->tstamp + (str_id * sizeof(fw_tstamp)); dev_dbg(sst_drv_ctx->dev, "alloc tstamp location = 0x%x\n", - alloc_param.ts); + str_info->alloc_param.ts); dev_dbg(sst_drv_ctx->dev, "assigned pipe id 0x%x to task %d\n", - pipe_id, task_id); + str_info->pipe_id, str_info->task_id); + + return sst_realloc_stream(sst_drv_ctx, str_id); +} + +/** + * sst_realloc_stream - Send msg for (re-)allocating a stream using the + * @sst_drv_ctx intel_sst_drv context pointer + * @str_id: stream ID + * + * Send a msg for (re-)allocating a stream using the parameters previously + * passed to sst_alloc_stream_mrfld() for the same stream ID. + * Return: 0 or negative errno value. + */ +int sst_realloc_stream(struct intel_sst_drv *sst_drv_ctx, int str_id) +{ + struct snd_sst_alloc_response *response; + struct stream_info *str_info; + void *data = NULL; + int ret; + + str_info = get_stream_info(sst_drv_ctx, str_id); + if (!str_info) + return -EINVAL; - /* allocate device type context */ dev_dbg(sst_drv_ctx->dev, "Alloc for str %d pipe %#x\n", - str_id, pipe_id); - ret = sst_prepare_and_post_msg(sst_drv_ctx, task_id, IPC_CMD, - IPC_IA_ALLOC_STREAM_MRFLD, pipe_id, sizeof(alloc_param), - &alloc_param, &data, true, true, false, true); + str_id, str_info->pipe_id); + + ret = sst_prepare_and_post_msg(sst_drv_ctx, str_info->task_id, IPC_CMD, + IPC_IA_ALLOC_STREAM_MRFLD, str_info->pipe_id, + sizeof(str_info->alloc_param), &str_info->alloc_param, + &data, true, true, false, true); if (ret < 0) { dev_err(sst_drv_ctx->dev, "FW alloc failed ret %d\n", ret);