From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD426C46467 for ; Mon, 16 Jan 2023 14:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231344AbjAPOCJ (ORCPT ); Mon, 16 Jan 2023 09:02:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230373AbjAPOCC (ORCPT ); Mon, 16 Jan 2023 09:02:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B45A63C3A; Mon, 16 Jan 2023 06:02:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6993BB80F52; Mon, 16 Jan 2023 14:02:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B327EC433F1; Mon, 16 Jan 2023 14:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673877719; bh=We4AOABTCrlp9F1jwtkkQL4Oz6PzYUIHv8bU4uce94M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZhVbiC5VuxVgnFlze6h+c0CA4eB/roBtnO2JExucH0g9FyhDi4tMD6HAnbeIFnZVL 3+MTmkX38kdnE64WVdGZJOsUrUEQAaeM8oMYurYtvLRMOmwADhh/OaQIC3LIdaHbY5 g30dce1n/ieunFMXxs/sCKZLksvUM/bDsGaWdtj9BsJLFBxakZq0X9C/MYtL6hVNEA 9ttUkpz2NJO5+Ja1xVBi+MYEIaLSXGMvk4RfubfhV02bZif9SFPSPBBtAMn+DG29mI m2triDAhKNDf+XWHJeovcALpRNxQ6vReELx7PToRSMKhRVTjgk7fcZwWdW35ftDMP9 NG5WU9nBopA7g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ranjani Sridharan , Curtis Malainey , Pierre-Louis Bossart , Bard Liao , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Mark Brown , Sasha Levin , lgirdwood@gmail.com, daniel.baluta@nxp.com, perex@perex.cz, tiwai@suse.com, sound-open-firmware@alsa-project.org, alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 6.1 02/53] ASoC: SOF: pm: Set target state earlier Date: Mon, 16 Jan 2023 09:01:02 -0500 Message-Id: <20230116140154.114951-2-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230116140154.114951-1-sashal@kernel.org> References: <20230116140154.114951-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ranjani Sridharan [ Upstream commit 6f95eec6fb89e195dbdf30de65553c7fc57d9372 ] 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 Link: https://lore.kernel.org/r/20221220125629.8469-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- 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 */ -- 2.35.1