mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 22:02:28 +00:00
ALSA: atiixp: Move PCM suspend/resume code into trigger callback
ATIIXP driver supports the full PCM resume and saves/restores the running PCM pointer. This used to be done in the suspend and resume callbacks together with snd_pcm_suspend() call. But since we moved the snd_pcm_supsend*() call in PCM device PM ops, this should be moved to a more appropriate place, i.e. the trigger callback. Along with the movement of the PCM suspend/resume code, remove the superfluous snd_pcm_suspend_all() call, too. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
3d21ef0b49
commit
435e25c67d
@ -733,6 +733,10 @@ static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
|||||||
case SNDRV_PCM_TRIGGER_START:
|
case SNDRV_PCM_TRIGGER_START:
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||||
case SNDRV_PCM_TRIGGER_RESUME:
|
case SNDRV_PCM_TRIGGER_RESUME:
|
||||||
|
if (dma->running && dma->suspended &&
|
||||||
|
cmd == SNDRV_PCM_TRIGGER_RESUME)
|
||||||
|
writel(dma->saved_curptr, chip->remap_addr +
|
||||||
|
dma->ops->dt_cur);
|
||||||
dma->ops->enable_transfer(chip, 1);
|
dma->ops->enable_transfer(chip, 1);
|
||||||
dma->running = 1;
|
dma->running = 1;
|
||||||
dma->suspended = 0;
|
dma->suspended = 0;
|
||||||
@ -740,9 +744,12 @@ static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
|||||||
case SNDRV_PCM_TRIGGER_STOP:
|
case SNDRV_PCM_TRIGGER_STOP:
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||||
|
dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND;
|
||||||
|
if (dma->running && dma->suspended)
|
||||||
|
dma->saved_curptr = readl(chip->remap_addr +
|
||||||
|
dma->ops->dt_cur);
|
||||||
dma->ops->enable_transfer(chip, 0);
|
dma->ops->enable_transfer(chip, 0);
|
||||||
dma->running = 0;
|
dma->running = 0;
|
||||||
dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
@ -1479,14 +1486,6 @@ static int snd_atiixp_suspend(struct device *dev)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||||
for (i = 0; i < NUM_ATI_PCMDEVS; i++)
|
|
||||||
if (chip->pcmdevs[i]) {
|
|
||||||
struct atiixp_dma *dma = &chip->dmas[i];
|
|
||||||
if (dma->substream && dma->running)
|
|
||||||
dma->saved_curptr = readl(chip->remap_addr +
|
|
||||||
dma->ops->dt_cur);
|
|
||||||
snd_pcm_suspend_all(chip->pcmdevs[i]);
|
|
||||||
}
|
|
||||||
for (i = 0; i < NUM_ATI_CODECS; i++)
|
for (i = 0; i < NUM_ATI_CODECS; i++)
|
||||||
snd_ac97_suspend(chip->ac97[i]);
|
snd_ac97_suspend(chip->ac97[i]);
|
||||||
snd_atiixp_aclink_down(chip);
|
snd_atiixp_aclink_down(chip);
|
||||||
@ -1514,8 +1513,6 @@ static int snd_atiixp_resume(struct device *dev)
|
|||||||
dma->substream->ops->prepare(dma->substream);
|
dma->substream->ops->prepare(dma->substream);
|
||||||
writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
|
writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
|
||||||
chip->remap_addr + dma->ops->llp_offset);
|
chip->remap_addr + dma->ops->llp_offset);
|
||||||
writel(dma->saved_curptr, chip->remap_addr +
|
|
||||||
dma->ops->dt_cur);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user