This source file includes following definitions.
- snd_cs5535audio_stop_hardware
- snd_cs5535audio_suspend
- snd_cs5535audio_resume
1
2
3
4
5
6
7 #include <linux/init.h>
8 #include <linux/pci.h>
9 #include <linux/delay.h>
10 #include <sound/core.h>
11 #include <sound/control.h>
12 #include <sound/initval.h>
13 #include <sound/asoundef.h>
14 #include <sound/pcm.h>
15 #include <sound/ac97_codec.h>
16 #include "cs5535audio.h"
17
18 static void snd_cs5535audio_stop_hardware(struct cs5535audio *cs5535au)
19 {
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 cs_writel(cs5535au, ACC_CODEC_CNTL, ACC_CODEC_CNTL_LNK_SHUTDOWN);
41
42 }
43
44 static int __maybe_unused snd_cs5535audio_suspend(struct device *dev)
45 {
46 struct snd_card *card = dev_get_drvdata(dev);
47 struct cs5535audio *cs5535au = card->private_data;
48 int i;
49
50 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
51 snd_ac97_suspend(cs5535au->ac97);
52 for (i = 0; i < NUM_CS5535AUDIO_DMAS; i++) {
53 struct cs5535audio_dma *dma = &cs5535au->dmas[i];
54 if (dma && dma->substream)
55 dma->saved_prd = dma->ops->read_prd(cs5535au);
56 }
57
58 snd_cs5535audio_stop_hardware(cs5535au);
59 return 0;
60 }
61
62 static int __maybe_unused snd_cs5535audio_resume(struct device *dev)
63 {
64 struct snd_card *card = dev_get_drvdata(dev);
65 struct cs5535audio *cs5535au = card->private_data;
66 u32 tmp;
67 int timeout;
68 int i;
69
70
71 cs_writel(cs5535au, ACC_CODEC_CNTL, ACC_CODEC_CNTL_LNK_WRM_RST);
72
73 timeout = 50;
74 do {
75 tmp = cs_readl(cs5535au, ACC_CODEC_STATUS);
76 if (tmp & PRM_RDY_STS)
77 break;
78 udelay(1);
79 } while (--timeout);
80
81 if (!timeout)
82 dev_err(cs5535au->card->dev, "Failure getting AC Link ready\n");
83
84
85 for (i = 0; i < NUM_CS5535AUDIO_DMAS; i++) {
86 struct cs5535audio_dma *dma = &cs5535au->dmas[i];
87 if (dma && dma->substream) {
88 dma->substream->ops->prepare(dma->substream);
89 dma->ops->setup_prd(cs5535au, dma->saved_prd);
90 }
91 }
92
93
94 snd_ac97_resume(cs5535au->ac97);
95 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
96
97 return 0;
98 }
99
100 SIMPLE_DEV_PM_OPS(snd_cs5535audio_pm, snd_cs5535audio_suspend, snd_cs5535audio_resume);