Skip to content

Commit 872c743

Browse files
CassivsGabriellistiwai
authored andcommitted
ALSA: es1688: add ISA suspend and resume callbacks
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> Link: https://patch.msgid.link/20260401-alsa-es1688-pm-v1-1-510767628fe6@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 80449e1 commit 872c743

1 file changed

Lines changed: 37 additions & 13 deletions

File tree

sound/isa/es1688/es1688.c

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,44 @@ static int snd_es1688_isa_probe(struct device *dev, unsigned int n)
184184
return 0;
185185
}
186186

187+
#ifdef CONFIG_PM
188+
static int snd_es1688_card_suspend(struct snd_card *card)
189+
{
190+
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
191+
return 0;
192+
}
193+
194+
static int snd_es1688_card_resume(struct snd_card *card)
195+
{
196+
struct snd_es1688 *chip = card->private_data;
197+
int err;
198+
199+
err = snd_es1688_reset(chip);
200+
if (err < 0)
201+
return err;
202+
203+
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
204+
return 0;
205+
}
206+
207+
static int snd_es1688_isa_suspend(struct device *dev, unsigned int n,
208+
pm_message_t state)
209+
{
210+
return snd_es1688_card_suspend(dev_get_drvdata(dev));
211+
}
212+
213+
static int snd_es1688_isa_resume(struct device *dev, unsigned int n)
214+
{
215+
return snd_es1688_card_resume(dev_get_drvdata(dev));
216+
}
217+
#endif
218+
187219
static struct isa_driver snd_es1688_driver = {
188220
.match = snd_es1688_match,
189221
.probe = snd_es1688_isa_probe,
190-
#if 0 /* FIXME */
191-
.suspend = snd_es1688_suspend,
192-
.resume = snd_es1688_resume,
222+
#ifdef CONFIG_PM
223+
.suspend = snd_es1688_isa_suspend,
224+
.resume = snd_es1688_isa_resume,
193225
#endif
194226
.driver = {
195227
.name = DEV_NAME
@@ -266,20 +298,12 @@ static void snd_es968_pnp_remove(struct pnp_card_link *pcard)
266298
static int snd_es968_pnp_suspend(struct pnp_card_link *pcard,
267299
pm_message_t state)
268300
{
269-
struct snd_card *card = pnp_get_card_drvdata(pcard);
270-
271-
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
272-
return 0;
301+
return snd_es1688_card_suspend(pnp_get_card_drvdata(pcard));
273302
}
274303

275304
static int snd_es968_pnp_resume(struct pnp_card_link *pcard)
276305
{
277-
struct snd_card *card = pnp_get_card_drvdata(pcard);
278-
struct snd_es1688 *chip = card->private_data;
279-
280-
snd_es1688_reset(chip);
281-
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
282-
return 0;
306+
return snd_es1688_card_resume(pnp_get_card_drvdata(pcard));
283307
}
284308
#endif
285309

0 commit comments

Comments
 (0)