From patchwork Tue Dec 20 12:56:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 635480 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 AC237C4332F for ; Tue, 20 Dec 2022 12:57:59 +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 EF68E2132; Tue, 20 Dec 2022 13:57:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EF68E2132 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671541078; bh=DIzxGdpsaudAy4Rr6Rfk/rSkOgdDzfTmlES+w5hTlWI=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=qrGsecs6jtZbLtW4w2cJJKvQkyY0xXcxOLE8lJBxjWCxWTP2nj3cBqDpA5Ni+DpM3 kMLnKa7EqrttgfBLCZecFxXZ9E2Z/5I/HNwCXaVNAmm5bMayihhG6q7SS/+j+SZWqE 8W+8Be5GyUCNEqhnOhcykEdw5Q1kusJ2zJQ/hbQw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 02519F80537; Tue, 20 Dec 2022 13:56:55 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 623B0F804CB; Tue, 20 Dec 2022 13:56:53 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 3E587F8018A for ; Tue, 20 Dec 2022 13:56:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3E587F8018A 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=B6pbNUpy DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671541012; x=1703077012; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DIzxGdpsaudAy4Rr6Rfk/rSkOgdDzfTmlES+w5hTlWI=; b=B6pbNUpyc5nSoIBzMw83JF7JmsQVcVWp+qyWEPxHW2m0hyyRzTT/pDiC z147f+jvGLHWeWeI0Y9rvJsCXJzgKHhlV8lRYmrpuuw3HtYWEtlH4QiWd OE1+HbT4caXW3G+2PFPp4AkSDe1QoNk53uXozICZV5m+PsKbZNMrzc4WR vBAPsV+8x3Bbk1gIUezJmWwQBsc5kjTF0PK8uds1vymyqWBkt4g9YbjDS xh4kJrRCT7glgCebHm4MpQRssaO2uz03GKXc8t+ZlR4GttGL1C/MVdBBJ flRwYHaNue0qNUkuDsKvysQ4Wzsd1F9NNs4+Wi80Xd69GWYrjnx9uVmuA A==; X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="299280480" X-IronPort-AV: E=Sophos;i="5.96,259,1665471600"; d="scan'208";a="299280480" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2022 04:56:26 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="825222233" X-IronPort-AV: E=Sophos;i="5.96,259,1665471600"; d="scan'208";a="825222233" Received: from vadimbel-mobl2.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.20.205]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2022 04:56:23 -0800 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 1/3] ASoC: SOF: pm: Set target state earlier Date: Tue, 20 Dec 2022 14:56:27 +0200 Message-Id: <20221220125629.8469-2-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221220125629.8469-1-peter.ujfalusi@linux.intel.com> References: <20221220125629.8469-1-peter.ujfalusi@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: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, cujomalainey@chromium.org, yung-chuan.liao@linux.intel.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Ranjani Sridharan 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 Signed-off-by: Peter 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 Tue Dec 20 12:56:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 635983 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 D0CB0C10F1E for ; Tue, 20 Dec 2022 12:58:02 +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 E44722140; Tue, 20 Dec 2022 13:57:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E44722140 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671541081; bh=2xUvJppOjrTHGAXye1BLsB5WdkkLABznyEZYkQBE2U8=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=LjE18jnhaTKsSmtyf16FCXa90i17Rzl+2qwxhhC4dAMs+bh7EE/QmCfd/9LapdTIa LSc18sACPtKNfSL5NPeeZS/IaASPuDQo69BR2xBnhqQXDB4OVqHqy4iz/yaOd3Qhtb /o+9H4ywtc8Hbv7lT1uBw4NgKdirbk5EkLwXF7Kc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9FCF4F8053A; Tue, 20 Dec 2022 13:56:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E2428F80538; Tue, 20 Dec 2022 13:56:54 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 001A3F80536 for ; Tue, 20 Dec 2022 13:56:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 001A3F80536 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=akxRB0iX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671541014; x=1703077014; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2xUvJppOjrTHGAXye1BLsB5WdkkLABznyEZYkQBE2U8=; b=akxRB0iXEHraoJHWdl04sHrDNewk8qct2V1g/aD6S741Kj0X+R39bBx/ 2UjeCLHmAUl2qiknhAS+x61pMfSjXcqQ+sSIc9rvM92oKxoSfXQtoJsLo SH5zPUAXseVM1qqAFttgqNV1fJLs11UINUuosDJrNCm4UD4hxjzSl3UC+ 7mKVgbrIzwHtJfMDzXJdySqlZwwAwU5MObwFKGe0qJDnrGHflJxGJP9eh tNy8o/hxFh9+amLoQ1TTQpo9WCXOQqVMxtZ0A0cH1PzxiAXLbnrZwdaEw psKoDQZKz5lLBRQKbc8lx+QpKMe4GWEcjnezRjoE+NHZ/6Dn38VNuokEP Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="299280493" X-IronPort-AV: E=Sophos;i="5.96,259,1665471600"; d="scan'208";a="299280493" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2022 04:56:29 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="825222245" X-IronPort-AV: E=Sophos;i="5.96,259,1665471600"; d="scan'208";a="825222245" Received: from vadimbel-mobl2.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.20.205]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2022 04:56:26 -0800 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 2/3] ASoC: SOF: pm: Always tear down pipelines before DSP suspend Date: Tue, 20 Dec 2022 14:56:28 +0200 Message-Id: <20221220125629.8469-3-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221220125629.8469-1-peter.ujfalusi@linux.intel.com> References: <20221220125629.8469-1-peter.ujfalusi@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: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, cujomalainey@chromium.org, yung-chuan.liao@linux.intel.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Ranjani Sridharan 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 Signed-off-by: Peter Ujfalusi --- sound/soc/sof/pm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c index 5f88c4a01fa3..8722bbd7fd3d 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; @@ -216,9 +219,6 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) goto suspend; } - if (tplg_ops->tear_down_all_pipelines) - tplg_ops->tear_down_all_pipelines(sdev, false); - /* suspend DMA trace */ sof_fw_trace_suspend(sdev, pm_state); From patchwork Tue Dec 20 12:56:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 635479 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 6C02AC4332F for ; Tue, 20 Dec 2022 12:58: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 C74FF1F9B; Tue, 20 Dec 2022 13:57:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C74FF1F9B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671541096; bh=5BI/6+kTZ4fuF2ycWHghLM+X5bYBZ3gOLwrTcMmfyII=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=vVG0bPiuKALBbRhCQYo59DWNIMSyrqtv02/OdSZddUV/3pFO8EpNE5+EYs3yXtl5N l/rnCiFPUjNm7iDaCOzohRi/8k4kwXr5abJUHyxQk+Jmi7voEDUv0CVRtZAv30FnT3 oPOJm2tKiDm3H810Cav+br3P5Eg2iA09ycqPfzSM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 31BB3F80544; Tue, 20 Dec 2022 13:56:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C1517F8032B; Tue, 20 Dec 2022 13:56:55 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 380F9F8032B for ; Tue, 20 Dec 2022 13:56:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 380F9F8032B 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=fMyh4z9Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671541014; x=1703077014; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5BI/6+kTZ4fuF2ycWHghLM+X5bYBZ3gOLwrTcMmfyII=; b=fMyh4z9Q33gNWURIaOFzUlVnjpqOhTRh+9DHbNwwdtfkx1h3w9zbJXvU LQ3re1H1tP8iKsK1wHHs7ab63ng59VkkjIurSbME7YiJ5VUOyukcP43vz kAIq47VE3gz6r9KKNF8Nlu21ot5RfF5GtnpVDsE4pqR5PyOmWpafTpq6u nDQmIkZurM8WGOPpNf5cS4bRMtOMgbbpGiR/nw2E2xCDU8hb2b+SNjlLI I1YNCKHI6IK9MRFSONG6z3x3odV5WuESDzEZkQOSVHEh7yRtSqmJJOSN3 akeo2mKGBpNj/Jptu6Oz1QbJepSlXwLDFFHHg5zpHOCEZwRAUyJdAj8IM Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="299280504" X-IronPort-AV: E=Sophos;i="5.96,259,1665471600"; d="scan'208";a="299280504" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2022 04:56:32 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="825222255" X-IronPort-AV: E=Sophos;i="5.96,259,1665471600"; d="scan'208";a="825222255" Received: from vadimbel-mobl2.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.20.205]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2022 04:56:29 -0800 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH v2 3/3] ASoC: SOF: Add FW state to debugfs Date: Tue, 20 Dec 2022 14:56:29 +0200 Message-Id: <20221220125629.8469-4-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221220125629.8469-1-peter.ujfalusi@linux.intel.com> References: <20221220125629.8469-1-peter.ujfalusi@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: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, cujomalainey@chromium.org, yung-chuan.liao@linux.intel.com 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: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Péter Ujfalusi Signed-off-by: Peter Ujfalusi --- 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);