From patchwork Tue Mar 12 09:41:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13589739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5F8BC54E67 for ; Tue, 12 Mar 2024 09:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xfZdQ4RK2H3fqd76P7yQyyp1lC3AioOvdGO0QL/nnp8=; b=GlDi5CTy7++gLY PynYKf2PWp6jtLlzFQXOhSXgraTns5aRo8HOkGQlHYpvRZHIZd3JgwxioOR7JQirzeJBSWZqnDkFi MQSCtYPKOp3NK6/MecSlzzdph9673UWN5epXBHcHPHsmcYJICgPW/5pc3oDccePJVVWYwavDfrqvd RtIlipNwBjlbWbg2HmgvplVPs0AGqwFMd/PDv8WvjBpX7s84BSVUo7QspYsA3BFQk7Cn3XffBkPl7 j3207kIyuqQfvBO74ZqkR59+udLGqrEBimBUlgDcXlxDbXfEkW2l3+8x/XPx/Y8YXhsqfKlEb1erS fgtbyy/XyQ9XrcqOzdKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjydg-000000059Gm-2t3S; Tue, 12 Mar 2024 09:41:40 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjydc-000000059EY-39Je for linux-arm-kernel@lists.infradead.org; Tue, 12 Mar 2024 09:41:38 +0000 Received: from [127.0.1.1] (91-154-34-181.elisa-laajakaista.fi [91.154.34.181]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 675CADFB; Tue, 12 Mar 2024 10:41:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1710236473; bh=Y20q2GHyYvn4IMCZter81h5YE8yYywNCvuN8kMhR93Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jc6uYaHGU7u2yNC5dKa5YQ1XkiLwVNzQIDUYAuwtx6ntZIwjn65AFWOcj9mWGq5Kr e97d1b4D2FYGHfNzTtlwlgGHo2WiBQM1LfzU4KUazirL1kUD6cJbGJWJlQr4ps6LSt svkxt/SBF2G0DkqWfrNmq76IjZOpxs4df+hcS4n0= From: Tomi Valkeinen Date: Tue, 12 Mar 2024 11:41:02 +0200 Subject: [PATCH 1/4] ASoC: dmaengine_pcm: Allow passing component name via config MIME-Version: 1.0 Message-Id: <20240312-xilinx-dp-audio-v1-1-696c79facbb9@ideasonboard.com> References: <20240312-xilinx-dp-audio-v1-0-696c79facbb9@ideasonboard.com> In-Reply-To: <20240312-xilinx-dp-audio-v1-0-696c79facbb9@ideasonboard.com> To: Lars-Peter Clausen , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michal Simek Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Vishal Sagar , Anatoliy Klymenko , =?utf-8?q?P=C3=A9ter_Ujfalu?= =?utf-8?q?si?= , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2760; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=Y20q2GHyYvn4IMCZter81h5YE8yYywNCvuN8kMhR93Y=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBl8CNKmHTvKOCOEEFwtj9jcZSpkgC6g5K4s/BuU 3XtQVx35ZuJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZfAjSgAKCRD6PaqMvJYe 9fyiD/41i6r4AfXqSSPLB04IsYhdCuxvfRH3yFul6aSXRkSQEfUXAaskoggc5/Opc4cKTzBav7Z RszLw/BN2WmUWZqL2DSQQbIf6qAxFUXEFLsCi3MpyEIOU7cy42NbtI1ffxcwAYnsWxYGNzl30JO IlXhcIXjtMIlX4yVSgmDUDsbAHw7q93Ghh4paQ4ngzxWMRaqrTWhnAvfe7evIYJwlrD3MUqegvU ol4FV86A6d/939RKEk7VCKmr5dFeiPwfppbZmpGsRLf9GF95Q2NBlm6AxQ5gRU/Wih+cOvNy1Dc XbPWNEpLfBopB/rIkFW/bpOOoMa2H3Cf5yEYZeU5VnLt9tQWn9rtQY0uhOUhSx9jeQ5RWAX1C3/ StQZZaZhgpx0F6SGofJYU50mtbiXNQIdq/WcAU+2fPzCqhRkB5NLkU97rKdepxzWINRjyCGfilC DngtbhAq1caIa088k5MidS+1/SIsPPWZvhquL9fFUiUtXQg2+PYabQ10kR3yrOpDoFRKOqAlcLP x+SW2FvjhM9FLJk65MVABDLh54XgpnSX2Tt3QdyRSLe/dXjOuxDX4nknZ3MMQZhrhE8Bvkp3ELB YWLz+KtotBhkEKy/JFIgnGrjgufGmk4QEtjDwq9bKOWQ4Sl8WdryiXkmcQj0T4doThInY3ZKUX7 6FettnOo+TSUU+Q== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240312_024136_981990_6D28B6B7 X-CRM114-Status: GOOD ( 14.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org At the moment we cannot instantiate two dmaengine_pcms with the same parent device, as the components will be named the same, leading to conflicts. Add 'name' field to the snd_dmaengine_pcm_config, and use that (if defined) as the component name instead of deriving the component name from the device. Signed-off-by: Tomi Valkeinen --- include/sound/dmaengine_pcm.h | 2 ++ sound/soc/soc-core.c | 8 +++++--- sound/soc/soc-generic-dmaengine-pcm.c | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index d70c55f17df7..c11aaf8079fb 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h @@ -118,6 +118,7 @@ int snd_dmaengine_pcm_refine_runtime_hwparams( * which do not use devicetree. * @process: Callback used to apply processing on samples transferred from/to * user space. + * @name: Component name. If null, dev_name will be used. * @compat_filter_fn: Will be used as the filter function when requesting a * channel for platforms which do not use devicetree. The filter parameter * will be the DAI's DMA data. @@ -143,6 +144,7 @@ struct snd_dmaengine_pcm_config { int (*process)(struct snd_pcm_substream *substream, int channel, unsigned long hwoff, unsigned long bytes); + const char *name; dma_filter_fn compat_filter_fn; struct device *dma_dev; const char *chan_names[SNDRV_PCM_STREAM_LAST + 1]; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 516350533e73..772d67065611 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2792,10 +2792,12 @@ int snd_soc_component_initialize(struct snd_soc_component *component, INIT_LIST_HEAD(&component->list); mutex_init(&component->io_mutex); - component->name = fmt_single_name(dev, &component->id); if (!component->name) { - dev_err(dev, "ASoC: Failed to allocate name\n"); - return -ENOMEM; + component->name = fmt_single_name(dev, &component->id); + if (!component->name) { + dev_err(dev, "ASoC: Failed to allocate name\n"); + return -ENOMEM; + } } component->dev = dev; diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 092ca09f3631..83db1a83d8ba 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -441,6 +441,9 @@ int snd_dmaengine_pcm_register(struct device *dev, pcm->config = config; pcm->flags = flags; + if (config->name) + pcm->component.name = config->name; + ret = dmaengine_pcm_request_chan_of(pcm, dev, config); if (ret) goto err_free_dma;