diff options
author | Jaroslav Kysela <perex@suse.cz> | 2004-05-17 19:23:08 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2004-05-17 19:23:08 +0200 |
commit | a29211b921dd82a7a1dbf101d612f15a0e8a145b (patch) | |
tree | 700cb4d7824859228008a9c5426cf3e1f9ef7ab9 /sound | |
parent | 0f2c1fd45b3c73e24a4efb69e544b0a413c323fc (diff) | |
download | history-a29211b921dd82a7a1dbf101d612f15a0e8a145b.tar.gz |
ALSA CVS update - Takashi Iwai <tiwai@suse.de>
SA11xx UDA1341 driver,UDA1341
- clean up PM codes using the new PM callback functions.
Diffstat (limited to 'sound')
-rw-r--r-- | sound/arm/sa11xx-uda1341.c | 65 |
1 files changed, 10 insertions, 55 deletions
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c index 7ca564f1c6fbf0..59916802c914d2 100644 --- a/sound/arm/sa11xx-uda1341.c +++ b/sound/arm/sa11xx-uda1341.c @@ -21,7 +21,7 @@ * merged HAL layer (patches from Brian) */ -/* $Id: sa11xx-uda1341.c,v 1.14 2004/04/07 17:48:10 tiwai Exp $ */ +/* $Id: sa11xx-uda1341.c,v 1.15 2004/05/03 17:36:50 tiwai Exp $ */ /*************************************************************************************************** * @@ -137,7 +137,6 @@ typedef struct audio_stream { }audio_stream_t; typedef struct snd_card_sa11xx_uda1341 { - struct pm_dev *pm_dev; snd_card_t *card; struct l3_client *uda1341; snd_pcm_t *pcm; @@ -868,12 +867,10 @@ static int __init snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341_t *sa11xx_uda1341, #ifdef CONFIG_PM -static void snd_sa11xx_uda1341_suspend(sa11xx_uda1341_t *chip) +static int snd_sa11xx_uda1341_suspend(snd_card_t *card, unsigned int state) { - snd_card_t *card = chip->card; + sa11xx_uda1341_t *chip = snd_magic_cast(sa11x_uda1341_t, card->pm_private_data, return -EINVAL); - if (card->power_state == SNDRV_CTL_POWER_D3hot) - return; snd_pcm_suspend_all(chip->pcm); #ifdef HH_VERSION sa1100_dma_sleep(chip->s[SNDRV_PCM_STREAM_PLAYBACK].dmach); @@ -884,14 +881,13 @@ static void snd_sa11xx_uda1341_suspend(sa11xx_uda1341_t *chip) l3_command(chip->uda1341, CMD_SUSPEND, NULL); sa11xx_uda1341_audio_shutdown(chip); snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + return 0; } -static void snd_sa11xx_uda1341_resume(sa11xx_uda1341_t *chip) +static int snd_sa11xx_uda1341_resume(snd_card_t *card, unsigned int state) { - snd_card_t *card = chip->card; + sa11xx_uda1341_t *chip = snd_magic_cast(sa11x_uda1341_t, card->pm_private_data, return -EINVAL); - if (card->power_state == SNDRV_CTL_POWER_D0) - return; sa11xx_uda1341_audio_init(chip); l3_command(chip->uda1341, CMD_RESUME, NULL); #ifdef HH_VERSION @@ -901,50 +897,14 @@ static void snd_sa11xx_uda1341_resume(sa11xx_uda1341_t *chip) //FIXME #endif snd_power_change_state(card, SNDRV_CTL_POWER_D0); -} - -static int sa11xx_uda1341_pm_callback(struct pm_dev *pm_dev, pm_request_t req, void *data) -{ - sa11xx_uda1341_t *chip = pm_dev->data; - - switch (req) { - case PM_SUSPEND: /* enter D1-D3 */ - snd_sa11xx_uda1341_suspend(chip); - break; - case PM_RESUME: /* enter D0 */ - snd_sa11xx_uda1341_resume(chip); - break; - } return 0; } - -static int sa11xx_uda1341_set_power_state(snd_card_t *card, unsigned int power_state) -{ - sa11xx_uda1341_t *chip = snd_magic_cast(sa11xx_uda1341_t, card->power_state_private_data, return); - - switch (power_state) { - case SNDRV_CTL_POWER_D0: - case SNDRV_CTL_POWER_D1: - case SNDRV_CTL_POWER_D2: - snd_sa11xx_uda1341_resume(chip); - break; - case SNDRV_CTL_POWER_D3hot: - case SNDRV_CTL_POWER_D3cold: - snd_sa11xx_uda1341_suspend(chip); - break; - default: - return -EINVAL; - } - return 0; -} - #endif /* COMFIG_PM */ void snd_sa11xx_uda1341_free(snd_card_t *card) { sa11xx_uda1341_t *chip = snd_magic_cast(sa11xx_uda1341_t, card->private_data, return); - pm_unregister(chip->pm_dev); audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]); audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]); sa11xx_uda1341 = NULL; @@ -985,15 +945,10 @@ static int __init sa11xx_uda1341_init(void) if ((err = snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341, 0)) < 0) goto nodev; - -#ifdef CONFIG_PM - card->power_state_private_data = sa11xx_uda1341; - card->set_power_state = sa11xx_uda1341_set_power_state; - sa11xx_uda1341->pm_dev = pm_register(PM_SYS_DEV, 0, sa11xx_uda1341_pm_callback); - if (sa11xx_uda1341->pm_dev) - sa11xx_uda1341->pm_dev->data = sa11xx_uda1341; -#endif - + snd_card_set_dev_pm_callback(card, PM_SYS_DEV, + snd_sa11xx_uda1341_suspend, snd_sa11_uda1341_resume, + sa11xx_uda1341); + strcpy(card->driver, "UDA1341"); strcpy(card->shortname, "H3600 UDA1341TS"); sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS"); |