15 #include <linux/module.h>
24 #include <mach/regs-ac97.h>
29 static void pxa2xx_ac97_reset(
struct snd_ac97 *ac97)
41 .reset = pxa2xx_ac97_reset,
45 .name =
"AC97 PCM out",
53 .name =
"AC97 PCM in",
60 static struct snd_pcm *pxa2xx_ac97_pcm;
61 static struct snd_ac97 *pxa2xx_ac97_ac97;
69 runtime->
hw.channels_min = 2;
70 runtime->
hw.channels_max = 2;
74 runtime->
hw.rates = pxa2xx_ac97_ac97->
rates[
r];
77 platform_ops = substream->
pcm->card->dev->platform_data;
78 if (platform_ops && platform_ops->
startup)
79 return platform_ops->
startup(substream, platform_ops->
priv);
88 platform_ops = substream->
pcm->card->dev->platform_data;
89 if (platform_ops && platform_ops->
shutdown)
102 .playback_params = &pxa2xx_ac97_pcm_out,
103 .capture_params = &pxa2xx_ac97_pcm_in,
104 .startup = pxa2xx_ac97_pcm_startup,
105 .shutdown = pxa2xx_ac97_pcm_shutdown,
106 .prepare = pxa2xx_ac97_pcm_prepare,
109 #ifdef CONFIG_PM_SLEEP
111 static int pxa2xx_ac97_do_suspend(
struct snd_card *
card)
116 snd_pcm_suspend_all(pxa2xx_ac97_pcm);
117 snd_ac97_suspend(pxa2xx_ac97_ac97);
118 if (platform_ops && platform_ops->
suspend)
124 static int pxa2xx_ac97_do_resume(
struct snd_card *card)
133 if (platform_ops && platform_ops->
resume)
135 snd_ac97_resume(pxa2xx_ac97_ac97);
147 ret = pxa2xx_ac97_do_suspend(card);
158 ret = pxa2xx_ac97_do_resume(card);
175 dev_err(&dev->
dev,
"PXA2xx has only one AC97 port.\n");
188 ret =
pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
199 memset(&ac97_template, 0,
sizeof(ac97_template));
200 ret =
snd_ac97_mixer(ac97_bus, &ac97_template, &pxa2xx_ac97_ac97);
214 platform_set_drvdata(dev, card);
229 struct snd_card *card = platform_get_drvdata(dev);
233 platform_set_drvdata(dev,
NULL);
241 .probe = pxa2xx_ac97_probe,
244 .name =
"pxa2xx-ac97",
246 #ifdef CONFIG_PM_SLEEP
247 .pm = &pxa2xx_ac97_pm_ops,