From patchwork Thu Dec 15 18:53:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 634210 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 C353BC4332F for ; Thu, 15 Dec 2022 18:55:30 +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 7F4C321EA; Thu, 15 Dec 2022 19:54:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7F4C321EA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671130528; bh=j73SLV8Dy0hfxMlBy2XicZPFmXbzH0ZbGjxroUA8I0c=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=e6OLEe/CkLOK0gMkuj02PAMKYzwulVVkcsOeI11F5Y2OKnKbG1zBUnBn8GtSmLSB6 Y6RzmMegMOse+C5w1y1U+Nm8Otl7k2Qsd3//JzYmQ+NUL0B0L5c7z4+M71y6KLseyT kOt0VwDHnOH/OnuJLfpU6ULlq3TAuS+Eda2U4NY0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 29EEAF804FD; Thu, 15 Dec 2022 19:54:17 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 236D9F80510; Thu, 15 Dec 2022 19:54:15 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 C14C3F801D5 for ; Thu, 15 Dec 2022 19:54:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C14C3F801D5 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=Fa0so+i6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671130453; x=1702666453; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j73SLV8Dy0hfxMlBy2XicZPFmXbzH0ZbGjxroUA8I0c=; b=Fa0so+i6d+tCVHzvCPzd6GLHU/j89UGHceNz+F5kdtsW/WSFn0nksxTW 5T7vH1T2DeqQGlvUNmYbcN32yORG46JS3euaP0DlGDTW29r6/BkgySp84 WmM/pEFVc365RogBHW4TfRVRzvGKGVTG+5xBSRlcytBXNmZHNE9PzPuB6 gQS1QR3NeIRnlkqZMQh1nZ0ebvhxbp90Spkg0YLuMdlEyCxLcNc6i5hsG FA2gveYLMECix1ZXxzlMFaHT2W6JlyOz+c1P2+7ZLVlCB3ozw8KWWF43r b4HACmXPrDlXVBLoWRuhjBmn/6aU/1amrEufoJnI9VMwp3rm2VqTjNqRA w==; X-IronPort-AV: E=McAfee;i="6500,9779,10562"; a="318819921" X-IronPort-AV: E=Sophos;i="5.96,248,1665471600"; d="scan'208";a="318819921" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 10:54:05 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10562"; a="738260652" X-IronPort-AV: E=Sophos;i="5.96,248,1665471600"; d="scan'208";a="738260652" Received: from mayurarx-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.35.200]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 10:54:05 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 1/3] ASoC: SOF: pm: Set target state earlier Date: Thu, 15 Dec 2022 10:53:45 -0800 Message-Id: <20221215185347.1457541-2-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221215185347.1457541-1-ranjani.sridharan@linux.intel.com> References: <20221215185347.1457541-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tiwai@suse.de, =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, Curtis Malainey , Bard Liao Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" If the DSP crashes before the system suspends, the setting of target state will be skipped because the firmware state will no longer be SOF_FW_BOOT_COMPLETE. This leads to the incorrect assumption that the DSP should suspend to D0I3 instead of suspending to D3. To fix this, set the target_state before we skip to DSP suspend even when the DSP has crashed. Signed-off-by: Ranjani Sridharan Reviewed-by: Curtis Malainey Reviewed-by: Pierre-Louis Bossart Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi --- sound/soc/sof/pm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c index df740be645e8..5f88c4a01fa3 100644 --- a/sound/soc/sof/pm.c +++ b/sound/soc/sof/pm.c @@ -182,7 +182,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm; const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg; pm_message_t pm_state; - u32 target_state = 0; + u32 target_state = snd_sof_dsp_power_target(sdev); int ret; /* do nothing if dsp suspend callback is not set */ @@ -206,7 +206,6 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) } } - target_state = snd_sof_dsp_power_target(sdev); pm_state.event = target_state; /* Skip to platform-specific suspend if DSP is entering D0 */ From patchwork Thu Dec 15 18:53:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 634977 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 721E3C4332F for ; Thu, 15 Dec 2022 18:55:57 +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 7468B2140; Thu, 15 Dec 2022 19:55:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7468B2140 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671130555; bh=R3HG/Rh2QBhn5h9nrDhEplNPyBpnoPqfH5DA2PQMmI4=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=V4tNw5IAwF3WcJj8OttBHyjK2coBsVcFhRkigwF6Q6sKput2Q0c8NUyxR1b/o+UtU F1/M05jjdY4EfJ1lsrc6ijOH96q79/MjPLEWfAr6S8+GX8YohqXp6rVbihJNV2QFlo mRtejtLfmXgVzW6pgldsv6wOdsKoePubzSVC+k38= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AC3D6F80141; Thu, 15 Dec 2022 19:54:17 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D7F55F80510; Thu, 15 Dec 2022 19:54:16 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 E2EB8F80141 for ; Thu, 15 Dec 2022 19:54:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E2EB8F80141 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=VNXihaDp DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671130456; x=1702666456; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R3HG/Rh2QBhn5h9nrDhEplNPyBpnoPqfH5DA2PQMmI4=; b=VNXihaDp1u4mTRw4QIbSQrPBMxK25idMTfPr52GGDI+qFE+Qq+SmZ2eC n2/I9TOdxy3E0DdVgaH7D+I/VdmUjQUoyNydrwYBTymTLcbRomeYbvJAl cLsZLnvLqzy2RAdr5sNAK7boYAr8o5eWqWA+uQ46yIG5fmWH6nUl3eDHD elt2TFBra5JRE8w2LpQj8rdHFT85kANo3u2n2svuNL46pYqrdAGwSDSl1 yB/llzJmg8TV6YttPgJUP9O7MgBqouDCqvMRbodl84V6xihOSUrO7+GPe QM4XhNQXes5inBwkg+BLjm9rkKu1SIPVEyKuEx8BwbBfFd55BIKU7GDoW Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10562"; a="318819927" X-IronPort-AV: E=Sophos;i="5.96,248,1665471600"; d="scan'208";a="318819927" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 10:54:05 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10562"; a="738260653" X-IronPort-AV: E=Sophos;i="5.96,248,1665471600"; d="scan'208";a="738260653" Received: from mayurarx-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.35.200]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 10:54:05 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 2/3] ASoC: SOF: pm: Always tear down pipelines before DSP suspend Date: Thu, 15 Dec 2022 10:53:46 -0800 Message-Id: <20221215185347.1457541-3-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221215185347.1457541-1-ranjani.sridharan@linux.intel.com> References: <20221215185347.1457541-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tiwai@suse.de, =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, Curtis Malainey , Bard Liao Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" When the DSP is suspended while the firmware is in the crashed state, we skip tearing down the pipelines. This means that the widget reference counts will not get to reset to 0 before suspend. This will lead to errors with resuming audio after system resume. To fix this, invoke the tear_down_all_pipelines op before skipping to DSP suspend. Signed-off-by: Ranjani Sridharan Reviewed-by: Curtis Malainey Reviewed-by: Pierre-Louis Bossart Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi --- sound/soc/sof/pm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c index 5f88c4a01fa3..f153881db189 100644 --- a/sound/soc/sof/pm.c +++ b/sound/soc/sof/pm.c @@ -192,6 +192,9 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) if (runtime_suspend && !sof_ops(sdev)->runtime_suspend) return 0; + if (tplg_ops && tplg_ops->tear_down_all_pipelines) + tplg_ops->tear_down_all_pipelines(sdev, false); + if (sdev->fw_state != SOF_FW_BOOT_COMPLETE) goto suspend; From patchwork Thu Dec 15 18:53:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 634209 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 59AABC4332F for ; Thu, 15 Dec 2022 18:56:04 +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 86E3E224C; Thu, 15 Dec 2022 19:55:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 86E3E224C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671130562; bh=YZXWFk12BqEf8sAsdvJ+ZpEfpctLDZin4pz6bzZL6g4=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=hmIbK0zeB06cinu763SvUpWA8tIPkQRivf3iQQGt28zERHkFIomAEhW26uuELDTw5 aHwyrKidVxIJgsXGCKrkggHMA91z5/MLSHomEUnEDGMeywWEZzV6h0w55mu+fgNkYZ im5sx88SfQWLOh7bOV1BcDTBI5/JSuNxm/4+eC48= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2F33AF80534; Thu, 15 Dec 2022 19:54:20 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 42034F80515; Thu, 15 Dec 2022 19:54:17 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 0AEECF804FC for ; Thu, 15 Dec 2022 19:54:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0AEECF804FC 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=Hl0WTl6m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671130456; x=1702666456; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YZXWFk12BqEf8sAsdvJ+ZpEfpctLDZin4pz6bzZL6g4=; b=Hl0WTl6md1r9+WWUD2MLRg2ZZsHwgQbxCPxIW4RAEEA4TSeE1M3JmEPS OC+KhgFS8Rr1pwWv6k7Jm1duGl+2HAtxWQGtN5pGJUk0O5miPb9sV29mL xOWkp9SnJIgeJEZYiQ1Fq0LodwJLhf3ufZS4gVpcm0HoD12m5HVlekcXS ebNzto7DEFutKAhWSC8rnEa8/SzoZRNTRGahQrxMvht4m3giQ6Z0mbj41 CmCwSbVJWvyzI2NesJqs8QH/l9k0q5+rRyqSYgU6fPgTDXUCYskfmIYgr x5MRd2TxOZX2Jkf3XlfNDP7ja/uI1tQYTCII3IqPuw7ycv+jbpSN3/Cfx w==; X-IronPort-AV: E=McAfee;i="6500,9779,10562"; a="318819932" X-IronPort-AV: E=Sophos;i="5.96,248,1665471600"; d="scan'208";a="318819932" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 10:54:05 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10562"; a="738260654" X-IronPort-AV: E=Sophos;i="5.96,248,1665471600"; d="scan'208";a="738260654" Received: from mayurarx-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.35.200]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 10:54:05 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 3/3] ASoC: SOF: Add FW state to debugfs Date: Thu, 15 Dec 2022 10:53:47 -0800 Message-Id: <20221215185347.1457541-4-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221215185347.1457541-1-ranjani.sridharan@linux.intel.com> References: <20221215185347.1457541-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tiwai@suse.de, Pierre-Louis Bossart , Ranjani Sridharan , broonie@kernel.org, Curtis Malainey , =?utf-8?q?P=C3=A9ter_Ujfalusi?= Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Curtis Malainey Allow system health detection mechanisms to check the FW state, this will allow them to check if the FW is in its "crashed" state going forward to help automatically diagnose driver state. Signed-off-by: Curtis Malainey Reviewed-by: Pierre-Louis Bossart Reviewed-by: Péter Ujfalusi Signed-off-by: Ranjani Sridharan --- sound/soc/sof/debug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c index d9a3ce7b69e1..ade0507328af 100644 --- a/sound/soc/sof/debug.c +++ b/sound/soc/sof/debug.c @@ -353,7 +353,9 @@ int snd_sof_dbg_init(struct snd_sof_dev *sdev) return err; } - return 0; + return snd_sof_debugfs_buf_item(sdev, &sdev->fw_state, + sizeof(sdev->fw_state), + "fw_state", 0444); } EXPORT_SYMBOL_GPL(snd_sof_dbg_init);