From patchwork Fri Oct 21 16:51:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 6875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp804308wrr; Fri, 21 Oct 2022 09:59:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cqVYc+wKqRLb904gPUgzbBifKOUMujANdsAszLNzhEkYKQnl71m8iz5y11oF2H7Q0lWMB X-Received: by 2002:a62:5587:0:b0:56a:fd45:d15c with SMTP id j129-20020a625587000000b0056afd45d15cmr2784242pfb.33.1666371598425; Fri, 21 Oct 2022 09:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666371598; cv=none; d=google.com; s=arc-20160816; b=fvmqxyotzZC+wRh1rh7EZtUg+p/AA2ETJjMT+ao1wWL5etc83ipOqLxm9GfumrY9Ya G6zkUTkPw0PjACz+eyxauaxlNP+U4QaJRC4DsAnDFJ3e9Sat/qdgDpOSf2P3caiE7x2t m40iF0dJq9evDga2pwn/J7tG8YVZgdE9Y9LA7Xy7jCj0HVByp4TY/zLRBM4kUuPxLGHu oQ/7i5jUYWKrn89NyrBpZg2n67czpoCjEQgOBj5k5iS7+3gGj/yHoPWe23Ikpx/GBQOZ zurQ/r2njf6WY0aiNgwEY0Vc2cMb32F+b0IEuOryxi97m6ymft6ZKdK6KVaQwdfx15PO 41vQ== 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=S1Wbe703KgwRjRnGYT1UQwDcnhEdqY3xQGpBo/iRxEg=; b=BhfKt6er4ny4Ft7vr/6UzAX4Gxquib+NBUu9iswF5r9Ji8ePDipE9VFDZjM4hCmE6Y 2fo6KEmcWM6MMDtEc8NNBMmiGeiqNa9NT1cOKex7r4kLE74rVQ8qXbD896zXMYKQWlnY 8RlL+hrNxq5IT5+zp1ntLV4mAWRes3dpzPIjcs8K3zV5fueYfsoZOkgjGDJQhK4pahjP PQXKNsb9Ik7xCCSls8WyadEj9eEoeMgDyQXMYQVRuo36rCQrwjYuktAfPyC7gDKBw/tV 2s3b2XLYSeYGQH6RBDOlu1kcVhZ6geC36UPtdedi/J1XQ3spn/YlXyHFf6DE8dL9m1Vh ptMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e5cCay4S; 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 r30-20020a63205e000000b00460b9d08d7bsi24975002pgm.868.2022.10.21.09.59.44; Fri, 21 Oct 2022 09:59: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=e5cCay4S; 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 S231171AbiJUQx1 (ORCPT + 99 others); Fri, 21 Oct 2022 12:53:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbiJUQxT (ORCPT ); Fri, 21 Oct 2022 12:53:19 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B39A728B1DB for ; Fri, 21 Oct 2022 09:53:08 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id bh7-20020a05600c3d0700b003c6fb3b2052so2447416wmb.2 for ; Fri, 21 Oct 2022 09:53:08 -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=S1Wbe703KgwRjRnGYT1UQwDcnhEdqY3xQGpBo/iRxEg=; b=e5cCay4SFUrpxbbt6ZxM5tOq2iPJacFUiZ6rBvOTWdwCsnj2o12Egu9+sXict2iThJ ARwmWdHIKdw0ja2J5x+9MdEl7cs4f2r0tnXfx+0bwPQmKYfzWEViMmx0gVwa6LpxgoIL WMkC12dSMmOSXd4nAN+yjqm4NVbfNmSnJx9z3hxtta+lpbDkYftEQBwblf01wD10mSH2 WrkQnRZcl9eFD80EwYKR0mOxVxbJ4CyOJKkd1bHnSdF0yPHTns9OfXoqRkulvslnEm8x 0EACz0O1lrr40AYC+zOnZ6F82clKqRStr2Cy39R+iQaZJxa/9ZSPLMYFKiz8QQvYO4vd C+mg== 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=S1Wbe703KgwRjRnGYT1UQwDcnhEdqY3xQGpBo/iRxEg=; b=L9Ly1+HL4pSiymKQoRRSMv3f+eoqB+mzt8xQALWidf5ie4ruGKh3Xbqk8RqjPQv54T DU6ImapcPTVPuDnT1WQGCICkdUeCXdv+l9oak6+MW2YCD69OOEU8LkYy3/TfpVqjElR1 MkiJDv+AEkzPU1ka/aFK5hcB4UO8CiV8JrpxN9RKFv0H3xLUvoj1D4P45SWVTlxateCb nPxZ4+WotI/G9hhmdSGvNWhgCGj49P8HNLpebPIqfP4ManJRFOnFbjURqWtco8RFWArX 8AOULnpnN4feHRqnM4uImDcOntl7+KdxjZwyvNCy32WqhWYVe0ZSP+xg5iK+fKOqEWPj C2+A== X-Gm-Message-State: ACrzQf0POOD1K0qD5vRMrFBowoM8Bvu7kGo7wsFearkVdMSAFaNR/g30 EKGECG+U9kikdXHQxgYF+D0VjA== X-Received: by 2002:a05:600c:1e2a:b0:3c3:d770:1756 with SMTP id ay42-20020a05600c1e2a00b003c3d7701756mr14158424wmb.134.1666371183770; Fri, 21 Oct 2022 09:53:03 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:02 -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 v2 1/9] ASoC: qdsp6: audioreach: topology use idr_alloc_u32 Date: Fri, 21 Oct 2022 17:51:59 +0100 Message-Id: <20221021165207.13220-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-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,URIBL_BLOCKED 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?1747317265497996350?= X-GMAIL-MSGID: =?utf-8?q?1747317265497996350?= SubGraph and Module Instance ids take 32 bits, so use idr_alloc_u32 instead of idr_alloc to able to accomdate 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 Fri Oct 21 16:52:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 6878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp804792wrr; Fri, 21 Oct 2022 10:00:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4m9C7QNy6ndQ49FbVpFwZZE25d1KADvY66NbxVdOg+50J/kAxd7QOk/evE857IvJq42JUn X-Received: by 2002:a17:90a:5e03:b0:210:d4b3:4c98 with SMTP id w3-20020a17090a5e0300b00210d4b34c98mr14126045pjf.63.1666371654074; Fri, 21 Oct 2022 10:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666371654; cv=none; d=google.com; s=arc-20160816; b=UmdFgo4WiH0jTU41hn1uiTOkFQDjgXTld7a1NZFIAi1SHtJ+AX2b25Ra9AOs9pWAI/ Xe9g1xVWP+AgrKlkw7z8zlnnYRRVuFMtLuI1Kq51W1fZL+Ytp2WE1KeDFsHkrJ5KYgA4 y7c9N4e+YxZfCSuVe1LAd6yTsDtL5348l/pNrU4RupUiwCIcvay0rRvpWR5RSiAAf//m mzPuB67E7EXOP+7FV4JzCBfThs5MTGKmNnZqJNe/TrV7lDKHACWyb92QfyVda++ZzkKf aWqmkymxFjGuRXF673ndILq2aswknc/6bfUZNl8fVujPepEjQizxWSXF9AOVVlclcMLy /a/w== 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=vXOyyUnBnvHo2Xd73kWSGxIJ76s/1XcApDiCs6K0b5GTXbfyB+CVLW0fSULqZJzj7o sGxXxR/utPTNUJWeKoSWfyRVzkpcKVAvE0CmDHeHedk7rUgVHH2iFWFAVu0mt1/p5S0u /J/TGSfbWtsZ6yeKP0b+UPUrt2zgLErwDbiXZwh6rr1TfYRuOCC4O5zt0qwP7HqI9hmQ BchYuN+i8/fjoQ7HHBd2NH2KBzlo1T3A2oqjKwcRiVZLQHsxvtvZclJcA0DprbcPKGvM k6v+ZqjB4XxUrBuQinDzNYbdoQ7mc5xaSVfhfiwSpk94RiSmea1KL4mcnf+Tj0RVA7bt dOxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TZiNQE3X; 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 w8-20020a634908000000b0045f702aaec0si25970700pga.158.2022.10.21.10.00.33; Fri, 21 Oct 2022 10:00:54 -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=TZiNQE3X; 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 S229982AbiJUQxu (ORCPT + 99 others); Fri, 21 Oct 2022 12:53:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231237AbiJUQxX (ORCPT ); Fri, 21 Oct 2022 12:53:23 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A079628C33C for ; Fri, 21 Oct 2022 09:53:10 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id b4so5956799wrs.1 for ; Fri, 21 Oct 2022 09:53:09 -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=TZiNQE3XOaoDBX4SGKjXJnsnREkA/Fg8Z+lZBP851P+khMnJWvm5pwsMg3gW4Nu+kv yi/ilKE+4pQpSnPy9Fqi3UUUtvr51QKSuFo69OcDKVQGSoxwDcWdaPiRsz1Tf7rfMpLU eSU01OyMfnU2y5Fm3UP+jUqRCP1NJqMOfztW+MqBsJmkihO/bfqs4rQYiflQxt4cZycI aZ/rrAe7sX9qLQgXYnJ1LEFNH598L8hifJMiav5DxAfiLEhH1JLlcO8BhWxwxN+eBXz6 xjhygwwSpq2uGXjZmTrKRdgCY1EZ0ZqhQjjIGWht3MZuYoTiDBR67Y6KRYLC0a+ma8B3 n9Fg== 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=gH9dKD3yrMM7uRRXQTB1dkTqytvVzDouiIvVCNWezrcEMHg8B38iSnCEYOtkbskigH PmnthFXFHp4P+R3AjnK4N2eS7Va8iQIJ0i9y/Jzns9GcUMDHzxiTgVtAglBfOE/AkrTM ZFlS3PGak9XeBzgOmOJC60dCEfqOAnU33Z3Vgyg/MM5dX/ZgLgrNstYkjh5blo5APAJT tGcGsqlKRDkkCNibryDqDHxH9IYWmbEdla9ajCyLqUMQILn1cxRbBTq59qI4RT1Wf2K8 T9wTiIMQdq3tOtiRFwis0VGyLdI1zbWsNI8NiZpYydmg033o7ao5n9NaB8GNZ9+u7HHG OfOw== X-Gm-Message-State: ACrzQf1nvxsUKtq/lPjdv8VPN+/oF+M9v+AbbQvKwdzW5kRG6a551PZs Fzg5tK2iDNyTP09nk4HVHoNCMA== X-Received: by 2002:a05:6000:144c:b0:230:816f:3167 with SMTP id v12-20020a056000144c00b00230816f3167mr12832842wrx.532.1666371185752; Fri, 21 Oct 2022 09:53:05 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:04 -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 v2 2/9] ASoC: qdsp6: audioreach: remove unused connection_list Date: Fri, 21 Oct 2022 17:52:00 +0100 Message-Id: <20221021165207.13220-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-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,URIBL_BLOCKED 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?1747317323449683034?= X-GMAIL-MSGID: =?utf-8?q?1747317323449683034?= 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 Fri Oct 21 16:52:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 6877 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp804573wrr; Fri, 21 Oct 2022 10:00:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4n3YbJbCxDIdann14Z+2oOXi+WgpOmop4RSbg0uWtgNMwB0Bw8MTJKX6umD2VuC2xAgxTv X-Received: by 2002:a05:6a00:4391:b0:56a:d241:37aa with SMTP id bt17-20020a056a00439100b0056ad24137aamr3339754pfb.40.1666371629607; Fri, 21 Oct 2022 10:00:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666371629; cv=none; d=google.com; s=arc-20160816; b=U9oX7ZYBqEMTGX5/qWc9H2yk1W9OpaPXD7fTFZwIOmC0wdWnmHL8RHjINIuMwL5o7p vKThKOOg29/+k5C0rj06JOx8NZ46UKJLVdCqoRfB33rczf7vFDbk1GuYAMNRflPPziZ2 WQzbP9ljevkxtizF9D3BL6ud8RtDgZsTFYtTLplELzn1b73oE/SNZiBeCvdG7Ii7j4Yy dR/Yks+KBC66c74JHuvegVETAhXOALZbKj8CsZ9Ty16QKXc7RJ/4+ETLhV5Hm/XeOYa3 eammKnZvAJr02nMha8Sz3RWgXqxZB/uP92gI3Vq/MMQsm8Yg06gQeUhRe/c2tWSJ85O4 Cs5w== 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=dYi+a7WF9Ayzrd+QHpuPicGeXYKAl5rZjtl76t/uBCZhsCkG8vBbh32r2fH4GBQBlD yVTF7nnYDX2+p9R8ELqpL4umwBLp3DoSTdyu/kNk5PL3YiG96bg5Q8HY3E8zyD5dbIFr EiPTuIGsAtBH1BbXOVcRD1TReW+/epyCAmU4/bUEfZSdM51+3NOI4D3PyT/xk4GDYq8Z W15nRi8cPiEBYfhnoUnVSESW69Uhkx1+X7nKa4IJ1XEXF3LezxTtdpGeo6tyi+PqHx3Y sfBeshQhGRuZwcZlxo04ER+RbpXxQZ56O8sBxaCv3zn6vk+LgAuOpzFdpEjKU25FV6q/ zlqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xoYaAB1s; 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 x10-20020a170902ec8a00b0016f5e7d0febsi30943531plg.244.2022.10.21.10.00.16; Fri, 21 Oct 2022 10:00:29 -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=xoYaAB1s; 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 S229667AbiJUQxi (ORCPT + 99 others); Fri, 21 Oct 2022 12:53:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231214AbiJUQxX (ORCPT ); Fri, 21 Oct 2022 12:53:23 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23C3328DC09 for ; Fri, 21 Oct 2022 09:53:12 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id bu30so5872731wrb.8 for ; Fri, 21 Oct 2022 09:53:12 -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=xoYaAB1se0w8ASUEmK0yW36m16q6/3YuZFWOFiqSgFAt6Q+2IAr3T/myjzrkvcz8Bv gzKrXoFMxmuEBnG1T/Kz3GlngDReayQaAjRoHvXcIACbjnQ9qdTr9ysWh6oql/kGBEGu FbZ9kGFUXx8rYpIuq67r0LDS2k87GwNMtP8XC8zjnOY7bnedQqrFBml/erwBb9npWAej 61CGnKq/VPVrPPoVymQjS43npVirCIeIDZyzYjiAf1X+G0hRSTHlc7Mly4gIQM9KS2Nq GJp+T0OqZx5GvUTOs0G7vJwBtVw6owITtpQA8EnfOZI6lyAx5u0uYCscpedA//6JfOj2 UbbQ== 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=S9nAaMpJ14ti1VV1Ae/MuhHAp5YhgS8wGxAoFSbDODl0dNwTVQ7O5cC10w4zsj6KSu 6Jzi++NOpiil5I5QsMUx4bWl2wnLf/SJSTBd8NtMpOnwNHIkHwsKr9dsu1eYOlWn1+F4 AImMwPXAn0zl+Yx+vf6ZYnHTUQHDsnpVWxD9hLHJupPDn2E8EewLXytXCxbq2gLlavy+ Y39o0Cgt6R7iw5nDKgF7gYPR4Rba1brw7H/AJQ9cEuObHrcwsm5UYoDryLpyRx1uVdT6 RcIEUjpqjmCzOeprE3GwhEnYOgnPWSChHTaZPPFbyI4FQMK3Po11sRmDKhtENfiSCAS/ 0oCQ== X-Gm-Message-State: ACrzQf1/FneTQHInsttn3VZk2q/ttZljpeiDhZ4lOSsOQOsQ3EqKKs9+ eIF3ZP8voKjy+CUuMN0W0LGyim3975hFiQ== X-Received: by 2002:a05:6000:1ac7:b0:232:8c6c:6c4a with SMTP id i7-20020a0560001ac700b002328c6c6c4amr13030296wry.455.1666371187605; Fri, 21 Oct 2022 09:53:07 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:06 -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 v2 3/9] ASoC: qdsp6: audioreach: update dapm kcontrol private data Date: Fri, 21 Oct 2022 17:52:01 +0100 Message-Id: <20221021165207.13220-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-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,URIBL_BLOCKED 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?1747317298017026749?= X-GMAIL-MSGID: =?utf-8?q?1747317298017026749?= 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 Fri Oct 21 16:52: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: 6876 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp804497wrr; Fri, 21 Oct 2022 10:00:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Zr3YJT1ULs8S73NgCbsr6pXQBaNVkYyfw0MqpMZhndm/Rj4QGrCehdPo2D2QLX4IOG+Ez X-Received: by 2002:a17:90b:4fcc:b0:20f:81ca:ec18 with SMTP id qa12-20020a17090b4fcc00b0020f81caec18mr23042110pjb.176.1666371620524; Fri, 21 Oct 2022 10:00:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666371620; cv=none; d=google.com; s=arc-20160816; b=Fmj8mDntTuTaUB88/L7PdUyC2ToXk24sTEJ7v/DjkDmd0c1kc8aHJ/ZW3LtF9UylT1 mLdpYDlcpwaSX24L/n5VOk50UkvLc9If/9o+G2DB1h5zxXHaJHgngZB/1ClroRNDzTKo HEk42TqxYKN/vko2yl1T1Qwyx1G+BM/SmBpH5yco0xcbwjEZiJaZSK2pffdnU8kYk/Y/ MO5+zJz2JF4Hpf/LnX+imAi2m3UpYRp1jHxO68o1F7hRE/swIOoWDC+iYqTak7vKFtrL gexMHThw3hdjNo2jm1PwD52Xyc/Th2RRGEYlTgQqY6IE/WEWv2N3zp2jH45ySQImrXiS KDMQ== 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=Bz3DnYsjxtcNx6mK1BJSBzW8bE1dtPn5c7FVbObpMScyw3JZYDxGl6sYq/QYJQydZN evWU6lJGn30NMIZKsK67DYiQF79H9mUqq8uGYEKff8BuXVWzZemU58VEVj0jfsqle3CV /DLCQTCLL1jcvZBus3Z0CK/A3lrm0Q/U25PWbu8RsekxN4KDk4dLCPtZ/D/ssKFJsqsx m/ou31Hv2pIQqS6KUq6OrrkcWVosg1Q88P3j7VKEfqvoUw38moFeGBlewoeWKsQ7VMlO Oxtb7+0jYeHGBiiOPnQtF8OAJDa96dlt11FAcBFAHC1L9rPMUsVEqFYoUhxMeZ5nI7yJ s4rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XeLCS/6h"; 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 b7-20020a170902b60700b0017f685c2e4dsi22954370pls.136.2022.10.21.10.00.06; Fri, 21 Oct 2022 10:00: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="XeLCS/6h"; 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 S230405AbiJUQxd (ORCPT + 99 others); Fri, 21 Oct 2022 12:53:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbiJUQxW (ORCPT ); Fri, 21 Oct 2022 12:53:22 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AC462892F9 for ; Fri, 21 Oct 2022 09:53:13 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id f11so5460478wrm.6 for ; Fri, 21 Oct 2022 09:53:13 -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=XeLCS/6hpuhiBIpFV803liOEgJFh6EnCIpC5NiMzr8j3DdSmkUTtYxhj17bltpQ25u N1ONwe7XmLKghRS74ELEVdP1JfhLkiX95JrgMXk0RJIhEuwjT7LXT+51TsXeD4Arw5RW UX3NUuo9QyNv6UG4MMciWfk2XKnCamvXp1GrmkEb/puW4aF+AZq1p/W/0oHKkH2hPsDI pnGQ5GRM4lnUb+EMuQf/gRpI78WVHvQ/GUr42pywpwFbC4cxqyNhO8maewQkhgcF7xg/ aJaA+vS0nrAmVf29GVv8NneA7j8f8TBVdTC6U/zypnWJJEDeQ8mdeUCC8/5pQ9oLERXk U/xQ== 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=ewbOJJvJbQWhVYI5eDlQ56jMB3jQovJVgXmsqfDFHMsyImt4QV1Hw0u+mfwIxI2Y4B 4jJYH2YHYnUs32hw+SQIDhGmNMrACEOTxY1mYjy3k+eR0vZ0VQJlZ3LcL7PFWUPTjGoJ eyzKeYiy6gAcE1Bz2NrINkWWMrrwC5jyGQ6q7UBvIedqYMy51HZI1Kn7gkKE5QCR7elk ffegrdrIdyLRTLZJ7wr/tabO2ViXJJAyXuzWXqKVPLSxIIya0wqMGNzkqoSA59Sc8Kei 51XRVa1N5wiwCsNg0CqtpEUYBFJvnWQalj5Xm5TgSCSsCMn70dShQ5VTTbBMF7lFQdzs A9rw== X-Gm-Message-State: ACrzQf2EzOc255bVyb/zpWzQ6SbqJrj4sXFnGOzz77CSyCKKOa1seaYj rD/4HxUTJOvueQAcr9JOCbhcvQ== X-Received: by 2002:a05:6000:189:b0:236:5c22:27bc with SMTP id p9-20020a056000018900b002365c2227bcmr37324wrx.30.1666371189569; Fri, 21 Oct 2022 09:53:09 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:08 -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 v2 4/9] ASoC: qdsp6: audioreach: Simplify handing FE and BE graph connections Date: Fri, 21 Oct 2022 17:52:02 +0100 Message-Id: <20221021165207.13220-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-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,URIBL_BLOCKED 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?1747317288236065565?= X-GMAIL-MSGID: =?utf-8?q?1747317288236065565?= 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 Fri Oct 21 16:52: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: 6882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp806498wrr; Fri, 21 Oct 2022 10:03:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uLCUWwifg0Atzy/7pBgQ6ak2Jz311nh+TrgvXOnC7qnkyjUGkeNt9XPo4PPj5dq6I6S9F X-Received: by 2002:a17:907:7e90:b0:78d:50f7:8abd with SMTP id qb16-20020a1709077e9000b0078d50f78abdmr15983818ejc.523.1666371821457; Fri, 21 Oct 2022 10:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666371821; cv=none; d=google.com; s=arc-20160816; b=ZFZPjPnipPzW1pXh+JuFCCLvLWkp3FsGcyI3Fny8H2OQ52aWI92/jkJvxn25PA9NnY /bZrkwY1hsXy5K4W2K5fPXNpnqxb1l9phY5y8kXQzhe0VgLQQOFpTLRlaP72lHu//EEx BOe1THD0OuHfaT4u3Edfz1mGm4Kk8uHMhtOMdVZlgrGuzL0XR2QXUyVddm6OirSaGyIB +gbMhNGg+CBqPWL0D2uexsbKxwcx/1+VfQkw2omqoq70e/M07byOpL5rrf3xJeyg7Nup Ja+nifTwzcByRmdfKrggwltknb/Byv+toZnjhU/Oz7TDrL49j8bFwty2UC0R8d3CYcMJ HArg== 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=JOZVp/Ggs8l86OX0u92Nyg/+QC7QhjHhV1ZLVFPgdYY=; b=nRjeb7ZsswVmdVYrNlmZpoW1/eJ4Ge+AaelleIt5ybmN0JzGSNhgtJ+8p8srqzdl0D 4TIqkfceNT91umwfH2yvArGn6sG0ltjxcQLwRd1QuCZWlT6kJhcn9FgpiQUzBqCuflYV oVIOaEvaTYcjxUzeYgnRy1AuSdyIwTEemu4Ql5YAMoUnXINd/EytVNMt4OHP2Z1wPY4Y iWwAU1iaLSXiqRxhNBuSUS3YrPX3Jf2fqD2BbCRB+xKXpVHCIy5f/cvDHWraYGOn8/8a aTMhiUFhb108zlXRV3C/2b9xAGmYTgbe71xCbOdWNvjl1Nsg3uaQ+NlBEYiZ+IpoaXoC Wn3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RnL67RMk; 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 b13-20020a056402278d00b0045ddb2076casi11046184ede.177.2022.10.21.10.03.07; Fri, 21 Oct 2022 10:03:41 -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=RnL67RMk; 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 S229816AbiJUQxo (ORCPT + 99 others); Fri, 21 Oct 2022 12:53:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231222AbiJUQxX (ORCPT ); Fri, 21 Oct 2022 12:53:23 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2EE028F248 for ; Fri, 21 Oct 2022 09:53:14 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id bg9-20020a05600c3c8900b003bf249616b0so2430753wmb.3 for ; Fri, 21 Oct 2022 09:53:14 -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=JOZVp/Ggs8l86OX0u92Nyg/+QC7QhjHhV1ZLVFPgdYY=; b=RnL67RMkA+EJ3Aokp+TMvkQH8J/bZTNsUsG+3rsseURrIibiPD3Zf5PxOiguP7S1CR 2Jxd3581YdcKRV153AIqR/ys8GrkxkExOkxJsPNh+2p2lsb3X9QbxOYEdNxSSe9hu+aG MQMKqAbuDh8wvfHw6AF7I/Jzs2sZ2kzoYzhO0o3o3f/5M3oDynSaxQchvYm3dmqXhHso RJG15erItdianrV6fjqWuTKenHcBP9q+umC9i50q/FY4iOIKMrN5fUa52OTB66JD5Amu 5TbU/qzw7zofHnmW4TPL4nX8444lXIWY5M5KhNoL8IWZLTG5RbIOhKMh4fEum+YVyGvD PHBw== 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=JOZVp/Ggs8l86OX0u92Nyg/+QC7QhjHhV1ZLVFPgdYY=; b=6EpxkNUBwJPqdzqRq2XRzVQy34EkTVojd8XHPrOr0yfJ1sDwYjZXacFimSVdv9SGy3 bA96toDQW2ooJKV3SNNjqN6husNaJDMyW4gSUKDjmoNBi6bG5cez0kZJnZn+JUKLzwiF pSJgVU/T/Y3bPN2MGGrd1ofGUG0QCvAxhJ7wvdp9t7Cij7UfH1Y+MH6pczK4Af9Y7fAU ztPR1x43emtMbjiHJbeNjGuH9tRvUZPvUqQY7Z7tgc5Igu7oWxsvT4I1AOUTmoI68vKZ UKTXZil/OePw5P7uSaZTmjlLghEU9CPFH7umCa17axRlowcDqmLi4FEttK7tWoTOeDE1 QOoQ== X-Gm-Message-State: ACrzQf2AsbpfzqSxhNrF9LxQmGAhC6/xrKRfGrKyRc2yyMm3+jW2syWd ygYr5D17vUB4mT+Ayn7I9U/xww== X-Received: by 2002:a05:600c:4e50:b0:3c6:faaa:1e7d with SMTP id e16-20020a05600c4e5000b003c6faaa1e7dmr14310340wmq.9.1666371191002; Fri, 21 Oct 2022 09:53:11 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:09 -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 v2 5/9] ASoC: qdsp6: audioreach: simplify module_list sz calculation Date: Fri, 21 Oct 2022 17:52:03 +0100 Message-Id: <20221021165207.13220-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-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,URIBL_BLOCKED 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?1747317499130143130?= X-GMAIL-MSGID: =?utf-8?q?1747317499130143130?= Simplify module_list size calcuation 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 Fri Oct 21 16:52: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: 6883 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp807042wrr; Fri, 21 Oct 2022 10:04:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JGHbynKqCSasdf2aiWsz2P7jKaB+Zy5rQ4t99KV915aY4z1DjCnFp1lbGdYSZBINw08ID X-Received: by 2002:aa7:dcd5:0:b0:461:5fad:4215 with SMTP id w21-20020aa7dcd5000000b004615fad4215mr1664698edu.332.1666371881343; Fri, 21 Oct 2022 10:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666371881; cv=none; d=google.com; s=arc-20160816; b=HmNwNiRhEAiomDb1b6hXvVUp8TvQ4MEtQBs2Np0gOZweS4i4wJkV4OdiVb/RPeoj5N vDQUQ6LcAa+ksRTxKi3M+JLtcUZoqloQSfdZfl3AqTvZnS9tKykGn1B2avpY4STkjFzM /5va9n5ik+Ff8PA/U2EkAvw2e/E7+6CvSard7oFLcBnv5xfoFrki9SY2aSVSMaAvbnJ7 mAJs+S4Tj1E3tDpf8v+SMBTbwK0hBugfUIpuBAQip3nAyV1mHnei+yyBuN0lCnnmRVZ0 wgaAtzabPFSboeXvQFTRxpG1LQlqRkpIe2T0cOqR8Ia3NHY06uHcywkE4eObeQFzVHyJ 7K0g== 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=SaPGYyK9IFYpbPC82iEn6iSxVCd2vMAmjg+6ahEeeraWqPxCy4GNKhgLOfDhiS+pcU YXB2fkjpCSFAoKwMSDkzTLqF+93fZMFBFKdnKITLxMNWcfX4dCSPeQK9bSxGiaztU/EI xCK6VFY8R4Pp4RkIIgRFFqnyudBf0GZVgfqIReIXtaIDU31fByR/AwvQv2FTAP/oglR2 vToUdVhD3bk676wDdZFq8qxknViZBYfkIMIjj0AbnvH17i0pJYdlfqRyoiW8jnnuZwN5 u2pu7QjBZd5yXMToT1d0ntw+6Up8YDno7sITmTe6fhXmcGGaU2IUyPqWvWVlw48q8KaY Oaiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dejaPii1; 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 v11-20020a50d08b000000b0045903f0af98si19940005edd.128.2022.10.21.10.04.14; Fri, 21 Oct 2022 10:04:41 -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=dejaPii1; 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 S231493AbiJUQyH (ORCPT + 99 others); Fri, 21 Oct 2022 12:54:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231268AbiJUQx1 (ORCPT ); Fri, 21 Oct 2022 12:53:27 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F83E28B1E8 for ; Fri, 21 Oct 2022 09:53:14 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id l16-20020a05600c4f1000b003c6c0d2a445so2429068wmq.4 for ; Fri, 21 Oct 2022 09:53:14 -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=dejaPii1cZUVNF7ohiKrnnTJgDJu8PGIw9aXvJoPbOPulG7I9Wk0CQceV+ZVoptzDi jevInAwLdXRciwyo3mN4OpI0bwOBElBguAoTp0UZ8GhFyyGD3uWTRb+3L+U1oaDDZg76 PWl8rw085X3lTccVfR8kS3QxGlSS2yGhxjsNEsqBZ5bjfPVIUrnETie6ObgfrbgJQ48N 5RLx6jxZqsvipnpSUWt1sjp3Iym2hIetzuj9kVylPiOYT0R5xkj//Hamh/RKNCe0j4Kk cvlAYNal9VyQLfSAQ7ISdgzaV/+KkGZw9etrbiV5Qn0pvU3XThrB+SJmHFOhPofeM8MK Nm3g== 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=hSa6kDSbtCFJ5IHXOfIvzHLDY5YUmq7nOpuddW55JeuQZnqBWOj/Cd8p7eCMQ2uDHG 7Eaq6hUL7NuS6YlmG8CNsjdBH1grFjMPEvtrjrWj69DNVS0gqAInMAf+QnXKppYk/2pO AHtHt+o049Z9a2i8RwTNzeAXFG5X09ju75IJnavfZkXYAXrsaG1IN2HlDZFRRFiRCdsS K2CAi8YgxUi5gNgbfJIx0JOcpMHWuRqbpZLGzMgjHNU3irVhUwjgNkp4TtV7KlaQLsEJ UL+893NhiHn6jb1cU8m0RAgtG/ei6xdvu+LC0kuOuVjH/NtpKy2Yom2kFT+8cB6yP73K +BoQ== X-Gm-Message-State: ACrzQf1hFHE4MEkVM5oDA4hWULWe2oAE+Pr5Pzs7nMvZrJvwfTDTFwCN AKm42ArPygxv3idi8wnNjs69Og== X-Received: by 2002:a05:600c:3148:b0:3c6:eefa:fa5 with SMTP id h8-20020a05600c314800b003c6eefa0fa5mr14591191wmo.88.1666371192406; Fri, 21 Oct 2022 09:53:12 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:11 -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 v2 6/9] ASoC: qdsp6: audioreach: add support for more port connections Date: Fri, 21 Oct 2022 17:52:04 +0100 Message-Id: <20221021165207.13220-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-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,URIBL_BLOCKED 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?1747317561616139524?= X-GMAIL-MSGID: =?utf-8?q?1747317561616139524?= 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 Fri Oct 21 16:52: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: 6880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp805306wrr; Fri, 21 Oct 2022 10:01:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52zqVVnYNx/3jKiwHIeEcIZ/nwXsZCex8HYYgUEehTF7/GeMAWqtreI9Wj46bZFry+h0Dk X-Received: by 2002:a17:907:320c:b0:741:1e55:7a69 with SMTP id xg12-20020a170907320c00b007411e557a69mr17083457ejb.740.1666371707520; Fri, 21 Oct 2022 10:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666371707; cv=none; d=google.com; s=arc-20160816; b=q3MppsZHe12BnbN8cFOpa2bKHwQzhBdmBI/m9fedaEi8ORYdZGJl+HnAWkVKCzRfsv 4YRDTlNNCe9bmyB1HelfIxpHJ3jFg6xEFzu1adxMR1ARW8O7x0L0RqRYvut+qmjPxP91 w0pcMo5fJCUcNlY+DunxELf/kokYyBwE6U4oq9Qk7eBEdGBBFNo8TxblSCgiosjMoNXQ rURyvspDX3DgvrcxtOHTUPp1Ta3lqV0XzKh5Eg5wpvqsDyuRJ/d/ZNb7yUhykmiUiw6l QRBEMi01BjAN3Ko34wipFQdFCLF9H4gsdJF+48HXDiBqdhhCG59cxfUNce5Zqs5QOCPe icfQ== 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=AYmTCd6+hBph2kK4IAWN5ulFmhdrsKFtG8P8zXZuMCbpBIvq4BMztQP0SI2UjKKGPk Y02L+4yufAZLZtx97OpZkIDK1N8WLAo35mJYRR3SJOIEI69TWS+UCNWmFOVQDgHkV+G0 8KnnMzm4CnxDR+y4Xq6w8NQ7XN+8z8Yh4C/U4cWZ0IPh1aEMXxFZaTolob8vB04HyVas o0p2r8sa+PA+v4dLipo1hRhq9EOs1SSxZavl8iAT4A+++1H3YFOqXGSMzDU5ydeMpwMo 9DTMX/KMlgDLKPvmujeRTwCKRtOhrd2oDm5TOkSOINiTajMbTJf983RzTmdY6iesIwyl 03LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="rOBozg/n"; 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 z9-20020a05640235c900b00459060fce1bsi22537491edc.574.2022.10.21.10.01.21; Fri, 21 Oct 2022 10:01:47 -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="rOBozg/n"; 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 S229787AbiJUQx6 (ORCPT + 99 others); Fri, 21 Oct 2022 12:53:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231261AbiJUQxY (ORCPT ); Fri, 21 Oct 2022 12:53:24 -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 6D02D28F251 for ; Fri, 21 Oct 2022 09:53:16 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id b4so5957409wrs.1 for ; Fri, 21 Oct 2022 09:53:16 -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=rOBozg/nN2RN5je3p1RPl2XMpNpj4WdvTEXpCZC39tWajzVNcG57vXDDtC/MoQHnDq iFoHhelA5qAfzuHtriP5L0hDlSiJcWgfGp5Yigq7/6UaPfn2NAsNv6wZThLHWzJTp1ns AT3moeIhKX97fwlQHM7n7BQl2allYwL5qAoOogJNOPBqitKiJZ4XXoquFQ4Oc9yIRSvw lOLEjjfPBIaM5uuIHpX2T7x0Lyp2v+li7wNgcGJihxz0fNkjwcWbnIziYMzZhM9A8nBn u6dX1acsvWY51aed0ODYrMRxVHIirGvwyzEclbHoUmOF5PXo/z9Jrx6Gn5mauAohlNwo tLdw== 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=MzEzheLcL7sGM1r6ynOvbaAjC6gj7gkfcWkDkNdeZV3PLyzWMs39KzpUBxX40/HRLV C6ksC1phiZumhVmTU7OfFTyltJOwlksthH6FZxtb03bkK0IkDnnUg+cluoHxtwf+81Ka RfEqXXdN7o+zMdET8/C8dTzcEeDCAZQtZ0K+4fDUwAWjf5JSADp3QDe7vB0BLFhbiNKs 3B/Ds5zRFxD8NVFH+0ql0PEhWiy38c2zmrTbOkY82tFxAWIKh6p0KAO4jyU8KXlnk6n/ aJcH4WOCf4Hr4OgvsINkJefCzuL4z0Q+LAaFmfDrcvDbZNbKYPcBqQ2YVL01WeZTm9GN 29DQ== X-Gm-Message-State: ACrzQf2UKFYvZaSwCC0LuoP1ZgC0eOIfB1ZdmfdvyM6vpTrjz/ScNiki QOSiKomwNys+x9rUuyY2M//hxQ== X-Received: by 2002:a05:6000:15c5:b0:22e:44c5:4973 with SMTP id y5-20020a05600015c500b0022e44c54973mr13466496wry.513.1666371194035; Fri, 21 Oct 2022 09:53:14 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:12 -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 v2 7/9] ASoC: qdsp6: audioreach: add support to enable SAL Module Date: Fri, 21 Oct 2022 17:52:05 +0100 Message-Id: <20221021165207.13220-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-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,URIBL_BLOCKED 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?1747317379866551764?= X-GMAIL-MSGID: =?utf-8?q?1747317379866551764?= 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 Fri Oct 21 16:52: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: 6881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp805650wrr; Fri, 21 Oct 2022 10:02:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68glQYZDNyiu/cuCRKJpw16DIch8ap/tsFj1oKpKd33ZTQW60kBr5OJkIL4rjVCtfjPKw9 X-Received: by 2002:a17:90b:524f:b0:212:c22f:fbd1 with SMTP id sh15-20020a17090b524f00b00212c22ffbd1mr8487407pjb.155.1666371737795; Fri, 21 Oct 2022 10:02:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666371737; cv=none; d=google.com; s=arc-20160816; b=aflHh9cwrqYjf7M+lZN2vrwYDWASCTfGCCvQvEX5kaeJOHjItSg7zTjxwqfi5MQr6u tvm42oeSVIVfkQwdrdrulOrRJJ5cKAsaLmQFUbmGuZUAOGrJjPb7hWB///2UQzZQ0fz3 wvuy/0ZGSx8yCcc75dsL6rGmMjhPpyE2MXQJ4qG8r/PFg4YE8D3RFipgqLns+gSEhR++ P1G5PiGNEXGuCBrsFdpPUGdpG62cRPe4d5HFgNwLAPVzv/FslbXpWqNlAKkzvNixLp+m I5lRtFPMu+dtyEyHATCb6QWhn7B3cD5M6+cORYNnRIkTpxxJDTT6egoC0FOLK5nbuW+C Vukg== 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=dI9MjSKouQ1/pxXK07nt+zim65E+/XgjLIZ15Hy1lz/xtRtVey22hPd1xV4eJ4bOoG C9EzFNbEvB+kNOfDL7IzTNjwI/GrLtVXCa32hhnyMxcZMo56GrBPMLqTDhxqATXKGByw ivV7yuFhvtA1CvBzOjTcOJ1hf/IU3dBeCZto/oAjK+b9/EMbjd4hUfBkxrzwFkugKCQD YYtX6YzCoCSwTceRPW60obGlDZVSqQRygg7RFr8r1lKT3DNTydK7H5G0UnkTugKpMkII TU8hrI5MtkaD9Wst2DEg0xEmU5yQTDnkVHC16XhMFPjFJ+zwXTElfhEOYdhZwliURFXu csQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ETL3DvzL; 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 z6-20020a170902d54600b0017a0a61ce92si25245930plf.77.2022.10.21.10.01.48; Fri, 21 Oct 2022 10:02:17 -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=ETL3DvzL; 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 S231464AbiJUQyD (ORCPT + 99 others); Fri, 21 Oct 2022 12:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbiJUQx0 (ORCPT ); Fri, 21 Oct 2022 12:53:26 -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 23C7328867C for ; Fri, 21 Oct 2022 09:53:19 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id bv10so5921974wrb.4 for ; Fri, 21 Oct 2022 09:53:18 -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=ETL3DvzLayvhN6lct9pEKhf6AIC3RMKL/sYqgiaYuuG9Atl2eKXV0r5PI/h9+pcPft r9gJEdYSK5QnUBSQs1NwQvvN6oNNoyxdpgdBUeUzIU/ukzeDlU5aPXICNGTNwammybIV 3Up5iqGnJjua6H1XOjOTv0Z7qI8wGJNtL9AWalLj9ab4DN34tGovnHHcBDpYUbzRx4wl yAvTecuj/qkIojyqPlhYdszabqpNX6EG1g63Mps3CBIGvftvb7KVjjcfejrgXw4MimlG f0T1DKtGhcHv1HzAcVRel6VOT6puEwhJK+oH7VbvA41Jqf6vqmRRpQWvZjx/hZfmg1Pk wJhQ== 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=xJRI9UXWqvqDlq2/JSFic8SU8xYhY9FMknbpuEF1AU7ms388917A/fZvSFkhSUHHLD XbEC36nTTOaCkkOFbs9hZVDYMyxmd3ipWmJd04Ey+lzZLZJ7EdrxI+cMpmQkN61dQLOM 9Md2U3vXXsBA9YsdXIJ8qBvFfAEZXAJhdgYVqUjr+iuYk+WNvecDTsLm6lrPDhxDW/qh nuHdT0lQWFqhyedSrTeAq7Y3ChmGrSHRgnVvSiMloQft8HQ2KkJ/MmntlQiOZFUbc93I q1V0GKXOo/lkeXTHXuVKlHH4lWbbtVo7sl6aBCVvYuKlzJr8AyBI2oI0o1Yp5+M85LyH 9Q3A== X-Gm-Message-State: ACrzQf1FFowt9zuSYA6xakSRROBWxqm5t7i2n6Xbschx1vJU+NmraTxz G+o03h3SGDQ8Q1kZEGyb0/MP2w== X-Received: by 2002:a5d:5084:0:b0:22e:2f15:b521 with SMTP id a4-20020a5d5084000000b0022e2f15b521mr13612358wrt.271.1666371195376; Fri, 21 Oct 2022 09:53:15 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:14 -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 v2 8/9] ASoC: qdsp6: audioreach: add support for MFC Module Date: Fri, 21 Oct 2022 17:52:06 +0100 Message-Id: <20221021165207.13220-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-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,URIBL_BLOCKED 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?1747317411365377066?= X-GMAIL-MSGID: =?utf-8?q?1747317411365377066?= 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 Fri Oct 21 16:52: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: 6879 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp805194wrr; Fri, 21 Oct 2022 10:01:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47bNT8huz5GrCnjfyQbRh2MBuQKoeFC5l4C4zCrX719VifgZtgwwNk/o5eR1LZDL5oJPfc X-Received: by 2002:a05:6402:4446:b0:457:eebd:fe52 with SMTP id o6-20020a056402444600b00457eebdfe52mr18105015edb.234.1666371698565; Fri, 21 Oct 2022 10:01:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666371698; cv=none; d=google.com; s=arc-20160816; b=ccA6tj7u45JmKhe0MonofiMxsxexXfiwe5543Mrchp24ij1njml6rHXY3o2chp3c+5 nUeKCD3zyHsUw9jaW6hMVemDpkDQIRydgdAsxA0RtTISCuyU3LdN+ZS41exIi11QMnW2 nQGOZvRsFa4at6JsJSSmORU293i3d3IYpm9t6GUFtBr+LwrVjGO/U5p1ohXrn9vYIRav WRQipGOhA7H2Vnv7c/y6AdaiQ01fFGEJ+BvZEBCDtdsO2wfaEgqHeZ5vdK1hQ9BUC6wX ZIJ+wB9kNDT5S1lQDHhjhURSznLSHnrWT5JHZBK3fgCbl9a2U3VccwftDH6RwIcmFr6o g7rA== 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=tecWLRr5UWN+tKU9gUxEKS+YJhtqr+QICMa7B6EaerMKKSLSrd7MhJYP5aJkyRRm/D kv4UCfZVuW2NDeWyWaqFrYO9BwkeHnKjjZdSx2neVBGw+69+PQzQS1oCgiqkWw1zmEcJ uwYX5n9R4t20k3YsYs9wRaR9sY9KYpw4oKL3m68nDYTHrv6/eirj6Kg11mXUTfzvsLW3 cR3CQ+iWei1SUlircs9OQVYr297shTi82ENAxDosaIUUmI8+a7LxETNv3g4rqdTRtinV 4sSxy+Y+24bpZyVuT9U+eOSOC/KW30tqh3t36Ns33ecu7z64JjWp6ROoD7O1lEtT24+h aGXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="v2L7/MLQ"; 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 sa22-20020a1709076d1600b0078b96068bc0si22461627ejc.79.2022.10.21.10.00.51; Fri, 21 Oct 2022 10:01:38 -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="v2L7/MLQ"; 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 S231415AbiJUQxz (ORCPT + 99 others); Fri, 21 Oct 2022 12:53:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbiJUQxX (ORCPT ); Fri, 21 Oct 2022 12:53:23 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03E9128F26F for ; Fri, 21 Oct 2022 09:53:18 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id bu30so5873442wrb.8 for ; Fri, 21 Oct 2022 09:53:18 -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=v2L7/MLQEM62vRMDJl2OvRagyQDMvI9Nymr91iGl6SCFtRwreusq9eArbalmCitKmw +hhaFtS/OnHIn+5Xf6nwDNqdfoUMc7HgHUiF2pUGEE3DwN7QEYkAcxb4cK4TRHIDHee5 qtcn/Zh7JexBtSjqDnAv3pzmWv3BQM8oepnsMsqkgFsgD7GAXqIIdx6gyUhxyW1yZf0a jJ9asdZ03lPN3bVlMf+Jf6yZGUdf3sE3aPcWLKN0O7T8ZGPUQl3+gJSbTImklJ8iGhlu wGxVv2oHVoc11MJe/Ebl0h3dBwVu89Zv+HwtG2xPUafiph0CvZLyUJXmP5rEAerNZreA 6mJA== 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=7DoqgyLV0Ul2nSKeTNdQo5MJh5ekjaLxTVfKAcLmZp1MQuz4iGNbTp17sjv8VV5duL d8dX7fvDHusAXPtzTCaB+JTxWK5DGxGDaWcOFHeaNcppbOx2ngDkOoyKMfv/fhMLuHzf JsBoaLYmc6uOrXxYYol89inFcgOb4oqlJOZ2fW52pRqrHoY5u96fbTqZnj4jsbriEeFO qmdydC+tjSU5p2TCT2gBBpWK4aa6rz4ojiLZadkCIAPrJ7Y7ephMTeuP3y3HiLeVQbw+ Oou/5ntU19Jxp5IsGfM4b1sAyNGvqivdHbepRXak3oEZMom5eHd/Upc2LrqmDFjYDthi wuUQ== X-Gm-Message-State: ACrzQf2VpiJ359+jxG6kLhXupxFc+X/+5SVoxKl2r7rQxaoyjnKYtJzu aMWqI46aP3GeVa2QTRGeQdyMow== X-Received: by 2002:a5d:598d:0:b0:230:f238:a485 with SMTP id n13-20020a5d598d000000b00230f238a485mr13533983wri.71.1666371196492; Fri, 21 Oct 2022 09:53:16 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:15 -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 v2 9/9] ASoC: qdsp6: audioreach: add support to enable module command Date: Fri, 21 Oct 2022 17:52:07 +0100 Message-Id: <20221021165207.13220-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-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,URIBL_BLOCKED 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?1747317369975316228?= X-GMAIL-MSGID: =?utf-8?q?1747317369975316228?= 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 {