Update of /cvsroot/alsa/alsa-kernel/isa/cs423x
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19034/isa/cs423x
Modified Files:
cs4231_lib.c
Log Message:
Clean up of power-management codes.
- moved commonly used codes to the core layer.
- using the unified suspend/resume callbacks for PCI and ISA
- added snd_card_set_pm_callbacks() and snd_card_set_isa_pm_callbacks()
as the registration functions.
Index: cs4231_lib.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/isa/cs423x/cs4231_lib.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- cs4231_lib.c 6 Mar 2004 16:51:29 -0000 1.37
+++ cs4231_lib.c 8 Apr 2004 16:34:59 -0000 1.38
@@ -1343,6 +1343,7 @@
#ifdef CONFIG_PM
+/* lowlevel suspend callback for CS4231 */
static void snd_cs4231_suspend(cs4231_t *chip)
{
int reg;
@@ -1354,6 +1355,7 @@
spin_unlock_irqrestore(&chip->reg_lock, flags);
}
+/* lowlevel resume callback for CS4231 */
static void snd_cs4231_resume(cs4231_t *chip)
{
int reg;
@@ -1395,25 +1397,25 @@
#endif
}
-static int snd_cs4231_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
+static int snd_cs4231_pm_suspend(snd_card_t *card, unsigned int state)
{
- cs4231_t *chip = snd_magic_cast(cs4231_t, dev->data, return 0);
-
- switch (rqst) {
- case PM_SUSPEND:
- if (chip->suspend) {
- snd_pcm_suspend_all(chip->pcm);
- (*chip->suspend)(chip);
- }
- break;
- case PM_RESUME:
- if (chip->resume)
- (*chip->resume)(chip);
- break;
+ cs4231_t *chip = snd_magic_cast(cs4231_t, card->pm_private_data, return
-EINVAL);
+ if (chip->suspend) {
+ chip->suspend(chip);
+ snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
}
return 0;
}
+static int snd_cs4231_pm_resume(snd_card_t *card, unsigned int state)
+{
+ cs4231_t *chip = snd_magic_cast(cs4231_t, card->pm_private_data, return
-EINVAL);
+ if (chip->resume) {
+ chip->resume(chip);
+ snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+ }
+ return 0;
+}
#endif /* CONFIG_PM */
#ifdef LEGACY_SUPPORT
@@ -1441,10 +1443,6 @@
snd_dma_disable(chip->dma2);
free_dma(chip->dma2);
}
-#ifdef CONFIG_PM
- if (chip->pm_dev)
- pm_unregister(chip->pm_dev);
-#endif
if (chip->timer)
snd_device_free(chip->card, chip->timer);
snd_magic_kfree(chip);
@@ -1587,9 +1585,7 @@
/* Power Management */
chip->suspend = snd_cs4231_suspend;
chip->resume = snd_cs4231_resume;
- chip->pm_dev = pm_register(PM_ISA_DEV, 0, snd_cs4231_pm_callback);
- if (chip->pm_dev)
- chip->pm_dev->data = chip;
+ snd_card_set_isa_pm_callback(card, snd_cs4231_pm_suspend,
snd_cs4231_pm_resume, chip);
#endif
*rchip = chip;
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog