From patchwork Fri Jun 16 10:00:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 694120 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DBDACEB64DA for ; Fri, 16 Jun 2023 10:02:54 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8F1DC82B; Fri, 16 Jun 2023 12:02:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8F1DC82B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686909772; bh=Bk2q3iAAiKycn2Ls9NCUI96RekuI5lfq81JLCALIQyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=hwwB0q5ajrtbWtUeHCMawTbD9TNfJp/bjLJdxmhsnLeL9XAt/4RNddGLoYnwPSfiZ aCEkDGTmVOz0SooBrQkRwzwrM2X1ZeNSTSFIQ2TliwvJefwlotxhLDvG1XrTciQVKN 38NxSb+kNIWc3uHpK/excTB9SHIjfMk0AiTKQrEU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7984BF80553; Fri, 16 Jun 2023 12:01:13 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 9DA35F80553; Fri, 16 Jun 2023 12:01:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 641A1F80246; Fri, 16 Jun 2023 12:01:08 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1973FF80132 for ; Fri, 16 Jun 2023 12:00:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1973FF80132 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=nn1BiNhC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686909661; x=1718445661; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Bk2q3iAAiKycn2Ls9NCUI96RekuI5lfq81JLCALIQyw=; b=nn1BiNhCNBxDp/TovIPzGiRzgf4wrIBWssoHbzR7rJB/XzdZkcxz1SVC mctwGVnjpJpJ8QbqorFgmojXDzjlQ3FNfBn7ygvXcrKLOOK+nAaWp8YQ4 oG5xn1q/d0mtEJ74LpxvrVwqfXbOkEM/jYhNjafLw17Z88lBoJZLH5Txw FaoiBx/a4JhyVWBPG897PjuluCpmpDfvfa7S4K8S7LX7UkXJy0LUMyHRy 1Xm6XCEaWhQFCbKZ3M1Mna4hRMv6bNSBaS5xkdM6idnH6T012Qz0YKqeJ tJhYmoPbedK2SFncFvtl0O8nKfuyRWGTPBbISB2q5TFG5aF95XybvT6pD w==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="362591580" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="362591580" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:00:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="825689338" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="825689338" Received: from kjaffe-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.254.114.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:00:54 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart Subject: [PATCH 1/8] ASoC: SOF: sof-audio: add is_virtual_widget helper Date: Fri, 16 Jun 2023 12:00:32 +0200 Message-Id: <20230616100039.378150-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> References: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: HC33MM6WZFNGCTEBZVRN2JXT4TXFRXZN X-Message-ID-Hash: HC33MM6WZFNGCTEBZVRN2JXT4TXFRXZN X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Bard Liao Testing virtual widget is required in many functions. No function changed in this commit. Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/sof-audio.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 1cbda595c518..c77d07d62517 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -14,6 +14,20 @@ #include "sof-of-dev.h" #include "ops.h" +static bool is_virtual_widget(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, + const char *func) +{ + switch (widget->id) { + case snd_soc_dapm_out_drv: + case snd_soc_dapm_output: + case snd_soc_dapm_input: + dev_dbg(sdev->dev, "%s: %s is a virtual widget\n", func, widget->name); + return true; + default: + return false; + } +} + static void sof_reset_route_setup_status(struct snd_sof_dev *sdev, struct snd_sof_widget *widget) { const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg); @@ -231,23 +245,9 @@ int sof_route_setup(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *wsourc bool route_found = false; /* ignore routes involving virtual widgets in topology */ - switch (src_widget->id) { - case snd_soc_dapm_out_drv: - case snd_soc_dapm_output: - case snd_soc_dapm_input: + if (is_virtual_widget(sdev, src_widget->widget, __func__) || + is_virtual_widget(sdev, sink_widget->widget, __func__)) return 0; - default: - break; - } - - switch (sink_widget->id) { - case snd_soc_dapm_out_drv: - case snd_soc_dapm_output: - case snd_soc_dapm_input: - return 0; - default: - break; - } /* find route matching source and sink widgets */ list_for_each_entry(sroute, &sdev->route_list, list) From patchwork Fri Jun 16 10:00:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 693266 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43F59EB64D7 for ; Fri, 16 Jun 2023 10:03:00 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2F2E1846; Fri, 16 Jun 2023 12:02:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2F2E1846 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686909778; bh=srAy1YN4H6qredt/xC47GYnMbSJvwGaU4Fld0p7l8IU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=lOony6g8U1PwI91atfiPmqYWRKfIRlzbNVSMgeLizVtbtdUxgoE15zcPgRtoFVAQL 2vJaOPu17kI3z8zICkqbCr/EeNJ1MGOnItUirEpNvujfjDmQ41TFlbsCQ5TxdnL59B jvNzHSILmZFCPyq0BRT6VB2taqnTGJFEBFejTr6U= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A131BF8057C; Fri, 16 Jun 2023 12:01:15 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 243ECF8056F; Fri, 16 Jun 2023 12:01:15 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 13FB2F80301; Fri, 16 Jun 2023 12:01:11 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0BAD4F800BA for ; Fri, 16 Jun 2023 12:01:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0BAD4F800BA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=RkSNTxcY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686909663; x=1718445663; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=srAy1YN4H6qredt/xC47GYnMbSJvwGaU4Fld0p7l8IU=; b=RkSNTxcYAZfecdj4dt6bPAIE3YQqAg7M43wGfxkX6LungNmva+TxXk5w rzuySrXLKfK8rzGvDtokWCCLx6aFkdEEBJPOZCErK+FUga6Z9gsJDKnSp uNoRIie37czSIRerwEuBXWsT8wPu32hNBSPxjWAK2SX/6eddtTa0y9Buf NowPmHg+WrnOZ78m/QDiSaikHjn9Gt8Td6Nrz3Q6tKb8wa5MlQRqDjWT5 NlhXA/lWqShgOBlOZlGBJvrsN05IS6FUgz3y9QxdApsjO/hQgcF1geruA rTSp5dcMPHoaTdg0lCXHrCwCrkFuZVXG6IXPNufIiA4ukEpdFlb7bon2K w==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="362591591" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="362591591" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:00:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="825689347" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="825689347" Received: from kjaffe-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.254.114.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:00:57 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart Subject: [PATCH 2/8] ASoC: SOF: sof-audio: test virtual widget in sof_walk_widgets_in_order Date: Fri, 16 Jun 2023 12:00:33 +0200 Message-Id: <20230616100039.378150-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> References: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: NBZ4CTDZJM46TU4GKCEPZS2I5NG4PFCS X-Message-ID-Hash: NBZ4CTDZJM46TU4GKCEPZS2I5NG4PFCS X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Bard Liao Virtual widgets are added for the purpose of showing connections between aggregated DAIs in SDW topologies. However, we shouldn't touch them in SOF. Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/sof-audio.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index c77d07d62517..e7ef77012c35 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -396,6 +396,9 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg const struct sof_ipc_tplg_widget_ops *widget_ops; struct snd_soc_dapm_path *p; + if (is_virtual_widget(sdev, widget, __func__)) + return; + /* skip if the widget is in use or if it is already unprepared */ if (!swidget || !swidget->prepared || swidget->use_count > 0) goto sink_unprepare; @@ -433,6 +436,9 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget struct snd_soc_dapm_path *p; int ret; + if (is_virtual_widget(sdev, widget, __func__)) + return 0; + widget_ops = tplg_ops ? tplg_ops->widget : NULL; if (!widget_ops) return 0; @@ -488,6 +494,9 @@ static int sof_free_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dap int err; int ret = 0; + if (is_virtual_widget(sdev, widget, __func__)) + return 0; + if (widget->dobj.private) { err = sof_widget_free(sdev, widget->dobj.private); if (err < 0) @@ -527,6 +536,9 @@ static int sof_set_up_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_d struct snd_soc_dapm_path *p; int ret; + if (is_virtual_widget(sdev, widget, __func__)) + return 0; + if (swidget) { int i; @@ -592,6 +604,9 @@ sof_walk_widgets_in_order(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, return 0; for_each_dapm_widgets(list, i, widget) { + if (is_virtual_widget(sdev, widget, __func__)) + continue; + /* starting widget for playback is AIF type */ if (dir == SNDRV_PCM_STREAM_PLAYBACK && widget->id != snd_soc_dapm_aif_in) continue; From patchwork Fri Jun 16 10:00:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 693263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DF76EB64D8 for ; Fri, 16 Jun 2023 10:04:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5BA7883A; Fri, 16 Jun 2023 12:03:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5BA7883A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686909876; bh=euc1LNyU/gOBdaoUs/unm7pIRjpPLm0R/Sx438RYDVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UY98dGykkcNi2d6Nr6AjbZHqeMxGTCtNQTZPQxDd7zq2HedPOPXOtm4yF27diXXia dUgAIxNuJAu4BTL0u3ACvwrsGdg2jj0QZPrmqp909QL7E8G6N8q+Mz/Tw67kSind6v r6AgQFKz1N1rEvs6Q0MajBLe7L9iQaWnwRA/MGlw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3A043F805D9; Fri, 16 Jun 2023 12:01:54 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id DEB17F80548; Fri, 16 Jun 2023 12:01:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 55DFFF805BE; Fri, 16 Jun 2023 12:01:48 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A7A6BF80155 for ; Fri, 16 Jun 2023 12:01:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A7A6BF80155 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=OtrmcSSb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686909664; x=1718445664; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=euc1LNyU/gOBdaoUs/unm7pIRjpPLm0R/Sx438RYDVY=; b=OtrmcSSbPpftShvaqPCL5XsfoIs6m5i5xJ+hISK9Lz1ukWn4jONHaE+9 HlwRIHB9nl7rw8aZlLxqrUDCa4em4lO+UsXf2fi46+K8G8v9dcSKP0dXa Q7AhQD9n1V+Avn9+u/iBG/EdCSArG7UDaz6lf6b1gBbDQkCV/YG8UScqa PZaTCfdZnUnbFoz9eKhA/6D8/IXSV5bizCC3hn2D2IEp1mrysgoRWqzU5 G0qZEyxFsdBCliFfmneqD9rapR84dAIFiGx9imNWHujW43sRwh7IelPRf 0pLnsoDkvKbJcs/VP+CNHqlrsVw0+yw3I/LK+bFDIrDjOvjzw2PVFg3rm g==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="362591608" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="362591608" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="825689393" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="825689393" Received: from kjaffe-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.254.114.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:00:59 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Peter Ujfalusi , Kai Vehmanen , Daniel Baluta , Ranjani Sridharan , Rander Wang , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 3/8] ASoC: SOF: core: Free the firmware trace before calling snd_sof_shutdown() Date: Fri, 16 Jun 2023 12:00:34 +0200 Message-Id: <20230616100039.378150-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> References: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: FOP4ZTRPE7WI7H7FLXO6SSCI4LMUXPTC X-Message-ID-Hash: FOP4ZTRPE7WI7H7FLXO6SSCI4LMUXPTC X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Ujfalusi The shutdown is called on reboot/shutdown of the machine. At this point the firmware tracing cannot be used anymore but in case of IPC3 it is using and keeping a DMA channel active (dtrace). For Tiger Lake platforms we have a quirk in place to fix rare reboot issues when a DMA was active before rebooting the system. If the tracing is enabled this quirk will be always used and a print appears on the kernel log which might be misleading or not even correct. Release the fw tracing before executing the shutdown to make sure that this known DMA user is cleared away. Reviewed-by: Kai Vehmanen Reviewed-by: Daniel Baluta Reviewed-by: Ranjani Sridharan Reviewed-by: Rander Wang Reviewed-by: Bard Liao Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 9a9d82220fd0..30db685cc5f4 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -504,8 +504,10 @@ int snd_sof_device_shutdown(struct device *dev) if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)) cancel_work_sync(&sdev->probe_work); - if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) + if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) { + sof_fw_trace_free(sdev); return snd_sof_shutdown(sdev); + } return 0; } From patchwork Fri Jun 16 10:00:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 694119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F03B9EB64D7 for ; Fri, 16 Jun 2023 10:03:18 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 26D6686E; Fri, 16 Jun 2023 12:02:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 26D6686E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686909797; bh=lIJV9WJVsC1i11gMTvTAxOJ8VEod0bdEOZLVzE3/D6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=dbG5kJJBcUfk4gTF5d9OzgIl7RbBtDe4FZon4ElErZIbALDj8Af+u9+j4nOVYW6KO N7tw/ibXuimi8TzGC2X9K7o9pvlKfkn9GC3aOJt8zLceDMvFk9E+hbybNgPnZQMgKo Dq0Jk8GNeVVusZIByXmiFdaBmCX7Fbz5oluQITbM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 15C28F80589; Fri, 16 Jun 2023 12:01:21 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 51F2EF80568; Fri, 16 Jun 2023 12:01:20 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3FA93F80578; Fri, 16 Jun 2023 12:01:15 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2FE15F80130 for ; Fri, 16 Jun 2023 12:01:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2FE15F80130 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=WzqXp/4O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686909670; x=1718445670; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lIJV9WJVsC1i11gMTvTAxOJ8VEod0bdEOZLVzE3/D6g=; b=WzqXp/4ONAMzBgV8JKNfNa0teHPZfhh/3W17Y6l0olrwx7flIonoPe2q 4LH1FdZbUCc7RcYPprwTkVdIat4FWKf2gXAL1pvipoZGYk3yw9oK7S/go uYKjNBlIo8I+d+/3P8fr5udM22GukjI4P9KXqN50ntO8zpCgLcVXF4C+Y wH1r6xzU0SYVRmEz7vLWPWmTpWI7vZAZM6DmoV/rlUQR6LKhjBusTzJqZ cC6izmlNGVS3N66pDj+XdOkIaF3E6V2ldlstoiJOj+jr1IDG10mCU1MgT xF5eZhS6sZieZH3ymM6iNLvejsPaBHbct2Jj0At+ywGI7b/Mq4ivW8NqL g==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="362591630" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="362591630" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="825689396" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="825689396" Received: from kjaffe-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.254.114.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:03 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Peter Ujfalusi , Kai Vehmanen , Ranjani Sridharan , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 4/8] ASoC: SOF: Add new sof_debug flag to request message payload dump Date: Fri, 16 Jun 2023 12:00:35 +0200 Message-Id: <20230616100039.378150-5-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> References: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: B7HDT4ICLGRPOTNHY4HIRJVXHWPEMLNV X-Message-ID-Hash: B7HDT4ICLGRPOTNHY4HIRJVXHWPEMLNV X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Ujfalusi We only print out the header information of an IPC message in debug level, either in verbose or non verbose way (Kconfig option). On top of the header information the message itself can help reproducing and identifying issues. BIT(11) can be used to request a message payload dump if it is supported by the IPC implementation. Since IPC message payload printing is only implemented for IPC4, the flag will not have any effect to IPC3 for now. Reviewed-by: Kai Vehmanen Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/sof-priv.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index cd4f6ac126ec..d4f6702e93dc 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -48,6 +48,9 @@ struct snd_sof_pcm_stream; #define SOF_DBG_FORCE_NOCODEC BIT(10) /* ignore all codec-related * configurations */ +#define SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD BIT(11) /* On top of the IPC message header + * dump the message payload also + */ #define SOF_DBG_DSPLESS_MODE BIT(15) /* Do not initialize and use the DSP */ /* Flag definitions used for controlling the DSP dump behavior */ From patchwork Fri Jun 16 10:00:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 693265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0825AEB64D8 for ; Fri, 16 Jun 2023 10:03:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D51B9828; Fri, 16 Jun 2023 12:02:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D51B9828 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686909813; bh=ydRsfYTPJOjT9KIaSZNQlDhEuEelN1lLPEXhvr0ySeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=vuf4pvqBCYa8hsBItjP3GfT9/QJtlMz3rOCyICmgP1R6B+3REeBSlKySRW3cAb7oL hQx787MyEauZJ/s/TvghGHARNRP2QMKok4uGL3sEALFJRMkHWVgJN7mdmyZevaRWTS 5yUtjn6zP/KsofBIRFaPLakk5H4DE8ljlwhIZ+nc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3B489F805AC; Fri, 16 Jun 2023 12:01:23 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 5D01FF805A0; Fri, 16 Jun 2023 12:01:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EBDD3F8057B; Fri, 16 Jun 2023 12:01:17 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 53054F80246 for ; Fri, 16 Jun 2023 12:01:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 53054F80246 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=IlX8PHx2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686909672; x=1718445672; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ydRsfYTPJOjT9KIaSZNQlDhEuEelN1lLPEXhvr0ySeU=; b=IlX8PHx2T/B1kAEu9KtWq5snobZQLpq1ad0yHSEkI37YjN4WoepcOI8Z UAbOgn6uyPkJDMkQeYl8ce4enfEOB8F3fD3L6NoaiD8TvtSgzZBrU2TjH uChNdnsatzplTXuO1UK/WoosJe+S7m/l3rLLy4vcIuweTDUWpxE+UG+Wl XNfbYodq8sYnlUHF0ooE9EGxFewLycxcS6nipX3C5k6EZhpYaWO7CfXhz KXwbW/c7tB+S5xLnAK7uaS1qPG3nMfAmQdU4M1sH5PIQwcx/qI/oh3MBM y77H3/0stetyU21nVDCSZL2dIhIRwLO05aACPZjDDLmvHuJKIdrO3SupF g==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="362591650" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="362591650" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="825689413" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="825689413" Received: from kjaffe-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.254.114.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:05 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Peter Ujfalusi , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 5/8] ASoC: SOF: ipc3: Dump IPC message payload Date: Fri, 16 Jun 2023 12:00:36 +0200 Message-Id: <20230616100039.378150-6-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> References: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: WPOJAL2M7AAIPT3HORY4HS2VQHVBYO65 X-Message-ID-Hash: WPOJAL2M7AAIPT3HORY4HS2VQHVBYO65 X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Ujfalusi Dump the IPC message payload if BIT(11) of sof_debug is set and the message contains more data than just a header. The header size differs between TX and RX and in case of set_get_data, the header is always the reply header for the message regardless if it is TX or RX. The use of printk(KERN_DEBUG "..."); is on purpose to keep the dmesg output tidy. Reviewed-by: Bard Liao Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/ipc3.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/sound/soc/sof/ipc3.c b/sound/soc/sof/ipc3.c index ec1ac0fb2d9f..2c5aac31e8b0 100644 --- a/sound/soc/sof/ipc3.c +++ b/sound/soc/sof/ipc3.c @@ -223,6 +223,14 @@ static inline void ipc3_log_header(struct device *dev, u8 *text, u32 cmd) } #endif +static void sof_ipc3_dump_payload(struct snd_sof_dev *sdev, + void *ipc_data, size_t size) +{ + printk(KERN_DEBUG "Size of payload following the header: %zu\n", size); + print_hex_dump_debug("Message payload: ", DUMP_PREFIX_OFFSET, + 16, 4, ipc_data, size, false); +} + static int sof_ipc3_get_reply(struct snd_sof_dev *sdev) { struct snd_sof_ipc_msg *msg = sdev->msg; @@ -374,6 +382,29 @@ static int sof_ipc3_tx_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_ ret = ipc3_tx_msg_unlocked(ipc, msg_data, msg_bytes, reply_data, reply_bytes); + if (sof_debug_check_flag(SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD)) { + size_t payload_bytes, header_bytes; + char *payload = NULL; + + /* payload is indicated by non zero msg/reply_bytes */ + if (msg_bytes > sizeof(struct sof_ipc_cmd_hdr)) { + payload = msg_data; + + header_bytes = sizeof(struct sof_ipc_cmd_hdr); + payload_bytes = msg_bytes - header_bytes; + } else if (reply_bytes > sizeof(struct sof_ipc_reply)) { + payload = reply_data; + + header_bytes = sizeof(struct sof_ipc_reply); + payload_bytes = reply_bytes - header_bytes; + } + + if (payload) { + payload += header_bytes; + sof_ipc3_dump_payload(sdev, payload, payload_bytes); + } + } + mutex_unlock(&ipc->tx_mutex); return ret; @@ -472,6 +503,14 @@ static int sof_ipc3_set_get_data(struct snd_sof_dev *sdev, void *data, size_t da offset += payload_size; } + if (sof_debug_check_flag(SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD)) { + size_t header_bytes = sizeof(struct sof_ipc_reply); + char *payload = (char *)cdata; + + payload += header_bytes; + sof_ipc3_dump_payload(sdev, payload, data_bytes - header_bytes); + } + mutex_unlock(&sdev->ipc->tx_mutex); kfree(cdata_chunk); From patchwork Fri Jun 16 10:00:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 694118 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7CFAEB64D7 for ; Fri, 16 Jun 2023 10:03:47 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5BF22850; Fri, 16 Jun 2023 12:02:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5BF22850 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686909825; bh=5uUan09521IhdAtIQuxDdPmUuMj3zu+2q5cKVzNhmL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Jpc4pUqI6Wk69D0jEWbbuUrCTZ1R6fBWN7dtMSpXuGKysmWRrKF7ehjIgGe2qNR08 s0muIkx2uZ8rlYghRfuwe2Yg7AaSyLMx/r+jxG3/ilu7kCnV09a2msVQC239Y7QtX4 bHnIlatvXzWgkDWhXOGhBjQu9+09Slnb6rRqjPGY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 24FBAF805BD; Fri, 16 Jun 2023 12:01:27 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3FEC8F805B1; Fri, 16 Jun 2023 12:01:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2D0C1F80558; Fri, 16 Jun 2023 12:01:21 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E356EF80558 for ; Fri, 16 Jun 2023 12:01:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E356EF80558 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=QJ6xzB0N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686909673; x=1718445673; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5uUan09521IhdAtIQuxDdPmUuMj3zu+2q5cKVzNhmL0=; b=QJ6xzB0NjZj6xm2Zd1C0k65fv6znUYEa0I3kloKXdEXG3aNYNuXHhKFa qZyO+bJZVk4d37olDBE2aJVCFLC/0ej3z6LKt5SklDfQaUUb7tg9BFd9n fCXbBOkrbo15wroaK9pdy/BhuBtM82+ibdvUlqdiogdh6WBZOew/hFPb4 7oLfJEt0J3pQ+AGLZmSo1H7aI9i+aWLB2b9Qh5mxGTLJAWJneGEoG9iO5 BPrQguQAm9wlqgf5V8gLCn3QjPQZwBBqQDcLGxHXAL3ntymVznKVwiTNS 7kbwsCEsP7H9TPspu0U7jZl1fpGizdtkc15iwlaw09l9aC9pBAYDle+o/ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="362591666" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="362591666" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="825689436" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="825689436" Received: from kjaffe-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.254.114.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:09 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Peter Ujfalusi , Kai Vehmanen , Ranjani Sridharan , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 6/8] ASoC: SOF: ipc4: Switch to use the sof_debug:bit11 to dump message payload Date: Fri, 16 Jun 2023 12:00:37 +0200 Message-Id: <20230616100039.378150-7-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> References: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: A3KRHIW7P6CVNUBV2LA7BPKNT2CVPLEA X-Message-ID-Hash: A3KRHIW7P6CVNUBV2LA7BPKNT2CVPLEA X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Ujfalusi Use the SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD flag to print the message payload instead of the DEBUG_VERBOSE, which would need code modification and kernel re-compilation. Reviewed-by: Kai Vehmanen Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/ipc4.c | 46 +++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/sound/soc/sof/ipc4.c b/sound/soc/sof/ipc4.c index 246b56d24a6f..ab6eddd91bb7 100644 --- a/sound/soc/sof/ipc4.c +++ b/sound/soc/sof/ipc4.c @@ -17,15 +17,6 @@ #include "ipc4-priv.h" #include "ops.h" -#ifdef DEBUG_VERBOSE -#define sof_ipc4_dump_payload(sdev, ipc_data, size) \ - print_hex_dump_debug("Message payload: ", \ - DUMP_PREFIX_OFFSET, \ - 16, 4, ipc_data, size, false) -#else -#define sof_ipc4_dump_payload(sdev, ipc_data, size) do { } while (0) -#endif - static const struct sof_ipc4_fw_status { int status; char *msg; @@ -256,6 +247,13 @@ static void sof_ipc4_log_header(struct device *dev, u8 *text, struct sof_ipc4_ms } #endif +static void sof_ipc4_dump_payload(struct snd_sof_dev *sdev, + void *ipc_data, size_t size) +{ + print_hex_dump_debug("Message payload: ", DUMP_PREFIX_OFFSET, + 16, 4, ipc_data, size, false); +} + static int sof_ipc4_get_reply(struct snd_sof_dev *sdev) { struct snd_sof_ipc_msg *msg = sdev->msg; @@ -362,9 +360,6 @@ static int sof_ipc4_tx_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_ void *reply_data, size_t reply_bytes, bool no_pm) { struct snd_sof_ipc *ipc = sdev->ipc; -#ifdef DEBUG_VERBOSE - struct sof_ipc4_msg *msg = NULL; -#endif int ret; if (!msg_data) @@ -386,19 +381,21 @@ static int sof_ipc4_tx_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_ ret = ipc4_tx_msg_unlocked(ipc, msg_data, msg_bytes, reply_data, reply_bytes); + if (sof_debug_check_flag(SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD)) { + struct sof_ipc4_msg *msg = NULL; + + /* payload is indicated by non zero msg/reply_bytes */ + if (msg_bytes) + msg = msg_data; + else if (reply_bytes) + msg = reply_data; + + if (msg) + sof_ipc4_dump_payload(sdev, msg->data_ptr, msg->data_size); + } + mutex_unlock(&ipc->tx_mutex); -#ifdef DEBUG_VERBOSE - /* payload is indicated by non zero msg/reply_bytes */ - if (msg_bytes) - msg = msg_data; - else if (reply_bytes) - msg = reply_data; - - if (msg) - sof_ipc4_dump_payload(sdev, msg->data_ptr, msg->data_size); -#endif - return ret; } @@ -516,7 +513,8 @@ static int sof_ipc4_set_get_data(struct snd_sof_dev *sdev, void *data, if (!set && payload_bytes != offset) ipc4_msg->data_size = offset; - sof_ipc4_dump_payload(sdev, ipc4_msg->data_ptr, ipc4_msg->data_size); + if (sof_debug_check_flag(SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD)) + sof_ipc4_dump_payload(sdev, ipc4_msg->data_ptr, ipc4_msg->data_size); out: mutex_unlock(&sdev->ipc->tx_mutex); From patchwork Fri Jun 16 10:00:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 693264 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8F1EEB64D8 for ; Fri, 16 Jun 2023 10:04:07 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5C798829; Fri, 16 Jun 2023 12:03:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5C798829 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686909845; bh=/SrPvf22NQSBPFIMA709/BzWKL29SuvAijCsgY836Cg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=W9SNZpS+hiBgv1pqHs1r/q9Sf5wB5WENFg0NKGc+l8FfyAI28yv3vbMlmXzdEjR86 arQ/Wpb+kn1AWON9/xRwd6lD5nH68zgsALX/PdGtKbhzfi9X+5VWxtHQjIdlpjhQUV /zj72pB1P7DKNFN7UDVkioB3mFOhn1s4Cl8uhPPI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 14D7EF805C2; Fri, 16 Jun 2023 12:01:32 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 333FBF805BE; Fri, 16 Jun 2023 12:01:32 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 62AC0F805BF; Fri, 16 Jun 2023 12:01:28 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6BEB6F80558 for ; Fri, 16 Jun 2023 12:01:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6BEB6F80558 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=jbUK6QV6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686909683; x=1718445683; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/SrPvf22NQSBPFIMA709/BzWKL29SuvAijCsgY836Cg=; b=jbUK6QV6L3wpue2++XmWCUMlc9rRvugy5V6MqkA2hXZAzoYoaKmRGbM2 DxnjEsZ8d8ho0+MRrrh55igmMmfrenpoBRBL5BFRJKfpXMSJ8XmVXjMGy Y9t7CccgfUelmYLacorewPOY4dJVP6uGqpZOVwKBx1X55aEO6DJwXxK7X hHLOaG28QBfhS29sG4KdGxsXnZLz6JDt66gnZfDeZWTdPyFrAmj3KQo4d XMf/vUtDujSQ/xjxA7hMLT55txJGA0NhvLoZLGI1zZsHe4/VqJH7iXezT 7CyJMb8Ow3VpQvAN320bLz7lOLUsLPiHLijk85eq7XcnIcdTw0UGd1lHE w==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="362591711" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="362591711" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="825689454" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="825689454" Received: from kjaffe-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.254.114.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:11 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Peter Ujfalusi , Daniel Baluta , Paul Olaru , Ranjani Sridharan , Pierre-Louis Bossart Subject: [PATCH 7/8] ASoC: SOF: pm: Remove duplicated code in sof_suspend Date: Fri, 16 Jun 2023 12:00:38 +0200 Message-Id: <20230616100039.378150-8-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> References: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: GBOZUC7IZLWIIJBHVFQ4IXBJMMRQQ3V3 X-Message-ID-Hash: GBOZUC7IZLWIIJBHVFQ4IXBJMMRQQ3V3 X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Ujfalusi Over time the function has changed and now there is no need to have the duplicated sof_fw_trace_suspend() and sof_suspend_clients() in the if (target_state == SOF_DSP_PM_D0) branch. Remove it and add a simple check with a single goto statement. Reviewed-by: Daniel Baluta Reviewed-by: Paul Olaru Reviewed-by: Ranjani Sridharan Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/pm.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c index 2b232442e84b..704b21413c71 100644 --- a/sound/soc/sof/pm.c +++ b/sound/soc/sof/pm.c @@ -234,20 +234,16 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) pm_state.event = target_state; - /* Skip to platform-specific suspend if DSP is entering D0 */ - if (target_state == SOF_DSP_PM_D0) { - sof_fw_trace_suspend(sdev, pm_state); - /* Notify clients not managed by pm framework about core suspend */ - sof_suspend_clients(sdev, pm_state); - goto suspend; - } - /* suspend DMA trace */ sof_fw_trace_suspend(sdev, pm_state); /* Notify clients not managed by pm framework about core suspend */ sof_suspend_clients(sdev, pm_state); + /* Skip to platform-specific suspend if DSP is entering D0 */ + if (target_state == SOF_DSP_PM_D0) + goto suspend; + #if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE) /* cache debugfs contents during runtime suspend */ if (runtime_suspend) From patchwork Fri Jun 16 10:00:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 694117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3604EEB64DB for ; Fri, 16 Jun 2023 10:04:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 097C39F6; Fri, 16 Jun 2023 12:03:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 097C39F6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686909855; bh=18Cg1qLjEkAqV2l06dhUWufeg8cv1oqaR23A772yCjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=hmhADxwwDj8eP/TzpvwO/yIBFcDAZ7hZGI6siCNB0APWeUR5lHDJkg94rtNffMbei ztuQnrZvrs94/s3oLWiClHMcmgkOlAiEbA2SDIGJ8peq53MbI07zIMxFgO5bUU0jo3 x05dV6IzApwCquvVu303BCyE8kD5XzlmCAGqntmU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8D79EF805C9; Fri, 16 Jun 2023 12:01:35 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 90120F805C8; Fri, 16 Jun 2023 12:01:34 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4C0E1F805BE; Fri, 16 Jun 2023 12:01:30 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 15762F805AF for ; Fri, 16 Jun 2023 12:01:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 15762F805AF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=WX/HTuJl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686909685; x=1718445685; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=18Cg1qLjEkAqV2l06dhUWufeg8cv1oqaR23A772yCjI=; b=WX/HTuJlYxvFF6jCmobHywbWb0eBnZKuvGHrvZmnTn961bLrY0lpOnXi 6bgdgX4pCVGb+FwhmU3I/bSnej/25sW48EARP3OLzvFwgfTc024w6834J rCn+fv2V3wrsatG+9f30A/xMIhPERT8LmWrm1nbyqaaRrWGGNDUEDTgpV NYd90Q5oytlLl9eyxpW570lfaASkA51fg48WxrfhR1AAXnUQ7+dXtbX8V 5yHaxPw7D32q5uN0PF/CPRuVQBzzx8AmQx71X7Eo7KRewQexDVYJF95Ov uqI6H+/fn8ajOwkSGBtZHDdmdYzKcVJ6pNVBp2vTEfH1+LDwb8QPq+wEE Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="362591719" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="362591719" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="825689490" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="825689490" Received: from kjaffe-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.254.114.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:15 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Rander Wang , Ranjani Sridharan , =?utf-8?q?P=C3=A9ter?= =?utf-8?q?_Ujfalusi?= , Pierre-Louis Bossart Subject: [PATCH 8/8] ASoC: SOF: Intel: mtl: setup primary core info on MeteorLake platform Date: Fri, 16 Jun 2023 12:00:39 +0200 Message-Id: <20230616100039.378150-9-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> References: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: DGTPCRYU2NVBZLMXNDBQL4BQT7YSCWKW X-Message-ID-Hash: DGTPCRYU2NVBZLMXNDBQL4BQT7YSCWKW X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Rander Wang Set primary core mask and refcount. Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi Signed-off-by: Rander Wang Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/mtl.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/intel/mtl.c b/sound/soc/sof/intel/mtl.c index 8ae331faca4e..30fe77fd87bf 100644 --- a/sound/soc/sof/intel/mtl.c +++ b/sound/soc/sof/intel/mtl.c @@ -361,11 +361,17 @@ static int mtl_dsp_core_power_up(struct snd_sof_dev *sdev, int core) ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, MTL_DSP2CXCTL_PRIMARY_CORE, dspcxctl, (dspcxctl & cpa) == cpa, HDA_DSP_REG_POLL_INTERVAL_US, HDA_DSP_RESET_TIMEOUT_US); - if (ret < 0) + if (ret < 0) { dev_err(sdev->dev, "%s: timeout on MTL_DSP2CXCTL_PRIMARY_CORE read\n", __func__); + return ret; + } - return ret; + /* set primary core mask and refcount to 1 */ + sdev->enabled_cores_mask = BIT(SOF_DSP_PRIMARY_CORE); + sdev->dsp_core_ref_count[SOF_DSP_PRIMARY_CORE] = 1; + + return 0; } static int mtl_dsp_core_power_down(struct snd_sof_dev *sdev, int core) @@ -388,10 +394,15 @@ static int mtl_dsp_core_power_down(struct snd_sof_dev *sdev, int core) !(dspcxctl & MTL_DSP2CXCTL_PRIMARY_CORE_CPA_MASK), HDA_DSP_REG_POLL_INTERVAL_US, HDA_DSP_PD_TIMEOUT * USEC_PER_MSEC); - if (ret < 0) + if (ret < 0) { dev_err(sdev->dev, "failed to power down primary core\n"); + return ret; + } - return ret; + sdev->enabled_cores_mask = 0; + sdev->dsp_core_ref_count[SOF_DSP_PRIMARY_CORE] = 0; + + return 0; } int mtl_power_down_dsp(struct snd_sof_dev *sdev)