summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-01-11 11:57:29 -0500
committerTakashi Iwai <tiwai@suse.de>2019-01-15 11:46:50 -0500
commit435e25c67de7e0a21fbb32239bded0cefc488e20 (patch)
tree0eed5310931c65feec035dbae2aa9e2bbd322204
parent3d21ef0b49f84d3341984caafc5c658739674927 (diff)
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>
-rw-r--r--sound/pci/atiixp.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 1a41f8c80243..7715d26916ac 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -733,6 +733,10 @@ static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
733 case SNDRV_PCM_TRIGGER_START: 733 case SNDRV_PCM_TRIGGER_START:
734 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 734 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
735 case SNDRV_PCM_TRIGGER_RESUME: 735 case SNDRV_PCM_TRIGGER_RESUME:
736 if (dma->running && dma->suspended &&
737 cmd == SNDRV_PCM_TRIGGER_RESUME)
738 writel(dma->saved_curptr, chip->remap_addr +
739 dma->ops->dt_cur);
736 dma->ops->enable_transfer(chip, 1); 740 dma->ops->enable_transfer(chip, 1);
737 dma->running = 1; 741 dma->running = 1;
738 dma->suspended = 0; 742 dma->suspended = 0;
@@ -740,9 +744,12 @@ static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
740 case SNDRV_PCM_TRIGGER_STOP: 744 case SNDRV_PCM_TRIGGER_STOP:
741 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 745 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
742 case SNDRV_PCM_TRIGGER_SUSPEND: 746 case SNDRV_PCM_TRIGGER_SUSPEND:
747 dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND;
748 if (dma->running && dma->suspended)
749 dma->saved_curptr = readl(chip->remap_addr +
750 dma->ops->dt_cur);
743 dma->ops->enable_transfer(chip, 0); 751 dma->ops->enable_transfer(chip, 0);
744 dma->running = 0; 752 dma->running = 0;
745 dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND;
746 break; 753 break;
747 default: 754 default:
748 err = -EINVAL; 755 err = -EINVAL;
@@ -1479,14 +1486,6 @@ static int snd_atiixp_suspend(struct device *dev)
1479 int i; 1486 int i;
1480 1487
1481 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 1488 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1482 for (i = 0; i < NUM_ATI_PCMDEVS; i++)
1483 if (chip->pcmdevs[i]) {
1484 struct atiixp_dma *dma = &chip->dmas[i];
1485 if (dma->substream && dma->running)
1486 dma->saved_curptr = readl(chip->remap_addr +
1487 dma->ops->dt_cur);
1488 snd_pcm_suspend_all(chip->pcmdevs[i]);
1489 }
1490 for (i = 0; i < NUM_ATI_CODECS; i++) 1489 for (i = 0; i < NUM_ATI_CODECS; i++)
1491 snd_ac97_suspend(chip->ac97[i]); 1490 snd_ac97_suspend(chip->ac97[i]);
1492 snd_atiixp_aclink_down(chip); 1491 snd_atiixp_aclink_down(chip);
@@ -1514,8 +1513,6 @@ static int snd_atiixp_resume(struct device *dev)
1514 dma->substream->ops->prepare(dma->substream); 1513 dma->substream->ops->prepare(dma->substream);
1515 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, 1514 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
1516 chip->remap_addr + dma->ops->llp_offset); 1515 chip->remap_addr + dma->ops->llp_offset);
1517 writel(dma->saved_curptr, chip->remap_addr +
1518 dma->ops->dt_cur);
1519 } 1516 }
1520 } 1517 }
1521 1518