From patchwork Thu Feb 25 02:52:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 387188 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp889957jap; Wed, 24 Feb 2021 19:07:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbzgIoxnRq35xdfq+uz5gdB4IphWEN7cgG7i1mcGrc0aevgdT+U182jbduUy1HUhHDJsnI X-Received: by 2002:a05:6402:34d:: with SMTP id r13mr77868edw.64.1614222438218; Wed, 24 Feb 2021 19:07:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614222438; cv=none; d=google.com; s=arc-20160816; b=WtFZW91x5eMATrj1yhDR53hZjHe/ijxw9zUL1kRxZZoLxoEy1PtArhBwMW1ZZZTiKg Yigdwr28QHw6sB8p455I8EGk4pZToXg3mG2ARalYpbKJk958jZNneyA4BOv6OyREDOMY 6Se8+j9iNuA/hOWjOjliHmoqVXE0zMWYx4PKvgIRJHqtvw3oQpH+kGLD1eAC00orAnUt vd0PrjUq6A9IlSJkBcQQtQqUUqWeALB3oTcyfJWUB1DYYl1C8Y+6oWOzuY06+Xv9ZDUl pTR8Ef/1J3/w64GltD4Q8QD8G/KvL9ULaLxmvWXbxJb9HmwgamaWyzJqGvWwWjWxMmR6 X90g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from; bh=sL6oCrrqvtldbB0OjXhLhPmjYYLZStceEID6TI9nJpQ=; b=N9a9y+tx4I/W+tTPqJVEgREEAfahojutrk3Q+vMjp+Dz0IjcnJyvpVyNhO9HvFD+98 Ph0aCChg8cZe84qXHF6UQti4LJ5hXMqUaM0ovZF52kZ2T3SiZZx3f5DSv+PDgVc8PjSl saQ+sGOycaRIQPxwYrSRgauJ0DNNbOyIvaGu9q8beZCtqO8gDCDP/6Bqx4LyVAFkggx8 gaNcoDjmYbDPwZ7DLM5hkVKPqlPgE68qImbqXcThJqhLTnWKc9OV3zy3NP1j+l/SVMOJ lEsks2AbGpYfM/p3NX2pZfCvyZ6Dk6LEXzBkc0ODcf9NgRnsMY5h0S03hqNzAJI3bPha P7Tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs7si2757584ejc.745.2021.02.24.19.07.18; Wed, 24 Feb 2021 19:07:18 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236930AbhBYDGJ (ORCPT + 6 others); Wed, 24 Feb 2021 22:06:09 -0500 Received: from inva021.nxp.com ([92.121.34.21]:40434 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234664AbhBYDGJ (ORCPT ); Wed, 24 Feb 2021 22:06:09 -0500 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E1B1A2006F6; Thu, 25 Feb 2021 04:05:21 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 498142006EC; Thu, 25 Feb 2021 04:05:15 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 8806540319; Thu, 25 Feb 2021 04:05:07 +0100 (CET) From: Shengjiu Wang To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, linuxppc-dev@lists.ozlabs.org, robh+dt@kernel.org, devicetree@vger.kernel.org Subject: [PATCH v3 1/7] ASoC: soc-component: Add snd_soc_pcm_component_ack Date: Thu, 25 Feb 2021 10:52:37 +0800 Message-Id: <1614221563-26822-2-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1614221563-26822-1-git-send-email-shengjiu.wang@nxp.com> References: <1614221563-26822-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add snd_soc_pcm_component_ack back, which can be used to get updated buffer pointer in platform driver. On Asymmetric multiprocessor, this pointer can be sent to Cortex-M core for audio processing. Signed-off-by: Shengjiu Wang --- include/sound/soc-component.h | 3 +++ sound/soc/soc-component.c | 14 ++++++++++++++ sound/soc/soc-pcm.c | 2 ++ 3 files changed, 19 insertions(+) -- 2.27.0 diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 5b47768222b7..2dc8c7e3d1a6 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -146,6 +146,8 @@ struct snd_soc_component_driver { int (*mmap)(struct snd_soc_component *component, struct snd_pcm_substream *substream, struct vm_area_struct *vma); + int (*ack)(struct snd_soc_component *component, + struct snd_pcm_substream *substream); const struct snd_compress_ops *compress_ops; @@ -498,5 +500,6 @@ int snd_soc_pcm_component_pm_runtime_get(struct snd_soc_pcm_runtime *rtd, void *stream); void snd_soc_pcm_component_pm_runtime_put(struct snd_soc_pcm_runtime *rtd, void *stream, int rollback); +int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream); #endif /* __SOC_COMPONENT_H */ diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index 159bf88b9f8c..a9fbb2d26412 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -1212,3 +1212,17 @@ void snd_soc_pcm_component_pm_runtime_put(struct snd_soc_pcm_runtime *rtd, soc_component_mark_pop(component, stream, pm); } } + +int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_component *component; + int i; + + /* FIXME: use 1st pointer */ + for_each_rtd_components(rtd, i, component) + if (component->driver->ack) + return component->driver->ack(component, substream); + + return 0; +} diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 14d85ca1e435..a1b81d4d678c 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2833,6 +2833,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) rtd->ops.page = snd_soc_pcm_component_page; if (drv->mmap) rtd->ops.mmap = snd_soc_pcm_component_mmap; + if (drv->ack) + rtd->ops.ack = snd_soc_pcm_component_ack; } if (playback)