public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: es1688: add ISA suspend and resume callbacks
@ 2026-04-01 11:45 Cássio Gabriel
  2026-04-01 12:47 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Cássio Gabriel @ 2026-04-01 11:45 UTC (permalink / raw)
  To: Takashi Iwai, Jaroslav Kysela
  Cc: linux-sound, linux-kernel, Cássio Gabriel

The ISA ES1688 driver still carries a disabled suspend/resume block in
its isa_driver definition, while the same file already provides minimal
power-management handling for the PnP ES968 path.

Add ISA-specific PM callbacks and factor the existing ES1688 suspend and
resume sequence into common card-level helpers shared by both probe
paths. Suspend moves the card to D3hot. Resume reinitializes the chip
with snd_es1688_reset() and restores the card to D0, propagating reset
failures to the caller.

This wires up power-management callbacks for the ISA path and keeps the
PM handling consistent between the ISA and PnP probe paths.

Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
---
 sound/isa/es1688/es1688.c | 50 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 37 insertions(+), 13 deletions(-)

diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index 6a95dfb7600a..7255b34f9148 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -184,12 +184,44 @@ static int snd_es1688_isa_probe(struct device *dev, unsigned int n)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int snd_es1688_card_suspend(struct snd_card *card)
+{
+	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
+}
+
+static int snd_es1688_card_resume(struct snd_card *card)
+{
+	struct snd_es1688 *chip = card->private_data;
+	int err;
+
+	err = snd_es1688_reset(chip);
+	if (err < 0)
+		return err;
+
+	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+	return 0;
+}
+
+static int snd_es1688_isa_suspend(struct device *dev, unsigned int n,
+				  pm_message_t state)
+{
+	return snd_es1688_card_suspend(dev_get_drvdata(dev));
+}
+
+static int snd_es1688_isa_resume(struct device *dev, unsigned int n)
+{
+	return snd_es1688_card_resume(dev_get_drvdata(dev));
+}
+#endif
+
 static struct isa_driver snd_es1688_driver = {
 	.match		= snd_es1688_match,
 	.probe		= snd_es1688_isa_probe,
-#if 0	/* FIXME */
-	.suspend	= snd_es1688_suspend,
-	.resume		= snd_es1688_resume,
+#ifdef CONFIG_PM
+	.suspend	= snd_es1688_isa_suspend,
+	.resume		= snd_es1688_isa_resume,
 #endif
 	.driver		= {
 		.name	= DEV_NAME
@@ -266,20 +298,12 @@ static void snd_es968_pnp_remove(struct pnp_card_link *pcard)
 static int snd_es968_pnp_suspend(struct pnp_card_link *pcard,
 				 pm_message_t state)
 {
-	struct snd_card *card = pnp_get_card_drvdata(pcard);
-
-	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
-	return 0;
+	return snd_es1688_card_suspend(pnp_get_card_drvdata(pcard));
 }
 
 static int snd_es968_pnp_resume(struct pnp_card_link *pcard)
 {
-	struct snd_card *card = pnp_get_card_drvdata(pcard);
-	struct snd_es1688 *chip = card->private_data;
-
-	snd_es1688_reset(chip);
-	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-	return 0;
+	return snd_es1688_card_resume(pnp_get_card_drvdata(pcard));
 }
 #endif
 

---
base-commit: 28f54b0f58c5855d924f970e05ddea9a9d51842f
change-id: 20260330-alsa-es1688-pm-840d2ecd2286

Best regards,
--  
Cássio Gabriel <cassiogabrielcontato@gmail.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: es1688: add ISA suspend and resume callbacks
  2026-04-01 11:45 [PATCH] ALSA: es1688: add ISA suspend and resume callbacks Cássio Gabriel
@ 2026-04-01 12:47 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-04-01 12:47 UTC (permalink / raw)
  To: Cássio Gabriel
  Cc: Takashi Iwai, Jaroslav Kysela, linux-sound, linux-kernel

On Wed, 01 Apr 2026 13:45:37 +0200,
Cássio Gabriel wrote:
> 
> The ISA ES1688 driver still carries a disabled suspend/resume block in
> its isa_driver definition, while the same file already provides minimal
> power-management handling for the PnP ES968 path.
> 
> Add ISA-specific PM callbacks and factor the existing ES1688 suspend and
> resume sequence into common card-level helpers shared by both probe
> paths. Suspend moves the card to D3hot. Resume reinitializes the chip
> with snd_es1688_reset() and restores the card to D0, propagating reset
> failures to the caller.
> 
> This wires up power-management callbacks for the ISA path and keeps the
> PM handling consistent between the ISA and PnP probe paths.
> 
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>

Applied to for-next branch now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-01 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01 11:45 [PATCH] ALSA: es1688: add ISA suspend and resume callbacks Cássio Gabriel
2026-04-01 12:47 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox