Takashi Iwai 360466
From 15a59cb0a3d6ddf2cb79f8dc3081b3130aad3767 Mon Sep 17 00:00:00 2001
Takashi Iwai 360466
From: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 360466
Date: Thu, 5 Jan 2023 10:35:30 +0100
Takashi Iwai 360466
Subject: [PATCH] ALSA: hda: cs35l41: Don't return -EINVAL from system suspend/resume
Takashi Iwai 360466
Git-commit: 15a59cb0a3d6ddf2cb79f8dc3081b3130aad3767
Takashi Iwai 360466
Patch-mainline: v6.2-rc4
Takashi Iwai 360466
References: git-fixes
Takashi Iwai 360466
Takashi Iwai 360466
The recent commit to support the system suspend for CS35L41 caused a
Takashi Iwai 360466
regression on the models with CS35L41_EXT_BOOST_NO_VSPK_SWITC boost
Takashi Iwai 360466
type, as the suspend/resume callbacks just return -EINVAL.  This is
Takashi Iwai 360466
eventually handled as a fatal error and blocks the whole system
Takashi Iwai 360466
suspend/resume.
Takashi Iwai 360466
Takashi Iwai 360466
For avoiding the problem, this patch corrects the return code from
Takashi Iwai 360466
cs35l41_system_suspend() and _resume() to 0, and replace dev_err()
Takashi Iwai 360466
with dev_err_once() for stop spamming too much.
Takashi Iwai 360466
Takashi Iwai 360466
Fixes: 88672826e2a4 ("ALSA: hda: cs35l41: Support System Suspend")
Takashi Iwai 360466
Cc: <stable@vger.kernel.org>
Takashi Iwai 360466
Link: https://lore.kernel.org/all/e6751ac2-34f3-d13f-13db-8174fade8308@pm.me
Takashi Iwai 360466
Link: https://lore.kernel.org/r/20230105093531.16960-1-tiwai@suse.de
Takashi Iwai 360466
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 360466
Takashi Iwai 360466
---
Takashi Iwai 360466
 sound/pci/hda/cs35l41_hda.c | 8 ++++----
Takashi Iwai 360466
 1 file changed, 4 insertions(+), 4 deletions(-)
Takashi Iwai 360466
Takashi Iwai 360466
diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
Takashi Iwai 360466
index 91842c0c8c74..0a5cee730268 100644
Takashi Iwai 360466
--- a/sound/pci/hda/cs35l41_hda.c
Takashi Iwai 360466
+++ b/sound/pci/hda/cs35l41_hda.c
Takashi Iwai 360466
@@ -598,8 +598,8 @@ static int cs35l41_system_suspend(struct device *dev)
Takashi Iwai 360466
 	dev_dbg(cs35l41->dev, "System Suspend\n");
Takashi Iwai 360466
 
Takashi Iwai 360466
 	if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST_NO_VSPK_SWITCH) {
Takashi Iwai 360466
-		dev_err(cs35l41->dev, "System Suspend not supported\n");
Takashi Iwai 360466
-		return -EINVAL;
Takashi Iwai 360466
+		dev_err_once(cs35l41->dev, "System Suspend not supported\n");
Takashi Iwai 360466
+		return 0; /* don't block the whole system suspend */
Takashi Iwai 360466
 	}
Takashi Iwai 360466
 
Takashi Iwai 360466
 	ret = pm_runtime_force_suspend(dev);
Takashi Iwai 360466
@@ -624,8 +624,8 @@ static int cs35l41_system_resume(struct device *dev)
Takashi Iwai 360466
 	dev_dbg(cs35l41->dev, "System Resume\n");
Takashi Iwai 360466
 
Takashi Iwai 360466
 	if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST_NO_VSPK_SWITCH) {
Takashi Iwai 360466
-		dev_err(cs35l41->dev, "System Resume not supported\n");
Takashi Iwai 360466
-		return -EINVAL;
Takashi Iwai 360466
+		dev_err_once(cs35l41->dev, "System Resume not supported\n");
Takashi Iwai 360466
+		return 0; /* don't block the whole system resume */
Takashi Iwai 360466
 	}
Takashi Iwai 360466
 
Takashi Iwai 360466
 	if (cs35l41->reset_gpio) {
Takashi Iwai 360466
-- 
Takashi Iwai 360466
2.35.3
Takashi Iwai 360466