mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Cássio Gabriel" <cassiogabrielcontato@gmail.com>
To: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
	 Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Cássio Gabriel" <cassiogabrielcontato@gmail.com>
Subject: [PATCH 2/2] ALSA: sc6000: Restore board setup across suspend
Date: Fri, 10 Apr 2026 00:54:33 -0300	[thread overview]
Message-ID: <20260410-alsa-sc6000-pm-v1-2-4d9e95493d26@gmail.com> (raw)
In-Reply-To: <20260410-alsa-sc6000-pm-v1-0-4d9e95493d26@gmail.com>

snd_wss_resume() restores only the codec register image.  The SC-6000
driver also programs card-specific DSP routing and enters MSS mode
during probe, and that setup is not replayed after suspend.

Cache the WSS chip pointer in the SC-6000 card state and wire ISA
suspend and resume callbacks to the shared board-programming helper,
so the board is reinitialized before the codec state is restored.

This keeps the old/new DSP split in one place and restores the
board-level MSS setup that the codec resume path does not cover.

Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
---
 sound/isa/sc6000.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index 9949e06403f6..cd3a63c7c2a7 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -103,6 +103,7 @@ MODULE_PARM_DESC(joystick, "Enable gameport.");
 struct snd_sc6000 {
 	char __iomem *vport;
 	char __iomem *vmss_port;
+	struct snd_wss *chip;
 	u8 mss_config;
 	u8 config;
 	u8 hw_cfg[2];
@@ -646,6 +647,7 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev)
 			     WSS_HW_DETECT, 0, &chip);
 	if (err < 0)
 		return err;
+	sc6000->chip = chip;
 
 	err = snd_wss_pcm(chip, 0);
 	if (err < 0) {
@@ -702,10 +704,47 @@ static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
 	return snd_card_free_on_error(devptr, __snd_sc6000_probe(devptr, dev));
 }
 
+#ifdef CONFIG_PM
+static int snd_sc6000_suspend(struct device *devptr, unsigned int dev,
+			      pm_message_t state)
+{
+	struct snd_card *card = dev_get_drvdata(devptr);
+	struct snd_sc6000 *sc6000 = card->private_data;
+
+	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	sc6000->chip->suspend(sc6000->chip);
+	return 0;
+}
+
+static int snd_sc6000_resume(struct device *devptr, unsigned int dev)
+{
+	struct snd_card *card = dev_get_drvdata(devptr);
+	struct snd_sc6000 *sc6000 = card->private_data;
+	int err;
+
+	err = sc6000_dsp_reset(sc6000->vport);
+	if (err < 0) {
+		dev_err(devptr, "sc6000_dsp_reset: failed!\n");
+		return err;
+	}
+
+	err = sc6000_program_board(devptr, sc6000);
+	if (err < 0)
+		return err;
+
+	sc6000->chip->resume(sc6000->chip);
+	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+	return 0;
+}
+#endif
+
 static struct isa_driver snd_sc6000_driver = {
 	.match		= snd_sc6000_match,
 	.probe		= snd_sc6000_probe,
-	/* FIXME: suspend/resume */
+#ifdef CONFIG_PM
+	.suspend	= snd_sc6000_suspend,
+	.resume		= snd_sc6000_resume,
+#endif
 	.driver		= {
 		.name	= DRV_NAME,
 	},

-- 
2.53.0


  parent reply	other threads:[~2026-04-10  3:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10  3:54 [PATCH 0/2] ALSA: sc6000: fix board configuration state and resume handling Cássio Gabriel
2026-04-10  3:54 ` [PATCH 1/2] ALSA: sc6000: Keep the programmed board state in card-private data Cássio Gabriel
2026-04-10  3:54 ` Cássio Gabriel [this message]
2026-04-10  6:37 ` [PATCH 0/2] ALSA: sc6000: fix board configuration state and resume handling Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260410-alsa-sc6000-pm-v1-2-4d9e95493d26@gmail.com \
    --to=cassiogabrielcontato@gmail.com \
    --cc=krzysztof.h1@poczta.fm \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®