mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	[ALSA] Fix PM support
Modules: ARM AACI PL041 driver,ARM PXA2XX driver Fix PM support of aaci and pxa2xx drivers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									5e12bea083
								
							
						
					
					
						commit
						792a6c5187
					
				
					 2 changed files with 19 additions and 29 deletions
				
			
		| 
						 | 
					@ -635,19 +635,14 @@ static struct snd_pcm_ops aaci_playback_ops = {
 | 
				
			||||||
static int aaci_do_suspend(struct snd_card *card, unsigned int state)
 | 
					static int aaci_do_suspend(struct snd_card *card, unsigned int state)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct aaci *aaci = card->private_data;
 | 
						struct aaci *aaci = card->private_data;
 | 
				
			||||||
	if (aaci->card->power_state != SNDRV_CTL_POWER_D3cold) {
 | 
						snd_power_change_state(card, SNDRV_CTL_POWER_D3cold);
 | 
				
			||||||
		snd_pcm_suspend_all(aaci->pcm);
 | 
						snd_pcm_suspend_all(aaci->pcm);
 | 
				
			||||||
		snd_power_change_state(aaci->card, SNDRV_CTL_POWER_D3cold);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int aaci_do_resume(struct snd_card *card, unsigned int state)
 | 
					static int aaci_do_resume(struct snd_card *card, unsigned int state)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct aaci *aaci = card->private_data;
 | 
						snd_power_change_state(card, SNDRV_CTL_POWER_D0);
 | 
				
			||||||
	if (aaci->card->power_state != SNDRV_CTL_POWER_D0) {
 | 
					 | 
				
			||||||
		snd_power_change_state(aaci->card, SNDRV_CTL_POWER_D0);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -780,7 +775,6 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
 | 
				
			||||||
		return ERR_PTR(-ENOMEM);
 | 
							return ERR_PTR(-ENOMEM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	card->private_free = aaci_free_card;
 | 
						card->private_free = aaci_free_card;
 | 
				
			||||||
	snd_card_set_pm_callback(card, aaci_do_suspend, aaci_do_resume, NULL);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	strlcpy(card->driver, DRIVER_NAME, sizeof(card->driver));
 | 
						strlcpy(card->driver, DRIVER_NAME, sizeof(card->driver));
 | 
				
			||||||
	strlcpy(card->shortname, "ARM AC'97 Interface", sizeof(card->shortname));
 | 
						strlcpy(card->shortname, "ARM AC'97 Interface", sizeof(card->shortname));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -247,30 +247,28 @@ static struct pxa2xx_pcm_client pxa2xx_ac97_pcm_client = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int pxa2xx_ac97_do_suspend(struct snd_card *card, pm_message_t state)
 | 
					static int pxa2xx_ac97_do_suspend(struct snd_card *card, pm_message_t state)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (card->power_state != SNDRV_CTL_POWER_D3cold) {
 | 
						pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data;
 | 
				
			||||||
		pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data;
 | 
					
 | 
				
			||||||
		snd_pcm_suspend_all(pxa2xx_ac97_pcm);
 | 
						snd_power_change_state(card, SNDRV_CTL_POWER_D3cold);
 | 
				
			||||||
		snd_ac97_suspend(pxa2xx_ac97_ac97);
 | 
						snd_pcm_suspend_all(pxa2xx_ac97_pcm);
 | 
				
			||||||
		snd_power_change_state(card, SNDRV_CTL_POWER_D3cold);
 | 
						snd_ac97_suspend(pxa2xx_ac97_ac97);
 | 
				
			||||||
		if (platform_ops && platform_ops->suspend)
 | 
						if (platform_ops && platform_ops->suspend)
 | 
				
			||||||
			platform_ops->suspend(platform_ops->priv);
 | 
							platform_ops->suspend(platform_ops->priv);
 | 
				
			||||||
		GCR |= GCR_ACLINK_OFF;
 | 
						GCR |= GCR_ACLINK_OFF;
 | 
				
			||||||
		pxa_set_cken(CKEN2_AC97, 0);
 | 
						pxa_set_cken(CKEN2_AC97, 0);
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int pxa2xx_ac97_do_resume(struct snd_card *card)
 | 
					static int pxa2xx_ac97_do_resume(struct snd_card *card)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (card->power_state != SNDRV_CTL_POWER_D0) {
 | 
						pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data;
 | 
				
			||||||
		pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data;
 | 
					
 | 
				
			||||||
		pxa_set_cken(CKEN2_AC97, 1);
 | 
						pxa_set_cken(CKEN2_AC97, 1);
 | 
				
			||||||
		if (platform_ops && platform_ops->resume)
 | 
						if (platform_ops && platform_ops->resume)
 | 
				
			||||||
			platform_ops->resume(platform_ops->priv);
 | 
							platform_ops->resume(platform_ops->priv);
 | 
				
			||||||
		snd_ac97_resume(pxa2xx_ac97_ac97);
 | 
						snd_ac97_resume(pxa2xx_ac97_ac97);
 | 
				
			||||||
		snd_power_change_state(card, SNDRV_CTL_POWER_D0);
 | 
						snd_power_change_state(card, SNDRV_CTL_POWER_D0);
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -349,8 +347,6 @@ static int pxa2xx_ac97_probe(struct platform_device *dev)
 | 
				
			||||||
	snprintf(card->longname, sizeof(card->longname),
 | 
						snprintf(card->longname, sizeof(card->longname),
 | 
				
			||||||
		 "%s (%s)", dev->dev.driver->name, card->mixername);
 | 
							 "%s (%s)", dev->dev.driver->name, card->mixername);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend,
 | 
					 | 
				
			||||||
				 pxa2xx_ac97_do_resume, NULL);
 | 
					 | 
				
			||||||
	ret = snd_card_register(card);
 | 
						ret = snd_card_register(card);
 | 
				
			||||||
	if (ret == 0) {
 | 
						if (ret == 0) {
 | 
				
			||||||
		platform_set_drvdata(dev, card);
 | 
							platform_set_drvdata(dev, card);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue