From patchwork Wed Sep 6 20:20:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1830549 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rgv0R5rnsz1yhc for ; Thu, 7 Sep 2023 06:21:27 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qdz1X-0007MV-Uq; Wed, 06 Sep 2023 20:21:15 +0000 Received: from mail-pl1-f170.google.com ([209.85.214.170]) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qdz1T-0007Kf-RT for kernel-team@lists.ubuntu.com; Wed, 06 Sep 2023 20:21:12 +0000 Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1bf55a81eeaso1816425ad.0 for ; Wed, 06 Sep 2023 13:21:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694031670; x=1694636470; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wjYrY2P3lTiz7flrPQ/5D4GlbiGFXlyebXN/QBPjZPU=; b=TjK+sPS7uxeApQgFYHY29jH4SdURZZ678G+4/6JDR49fzK+4cmVy+z4xPrvAaHpaj1 N2j5whHKpwEX57sqQBhumP1N0FLM9fa8c9y7flDVK96bSO4Noe2q4eKaGz+erqPRcNPC cAGmaPAZCQFAaWruICy4auwO5+r1YLsGJzbQrS6o7jdQZHk2LUq0E/TCIoypXYO/tNxJ fk8GIa/yw6Y3ngzGJcJGU7zvb5mPYbLSsuQsAlLJ9yBsrVVy3XNv2v5HZeB/5tsfN9iI t4ecIM+DaPqVREPyVg5Wz5fQMcQ3ubBgTq7aIqM14DcYuIaint94eF2XfrlbNYfBocyb DKoQ== X-Gm-Message-State: AOJu0YwAMeYM7Fx+V+qXfdIh80KCQtfmvkuJRJIaGhT71LeRH2Hl2HXP w4+2KbIKNrVXBbWyRpNBABvDskfY2sg= X-Google-Smtp-Source: AGHT+IHCvOe6BjVUxAbg7zZJwP3noPfeKhP0fBxEVTq3P/Rbo+V5mQXJ47jiPsTEI2fYKe23+AVL6Q== X-Received: by 2002:a17:903:22c3:b0:1bb:c5b5:8353 with SMTP id y3-20020a17090322c300b001bbc5b58353mr18491042plg.4.1694031669729; Wed, 06 Sep 2023 13:21:09 -0700 (PDT) Received: from localhost.localdomain (125-229-129-140.hinet-ip.hinet.net. [125.229.129.140]) by smtp.gmail.com with ESMTPSA id ix5-20020a170902f80500b001bc675068e2sm11450482plb.111.2023.09.06.13.21.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Sep 2023 13:21:09 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU][Mantic] ASoC: SOF: ipc4-topology: Add module parameter to ignore the CPC value Date: Thu, 7 Sep 2023 04:20:25 +0800 Message-Id: <20230906202025.422484-2-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230906202025.422484-1-vicamo.yang@canonical.com> References: <20230906202025.422484-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.214.170; envelope-from=vicamo@gmail.com; helo=mail-pl1-f170.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Peter Ujfalusi BugLink: https://bugs.launchpad.net/bugs/2034506 Add a new module parameter ipc4_ignore_cpc which can be used to force the kernel to ignore the queried CPC value for all firmware modules and use 0 instead. The CPC lookup is still done to report missing configurations and the debug print is going to be different to be explicit that the CPC is ignored and what was the value we would have used. The CPC value is sent to the firmware with the MOD_INIT_INSTANCE message and it is used by the firmware as a parameter for clock scaling. The flag is intended to be used only when there is a need to validate the firmware behavior regarding to clock scaling since the 0 CPC value will force the DSP to run in full speed, disabling the scaling and provides additional counter point to rule out clock management related issues. Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Kai Vehmanen Link: https://lore.kernel.org/r/20230822065419.24374-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown (cherry picked from commit 26ef47e5ba600ead306ee19e0bf56c1bf59213a3) Signed-off-by: You-Sheng Yang --- sound/soc/sof/ipc4-topology.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c index 11361e1cd6881..86888d302d4a0 100644 --- a/sound/soc/sof/ipc4-topology.c +++ b/sound/soc/sof/ipc4-topology.c @@ -17,6 +17,19 @@ #include "ipc4-topology.h" #include "ops.h" +/* + * The ignore_cpc flag can be used to ignore the CPC value for all modules by + * using 0 instead. + * The CPC is sent to the firmware along with the SOF_IPC4_MOD_INIT_INSTANCE + * message and it is used for clock scaling. + * 0 as CPC value will instruct the firmware to use maximum frequency, thus + * deactivating the clock scaling. + */ +static bool ignore_cpc; +module_param_named(ipc4_ignore_cpc, ignore_cpc, bool, 0444); +MODULE_PARM_DESC(ipc4_ignore_cpc, + "Ignore CPC values. This option will disable clock scaling in firmware."); + #define SOF_IPC4_GAIN_PARAM_ID 0 #define SOF_IPC4_TPLG_ABI_SIZE 6 #define SOF_IPC4_CHAIN_DMA_BUF_SIZE_MS 2 @@ -970,9 +983,16 @@ sof_ipc4_update_resource_usage(struct snd_sof_dev *sdev, struct snd_sof_widget * /* Update base_config->cpc from the module manifest */ sof_ipc4_update_cpc_from_manifest(sdev, fw_module, base_config); - dev_dbg(sdev->dev, "%s: ibs / obs / cpc: %u / %u / %u\n", - swidget->widget->name, base_config->ibs, base_config->obs, - base_config->cpc); + if (ignore_cpc) { + dev_dbg(sdev->dev, "%s: ibs / obs: %u / %u, forcing cpc to 0 from %u\n", + swidget->widget->name, base_config->ibs, base_config->obs, + base_config->cpc); + base_config->cpc = 0; + } else { + dev_dbg(sdev->dev, "%s: ibs / obs / cpc: %u / %u / %u\n", + swidget->widget->name, base_config->ibs, base_config->obs, + base_config->cpc); + } } static int sof_ipc4_widget_assign_instance_id(struct snd_sof_dev *sdev,