From patchwork Thu Oct 27 10:27:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp148496wru; Thu, 27 Oct 2022 03:29:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7M2CCP8cNfigRkBbeuWh/6F6t3gxiuAWi9/Vx4c9TUApVqHZR9GH80WmO8rD16jhgDrNuJ X-Received: by 2002:a63:8949:0:b0:46b:2f56:a910 with SMTP id v70-20020a638949000000b0046b2f56a910mr42916856pgd.158.1666866598346; Thu, 27 Oct 2022 03:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666866598; cv=none; d=google.com; s=arc-20160816; b=jaPuUYcNxkEF9iiNTx2NN7ITtb1MADc2KPLnaNMhkWQuy+wXMAloRrXNHAntNCJ0ZO DiMTepw26i+lAKwzr+7RtrO32MDQH16HKV+zGitbj1kAzLKLaAhXf7b0F+wy8+fgd8s0 e/f+KFy9hRBmuEjJ4IwIjI71gFaW6vbhIgEUyWfKL0500tx3+YfxIFcsQbADV8JZsTaX aIvGTDwjQEhwWXIVgKs60l0YRk4J4t1scfDtBo04JqUJZLiY5yg/iIMLmwjv/DOafr/I JvuNDzc26S1/r3DRy6ctv7Ya6QOVU5BajlmD4OeOelN6S0BpYW9GiphGwbH4S3tzBD/g 0Yiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UKQTPRFu++JOzaQvPKM6EY88nyYcpwHVj06ax0yzQAI=; b=EbNh2GvEAJ6Hmv94zuR11JTmjG1Kr2stgrzJpDa6Ab0RwBp9IyfxxhDshP8D4HxMeV ncWcwXmqAntOVIt7vZXCDFmz5jT4ySC/ZMJavd0/L8zgfgjZ1Rb2EA9pedWIBsp5Fj+U PYVNGR7IiWjGrcjTEcA1x7MvTk0225kdHQu+ZcLDOY46MygwlOEBe2q7cboMAKxFzdXf hpX7SLiEruRGh6XonLByvWbv5lVmvfWX/ljZvDGblFVbxQSNMYpJfIepzIaMutswSmNx zOtfD9DTm+69CF/lE5DsU4GUAnDX+le6HpTob2bINChXxlw4ncWoVYKx/8XRW2DqJTcN LATQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r1XOWKOp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020a170902ec8600b0016efde92292si1417818plg.255.2022.10.27.03.29.45; Thu, 27 Oct 2022 03:29:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r1XOWKOp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235345AbiJ0K17 (ORCPT + 99 others); Thu, 27 Oct 2022 06:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234509AbiJ0K1n (ORCPT ); Thu, 27 Oct 2022 06:27:43 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C7472F65C for ; Thu, 27 Oct 2022 03:27:42 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id t4so625684wmj.5 for ; Thu, 27 Oct 2022 03:27:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UKQTPRFu++JOzaQvPKM6EY88nyYcpwHVj06ax0yzQAI=; b=r1XOWKOprkHaO8FuW0u5IWId2lIgt3Vo1/lrOuUOcyBn9+EuFrRE8LSNux6ADaZRum VLi9zUsaL6CHZHxysp6vPtsxPRP6VXtjyYGXSDunjjjbcsML0DBQaqMykQumfXasesdI anr5cPryy9/WlbFYZU1ZHLyD8qh27kqGcXwcQ9016DQoyuPmOMfdjk9gfq7SIfNoPYzr oHhac+jl4qBAM1IoTS55RdoX5YW4BAyLN9qPpmq7uk546+slO19MKEsN1diDNBwUzLsE sP7oNAsBk/jdqqGXb1SLPu+xG1Yc2c914mgbtuAE12jSxS5U7pJ/rNV/mHttyaPS36Sm EJyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UKQTPRFu++JOzaQvPKM6EY88nyYcpwHVj06ax0yzQAI=; b=KHCR/99T1cGZQcy86ad6Up0KvOWWrEC+ztpJvSurJKdtIsJeCocTG5OZ2Gr4TQt8Cd WavSvnoawvCjVsStZKzDWa8zSylB1GCh24x1bWcqEltkhWt/Gv0eLjfAlSGtYhXuFF45 Sl9iF9Ooa1mWjTKCTwULuXCnXBd1RZ6JIbcQ5bfrMSACzVxCyAfELpsO3K0gEwh2AiOk cPtXER9+bA6OOGBNgo0F8NkpF+3w098Iw80toTl9cGDwMDFItc3DVJEyiLclyMnpFtXU c4KYu9svxhXvuwsooHCn1StocXFe5qCJqSZ8zTboqdeQGw8Q4zuxkUkc1KfGi8NHqw/S /fqQ== X-Gm-Message-State: ACrzQf1reIxB4VItS3+BAupDzWL2kVbaarFjXqRS0a3vCbe9piNgRAxN 7m6Hj2v8tTK2gmxW7ZUQHqH2/A== X-Received: by 2002:a05:600c:5563:b0:3cf:503c:c759 with SMTP id ja3-20020a05600c556300b003cf503cc759mr2107969wmb.30.1666866460613; Thu, 27 Oct 2022 03:27:40 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id fc7-20020a05600c524700b003b505d26776sm5088674wmb.5.2022.10.27.03.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:27:40 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 1/9] ASoC: qdsp6: audioreach: topology use idr_alloc_u32 Date: Thu, 27 Oct 2022 11:27:02 +0100 Message-Id: <20221027102710.21407-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> References: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747836309774505928?= X-GMAIL-MSGID: =?utf-8?q?1747836309774505928?= SubGraph and Module Instance ids take 32 bits, so use idr_alloc_u32 instead of idr_alloc to able to accommodate valid ranges. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/topology.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c index bd649c232a06..9a3d9e0eae53 100644 --- a/sound/soc/qcom/qdsp6/topology.c +++ b/sound/soc/qcom/qdsp6/topology.c @@ -44,7 +44,7 @@ static struct audioreach_graph_info *audioreach_tplg_alloc_graph_info(struct q6a INIT_LIST_HEAD(&info->sg_list); mutex_lock(&apm->lock); - ret = idr_alloc(&apm->graph_info_idr, info, graph_id, graph_id + 1, GFP_KERNEL); + ret = idr_alloc_u32(&apm->graph_info_idr, info, &graph_id, graph_id, GFP_KERNEL); mutex_unlock(&apm->lock); if (ret < 0) { @@ -53,7 +53,7 @@ static struct audioreach_graph_info *audioreach_tplg_alloc_graph_info(struct q6a return ERR_PTR(ret); } - info->id = ret; + info->id = graph_id; return info; } @@ -94,7 +94,7 @@ static struct audioreach_sub_graph *audioreach_tplg_alloc_sub_graph(struct q6apm INIT_LIST_HEAD(&sg->container_list); mutex_lock(&apm->lock); - ret = idr_alloc(&apm->sub_graphs_idr, sg, sub_graph_id, sub_graph_id + 1, GFP_KERNEL); + ret = idr_alloc_u32(&apm->sub_graphs_idr, sg, &sub_graph_id, sub_graph_id, GFP_KERNEL); mutex_unlock(&apm->lock); if (ret < 0) { @@ -103,7 +103,7 @@ static struct audioreach_sub_graph *audioreach_tplg_alloc_sub_graph(struct q6apm return ERR_PTR(ret); } - sg->sub_graph_id = ret; + sg->sub_graph_id = sub_graph_id; return sg; } @@ -136,7 +136,7 @@ static struct audioreach_container *audioreach_tplg_alloc_container(struct q6apm INIT_LIST_HEAD(&cont->modules_list); mutex_lock(&apm->lock); - ret = idr_alloc(&apm->containers_idr, cont, container_id, container_id + 1, GFP_KERNEL); + ret = idr_alloc_u32(&apm->containers_idr, cont, &container_id, container_id, GFP_KERNEL); mutex_unlock(&apm->lock); if (ret < 0) { @@ -145,7 +145,7 @@ static struct audioreach_container *audioreach_tplg_alloc_container(struct q6apm return ERR_PTR(ret); } - cont->container_id = ret; + cont->container_id = container_id; cont->sub_graph = sg; /* add to container list */ list_add_tail(&cont->node, &sg->container_list); @@ -181,7 +181,7 @@ static struct audioreach_module *audioreach_tplg_alloc_module(struct q6apm *apm, AR_MODULE_DYNAMIC_INSTANCE_ID_START, AR_MODULE_DYNAMIC_INSTANCE_ID_END, GFP_KERNEL); } else { - ret = idr_alloc(&apm->modules_idr, mod, module_id, module_id + 1, GFP_KERNEL); + ret = idr_alloc_u32(&apm->modules_idr, mod, &module_id, module_id, GFP_KERNEL); } mutex_unlock(&apm->lock); @@ -191,7 +191,7 @@ static struct audioreach_module *audioreach_tplg_alloc_module(struct q6apm *apm, return ERR_PTR(ret); } - mod->instance_id = ret; + mod->instance_id = module_id; /* add to module list */ list_add_tail(&mod->node, &cont->modules_list); mod->container = cont; From patchwork Thu Oct 27 10:27:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp148636wru; Thu, 27 Oct 2022 03:30:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45KoMLehNJFw5BG18YSJqexMCJTgj0XuUaPcb6kuRNmZWHsn3G2MVahBHYwaog/pxj/GD/ X-Received: by 2002:a17:903:41c7:b0:182:a32f:4db5 with SMTP id u7-20020a17090341c700b00182a32f4db5mr48879030ple.22.1666866620479; Thu, 27 Oct 2022 03:30:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666866620; cv=none; d=google.com; s=arc-20160816; b=0hzTiK6dsosOmhxVBfZv5tUdPgeqEXUtcaTaXr+NPG0ZE3SkOIbKj/I3LVwPxLdTzK 8B71Gr1+NH/gbKPWJTumfnBwcDCsLi8ams0WoOZoUOuRSl6FSCpS/vaJSJNbykVvgK45 btovpVdIf8CWGIjunSm8qt7X0jduUxuQ2b+ThDElHHRN7iBiMyckE/ZzWvDUbtx2wTGd au0av8fZeRJful7itV3gr0oBcKNQ2B3E163dRK+3MRMXcjB7403HxpBgOksOWp5arGrk lQjXn7e8WFv/37BG9r6HTPxgNeWLHqO01duxNHUJE4HmKzHp6C1RLWtdXVCP7rImiGOO 8xvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cF5Zvj+Kzci/ADALngKgDuePH0r1ubNxIDC6FLO5nXI=; b=KdpiCWTOkEO4s+bdN7NY/H5jih48kORaglJAaTqf5u6BgJHDi0kKpGK/jNUhREElAi 1L/Ou//TIJIEM8wuww8QaMDHLzDek6fp4IPAZRRTunmIBJncpNQF0GysXpw6tP5y5Xm5 LCN3qRAbG2lb6NH3y7BqyoC0WNroNhu7axg3n0OesayWSLHXYqtoIYpsgdtfRcDmaP1a DQyKLTMEpZOYGXmxaEPJ/ieCPaqObk/8ZdguwCzRUtgv4GGB0uX/RDRHqXUjDSF3a/0C JiNNoN0R0LvlEAmaD3hU2EBds+y8vsN1CWHamvHCFyw5vbOhGy/nX0QDWmRaGjhTMEE4 PPDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OfmcnN2A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a635044000000b0043bd8458031si1403833pgl.435.2022.10.27.03.30.05; Thu, 27 Oct 2022 03:30:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OfmcnN2A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233280AbiJ0K2D (ORCPT + 99 others); Thu, 27 Oct 2022 06:28:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234248AbiJ0K1o (ORCPT ); Thu, 27 Oct 2022 06:27:44 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7774E11E45B for ; Thu, 27 Oct 2022 03:27:43 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id h9so1440936wrt.0 for ; Thu, 27 Oct 2022 03:27:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cF5Zvj+Kzci/ADALngKgDuePH0r1ubNxIDC6FLO5nXI=; b=OfmcnN2ATMaOpm5S6kmUIuDgV9Frpxx46brWhLZxI1dy82qO45G2ZGVowls6lCKTWO HAqZnnXtVgJrIQP/DUGZqt5mFCCzx5Y7lSMkGOKJx4WW+LGu2Z5nZLcssfuyNcnuC/4k JFWkhSpO/CZyeaaJLrou68ss3ypdAP9sZSA71qq9jpwCWmnUFM6zok3vylJKFKDyQgXI liThdInxxTImzhJIjRlZIFwJ9f7kMtwXuT2rlaeZRCqkIBy+ig4gi0rACnSq5I4y+ZPI Yfr5/Vg57Vhc0aKaSaZ3vLERuUNXYS4R8dZ+9EPd1xc3aShX3CvfmTJvYpSUZt0R5FmB x7Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cF5Zvj+Kzci/ADALngKgDuePH0r1ubNxIDC6FLO5nXI=; b=PDY6ErvMsrbnWitYnnaeYmIlTTTyagX2ZVIA/IPPoGYUPKWUfDHnOd8CoQj3eQWJBB tPRQUAau5Dl1BBYWtO7MH6KmJ0oC/JMm+hV5hPOv1WhVmSPcRCCNx5a9Obk9zsxuN9HJ mvc6A7H/KYP9YixLyWoKfpJatTWtuZt1xmHUAOFz+yp5Y4RcuXXOKeG79WYdxEjVYDS7 AzSpTvW6jyWdriD1CEFjuFtLF3N+xPmCCNqQlwgxK1aX1H97ZiRYD5FXQfJf4wdpe7xg BY/202sMkK6yYSAWSjlcrpRr8SOaZcIsU1359mAhUeScsBwpanITo3OtvIllhDo8cfr+ ZVUA== X-Gm-Message-State: ACrzQf0y35E2CHihaSu+Up1wdQmM1q4YhSBa+CUiRCgr/lf7bKIKzdyi JobId95oJqx7MtldK0GosgU/FSPK1ko0wQ== X-Received: by 2002:adf:e7c8:0:b0:236:6a30:cb2e with SMTP id e8-20020adfe7c8000000b002366a30cb2emr15899887wrn.12.1666866461938; Thu, 27 Oct 2022 03:27:41 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id fc7-20020a05600c524700b003b505d26776sm5088674wmb.5.2022.10.27.03.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:27:41 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 2/9] ASoC: qdsp6: audioreach: remove unused connection_list Date: Thu, 27 Oct 2022 11:27:03 +0100 Message-Id: <20221027102710.21407-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> References: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747836333520049703?= X-GMAIL-MSGID: =?utf-8?q?1747836333520049703?= Remove unused connection_list parameter. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/audioreach.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index 3ee8bfcd0121..36779ad1952d 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -595,7 +595,6 @@ struct audioreach_graph_info { int id; uint32_t num_sub_graphs; struct list_head sg_list; - struct list_head connection_list; }; struct audioreach_sub_graph { From patchwork Thu Oct 27 10:27:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp148774wru; Thu, 27 Oct 2022 03:30:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uno1+M0uJuq1KcJc/wZiu0isefwN9Pt8ibp/c/2fBw9URv6aZ98YtOixoy2Hl5jbLI+uu X-Received: by 2002:a17:902:f60a:b0:186:5d06:8da4 with SMTP id n10-20020a170902f60a00b001865d068da4mr42838118plg.106.1666866636559; Thu, 27 Oct 2022 03:30:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666866636; cv=none; d=google.com; s=arc-20160816; b=yY1Emin5+szrVki7n4n2ye2rOqtcvC+05nzI79Rz60DW9G/FtsIQK7Mml+kzmPonZz B9BsbdpEUcj5viFyCczMx3Yn1HlzzKwfjOVM/nb1unA1uzAuQvLpjMugo30X10L1vogT DVodTa+88NGRSZqJ0ZTKz9LKc8v9NGAQH+ZIWBSqvIK50SdKni79j5WYmW+wig6vYO8U AlqCGZJ1MT4KiM37UIn94m3I5+mXbDujW/lJ1mKl7udPb8YL9I1+R9PHrGOqJoivQoXF b1EETaRxe0KBCiqyb8P1Qh1r4fs9L7WFs763fCUf+A8bt43mKn7F3k0CbeS+/ouiOLtZ V0tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Zia5PwPjvTpWqvNWhun5tKRspbVbRhZxzacUZUNqQiU=; b=Ya/Qtt9eWVhXVbbiAL/LEVk0Ez6IH6OSXtq+Hfis8s3OBnkJ9OGELYwL91ittke3/H XIApWzwEHcOEEu35JTjfD/xyv1vMaSj6kDxBy1BuR+TKi6Bd1sM6rqHkxpAS83PWSm1X vxDpPAh9Xip9ie6UCY3tqJN8gfwBMkRIt8y8p+ETE8cKCS/eRTkFLhMSTl+HfRtt0Gu4 iU3vrztpqiFOmIRRb9RiUk2UNzWljmy9YOe+XcC9CpisamhM5mJdJRcw2NsHJryCi6Ks Rk7UDBMSZp/CGoDr0obRBCL8qvML9iNg+wpKxyyRb2Wv4IFdqbYTUGTZsuXnjIuUrTlt oquA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RiqJKL/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020a17090aaa0300b0020ab20c54fesi4845783pjq.114.2022.10.27.03.30.20; Thu, 27 Oct 2022 03:30:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RiqJKL/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235075AbiJ0K2R (ORCPT + 99 others); Thu, 27 Oct 2022 06:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235015AbiJ0K1r (ORCPT ); Thu, 27 Oct 2022 06:27:47 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF82810EA0B for ; Thu, 27 Oct 2022 03:27:44 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id bs21so1399978wrb.4 for ; Thu, 27 Oct 2022 03:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Zia5PwPjvTpWqvNWhun5tKRspbVbRhZxzacUZUNqQiU=; b=RiqJKL/uMRA9zydHwoUZ5K0l+UFfgJ2Ly3Y/TDxZoEHQc3AoYv1TQ8z+HHo99c4kKX g+hYBuGaDNneX0KX+Q3CABFrJcHJwkBhBL3q0DEHRP9fWAGeLKACv333S3XFUBlJ8smQ rRmclfpV4OFtnYsmvxkoFQ2ayz2ahSH64yiU7zXxrmi/ObRHFHHEDFQziZE4/cAbFZsZ 9t/2QpmZtJnGh+wrDTzo8UG4K+Kt6d2DZw6q/A2FSho5y0YUGFa1CYdfIo6R2bt8YQ4B jcp8lNlMn+wta3Hi4z3D2nnZsQ1SPm8+akuEqO8DvBGxrzZZkcPMjarF9Ds+cv1POJa5 4jGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zia5PwPjvTpWqvNWhun5tKRspbVbRhZxzacUZUNqQiU=; b=cN0fBIJqmQDol4QfgiLj+vOpF8uvVSkEYHorVFDL+zOI++GsQzESLKBtRkGC7RIIqA zh4Ib0JMBB4u0XfIXfFKC/iOYt5Y+SwYUphGeAyXNuh5Fk7O4vcfu9MhBv0JVef1Ycdd I9HLMWZIEQpPulUfCIvXf4GDU+PdIwhsHcSYx7PGFyJr0M5JxaVLKcgENMy/be8USyEf jEpEuKk5o8tCtL5c1VfXSlARpvffs1lasw4V9gEr9pgX0G44elsYgjEYw3/XaRNNMutU CI4z8fcl9/Z/AYHgDVvYR48fnggex1qr3dBVd01E7sHNPcVhJSbnW6jmLj25TZfaW3e5 Pm8w== X-Gm-Message-State: ACrzQf0EHXonFYViJHkLphvI1Z8lFWDqUcxTLvDafU9HR8E3scF60qVD syExwAl9pGwROwN99u2r6MVTkg== X-Received: by 2002:adf:d1c9:0:b0:225:f98:d602 with SMTP id b9-20020adfd1c9000000b002250f98d602mr32014812wrd.419.1666866463209; Thu, 27 Oct 2022 03:27:43 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id fc7-20020a05600c524700b003b505d26776sm5088674wmb.5.2022.10.27.03.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:27:42 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 3/9] ASoC: qdsp6: audioreach: update dapm kcontrol private data Date: Thu, 27 Oct 2022 11:27:04 +0100 Message-Id: <20221027102710.21407-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> References: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747836350546518972?= X-GMAIL-MSGID: =?utf-8?q?1747836350546518972?= Update kcontrol private date to include more information like graph id and module instance id which its connected to. Also maintain this virtual dapm mixer widget in a list so that we could lookup while FE and BE connection are added. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6apm.c | 1 + sound/soc/qcom/qdsp6/q6apm.h | 1 + sound/soc/qcom/qdsp6/topology.c | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index 794019286c70..81e2d7090fb4 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -731,6 +731,7 @@ static int apm_probe(gpr_device_t *gdev) apm->gdev = gdev; init_waitqueue_head(&apm->wait); + INIT_LIST_HEAD(&apm->widget_list); idr_init(&apm->graph_idr); idr_init(&apm->graph_info_idr); idr_init(&apm->sub_graphs_idr); diff --git a/sound/soc/qcom/qdsp6/q6apm.h b/sound/soc/qcom/qdsp6/q6apm.h index 54eadadf712c..96ad5ea2ae07 100644 --- a/sound/soc/qcom/qdsp6/q6apm.h +++ b/sound/soc/qcom/qdsp6/q6apm.h @@ -58,6 +58,7 @@ struct q6apm { struct mutex lock; uint32_t state; + struct list_head widget_list; struct idr graph_idr; struct idr graph_info_idr; struct idr sub_graphs_idr; diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c index 9a3d9e0eae53..0c4886d30131 100644 --- a/sound/soc/qcom/qdsp6/topology.c +++ b/sound/soc/qcom/qdsp6/topology.c @@ -16,7 +16,11 @@ #include "audioreach.h" struct snd_ar_control { + u32 graph_id; /* Graph ID */ u32 sgid; /* Sub Graph ID */ + u32 module_instance_id; /* Connected Module Instance ID */ + struct snd_soc_dapm_widget *w; + struct list_head node; struct snd_soc_component *scomp; }; @@ -692,6 +696,7 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component, struct snd_soc_tplg_vendor_value_elem *w_elem; struct snd_soc_tplg_vendor_array *w_array; struct snd_ar_control *scontrol; + struct q6apm *data = dev_get_drvdata(component->dev); struct snd_soc_dobj *dobj; int tkn_count = 0; @@ -711,6 +716,9 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component, case AR_TKN_U32_SUB_GRAPH_INSTANCE_ID: scontrol->sgid = le32_to_cpu(w_elem->value); break; + case AR_TKN_DAI_INDEX: + scontrol->graph_id = le32_to_cpu(w_elem->value); + break; default: /* ignore other tokens */ break; } @@ -718,6 +726,9 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component, w_elem++; } + scontrol->w = w; + list_add_tail(&scontrol->node, &data->widget_list); + return 0; } @@ -819,7 +830,10 @@ static int audioreach_widget_unload(struct snd_soc_component *scomp, if (w->id == snd_soc_dapm_mixer) { /* virtual widget */ - kfree(dobj->private); + struct snd_ar_control *scontrol = dobj->private; + + list_del(&scontrol->node); + kfree(scontrol); return 0; } @@ -998,6 +1012,9 @@ static int audioreach_control_load_mix(struct snd_soc_component *scomp, case AR_TKN_U32_SUB_GRAPH_INSTANCE_ID: scontrol->sgid = le32_to_cpu(c_elem->value); break; + case AR_TKN_DAI_INDEX: + scontrol->graph_id = le32_to_cpu(c_elem->value); + break; default: /* Ignore other tokens */ break; From patchwork Thu Oct 27 10:27:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11727 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp148801wru; Thu, 27 Oct 2022 03:30:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IGt2JEOpr1JjEd8UWvPoiJHBDx91H/dK3/xQBRhun8MzLfd93n/evwjL90Yph3aG60/QZ X-Received: by 2002:a63:5f03:0:b0:460:b08a:8c00 with SMTP id t3-20020a635f03000000b00460b08a8c00mr40637706pgb.142.1666866639262; Thu, 27 Oct 2022 03:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666866639; cv=none; d=google.com; s=arc-20160816; b=k0hkW7CX5Wnldgfj1BR0tLk9MMEO9CKD1VoCi/I/32SV9PJYpz5axnCu/j0+Jp7KdY uH68x/H9+OfQxs/lHnZU3gCQC8lBO2BbNvNI+CJeSTf7QEW86QyhOawsLAMoSL2wH+HP Gu4nl4Lt7hJaifAsw39/BqHCarzT1QxvqHpgprisswDqStK5b+fVbvwlfyaBQmin2ixC Ch73Tz8MufsVigUr1UrEctnydcYEOpPLB5WUkRxdplfTgUqhzG5yJfENhNFOFkWzMG7W KNZojaRuiwgcnHsqpE1kD2GaAiX+TPsaH0eyi6gzarujHIO9VBr+pF3YCH+SxFFHocQb QoRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FfnhQtT8IbHX8aHAZB8HBIRRc4/jhJkwfYXwNCCxfJU=; b=XQlawRcYwuDqvMst3XpaVYZjxH6qMpq6cA50PiVeuqfixtgD6nNZsiuGAcOGmHktrk YAdgNoKiKA6VVIqarzTPR1E7puL/PEGFQ61mSAgSPt6aQf0iGIGXrr5Itpn7ZMsOK3k8 uuMtQIDkY84r1SVgOa2Z0wGBou+cqfJtW38Z2kLsHOcX1AXCmUvrjr3qmJ+2kqtkOFG9 oHt7GiGOPaLHKJQzgxxiTtoDoMYWiE5+Rw/cRBJTn/Skzj5diezWWl4znmkd26n7RDPN VVGg52JA34XVBAgWkXjOJFb1uSJU53DTdkH0EoS5F+Gwy1kAZ+OzG0XsNx4Crf5yB3Xq 5rCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGla8Lg6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a17090ab94300b00205f1a25a31si1262925pjw.161.2022.10.27.03.30.18; Thu, 27 Oct 2022 03:30:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGla8Lg6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235457AbiJ0K2O (ORCPT + 99 others); Thu, 27 Oct 2022 06:28:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234665AbiJ0K1r (ORCPT ); Thu, 27 Oct 2022 06:27:47 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08EE6127438 for ; Thu, 27 Oct 2022 03:27:45 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id h9so1441147wrt.0 for ; Thu, 27 Oct 2022 03:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FfnhQtT8IbHX8aHAZB8HBIRRc4/jhJkwfYXwNCCxfJU=; b=YGla8Lg60N6TI9iOCJBv53DJ0gR5OpPNhFW24bTGYTp/kNoGwN76lNUwy0ulF5mz5q mO7I+IbKW8NMoA8q+lQMEAsQOz4FWBvmcYCe6JyMhrkobQtdgLw+0Na90OmZb3T/fvSm Yxyp/wOqMGzx0I6TjhwhQFkeimbWX1vYKbz7tH4YS9QIsddbCQArfvLmF2Yh7ZKAsXH5 ZoO0ZwoQVUJ9P4e67mCx1J0A+NlxcI3gWfIjtJyJNZDFfR0l0Xm3Hu62CZU32Npgmvm5 gnis3VhPkGN5jTTfZUFDm/Qs48DJv5BWBraN2ZytaetlUgnVp8KwxbnzD4kRcIU9Twke g+aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FfnhQtT8IbHX8aHAZB8HBIRRc4/jhJkwfYXwNCCxfJU=; b=j5M/Ja8uaWpAVAkpazx3uROg129AOyUyWAplL9Ijmr7IUQGElN9X5Pq3a0uIX1QEDX L43oGAnztDZcvojr0zB+fL2pNfAAET03RUfL+C0eOmbnh9VD9iooxhC425P1r8msurJx JxlqaoQXpXMF4rW/0rSRH+T0uPefZdSHt9Dogne7y8MCEAlB1c2socjiYSTs3E61uA3x /w4eBZUQiy3UDETaHrAP/nCLbLGXOsV8UulaUyoi3Kc5IVAUyNvCNinMsTRY8nd3jWvC djBKKlVE/4qCk4H2hsAzE6YK7t1qDymIO7hmSOXd3iijVKWb9qpSRhHe7QvBXfQSxY/V qejw== X-Gm-Message-State: ACrzQf3LnBlGcmxRfA1BLiLk+ARRqwUz0AHG+ZH4c6gCSiGFY9OdliK0 6Gyhc/wHPkS+8U0XHyl3zDNK6A== X-Received: by 2002:adf:e3cc:0:b0:235:95b1:2124 with SMTP id k12-20020adfe3cc000000b0023595b12124mr25947096wrm.693.1666866464495; Thu, 27 Oct 2022 03:27:44 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id fc7-20020a05600c524700b003b505d26776sm5088674wmb.5.2022.10.27.03.27.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:27:43 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 4/9] ASoC: qdsp6: audioreach: Simplify handing FE and BE graph connections Date: Thu, 27 Oct 2022 11:27:05 +0100 Message-Id: <20221027102710.21407-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> References: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747836353117899629?= X-GMAIL-MSGID: =?utf-8?q?1747836353117899629?= Current AudioReach design of connecting FE and BE graph is very complicated and not reliable. Instead used the virtual damp widgets private data to help identify the modules that needs connection at runtime. Also maintain a inter-graph connection info in the graph info, which can be used to both determine if the graphs are connected and at graph build time. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/audioreach.c | 88 +++++++------------------ sound/soc/qcom/qdsp6/audioreach.h | 20 ++---- sound/soc/qcom/qdsp6/q6apm.c | 83 +---------------------- sound/soc/qcom/qdsp6/q6apm.h | 5 -- sound/soc/qcom/qdsp6/topology.c | 105 ++++++++++++++++++++++++++---- 5 files changed, 127 insertions(+), 174 deletions(-) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index 01dac32c50fd..0015ec89d90b 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -332,63 +332,6 @@ static void apm_populate_module_prop_obj(struct apm_mod_prop_obj *obj, obj->prop_id_port.max_op_port = module->max_op_port; } -struct audioreach_module *audioreach_get_container_last_module( - struct audioreach_container *container) -{ - struct audioreach_module *module; - - list_for_each_entry(module, &container->modules_list, node) { - if (module->dst_mod_inst_id == 0) - return module; - } - - return NULL; -} -EXPORT_SYMBOL_GPL(audioreach_get_container_last_module); - -static bool is_module_in_container(struct audioreach_container *container, int module_iid) -{ - struct audioreach_module *module; - - list_for_each_entry(module, &container->modules_list, node) { - if (module->instance_id == module_iid) - return true; - } - - return false; -} - -struct audioreach_module *audioreach_get_container_first_module( - struct audioreach_container *container) -{ - struct audioreach_module *module; - - /* get the first module from both connected or un-connected containers */ - list_for_each_entry(module, &container->modules_list, node) { - if (module->src_mod_inst_id == 0 || - !is_module_in_container(container, module->src_mod_inst_id)) - return module; - } - return NULL; -} -EXPORT_SYMBOL_GPL(audioreach_get_container_first_module); - -struct audioreach_module *audioreach_get_container_next_module( - struct audioreach_container *container, - struct audioreach_module *module) -{ - int nmodule_iid = module->dst_mod_inst_id; - struct audioreach_module *nmodule; - - list_for_each_entry(nmodule, &container->modules_list, node) { - if (nmodule->instance_id == nmodule_iid) - return nmodule; - } - - return NULL; -} -EXPORT_SYMBOL_GPL(audioreach_get_container_next_module); - static void apm_populate_module_list_obj(struct apm_mod_list_obj *obj, struct audioreach_container *container, int sub_graph_id) @@ -400,14 +343,15 @@ static void apm_populate_module_list_obj(struct apm_mod_list_obj *obj, obj->container_id = container->container_id; obj->num_modules = container->num_modules; i = 0; - list_for_each_container_module(module, container) { + list_for_each_entry(module, &container->modules_list, node) { obj->mod_cfg[i].module_id = module->module_id; obj->mod_cfg[i].instance_id = module->instance_id; i++; } } -static void audioreach_populate_graph(struct apm_graph_open_params *open, +static void audioreach_populate_graph(struct q6apm *apm, struct audioreach_graph_info *info, + struct apm_graph_open_params *open, struct list_head *sg_list, int num_sub_graphs) { @@ -428,6 +372,16 @@ static void audioreach_populate_graph(struct apm_graph_open_params *open, mlobj = &ml_data->mod_list_obj[0]; + + if (info->dst_mod_inst_id && info->src_mod_inst_id) { + conn_obj = &mc_data->conn_obj[nconn]; + conn_obj->src_mod_inst_id = info->src_mod_inst_id; + conn_obj->src_mod_op_port_id = info->src_mod_op_port_id; + conn_obj->dst_mod_inst_id = info->dst_mod_inst_id; + conn_obj->dst_mod_ip_port_id = info->dst_mod_ip_port_id; + nconn++; + } + list_for_each_entry(sg, sg_list, node) { struct apm_sub_graph_data *sg_cfg = &sg_data->sg_cfg[i++]; @@ -439,7 +393,7 @@ static void audioreach_populate_graph(struct apm_graph_open_params *open, apm_populate_container_config(cobj, container); apm_populate_module_list_obj(mlobj, container, sg->sub_graph_id); - list_for_each_container_module(module, container) { + list_for_each_entry(module, &container->modules_list, node) { uint32_t src_mod_inst_id; src_mod_inst_id = module->src_mod_inst_id; @@ -462,7 +416,7 @@ static void audioreach_populate_graph(struct apm_graph_open_params *open, } } -void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct list_head *sg_list, int graph_id) +void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info *info) { int payload_size, sg_sz, cont_sz, ml_sz, mp_sz, mc_sz; struct apm_module_param_data *param_data; @@ -475,6 +429,7 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct list_head *sg_list, i struct audioreach_module *module; struct audioreach_sub_graph *sgs; struct apm_mod_list_obj *mlobj; + struct list_head *sg_list; int num_modules_per_list; int num_connections = 0; int num_containers = 0; @@ -484,12 +439,19 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct list_head *sg_list, i struct gpr_pkt *pkt; void *p; + sg_list = &info->sg_list; + ml_sz = 0; + + /* add FE-BE connections */ + if (info->dst_mod_inst_id && info->src_mod_inst_id) + num_connections++; + list_for_each_entry(sgs, sg_list, node) { num_sub_graphs++; list_for_each_entry(container, &sgs->container_list, node) { num_containers++; num_modules += container->num_modules; - list_for_each_container_module(module, container) { + list_for_each_entry(module, &container->modules_list, node) { if (module->src_mod_inst_id) num_connections++; } @@ -557,7 +519,7 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct list_head *sg_list, i params.mod_conn_list_data->num_connections = num_connections; p += mc_sz; - audioreach_populate_graph(¶ms, sg_list, num_sub_graphs); + audioreach_populate_graph(apm, info, ¶ms, sg_list, num_sub_graphs); return pkt; } diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index 36779ad1952d..1dc6ffcb3362 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -595,6 +595,11 @@ struct audioreach_graph_info { int id; uint32_t num_sub_graphs; struct list_head sg_list; + /* DPCM connection from FE Graph to BE graph */ + uint32_t src_mod_inst_id; + uint32_t src_mod_op_port_id; + uint32_t dst_mod_inst_id; + uint32_t dst_mod_ip_port_id; }; struct audioreach_sub_graph { @@ -693,9 +698,8 @@ void *audioreach_alloc_apm_pkt(int pkt_size, uint32_t opcode, uint32_t token, void *audioreach_alloc_pkt(int payload_size, uint32_t opcode, uint32_t token, uint32_t src_port, uint32_t dest_port); -void *audioreach_alloc_graph_pkt(struct q6apm *apm, - struct list_head *sg_list, - int graph_id); +void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info + *info); /* Topology specific */ int audioreach_tplg_init(struct snd_soc_component *component); @@ -716,14 +720,4 @@ int audioreach_set_media_format(struct q6apm_graph *graph, int audioreach_shared_memory_send_eos(struct q6apm_graph *graph); int audioreach_gain_set_vol_ctrl(struct q6apm *apm, struct audioreach_module *module, int vol); -struct audioreach_module *audioreach_get_container_last_module( - struct audioreach_container *container); -struct audioreach_module *audioreach_get_container_first_module( - struct audioreach_container *container); -struct audioreach_module *audioreach_get_container_next_module( - struct audioreach_container *container, - struct audioreach_module *module); -#define list_for_each_container_module(mod, cont) \ - for (mod = audioreach_get_container_first_module(cont); mod != NULL; \ - mod = audioreach_get_container_next_module(cont, mod)) #endif /* __AUDIOREACH_H__ */ diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index 81e2d7090fb4..5beb898f28f5 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -63,7 +63,7 @@ static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, ui graph->info = info; graph->id = graph_id; - graph->graph = audioreach_alloc_graph_pkt(apm, &info->sg_list, graph_id); + graph->graph = audioreach_alloc_graph_pkt(apm, info); if (IS_ERR(graph->graph)) { void *err = graph->graph; @@ -178,87 +178,6 @@ static struct audioreach_module *__q6apm_find_module_by_mid(struct q6apm *apm, return NULL; } -static struct audioreach_module *q6apm_graph_get_last_module(struct q6apm *apm, u32 sgid) -{ - struct audioreach_container *container; - struct audioreach_module *module; - struct audioreach_sub_graph *sg; - - mutex_lock(&apm->lock); - sg = idr_find(&apm->sub_graphs_idr, sgid); - mutex_unlock(&apm->lock); - if (!sg) - return NULL; - - container = list_last_entry(&sg->container_list, struct audioreach_container, node); - module = audioreach_get_container_last_module(container); - - return module; -} - -static struct audioreach_module *q6apm_graph_get_first_module(struct q6apm *apm, u32 sgid) -{ - struct audioreach_container *container; - struct audioreach_module *module; - struct audioreach_sub_graph *sg; - - mutex_lock(&apm->lock); - sg = idr_find(&apm->sub_graphs_idr, sgid); - mutex_unlock(&apm->lock); - if (!sg) - return NULL; - - container = list_first_entry(&sg->container_list, struct audioreach_container, node); - module = audioreach_get_container_first_module(container); - - return module; -} - -bool q6apm_is_sub_graphs_connected(struct q6apm *apm, u32 src_sgid, u32 dst_sgid) -{ - struct audioreach_module *module; - u32 iid; - - module = q6apm_graph_get_last_module(apm, src_sgid); - if (!module) - return false; - - iid = module->instance_id; - module = q6apm_graph_get_first_module(apm, dst_sgid); - if (!module) - return false; - - if (module->src_mod_inst_id == iid) - return true; - - return false; -} - -int q6apm_connect_sub_graphs(struct q6apm *apm, u32 src_sgid, u32 dst_sgid, bool connect) -{ - struct audioreach_module *module; - u32 iid; - - if (connect) { - module = q6apm_graph_get_last_module(apm, src_sgid); - if (!module) - return -ENODEV; - - iid = module->instance_id; - } else { - iid = 0; - } - - module = q6apm_graph_get_first_module(apm, dst_sgid); - if (!module) - return -ENODEV; - - /* set src module in dst subgraph first module */ - module->src_mod_inst_id = iid; - - return 0; -} - int q6apm_graph_media_format_shmem(struct q6apm_graph *graph, struct audioreach_module_config *cfg) { diff --git a/sound/soc/qcom/qdsp6/q6apm.h b/sound/soc/qcom/qdsp6/q6apm.h index 96ad5ea2ae07..273f97812741 100644 --- a/sound/soc/qcom/qdsp6/q6apm.h +++ b/sound/soc/qcom/qdsp6/q6apm.h @@ -142,12 +142,7 @@ int q6apm_send_cmd_sync(struct q6apm *apm, struct gpr_pkt *pkt, /* Callback for graph specific */ struct audioreach_module *q6apm_find_module_by_mid(struct q6apm_graph *graph, uint32_t mid); - void q6apm_set_fe_dai_ops(struct snd_soc_dai_driver *dai_drv); -int q6apm_connect_sub_graphs(struct q6apm *apm, u32 src_sgid, u32 dst_sgid, - bool connect); -bool q6apm_is_sub_graphs_connected(struct q6apm *apm, u32 src_sgid, - u32 dst_sgid); int q6apm_graph_get_rx_shmem_module_iid(struct q6apm_graph *graph); #endif /* __APM_GRAPH_ */ diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c index 0c4886d30131..f66d7054177c 100644 --- a/sound/soc/qcom/qdsp6/topology.c +++ b/sound/soc/qcom/qdsp6/topology.c @@ -872,7 +872,21 @@ static int audioreach_widget_unload(struct snd_soc_component *scomp, return 0; } -static struct audioreach_module *audioreach_find_widget(struct snd_soc_component *comp, +static struct snd_ar_control *audioreach_find_widget(struct snd_soc_component *comp, + const char *name) +{ + struct q6apm *apm = dev_get_drvdata(comp->dev); + struct snd_ar_control *control; + + list_for_each_entry(control, &apm->widget_list, node) { + if (control->w && !strcmp(name, control->w->name)) + return control; + } + + return NULL; +} + +static struct audioreach_module *audioreach_find_module(struct snd_soc_component *comp, const char *name) { struct q6apm *apm = dev_get_drvdata(comp->dev); @@ -890,14 +904,41 @@ static struct audioreach_module *audioreach_find_widget(struct snd_soc_component static int audioreach_route_load(struct snd_soc_component *scomp, int index, struct snd_soc_dapm_route *route) { - struct audioreach_module *src, *sink; - - src = audioreach_find_widget(scomp, route->source); - sink = audioreach_find_widget(scomp, route->sink); + struct audioreach_module *src_module, *sink_module; + struct snd_ar_control *control; + struct snd_soc_dapm_widget *w; + int i; + + /* check if these are actual modules */ + src_module = audioreach_find_module(scomp, route->source); + sink_module = audioreach_find_module(scomp, route->sink); + + if (sink_module && !src_module) { + control = audioreach_find_widget(scomp, route->source); + if (control) + control->module_instance_id = sink_module->instance_id; + + } else if (!sink_module && src_module && route->control) { + /* check if this is a virtual mixer */ + control = audioreach_find_widget(scomp, route->sink); + if (!control || !control->w) + return 0; + + w = control->w; + + for (i = 0; i < w->num_kcontrols; i++) { + if (!strcmp(route->control, w->kcontrol_news[i].name)) { + struct soc_mixer_control *sm; + struct snd_soc_dobj *dobj; + struct snd_ar_control *scontrol; + + sm = (struct soc_mixer_control *)w->kcontrol_news[i].private_value; + dobj = &sm->dobj; + scontrol = dobj->private; + scontrol->module_instance_id = src_module->instance_id; + } + } - if (src && sink) { - src->dst_mod_inst_id = sink->instance_id; - sink->src_mod_inst_id = src->instance_id; } return 0; @@ -928,6 +969,48 @@ static int audioreach_link_load(struct snd_soc_component *component, int index, return 0; } +static void audioreach_connect_sub_graphs(struct q6apm *apm, + struct snd_ar_control *m1, + struct snd_ar_control *m2, + bool connect) +{ + struct audioreach_graph_info *info; + + mutex_lock(&apm->lock); + info = idr_find(&apm->graph_info_idr, m2->graph_id); + mutex_unlock(&apm->lock); + + if (connect) { + info->src_mod_inst_id = m1->module_instance_id; + info->src_mod_op_port_id = 1; + info->dst_mod_inst_id = m2->module_instance_id; + info->dst_mod_ip_port_id = 2; + + } else { + info->src_mod_inst_id = 0; + info->src_mod_op_port_id = 0; + info->dst_mod_inst_id = 0; + info->dst_mod_ip_port_id = 0; + } +} + +static bool audioreach_is_vmixer_connected(struct q6apm *apm, + struct snd_ar_control *m1, + struct snd_ar_control *m2) +{ + struct audioreach_graph_info *info; + + mutex_lock(&apm->lock); + info = idr_find(&apm->graph_info_idr, m2->graph_id); + mutex_unlock(&apm->lock); + + if (info->dst_mod_inst_id == m2->module_instance_id && + info->src_mod_inst_id == m1->module_instance_id) + return true; + + return false; +} + static int audioreach_get_audio_mixer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { @@ -940,7 +1023,7 @@ static int audioreach_get_audio_mixer(struct snd_kcontrol *kcontrol, struct q6apm *data = dev_get_drvdata(c->dev); bool connected; - connected = q6apm_is_sub_graphs_connected(data, scontrol->sgid, dapm_scontrol->sgid); + connected = audioreach_is_vmixer_connected(data, scontrol, dapm_scontrol); if (connected) ucontrol->value.integer.value[0] = 1; else @@ -961,10 +1044,10 @@ static int audioreach_put_audio_mixer(struct snd_kcontrol *kcontrol, struct q6apm *data = dev_get_drvdata(c->dev); if (ucontrol->value.integer.value[0]) { - q6apm_connect_sub_graphs(data, scontrol->sgid, dapm_scontrol->sgid, true); + audioreach_connect_sub_graphs(data, scontrol, dapm_scontrol, true); snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, NULL); } else { - q6apm_connect_sub_graphs(data, scontrol->sgid, dapm_scontrol->sgid, false); + audioreach_connect_sub_graphs(data, scontrol, dapm_scontrol, false); snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, NULL); } return 0; From patchwork Thu Oct 27 10:27:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11728 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp148847wru; Thu, 27 Oct 2022 03:30:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM607adatgeBBDk/qjyd7mH/X8yIiug61rt686/N00Jnft4Zr5XQtRdqmFslZQv0BksCVrOT X-Received: by 2002:a63:7304:0:b0:46a:faa5:700f with SMTP id o4-20020a637304000000b0046afaa5700fmr42727268pgc.253.1666866645352; Thu, 27 Oct 2022 03:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666866645; cv=none; d=google.com; s=arc-20160816; b=QycpPY7/FFe3DYjJo96crVZIL13AGaH7/gJVZ+wdMnIXLtmvvYHD6J3jjgKJpqzGaW u95fNu4kYuCqa+PsUsqFxubevPF3aEw+VGP9I+HKoNLNwyv4SjeaGXsVmYh7Vrv7en0K 4PcuLdvfECzT5jC6dLk7nJyCQUpbMabti3p+QZAT5DT5fxXSJW9i9yWA2EfuY518V9U6 0C87uVnSqYA7SaKgmYHZpp2zAIyXzMgfOkUe3IULvJJ0vw/jwToqAO6NY5l11MueKgU1 +QxU0P1Kx4q4H4zg2qVbdz5CBqwMNv4lPxyPD3JJWuB2BgYAOoP/vfzQQLWbu7hCOiQk x3KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8PzGOU3cHi3C/xmeEh0jzvedpAW9sTnCtCJCz/dvKXw=; b=Ax8Y7wYt9A+15P0hM87vHwgJVwMsWcjiPGTmDTt0vyEJD32F6flVYw9vAbLLOXDTAo rCngf3D6WmNn4OEXn6KupV4iIPMMMkqhEoB5JlSJil/KXkfF7K7cTqpgGHQiw3aMg13P czPn6YwbOYvRFztDyv8MThPcrdNTNHvslwtVF7V7zzq+obfBExhMr0XoPQXciHO3IxB6 y/QhBPLAqX82SVi0gqEuKou1C52P5sP7TUZ9n3oMcORoALFKsq00pH5oU+/1ne9Wk0W5 Y89MVn+V3XnX+L3rUpganYhCgJF3Ob4Q1VL0I1uR8DE4Hynn+b8LySWH4FbbObP6gD5G HhVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kmV7eRAw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a170902a38200b001869c035f20si999748pla.381.2022.10.27.03.30.31; Thu, 27 Oct 2022 03:30:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kmV7eRAw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235472AbiJ0K2T (ORCPT + 99 others); Thu, 27 Oct 2022 06:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230441AbiJ0K1s (ORCPT ); Thu, 27 Oct 2022 06:27:48 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 338C4E0981 for ; Thu, 27 Oct 2022 03:27:47 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id v1so1369472wrt.11 for ; Thu, 27 Oct 2022 03:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8PzGOU3cHi3C/xmeEh0jzvedpAW9sTnCtCJCz/dvKXw=; b=kmV7eRAwmX8oQYf73+tBJXu8eVBs3MEay0gi6/jZolwjNmntD04cdJrbfmVKBYB+CV r9lpGwwm2qZhvgMLWHLMc2LbSjONA7zBfHof42h3Ri4DgnMaRT06/ORl+SYOupi+jfdP 4m+yh8AiGtfzvWMiqzIGXu1hDGRWKy/qPaNZ2a9CYqZjyAFczd+78pW0rX+32BrYBmf3 ql+5TjspKrIkVn79k35TiRprdY9j5r22rErgkm0pksOT7htanoBuY+mnodh+ZgAutGrL zYj4tjKGrjebdTjxzsvzUNrAo/7IXblaM3iPc8u3iq6SuS2wChxQDx9Lvi87SLE7HZEp f+qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8PzGOU3cHi3C/xmeEh0jzvedpAW9sTnCtCJCz/dvKXw=; b=kU1kB53aTk1UFe8YiumCuP7bhkOJvqM5gi+YKB0Yg08zsJDOjVjjViaKQma8UJ96Gn sHHPaAviH/b/l3YtbvnPiKZknHTkywTFwMA7dO2uzmHBFj0pqalrvi93v511YPmiRFbe xllegd4C8T38065obDwdkT6jVV7g0qQl57wk6vHM0jkYMjquoc6F8dj0wooxo9otWxAe EZPtTVGBlC94PbJeNhBy6ThssRQ03ihq6Qn3zyGVp/2FyxMvCHiiyO4fpQVVvCWgb4qS kqW1XGUYZzNA26IBpeOzu622zt88uUkK9c9n1ikDzviMLMSwdsnw4/I7NCED7fmbAo2M RN3A== X-Gm-Message-State: ACrzQf3cA/rrhaYyDDTZsowRSg02AfLgopck97AqpSg6VkE+FCO7VQXM jPTrrPcXsMljmV4w+CPBeD069O5VaktADA== X-Received: by 2002:a5d:5988:0:b0:236:6e28:a493 with SMTP id n8-20020a5d5988000000b002366e28a493mr14754569wri.66.1666866465783; Thu, 27 Oct 2022 03:27:45 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id fc7-20020a05600c524700b003b505d26776sm5088674wmb.5.2022.10.27.03.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:27:44 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 5/9] ASoC: qdsp6: audioreach: simplify module_list sz calculation Date: Thu, 27 Oct 2022 11:27:06 +0100 Message-Id: <20221027102710.21407-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> References: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747836359569281617?= X-GMAIL-MSGID: =?utf-8?q?1747836359569281617?= Simplify module_list size calculation by doing inside modules loop. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/audioreach.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index 0015ec89d90b..87a3fd1f8107 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -430,7 +430,6 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info struct audioreach_sub_graph *sgs; struct apm_mod_list_obj *mlobj; struct list_head *sg_list; - int num_modules_per_list; int num_connections = 0; int num_containers = 0; int num_sub_graphs = 0; @@ -451,6 +450,9 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info list_for_each_entry(container, &sgs->container_list, node) { num_containers++; num_modules += container->num_modules; + ml_sz = ml_sz + sizeof(struct apm_module_list_params) + + APM_MOD_LIST_OBJ_PSIZE(mlobj, container->num_modules); + list_for_each_entry(module, &container->modules_list, node) { if (module->src_mod_inst_id) num_connections++; @@ -459,11 +461,11 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info } num_modules_list = num_containers; - num_modules_per_list = num_modules/num_containers; sg_sz = APM_SUB_GRAPH_PSIZE(sg_params, num_sub_graphs); cont_sz = APM_CONTAINER_PSIZE(cont_params, num_containers); - ml_sz = ALIGN(sizeof(struct apm_module_list_params) + - num_modules_list * APM_MOD_LIST_OBJ_PSIZE(mlobj, num_modules_per_list), 8); + + ml_sz = ALIGN(ml_sz, 8); + mp_sz = APM_MOD_PROP_PSIZE(mprop, num_modules); mc_sz = APM_MOD_CONN_PSIZE(mcon, num_connections); From patchwork Thu Oct 27 10:27:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp148884wru; Thu, 27 Oct 2022 03:30:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5TNSCYyJkmYoNYT9MAqiRzsnBRtktrPufUTyCYyTw6p93iBRs210F2iM0duwud51p8lUri X-Received: by 2002:aa7:91c5:0:b0:56b:e2db:5b75 with SMTP id z5-20020aa791c5000000b0056be2db5b75mr18922394pfa.73.1666866649979; Thu, 27 Oct 2022 03:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666866649; cv=none; d=google.com; s=arc-20160816; b=YyrGWRHZ6L8O6D+SZLdhRxkYrTH2E1cibjqMtxH4IhxhLFBSA4RDDyUDN4VgL4Ujn0 VYnxV+Fm13D9iSMY+XMuM1yRzU8vY2hzOc4zwPeAg7dJUrzrtzL7wNysZYaRnG2wwtA3 PL7kRJ8b7DZAkGVmN/+alT6+jIytnE3ZqQ3TvjocDImgg3USnZdcIySrGC3Dd40SrMo7 T7KqHMDe/1YQQv2JfCAcl4ss3BMqWEloQ+2JxRBZqp2P1amoZ4SBsW/nviM8q/oi0JyS //P5/3LCBsSGWjeaVTeJI+sPz85ujtyUbCEtZSKTjc6Scp1rhxEBMDW/AzNtP5aI3ZwP rojw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Gp+qeqYpAUBfqq9AAv/QE5uuGw4jREIuhh6ZeuCDwSI=; b=RW6zGQEXfTS763EzqkOqu4502qfjpmfJF73gpF0paT6ky/mcSpSObu3IVebFBw+1US nUFg5xKSvnZg+Am9g9iaZBwlce5KhRYMMhMY/FFOSc6RDOGQLC7glCL5jV83APKv1D35 /TQqjSXK6OrnvSkz+Ydhj+/le0TwjFWD4cU32zXfMn5t11AQGxRKLHvK17KFUsofaHqL xRuB228ms1HR7/mKpjd3lAasSdNDbpimdumqudWS/Geww8WXAj0XFJ3D+skk0hPXHTxi mwiX0VbNh+q2T2+IuWt0q/lt3A9ish0sNPW1DX/G4Z0Qr9tY9GUkbjz8Yr2nH/NpT2aV kThA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tSQnRemX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z72-20020a63334b000000b0046ef3a94264si1353399pgz.13.2022.10.27.03.30.36; Thu, 27 Oct 2022 03:30:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tSQnRemX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235483AbiJ0K2W (ORCPT + 99 others); Thu, 27 Oct 2022 06:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235081AbiJ0K1u (ORCPT ); Thu, 27 Oct 2022 06:27:50 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88BDCEB751 for ; Thu, 27 Oct 2022 03:27:48 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 14-20020a05600c228e00b003cf4eaef74eso1722965wmf.0 for ; Thu, 27 Oct 2022 03:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Gp+qeqYpAUBfqq9AAv/QE5uuGw4jREIuhh6ZeuCDwSI=; b=tSQnRemXI46oIS3dmvkmIn+nigjaHOop9TSov+MmCb7R90FnPGXOkLEpw9/MztZTtx xpMx/Iq6hRePD0RorCoUaMULt3rAett4vJYNH7TA4cALOzoSNcXdTjoT1KDZhO2J/Mpx xY3h+BEZL81Ge+/FOGR7FmvjCa9RkMoDVMcZqn6meytpeWSAWYVUbGk78lQtJr8Vr9EN JCMkhWxhah/R/jx/sm0BDLFNUnD5FvvYQ5bK1U3/vAd0d0Qe4UUgjNz5S8YGuEMurn86 Y+M7exXXP8KFHN4pTM1nQ0PKUfp9o+8r5WbICc+da9NiuZPcHZ9lubZ6+hlCdu8CEAp9 nBPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gp+qeqYpAUBfqq9AAv/QE5uuGw4jREIuhh6ZeuCDwSI=; b=yBn00NDS0FXZaHhMygqA87HcZVwJnmfWj9m944SISHmQNN3vFu6iCBdSgsNhC/mngF xwbZhXXFjiZNbL3FfLv/YgEesdROHmOqxfbccRoUZvfYa99CfDuM38R4Itn9u6FHZaeg Q8GDDjl2uYHt/Z/gzWXPbQfF/JsfvYzi1MUAMIV6IOSTC0PdWnkWO6wWo+hFM9sLkgsv tX992y52eeMvxGtCe78H7nDcpzwDmLzw0YtM1SiatGVef3t4NUI442YBoNvwIAvvBzfK dBBkLonOSgk3jMKWQJz3TCAPLea3g2SvVvmfvH5/irOBROSIn2D913V4JQQQVGhVuUEa Pc+w== X-Gm-Message-State: ACrzQf3yM1mAW5CebHJyjDYq/ryH3Q0ir90/deAZZp2Ee8e6Z2NNHnl6 ey/QATSCMOkJXrBgCJF9goVOSA== X-Received: by 2002:a05:600c:310b:b0:3cf:33c4:bc7 with SMTP id g11-20020a05600c310b00b003cf33c40bc7mr5402758wmo.25.1666866467001; Thu, 27 Oct 2022 03:27:47 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id fc7-20020a05600c524700b003b505d26776sm5088674wmb.5.2022.10.27.03.27.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:27:46 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 6/9] ASoC: qdsp6: audioreach: add support for more port connections Date: Thu, 27 Oct 2022 11:27:07 +0100 Message-Id: <20221027102710.21407-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> References: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747836364011150295?= X-GMAIL-MSGID: =?utf-8?q?1747836364011150295?= AudioReach Modules can connect to other modules using source and destination port, and each module in theory can support up to 255 port connections. But in practice this limit is at max 8 ports at a time. So add support for allowing multiple port connections. This support is needed for more detailed graphs like ECNS, speaker protection and so. Signed-off-by: Srinivas Kandagatla --- include/uapi/sound/snd_ar_tokens.h | 27 ++++++++ sound/soc/qcom/qdsp6/audioreach.c | 44 ++++++------ sound/soc/qcom/qdsp6/audioreach.h | 9 ++- sound/soc/qcom/qdsp6/topology.c | 103 +++++++++++++++++++++++++---- 4 files changed, 144 insertions(+), 39 deletions(-) diff --git a/include/uapi/sound/snd_ar_tokens.h b/include/uapi/sound/snd_ar_tokens.h index 440c0725660b..b9b9093b4396 100644 --- a/include/uapi/sound/snd_ar_tokens.h +++ b/include/uapi/sound/snd_ar_tokens.h @@ -191,6 +191,33 @@ enum ar_event_types { #define AR_TKN_U32_MODULE_SRC_INSTANCE_ID 208 #define AR_TKN_U32_MODULE_DST_INSTANCE_ID 209 +#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID1 210 +#define AR_TKN_U32_MODULE_DST_IN_PORT_ID1 211 +#define AR_TKN_U32_MODULE_DST_INSTANCE_ID1 212 + +#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID2 213 +#define AR_TKN_U32_MODULE_DST_IN_PORT_ID2 214 +#define AR_TKN_U32_MODULE_DST_INSTANCE_ID2 215 + +#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID3 216 +#define AR_TKN_U32_MODULE_DST_IN_PORT_ID3 217 +#define AR_TKN_U32_MODULE_DST_INSTANCE_ID3 218 + +#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID4 219 +#define AR_TKN_U32_MODULE_DST_IN_PORT_ID4 220 +#define AR_TKN_U32_MODULE_DST_INSTANCE_ID4 221 + +#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID5 222 +#define AR_TKN_U32_MODULE_DST_IN_PORT_ID5 223 +#define AR_TKN_U32_MODULE_DST_INSTANCE_ID5 224 + +#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID6 225 +#define AR_TKN_U32_MODULE_DST_IN_PORT_ID6 226 +#define AR_TKN_U32_MODULE_DST_INSTANCE_ID6 227 + +#define AR_TKN_U32_MODULE_SRC_OP_PORT_ID7 228 +#define AR_TKN_U32_MODULE_DST_IN_PORT_ID7 229 +#define AR_TKN_U32_MODULE_DST_INSTANCE_ID7 230 #define AR_TKN_U32_MODULE_HW_IF_IDX 250 #define AR_TKN_U32_MODULE_HW_IF_TYPE 251 diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index 87a3fd1f8107..99cade6d8a48 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -311,15 +311,6 @@ static void apm_populate_sub_graph_config(struct apm_sub_graph_data *cfg, cfg->sid.scenario_id = sg->scenario_id; } -static void apm_populate_connection_obj(struct apm_module_conn_obj *obj, - struct audioreach_module *module) -{ - obj->src_mod_inst_id = module->src_mod_inst_id; - obj->src_mod_op_port_id = module->src_mod_op_port_id; - obj->dst_mod_inst_id = module->instance_id; - obj->dst_mod_ip_port_id = module->in_port; -} - static void apm_populate_module_prop_obj(struct apm_mod_prop_obj *obj, struct audioreach_module *module) { @@ -394,22 +385,30 @@ static void audioreach_populate_graph(struct q6apm *apm, struct audioreach_graph apm_populate_module_list_obj(mlobj, container, sg->sub_graph_id); list_for_each_entry(module, &container->modules_list, node) { - uint32_t src_mod_inst_id; + int pn; - src_mod_inst_id = module->src_mod_inst_id; - - module_prop_obj = &mp_data->mod_prop_obj[nmodule]; + module_prop_obj = &mp_data->mod_prop_obj[nmodule++]; apm_populate_module_prop_obj(module_prop_obj, module); - if (src_mod_inst_id) { - conn_obj = &mc_data->conn_obj[nconn]; - apm_populate_connection_obj(conn_obj, module); - nconn++; + if (!module->max_op_port) + continue; + + for (pn = 0; pn < module->max_op_port; pn++) { + if (module->dst_mod_inst_id[pn]) { + conn_obj = &mc_data->conn_obj[nconn]; + conn_obj->src_mod_inst_id = module->instance_id; + conn_obj->src_mod_op_port_id = + module->src_mod_op_port_id[pn]; + conn_obj->dst_mod_inst_id = + module->dst_mod_inst_id[pn]; + conn_obj->dst_mod_ip_port_id = + module->dst_mod_ip_port_id[pn]; + nconn++; + } } - - nmodule++; } - mlobj = (void *) mlobj + APM_MOD_LIST_OBJ_PSIZE(mlobj, container->num_modules); + mlobj = (void *) mlobj + APM_MOD_LIST_OBJ_PSIZE(mlobj, + container->num_modules); ncontainer++; } @@ -454,8 +453,7 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info APM_MOD_LIST_OBJ_PSIZE(mlobj, container->num_modules); list_for_each_entry(module, &container->modules_list, node) { - if (module->src_mod_inst_id) - num_connections++; + num_connections += module->num_connections; } } } @@ -500,7 +498,7 @@ void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct audioreach_graph_info param_data->module_instance_id = APM_MODULE_INSTANCE_ID; param_data->param_id = APM_PARAM_ID_MODULE_LIST; param_data->param_size = ml_sz - APM_MODULE_PARAM_DATA_SIZE; - params.mod_list_data->num_modules_list = num_sub_graphs; + params.mod_list_data->num_modules_list = num_modules_list; p += ml_sz; /* Module Properties */ diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index 1dc6ffcb3362..df5026b646c1 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -627,6 +627,8 @@ struct audioreach_container { struct audioreach_sub_graph *sub_graph; }; +#define AR_MAX_MOD_LINKS 8 + struct audioreach_module { uint32_t module_id; uint32_t instance_id; @@ -637,11 +639,12 @@ struct audioreach_module { uint32_t in_port; uint32_t out_port; + uint32_t num_connections; /* Connections */ uint32_t src_mod_inst_id; - uint32_t src_mod_op_port_id; - uint32_t dst_mod_inst_id; - uint32_t dst_mod_ip_port_id; + uint32_t src_mod_op_port_id[AR_MAX_MOD_LINKS]; + uint32_t dst_mod_inst_id[AR_MAX_MOD_LINKS]; + uint32_t dst_mod_ip_port_id[AR_MAX_MOD_LINKS]; /* Format specifics */ uint32_t ch_fmt; diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c index f66d7054177c..cccc59b570b9 100644 --- a/sound/soc/qcom/qdsp6/topology.c +++ b/sound/soc/qcom/qdsp6/topology.c @@ -412,19 +412,25 @@ static struct audioreach_module *audioreach_parse_common_tokens(struct q6apm *ap struct snd_soc_dapm_widget *w) { uint32_t max_ip_port = 0, max_op_port = 0, in_port = 0, out_port = 0; - uint32_t src_mod_inst_id = 0, src_mod_op_port_id = 0; - uint32_t dst_mod_inst_id = 0, dst_mod_ip_port_id = 0; + uint32_t src_mod_op_port_id[AR_MAX_MOD_LINKS] = { 0, }; + uint32_t dst_mod_inst_id[AR_MAX_MOD_LINKS] = { 0, }; + uint32_t dst_mod_ip_port_id[AR_MAX_MOD_LINKS] = { 0, }; + uint32_t src_mod_inst_id = 0; + int module_id = 0, instance_id = 0, tkn_count = 0; struct snd_soc_tplg_vendor_value_elem *mod_elem; struct snd_soc_tplg_vendor_array *mod_array; struct audioreach_module *mod = NULL; + uint32_t token; bool found; + int max_tokens; mod_array = audioreach_get_module_array(private); mod_elem = mod_array->value; - - while (tkn_count <= (le32_to_cpu(mod_array->num_elems) - 1)) { - switch (le32_to_cpu(mod_elem->token)) { + max_tokens = le32_to_cpu(mod_array->num_elems); + while (tkn_count <= (max_tokens - 1)) { + token = le32_to_cpu(mod_elem->token); + switch (token) { /* common module info */ case AR_TKN_U32_MODULE_ID: module_id = le32_to_cpu(mod_elem->value); @@ -454,17 +460,80 @@ static struct audioreach_module *audioreach_parse_common_tokens(struct q6apm *ap case AR_TKN_U32_MODULE_OUT_PORTS: out_port = le32_to_cpu(mod_elem->value); break; - case AR_TKN_U32_MODULE_SRC_OP_PORT_ID: - src_mod_op_port_id = le32_to_cpu(mod_elem->value); - break; case AR_TKN_U32_MODULE_SRC_INSTANCE_ID: src_mod_inst_id = le32_to_cpu(mod_elem->value); break; + case AR_TKN_U32_MODULE_SRC_OP_PORT_ID: + src_mod_op_port_id[0] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_SRC_OP_PORT_ID1: + src_mod_op_port_id[1] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_SRC_OP_PORT_ID2: + src_mod_op_port_id[2] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_SRC_OP_PORT_ID3: + src_mod_op_port_id[3] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_SRC_OP_PORT_ID4: + src_mod_op_port_id[4] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_SRC_OP_PORT_ID5: + src_mod_op_port_id[5] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_SRC_OP_PORT_ID6: + src_mod_op_port_id[6] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_SRC_OP_PORT_ID7: + src_mod_op_port_id[7] = le32_to_cpu(mod_elem->value); + break; case AR_TKN_U32_MODULE_DST_INSTANCE_ID: - dst_mod_inst_id = le32_to_cpu(mod_elem->value); + dst_mod_inst_id[0] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_INSTANCE_ID1: + dst_mod_inst_id[1] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_INSTANCE_ID2: + dst_mod_inst_id[2] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_INSTANCE_ID3: + dst_mod_inst_id[3] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_INSTANCE_ID4: + dst_mod_inst_id[4] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_INSTANCE_ID5: + dst_mod_inst_id[5] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_INSTANCE_ID6: + dst_mod_inst_id[6] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_INSTANCE_ID7: + dst_mod_inst_id[7] = le32_to_cpu(mod_elem->value); break; case AR_TKN_U32_MODULE_DST_IN_PORT_ID: - dst_mod_ip_port_id = le32_to_cpu(mod_elem->value); + dst_mod_ip_port_id[0] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_IN_PORT_ID1: + dst_mod_ip_port_id[1] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_IN_PORT_ID2: + dst_mod_ip_port_id[2] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_IN_PORT_ID3: + dst_mod_ip_port_id[3] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_IN_PORT_ID4: + dst_mod_ip_port_id[4] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_IN_PORT_ID5: + dst_mod_ip_port_id[5] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_IN_PORT_ID6: + dst_mod_ip_port_id[6] = le32_to_cpu(mod_elem->value); + break; + case AR_TKN_U32_MODULE_DST_IN_PORT_ID7: + dst_mod_ip_port_id[7] = le32_to_cpu(mod_elem->value); break; default: break; @@ -475,15 +544,23 @@ static struct audioreach_module *audioreach_parse_common_tokens(struct q6apm *ap } if (mod) { + int pn, id = 0; mod->module_id = module_id; mod->max_ip_port = max_ip_port; mod->max_op_port = max_op_port; mod->in_port = in_port; mod->out_port = out_port; mod->src_mod_inst_id = src_mod_inst_id; - mod->src_mod_op_port_id = src_mod_op_port_id; - mod->dst_mod_inst_id = dst_mod_inst_id; - mod->dst_mod_ip_port_id = dst_mod_ip_port_id; + for (pn = 0; pn < mod->max_op_port; pn++) { + if (src_mod_op_port_id[pn] && dst_mod_inst_id[pn] && + dst_mod_ip_port_id[pn]) { + mod->src_mod_op_port_id[id] = src_mod_op_port_id[pn]; + mod->dst_mod_inst_id[id] = dst_mod_inst_id[pn]; + mod->dst_mod_ip_port_id[id] = dst_mod_ip_port_id[pn]; + id++; + mod->num_connections = id; + } + } } return mod; From patchwork Thu Oct 27 10:27:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11730 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp148907wru; Thu, 27 Oct 2022 03:30:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DdnZXSMqsyi1OV6h+BdWzz3yA6yMGK/XkQnTDYBtVLlt6LD7oBZ3/HylqL5BO7rQMpPNT X-Received: by 2002:a17:902:d183:b0:186:8d50:75bb with SMTP id m3-20020a170902d18300b001868d5075bbmr26864653plb.159.1666866651974; Thu, 27 Oct 2022 03:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666866651; cv=none; d=google.com; s=arc-20160816; b=QssFLbcKR2ncGoAEr8patWN2RA0rjj4b7/IML+RKXoPXIYsML2eoGPjdQSpYhQ2u39 hQ+aWHoe89FtzlVZZ4rDQNU4lkARisUhDtPp/CgpWZSMcUJJGzeFizXGzlgcFCRxfAHt MaGNUsWtUjtGhzOFryCxdXaDnm+eOFBmYIBgOqL3Ie7MpNuvpPorNHAXGSmnkxPAmsU+ cDISrq274SwqOX6iZubTXFBzXCBmAVbl6VFLKjJRDPBpEJmFZFoTH3pxlu7Dwa1sB+aC 9TuEOx9NRpnanaZBzli00uAn1GcPRLhRVIMRQZlSzAzMbQOPm8LuzL4VR0frrqvnhXfy i46w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9OQ1Vt/2QFgasQ2MWgN87SiOCnuqeXhPBQT7NHiM0Fk=; b=f85ZaN2v0qfncXgoq25RvoK6VfMX+aqGllq/X3ck6Kl/beFFZtBpymsXNN8/pcSAYT xih+FkGHvG1l734VJfuQlZgnyHwunCpSEyxOFOQ+BKNdcw9NyxNAQjvU/PYzGEZYxtDv aJRawwBadZ3joi/cvAtTecvHIERmeTDik2nq+5Mky2btMJ2esKFmGobNh6GbDSXV/29n awms7oCwAlhr5AvvRG/Y67XirBanRY0aYIEOxwTleiuau1sCrLrHKKxC3Q+Q0wZRp2tW pmr9w06O8HpUBpcjUR99FYncz1Miq3ub69lLVtvyD65aKgYpFpgepGGhbOxe4LdRyJP/ DghA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="u+4/ZPzx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d12-20020a056a00244c00b0056b01d2167bsi1593537pfj.156.2022.10.27.03.30.39; Thu, 27 Oct 2022 03:30:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="u+4/ZPzx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235372AbiJ0K21 (ORCPT + 99 others); Thu, 27 Oct 2022 06:28:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235068AbiJ0K1t (ORCPT ); Thu, 27 Oct 2022 06:27:49 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7694FE09D2 for ; Thu, 27 Oct 2022 03:27:48 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id t4so625911wmj.5 for ; Thu, 27 Oct 2022 03:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9OQ1Vt/2QFgasQ2MWgN87SiOCnuqeXhPBQT7NHiM0Fk=; b=u+4/ZPzxou6PU2ScLM19n6nyyr59m0ucjfFYfdcKRdZK1pCX1a+7Cal7wyMRREOloB veQ8wTv9YgBRQM0qKYluqlCOYQ3G3y/eI4pFlTHWs07fZ8jABxH/UjLt4oxm+9GV7qzg HqTXMG2WnlRhBe4CeZuLBYWtXfYFQZICLiscPv656KpcUFuinclxrDQHj558SrYIpAnN a6Uz360Q0nUB+X4Z+8A4NXzKLn6riJX9UrWw0KHeyqMEedchtFVPesQ4/pZLa+JeGwPU AR6u6xYL2LWwx1EboNTDNBwZJWJ8PuvIP33M3swTq9BCdOM79XYzv1fuUxdHnvfMBDwZ jx0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9OQ1Vt/2QFgasQ2MWgN87SiOCnuqeXhPBQT7NHiM0Fk=; b=x6HF6ekupBmIi+T61xwol1j13CT0yzXtRB/+Iw/P8v8W2qRommh/x1Qs4dTvmzxeLa aWcuFGjYOzRGHTkUy2+jHRI55cffaDkaHFxadrUTNqb5fSEIT5SIbn3HYDHj+dEfSd+D e4qTeCA2t8lJKYA6XhLuuFr68TCalUlykkqkBxm+WMfdZta9OFT5yjFkrWslYGfSpggG OtyoFR4h7r/97QsztXUt5m5kZuafjQptV51aexfQxz6RoCE2eV7wNK68QUdMHqhOpAGk KT94mVFRxYFLuLFWvmB8WHen6FjLfgeo8vxlUJkZ0GpiIyqwwQfm6kFANEUiNIWRKJCX BRmg== X-Gm-Message-State: ACrzQf26qtCIE8qWuB+/8kocTTYzrxKsTOJqYjHTaokSVy0NiaSoCKF2 +5swnR1dQnX/bZ79Kf8n4itDVQ== X-Received: by 2002:a05:600c:13c8:b0:3cf:4aa7:7562 with SMTP id e8-20020a05600c13c800b003cf4aa77562mr5258578wmg.104.1666866468014; Thu, 27 Oct 2022 03:27:48 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id fc7-20020a05600c524700b003b505d26776sm5088674wmb.5.2022.10.27.03.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:27:47 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 7/9] ASoC: qdsp6: audioreach: add support to enable SAL Module Date: Thu, 27 Oct 2022 11:27:08 +0100 Message-Id: <20221027102710.21407-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> References: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747836366600455072?= X-GMAIL-MSGID: =?utf-8?q?1747836366600455072?= Add support to Simple Accumulator-Limiter module. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/audioreach.c | 77 +++++++++++++++++++++++++++++++ sound/soc/qcom/qdsp6/audioreach.h | 11 +++++ 2 files changed, 88 insertions(+) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index 99cade6d8a48..be7068742fe4 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -658,6 +658,77 @@ static int audioreach_codec_dma_set_media_format(struct q6apm_graph *graph, return rc; } +static int audioreach_sal_limiter_enable(struct q6apm_graph *graph, + struct audioreach_module *module, bool enable) +{ + struct apm_module_param_data *param_data; + struct param_id_sal_limiter_enable *limiter_enable; + int payload_size; + struct gpr_pkt *pkt; + int rc; + void *p; + + payload_size = sizeof(*limiter_enable) + APM_MODULE_PARAM_DATA_SIZE; + + pkt = audioreach_alloc_apm_cmd_pkt(payload_size, APM_CMD_SET_CFG, 0); + if (IS_ERR(pkt)) + return PTR_ERR(pkt); + + p = (void *)pkt + GPR_HDR_SIZE + APM_CMD_HDR_SIZE; + + param_data = p; + param_data->module_instance_id = module->instance_id; + param_data->error_code = 0; + param_data->param_id = PARAM_ID_SAL_LIMITER_ENABLE; + param_data->param_size = sizeof(*limiter_enable); + p = p + APM_MODULE_PARAM_DATA_SIZE; + limiter_enable = p; + + limiter_enable->enable_lim = enable; + + rc = q6apm_send_cmd_sync(graph->apm, pkt, 0); + + kfree(pkt); + + return rc; +} + +static int audioreach_sal_set_media_format(struct q6apm_graph *graph, + struct audioreach_module *module, + struct audioreach_module_config *cfg) +{ + struct apm_module_param_data *param_data; + struct param_id_sal_output_config *media_format; + int payload_size; + struct gpr_pkt *pkt; + int rc; + void *p; + + payload_size = sizeof(*media_format) + APM_MODULE_PARAM_DATA_SIZE; + + pkt = audioreach_alloc_apm_cmd_pkt(payload_size, APM_CMD_SET_CFG, 0); + if (IS_ERR(pkt)) + return PTR_ERR(pkt); + + p = (void *)pkt + GPR_HDR_SIZE + APM_CMD_HDR_SIZE; + + param_data = p; + param_data->module_instance_id = module->instance_id; + param_data->error_code = 0; + param_data->param_id = PARAM_ID_SAL_OUTPUT_CFG; + param_data->param_size = sizeof(*media_format); + p = p + APM_MODULE_PARAM_DATA_SIZE; + media_format = p; + + media_format->bits_per_sample = cfg->bit_width; + + rc = q6apm_send_cmd_sync(graph->apm, pkt, 0); + + kfree(pkt); + + return rc; +} + static int audioreach_i2s_set_media_format(struct q6apm_graph *graph, struct audioreach_module *module, struct audioreach_module_config *cfg) @@ -978,6 +1049,12 @@ int audioreach_set_media_format(struct q6apm_graph *graph, struct audioreach_mod case MODULE_ID_CODEC_DMA_SOURCE: rc = audioreach_codec_dma_set_media_format(graph, module, cfg); break; + case MODULE_ID_SAL: + rc = audioreach_sal_set_media_format(graph, module, cfg); + if (!rc) + rc = audioreach_sal_limiter_enable(graph, module, true); + break; + default: rc = 0; } diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index df5026b646c1..f2b51d8fc718 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -15,6 +15,7 @@ struct q6apm_graph; #define MODULE_ID_PCM_CNV 0x07001003 #define MODULE_ID_PCM_ENC 0x07001004 #define MODULE_ID_PCM_DEC 0x07001005 +#define MODULE_ID_SAL 0x07001010 #define MODULE_ID_CODEC_DMA_SINK 0x07001023 #define MODULE_ID_CODEC_DMA_SOURCE 0x07001024 #define MODULE_ID_I2S_SINK 0x0700100A @@ -499,6 +500,16 @@ struct data_logging_config { uint32_t mode; } __packed; +#define PARAM_ID_SAL_OUTPUT_CFG 0x08001016 +struct param_id_sal_output_config { + uint32_t bits_per_sample; +} __packed; + +#define PARAM_ID_SAL_LIMITER_ENABLE 0x0800101E +struct param_id_sal_limiter_enable { + uint32_t enable_lim; +} __packed; + #define PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT 0x08001024 struct param_id_mfc_media_format { From patchwork Thu Oct 27 10:27:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp149584wru; Thu, 27 Oct 2022 03:32:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kF6vvHcPmfN3laKe4xxnpHvTJwa8gPxF6pKeHzX8649tV7YjRun+RoUkg8FKsmZQFyChB X-Received: by 2002:a63:5a08:0:b0:43c:9fcc:cc54 with SMTP id o8-20020a635a08000000b0043c9fcccc54mr41164988pgb.229.1666866754758; Thu, 27 Oct 2022 03:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666866754; cv=none; d=google.com; s=arc-20160816; b=ImfjRKiQCv4oMV0nOeyzrxP5vPNv3K1dr+KHqfX0/Cx+4nUypAt1ZLIYAEp6fnxJyB llR8d4RSkxjrfi+R1yQt9rtNszM6erbIIryHdsHGji0CCT3qrVB1pPw7aNxk/FOJBmXK AzO5iz7lyMokBphYKUE2gjR4+SRqWZGMHN8lcMAI6ASWdw5Xhrgsikfqa4NidGitMEot hH8pSFylkJk5ElFDrnpkq2HUNe6cjKQE+f6Hi0SK/BdfgUz98+Dij1zQKXImpzqS7NlQ VEIXZUdEQnXBm4UQvUXR3rNVEQvkWbd+jQ0SxyPa/5HmOd0mTQleDgwegDl+z8pt+E+m 6meQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XRksJXQbYrRhqCpyqmwfEWWPK1xGzs4Mo3xZYXwQ8qI=; b=clSLSWFDBOeBRVwOw6XIanw7FBhMUZ70+JeSx7GorQls8ZeXYAXU/aaTAbBqeFGjc6 7x7+8DfoZe7I2Zconbbgmu0Q81d4UDd3z0vyt1X6t4H4A/CkI1U0QUP9H+CMXsK0ubKs sytqQqqqJIw9akRvy3OY66hUQIYCOYVxLqmHgob/CFqoMMVHcZT0+IRNJbEWTLGN4hws 80q2QR4Vqcn1G8SxaE51WhuCqMtGKtgZpQ0dQeUU1ftW3x30Ibnm/IodIzUbthUTRSr8 rZRv+/+rCkGHgETe8hwUU2dZ0+fpez49eI8fbggf4tMy343ef8giU/o5xDBLg/OXSPYy WJrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="f/fmha2i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k70-20020a638449000000b0043c8ce98a69si973961pgd.711.2022.10.27.03.32.21; Thu, 27 Oct 2022 03:32:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="f/fmha2i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235202AbiJ0K2j (ORCPT + 99 others); Thu, 27 Oct 2022 06:28:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235286AbiJ0K1z (ORCPT ); Thu, 27 Oct 2022 06:27:55 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C42CE22508 for ; Thu, 27 Oct 2022 03:27:50 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id j15so1408812wrq.3 for ; Thu, 27 Oct 2022 03:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XRksJXQbYrRhqCpyqmwfEWWPK1xGzs4Mo3xZYXwQ8qI=; b=f/fmha2i9p6KmSlokHd/hMBPFW6SAgl0PFNlWcJ4nEkGm20pZSQJXenfEJEcEHuLlm 6ZP4/qQy5iLUJBfGCqaND/KY+y2CUqDlKqti0B7zr2sWuyOfH6SaRU51YcpATNIKNumZ Ce+yLpP9wBBn8RFE9HDi1mkhCoXtdPG0L1Uh0lNXoQ6i7pKtsyekb9Ak7UQfNpSAPHNk xhg7S7aBV+jP8CvrR1TkwgHho3M6uhm6ytah8H6e5g+/DJoFl+z+EjMvnE7LUSrdiPG9 ZwcgfyIr9AJ6x7G82/pnt9zk3felswollEp8bJno0RkB4mXxIF8PWLwX3QwCKTCC/zq5 /LwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XRksJXQbYrRhqCpyqmwfEWWPK1xGzs4Mo3xZYXwQ8qI=; b=eWGse7km2VRsScO3+HAW9P/Yihy+04PsadV/TnFcCiYn3jCrkmP0hRvPGYjNDJ2gK6 OruQnW0UJcY+27DpThQ9qmZpoYz0nsAKAot6utEHolHqyBNeDMFJnkEeHzSeJzIVWHZZ EUzV0Qyut/4rdvE67SlbEQJXNbVLqnOYHRiNV8nxkiVTPyrNjTHIYNsRIuToBY3wtog+ EGuvX5UfgOH2s7WuU0O3T3H93A+l5j49tJLo9+9Gp5zAIp2zgdBmw7jTUToQfrrkp7u3 rEBjKB8St7//5YVBdkuBJgOCydltSPMPAJ6KJerV3e7d3TIlZEQUZALpCeKU9SHSlS62 qCBA== X-Gm-Message-State: ACrzQf3xIvGPUxd/YFS9xmSQMSGPFO7/Zia+Bgx8CRvYDxVqVBnfacUC j/6gZvlyx48zT7EQdEFyVCqzCQ== X-Received: by 2002:adf:fc12:0:b0:236:9b2e:4843 with SMTP id i18-20020adffc12000000b002369b2e4843mr658925wrr.620.1666866469328; Thu, 27 Oct 2022 03:27:49 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id fc7-20020a05600c524700b003b505d26776sm5088674wmb.5.2022.10.27.03.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:27:48 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 8/9] ASoC: qdsp6: audioreach: add support for MFC Module Date: Thu, 27 Oct 2022 11:27:09 +0100 Message-Id: <20221027102710.21407-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> References: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747836474159814578?= X-GMAIL-MSGID: =?utf-8?q?1747836474159814578?= Add support to enable and configure Media Format Converter (MFC) Module. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/audioreach.c | 53 ++++++++++++++++++++++++++++++- sound/soc/qcom/qdsp6/audioreach.h | 1 + 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index be7068742fe4..1338b99f37e1 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -159,6 +159,8 @@ struct apm_module_hw_ep_mf_cfg { #define APM_HW_EP_CFG_PSIZE ALIGN(sizeof(struct apm_module_hw_ep_mf_cfg), 8) +#define APM_MFC_CFG_PSIZE(p, n) ALIGN(struct_size(p, channel_mapping, n), 4) + struct apm_module_frame_size_factor_cfg { struct apm_module_param_data param_data; uint32_t frame_size_factor; @@ -729,6 +731,53 @@ static int audioreach_sal_set_media_format(struct q6apm_graph *graph, return rc; } +static int audioreach_mfc_set_media_format(struct q6apm_graph *graph, + struct audioreach_module *module, + struct audioreach_module_config *cfg) +{ + struct apm_module_param_data *param_data; + struct param_id_mfc_media_format *media_format; + uint32_t num_channels = cfg->num_channels; + int payload_size; + struct gpr_pkt *pkt; + int rc; + void *p; + + payload_size = APM_MFC_CFG_PSIZE(media_format, num_channels) + + APM_MODULE_PARAM_DATA_SIZE; + + pkt = audioreach_alloc_apm_cmd_pkt(payload_size, APM_CMD_SET_CFG, 0); + if (IS_ERR(pkt)) + return PTR_ERR(pkt); + + p = (void *)pkt + GPR_HDR_SIZE + APM_CMD_HDR_SIZE; + + param_data = p; + param_data->module_instance_id = module->instance_id; + param_data->error_code = 0; + param_data->param_id = PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT; + param_data->param_size = APM_MFC_CFG_PSIZE(media_format, num_channels); + p = p + APM_MODULE_PARAM_DATA_SIZE; + media_format = p; + + media_format->sample_rate = cfg->sample_rate; + media_format->bit_width = cfg->bit_width; + media_format->num_channels = cfg->num_channels; + + if (num_channels == 1) { + media_format->channel_mapping[0] = PCM_CHANNEL_L; + } else if (num_channels == 2) { + media_format->channel_mapping[0] = PCM_CHANNEL_L; + media_format->channel_mapping[1] = PCM_CHANNEL_R; + } + + rc = q6apm_send_cmd_sync(graph->apm, pkt, 0); + + kfree(pkt); + + return rc; +} + static int audioreach_i2s_set_media_format(struct q6apm_graph *graph, struct audioreach_module *module, struct audioreach_module_config *cfg) @@ -1054,7 +1103,9 @@ int audioreach_set_media_format(struct q6apm_graph *graph, struct audioreach_mod if (!rc) rc = audioreach_sal_limiter_enable(graph, module, true); break; - + case MODULE_ID_MFC: + rc = audioreach_mfc_set_media_format(graph, module, cfg); + break; default: rc = 0; } diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index f2b51d8fc718..707dfbdbc156 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -16,6 +16,7 @@ struct q6apm_graph; #define MODULE_ID_PCM_ENC 0x07001004 #define MODULE_ID_PCM_DEC 0x07001005 #define MODULE_ID_SAL 0x07001010 +#define MODULE_ID_MFC 0x07001015 #define MODULE_ID_CODEC_DMA_SINK 0x07001023 #define MODULE_ID_CODEC_DMA_SOURCE 0x07001024 #define MODULE_ID_I2S_SINK 0x0700100A From patchwork Thu Oct 27 10:27:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 11731 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp149552wru; Thu, 27 Oct 2022 03:32:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DJn8tkccviRGdZE2pHt6qMl1Jmf6IVfwaQnd/w4LqOc/ezzOmQzkIf/qQ3KTtNsFSW0zJ X-Received: by 2002:a17:902:7849:b0:186:68b9:e1ae with SMTP id e9-20020a170902784900b0018668b9e1aemr36648591pln.139.1666866751391; Thu, 27 Oct 2022 03:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666866751; cv=none; d=google.com; s=arc-20160816; b=Th+wUUiTj/c+IwYZ7hlyIpJe8+Mw5JPoLp4lzQhJ18WnrgElIK6Kk5nbdXS5NJIIb1 AKL1VdKBVT9FYmKX5UYucJ5OctRgcnZqdsi1bDfS1esiP5pGPdp1Eiup5+DDX86uzS3s oV62gCfxHqPUIzyV7li7ub+7xYUCicIQxwsH6rB7zmwtviSpYXPr66oillbgxhKRr4ag 2KP0bJYi7fVIQWbrPii5e3pDC91sH7ZvKXCZBwvMnzwv+Pde/nXGOGNUUHRQp2P0mzcC LIl8vsCD+6K0jxpPSoVLLIq5a0IShcRgitp3tcojWolNPa0+256q3gyARWeuY189m4Sw 8vpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=P38kTBSJr/DRXyh4Je0XkAOEtRTZS4roS95ylRUlbWA=; b=T0onUL0spIZJbQR7R3t4dic4KpLwXze2YzLdWpkIccO8UZaDh+VlvK4Fy1U8t91dyy 9RPkurOX0jWkz0pnSyeV9MCrxb1dM99RJIdNQqHfKfrk0oMFOIUrEA7N0LKkckNuXuUo 6daZV+0sefINM+Rd9Q4Y9dozS+OvFFp41umpghj6L2uQ5Mtpr/3TPiZDuEUW6T6hzMir oscYX5vu9OtclMp5Vc16/xAvU6jKwKcNjfdkWXupk+9fdzHGSCWcLOey4U11E96sMD1j J7wRbwBbH1m1+ekROXBOi9eBFTNskuvBNB7vhR8O7Gk3BjECz/dMyxwGB5JIRxfwYFk4 wr+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ILJoWb3X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020a170902ec8600b0016efde92292si1417818plg.255.2022.10.27.03.32.18; Thu, 27 Oct 2022 03:32:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ILJoWb3X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235218AbiJ0K2f (ORCPT + 99 others); Thu, 27 Oct 2022 06:28:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234428AbiJ0K1z (ORCPT ); Thu, 27 Oct 2022 06:27:55 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A642C588C for ; Thu, 27 Oct 2022 03:27:52 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id l14so1416041wrw.2 for ; Thu, 27 Oct 2022 03:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P38kTBSJr/DRXyh4Je0XkAOEtRTZS4roS95ylRUlbWA=; b=ILJoWb3XrEu77ZuGCBs0pipPfO4HGPcyLw4RSiRRZTtUO8SCysUSQExzlcDrTMIRvN cBb/7EBQclQbY0zrEv8j2I7E8PiPYHot7xwsKOOLha0kgM4OGpvJNZX/a/Bywk3iAGDq tiNgZJe/5heYhar822aPNtv4gneYYhPVFkUpLzNE02gv0IiOTV6YfhMHsZtnXsawmqJj Gekwk2Dr72DN8aRhqRrIln6/ekwlGOsmNGRspkG9AVr1XVz52NqnswULcIvM7d9N7a5L 2wpww+JO5VccrA/sXkL/b5jdTiw4as9PKSPi1tCh9N8Y03eBbXgTg5IatcSelIrWtx/+ 8RIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P38kTBSJr/DRXyh4Je0XkAOEtRTZS4roS95ylRUlbWA=; b=Hc64NGWvJzU36gKcaUp+PJTIyMMqPI/tdYP31E2+lBmRVqo5akKOU0N4KGcOly82/8 lEH2cH8RS+zdgX4EU/RyGkSFYNa6RmAA9HILx/rRAu1LoDsaFAV1LpsbJCQs2o5162BY PMadZ2o7KBvLMSbE1bNfsC8B6SHze0JI7vrAWZO0Fr5OmgtApHJFD+JSQhCmrMqs6iAt rV75UhjE6neQKS3M4IDuJez6pUaERH0s/87j7qJjBEsd0aGWU6tkzKbkLrc5cEXMtjlN VBuMbHdOTeaDaA7WgEaMcnBw28O1C1Gqaqr3jY3iOC2L4S/RHogzgBsnRsGl/P/PtARw wKZg== X-Gm-Message-State: ACrzQf1I8lVL14YlwJC/sTC22U5JiDWkVo4BWVwbddaUi1Wh6NHkwMYF VtSjdXe2Ul1PHMeiA/2Qdv56zw== X-Received: by 2002:a05:6000:1b0e:b0:236:5c9e:7110 with SMTP id f14-20020a0560001b0e00b002365c9e7110mr18891472wrz.650.1666866470678; Thu, 27 Oct 2022 03:27:50 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id fc7-20020a05600c524700b003b505d26776sm5088674wmb.5.2022.10.27.03.27.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:27:50 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 9/9] ASoC: qdsp6: audioreach: add support to enable module command Date: Thu, 27 Oct 2022 11:27:10 +0100 Message-Id: <20221027102710.21407-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> References: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747836470675627209?= X-GMAIL-MSGID: =?utf-8?q?1747836470675627209?= Add support to enable Module command which is required for logging module to be able to debug. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/audioreach.c | 40 ++++++++++++++++++++++++++++++- sound/soc/qcom/qdsp6/audioreach.h | 5 ++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index 1338b99f37e1..1e0c918eb576 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -731,6 +731,42 @@ static int audioreach_sal_set_media_format(struct q6apm_graph *graph, return rc; } +static int audioreach_module_enable(struct q6apm_graph *graph, + struct audioreach_module *module, + bool enable) +{ + struct apm_module_param_data *param_data; + struct param_id_module_enable *param; + int payload_size; + struct gpr_pkt *pkt; + int rc; + void *p; + + payload_size = sizeof(*param) + APM_MODULE_PARAM_DATA_SIZE; + + pkt = audioreach_alloc_apm_cmd_pkt(payload_size, APM_CMD_SET_CFG, 0); + if (IS_ERR(pkt)) + return PTR_ERR(pkt); + + p = (void *)pkt + GPR_HDR_SIZE + APM_CMD_HDR_SIZE; + + param_data = p; + param_data->module_instance_id = module->instance_id; + param_data->error_code = 0; + param_data->param_id = PARAM_ID_MODULE_ENABLE; + param_data->param_size = sizeof(*param); + p = p + APM_MODULE_PARAM_DATA_SIZE; + param = p; + + param->enable = enable; + + rc = q6apm_send_cmd_sync(graph->apm, pkt, 0); + + kfree(pkt); + + return rc; +} + static int audioreach_mfc_set_media_format(struct q6apm_graph *graph, struct audioreach_module *module, struct audioreach_module_config *cfg) @@ -1077,7 +1113,9 @@ int audioreach_set_media_format(struct q6apm_graph *graph, struct audioreach_mod switch (module->module_id) { case MODULE_ID_DATA_LOGGING: - rc = audioreach_logging_set_media_format(graph, module); + rc = audioreach_module_enable(graph, module, true); + if (!rc) + rc = audioreach_logging_set_media_format(graph, module); break; case MODULE_ID_PCM_DEC: case MODULE_ID_PCM_ENC: diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index 707dfbdbc156..1d1d47d47d40 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -537,6 +537,11 @@ struct payload_media_fmt_pcm { uint8_t channel_mapping[]; } __packed; +#define PARAM_ID_MODULE_ENABLE 0x08001026 +struct param_id_module_enable { + uint32_t enable; +} __packed; + #define PARAM_ID_CODEC_DMA_INTF_CFG 0x08001063 struct param_id_codec_dma_intf_cfg {