blob: fd7bc865e672021b28ad431cb5c9ed8588901bec [file] [log] [blame]
Takashi Iwai2c484df2005-06-30 18:54:04 +02001/*
2 * linux/sound/pxa2xx-ac97.c -- AC97 support for the Intel PXA2xx chip.
3 *
4 * Author: Nicolas Pitre
5 * Created: Dec 02, 2004
6 * Copyright: MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010016#include <linux/platform_device.h>
Takashi Iwai2c484df2005-06-30 18:54:04 +020017#include <linux/interrupt.h>
18#include <linux/wait.h>
Mark Brown93873fb2008-03-04 11:14:25 +010019#include <linux/clk.h>
Takashi Iwai2c484df2005-06-30 18:54:04 +020020#include <linux/delay.h>
21
Takashi Iwai2c484df2005-06-30 18:54:04 +020022#include <sound/core.h>
23#include <sound/pcm.h>
24#include <sound/ac97_codec.h>
25#include <sound/initval.h>
26
27#include <asm/irq.h>
Ingo Molnar12aa7572006-01-16 16:36:05 +010028#include <linux/mutex.h>
Takashi Iwai2c484df2005-06-30 18:54:04 +020029#include <asm/hardware.h>
30#include <asm/arch/pxa-regs.h>
31#include <asm/arch/audio.h>
32
33#include "pxa2xx-pcm.h"
34
35
Ingo Molnar12aa7572006-01-16 16:36:05 +010036static DEFINE_MUTEX(car_mutex);
Takashi Iwai2c484df2005-06-30 18:54:04 +020037static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
38static volatile long gsr_bits;
Mark Brown93873fb2008-03-04 11:14:25 +010039static struct clk *ac97_clk;
40#ifdef CONFIG_PXA27x
41static struct clk *ac97conf_clk;
42#endif
Takashi Iwai2c484df2005-06-30 18:54:04 +020043
Nicolas Pitreea265c02005-12-12 15:41:47 +010044/*
45 * Beware PXA27x bugs:
46 *
47 * o Slot 12 read from modem space will hang controller.
48 * o CDONE, SDONE interrupt fails after any slot 12 IO.
49 *
50 * We therefore have an hybrid approach for waiting on SDONE (interrupt or
51 * 1 jiffy timeout if interrupt never comes).
52 */
53
Takashi Iwaid18f8372005-11-17 15:10:38 +010054static unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
Takashi Iwai2c484df2005-06-30 18:54:04 +020055{
56 unsigned short val = -1;
57 volatile u32 *reg_addr;
58
Ingo Molnar12aa7572006-01-16 16:36:05 +010059 mutex_lock(&car_mutex);
Takashi Iwai2c484df2005-06-30 18:54:04 +020060
61 /* set up primary or secondary codec space */
62 reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
63 reg_addr += (reg >> 1);
64
65 /* start read access across the ac97 link */
Nicolas Pitreea265c02005-12-12 15:41:47 +010066 GSR = GSR_CDONE | GSR_SDONE;
Takashi Iwai2c484df2005-06-30 18:54:04 +020067 gsr_bits = 0;
68 val = *reg_addr;
69 if (reg == AC97_GPIO_STATUS)
70 goto out;
Nicolas Pitreea265c02005-12-12 15:41:47 +010071 if (wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1) <= 0 &&
72 !((GSR | gsr_bits) & GSR_SDONE)) {
Takashi Iwai2c484df2005-06-30 18:54:04 +020073 printk(KERN_ERR "%s: read error (ac97_reg=%d GSR=%#lx)\n",
Nicolas Pitreea265c02005-12-12 15:41:47 +010074 __FUNCTION__, reg, GSR | gsr_bits);
Takashi Iwai2c484df2005-06-30 18:54:04 +020075 val = -1;
76 goto out;
77 }
78
79 /* valid data now */
Nicolas Pitreea265c02005-12-12 15:41:47 +010080 GSR = GSR_CDONE | GSR_SDONE;
Takashi Iwai2c484df2005-06-30 18:54:04 +020081 gsr_bits = 0;
82 val = *reg_addr;
83 /* but we've just started another cycle... */
Nicolas Pitreea265c02005-12-12 15:41:47 +010084 wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_SDONE, 1);
Takashi Iwai2c484df2005-06-30 18:54:04 +020085
Ingo Molnar12aa7572006-01-16 16:36:05 +010086out: mutex_unlock(&car_mutex);
Takashi Iwai2c484df2005-06-30 18:54:04 +020087 return val;
88}
89
Takashi Iwaid18f8372005-11-17 15:10:38 +010090static void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val)
Takashi Iwai2c484df2005-06-30 18:54:04 +020091{
92 volatile u32 *reg_addr;
93
Ingo Molnar12aa7572006-01-16 16:36:05 +010094 mutex_lock(&car_mutex);
Takashi Iwai2c484df2005-06-30 18:54:04 +020095
Takashi Iwai2c484df2005-06-30 18:54:04 +020096 /* set up primary or secondary codec space */
97 reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
98 reg_addr += (reg >> 1);
Nicolas Pitreea265c02005-12-12 15:41:47 +010099
100 GSR = GSR_CDONE | GSR_SDONE;
Takashi Iwai2c484df2005-06-30 18:54:04 +0200101 gsr_bits = 0;
102 *reg_addr = val;
Nicolas Pitreea265c02005-12-12 15:41:47 +0100103 if (wait_event_timeout(gsr_wq, (GSR | gsr_bits) & GSR_CDONE, 1) <= 0 &&
104 !((GSR | gsr_bits) & GSR_CDONE))
Takashi Iwai2c484df2005-06-30 18:54:04 +0200105 printk(KERN_ERR "%s: write error (ac97_reg=%d GSR=%#lx)\n",
Nicolas Pitreea265c02005-12-12 15:41:47 +0100106 __FUNCTION__, reg, GSR | gsr_bits);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200107
Ingo Molnar12aa7572006-01-16 16:36:05 +0100108 mutex_unlock(&car_mutex);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200109}
110
Takashi Iwaid18f8372005-11-17 15:10:38 +0100111static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200112{
113 /* First, try cold reset */
114 GCR &= GCR_COLD_RST; /* clear everything but nCRST */
115 GCR &= ~GCR_COLD_RST; /* then assert nCRST */
116
117 gsr_bits = 0;
118#ifdef CONFIG_PXA27x
119 /* PXA27x Developers Manual section 13.5.2.2.1 */
Mark Brown93873fb2008-03-04 11:14:25 +0100120 clk_enable(ac97conf_clk);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200121 udelay(5);
Mark Brown93873fb2008-03-04 11:14:25 +0100122 clk_disable(ac97conf_clk);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200123 GCR = GCR_COLD_RST;
124 udelay(50);
125#else
126 GCR = GCR_COLD_RST;
127 GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
128 wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
129#endif
130
131 if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR))) {
132 printk(KERN_INFO "%s: cold reset timeout (GSR=%#lx)\n",
133 __FUNCTION__, gsr_bits);
134
135 /* let's try warm reset */
136 gsr_bits = 0;
137#ifdef CONFIG_PXA27x
138 /* warm reset broken on Bulverde,
139 so manually keep AC97 reset high */
140 pxa_gpio_mode(113 | GPIO_OUT | GPIO_DFLT_HIGH);
141 udelay(10);
142 GCR |= GCR_WARM_RST;
143 pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
Liam Girdwood4a677ac52005-08-05 10:24:36 +0200144 udelay(500);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200145#else
Liam Girdwood4a677ac52005-08-05 10:24:36 +0200146 GCR |= GCR_WARM_RST|GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
Takashi Iwai2c484df2005-06-30 18:54:04 +0200147 wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
148#endif
149
150 if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)))
151 printk(KERN_INFO "%s: warm reset timeout (GSR=%#lx)\n",
152 __FUNCTION__, gsr_bits);
153 }
154
155 GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
156 GCR |= GCR_SDONE_IE|GCR_CDONE_IE;
157}
158
David Howells7d12e782006-10-05 14:55:46 +0100159static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200160{
161 long status;
162
163 status = GSR;
164 if (status) {
165 GSR = status;
166 gsr_bits |= status;
167 wake_up(&gsr_wq);
168
169#ifdef CONFIG_PXA27x
170 /* Although we don't use those we still need to clear them
171 since they tend to spuriously trigger when MMC is used
172 (hardware bug? go figure)... */
173 MISR = MISR_EOC;
174 PISR = PISR_EOC;
175 MCSR = MCSR_EOC;
176#endif
177
178 return IRQ_HANDLED;
179 }
180
181 return IRQ_NONE;
182}
183
Takashi Iwaid18f8372005-11-17 15:10:38 +0100184static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
Takashi Iwai2c484df2005-06-30 18:54:04 +0200185 .read = pxa2xx_ac97_read,
186 .write = pxa2xx_ac97_write,
187 .reset = pxa2xx_ac97_reset,
188};
189
Takashi Iwaid18f8372005-11-17 15:10:38 +0100190static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = {
Takashi Iwai2c484df2005-06-30 18:54:04 +0200191 .name = "AC97 PCM out",
192 .dev_addr = __PREG(PCDR),
193 .drcmr = &DRCMRTXPCDR,
194 .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG |
195 DCMD_BURST32 | DCMD_WIDTH4,
196};
197
Takashi Iwaid18f8372005-11-17 15:10:38 +0100198static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = {
Takashi Iwai2c484df2005-06-30 18:54:04 +0200199 .name = "AC97 PCM in",
200 .dev_addr = __PREG(PCDR),
201 .drcmr = &DRCMRRXPCDR,
202 .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC |
203 DCMD_BURST32 | DCMD_WIDTH4,
204};
205
Takashi Iwaid18f8372005-11-17 15:10:38 +0100206static struct snd_pcm *pxa2xx_ac97_pcm;
207static struct snd_ac97 *pxa2xx_ac97_ac97;
Takashi Iwai2c484df2005-06-30 18:54:04 +0200208
Takashi Iwaid18f8372005-11-17 15:10:38 +0100209static int pxa2xx_ac97_pcm_startup(struct snd_pcm_substream *substream)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200210{
Takashi Iwaid18f8372005-11-17 15:10:38 +0100211 struct snd_pcm_runtime *runtime = substream->runtime;
Takashi Iwai2c484df2005-06-30 18:54:04 +0200212 pxa2xx_audio_ops_t *platform_ops;
213 int r;
214
215 runtime->hw.channels_min = 2;
216 runtime->hw.channels_max = 2;
217
218 r = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
219 AC97_RATES_FRONT_DAC : AC97_RATES_ADC;
220 runtime->hw.rates = pxa2xx_ac97_ac97->rates[r];
221 snd_pcm_limit_hw_rates(runtime);
222
223 platform_ops = substream->pcm->card->dev->platform_data;
224 if (platform_ops && platform_ops->startup)
225 return platform_ops->startup(substream, platform_ops->priv);
226 else
227 return 0;
228}
229
Takashi Iwaid18f8372005-11-17 15:10:38 +0100230static void pxa2xx_ac97_pcm_shutdown(struct snd_pcm_substream *substream)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200231{
232 pxa2xx_audio_ops_t *platform_ops;
233
234 platform_ops = substream->pcm->card->dev->platform_data;
235 if (platform_ops && platform_ops->shutdown)
236 platform_ops->shutdown(substream, platform_ops->priv);
237}
238
Takashi Iwaid18f8372005-11-17 15:10:38 +0100239static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200240{
Takashi Iwaid18f8372005-11-17 15:10:38 +0100241 struct snd_pcm_runtime *runtime = substream->runtime;
Takashi Iwai2c484df2005-06-30 18:54:04 +0200242 int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
243 AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE;
244 return snd_ac97_set_rate(pxa2xx_ac97_ac97, reg, runtime->rate);
245}
246
Takashi Iwaid18f8372005-11-17 15:10:38 +0100247static struct pxa2xx_pcm_client pxa2xx_ac97_pcm_client = {
Takashi Iwai2c484df2005-06-30 18:54:04 +0200248 .playback_params = &pxa2xx_ac97_pcm_out,
249 .capture_params = &pxa2xx_ac97_pcm_in,
250 .startup = pxa2xx_ac97_pcm_startup,
251 .shutdown = pxa2xx_ac97_pcm_shutdown,
252 .prepare = pxa2xx_ac97_pcm_prepare,
253};
254
255#ifdef CONFIG_PM
256
Takashi Iwaid18f8372005-11-17 15:10:38 +0100257static int pxa2xx_ac97_do_suspend(struct snd_card *card, pm_message_t state)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200258{
Takashi Iwai792a6c52005-11-17 17:19:25 +0100259 pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data;
260
261 snd_power_change_state(card, SNDRV_CTL_POWER_D3cold);
262 snd_pcm_suspend_all(pxa2xx_ac97_pcm);
263 snd_ac97_suspend(pxa2xx_ac97_ac97);
264 if (platform_ops && platform_ops->suspend)
265 platform_ops->suspend(platform_ops->priv);
266 GCR |= GCR_ACLINK_OFF;
Mark Brown93873fb2008-03-04 11:14:25 +0100267 clk_disable(ac97_clk);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200268
269 return 0;
270}
271
Takashi Iwaid18f8372005-11-17 15:10:38 +0100272static int pxa2xx_ac97_do_resume(struct snd_card *card)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200273{
Takashi Iwai792a6c52005-11-17 17:19:25 +0100274 pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data;
275
Mark Brown93873fb2008-03-04 11:14:25 +0100276 clk_enable(ac97_clk);
Takashi Iwai792a6c52005-11-17 17:19:25 +0100277 if (platform_ops && platform_ops->resume)
278 platform_ops->resume(platform_ops->priv);
279 snd_ac97_resume(pxa2xx_ac97_ac97);
280 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200281
282 return 0;
283}
284
Russell King3ae5eae2005-11-09 22:32:44 +0000285static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200286{
Takashi Iwaid18f8372005-11-17 15:10:38 +0100287 struct snd_card *card = platform_get_drvdata(dev);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200288 int ret = 0;
289
Russell King9480e302005-10-28 09:52:56 -0700290 if (card)
Dirk Opfera55bfdc2005-08-08 16:29:43 +0200291 ret = pxa2xx_ac97_do_suspend(card, PMSG_SUSPEND);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200292
293 return ret;
294}
295
Russell King3ae5eae2005-11-09 22:32:44 +0000296static int pxa2xx_ac97_resume(struct platform_device *dev)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200297{
Takashi Iwaid18f8372005-11-17 15:10:38 +0100298 struct snd_card *card = platform_get_drvdata(dev);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200299 int ret = 0;
300
Russell King9480e302005-10-28 09:52:56 -0700301 if (card)
Dirk Opfera55bfdc2005-08-08 16:29:43 +0200302 ret = pxa2xx_ac97_do_resume(card);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200303
304 return ret;
305}
306
307#else
308#define pxa2xx_ac97_suspend NULL
309#define pxa2xx_ac97_resume NULL
310#endif
311
Prarit Bhargava788c6042007-02-13 13:11:11 +0100312static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200313{
Takashi Iwaid18f8372005-11-17 15:10:38 +0100314 struct snd_card *card;
315 struct snd_ac97_bus *ac97_bus;
316 struct snd_ac97_template ac97_template;
Takashi Iwai2c484df2005-06-30 18:54:04 +0200317 int ret;
318
319 ret = -ENOMEM;
320 card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
321 THIS_MODULE, 0);
322 if (!card)
323 goto err;
324
Russell King3ae5eae2005-11-09 22:32:44 +0000325 card->dev = &dev->dev;
326 strncpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
Takashi Iwai2c484df2005-06-30 18:54:04 +0200327
328 ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
329 if (ret)
330 goto err;
331
332 ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, 0, "AC97", NULL);
333 if (ret < 0)
334 goto err;
335
336 pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
337 pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
338 pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
339 pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
340#ifdef CONFIG_PXA27x
341 /* Use GPIO 113 as AC97 Reset on Bulverde */
342 pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
Mark Brown93873fb2008-03-04 11:14:25 +0100343 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
344 if (IS_ERR(ac97conf_clk)) {
345 ret = PTR_ERR(ac97conf_clk);
346 ac97conf_clk = NULL;
347 goto err;
348 }
Takashi Iwai2c484df2005-06-30 18:54:04 +0200349#endif
Mark Brown93873fb2008-03-04 11:14:25 +0100350
351 ac97_clk = clk_get(&dev->dev, "AC97CLK");
352 if (IS_ERR(ac97_clk)) {
353 ret = PTR_ERR(ac97_clk);
354 ac97_clk = NULL;
355 goto err;
356 }
357 clk_enable(ac97_clk);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200358
359 ret = snd_ac97_bus(card, 0, &pxa2xx_ac97_ops, NULL, &ac97_bus);
360 if (ret)
361 goto err;
362 memset(&ac97_template, 0, sizeof(ac97_template));
363 ret = snd_ac97_mixer(ac97_bus, &ac97_template, &pxa2xx_ac97_ac97);
364 if (ret)
365 goto err;
366
367 snprintf(card->shortname, sizeof(card->shortname),
368 "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97));
369 snprintf(card->longname, sizeof(card->longname),
Russell King3ae5eae2005-11-09 22:32:44 +0000370 "%s (%s)", dev->dev.driver->name, card->mixername);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200371
Takashi Iwaif78dfac2007-12-17 16:24:04 +0100372 snd_card_set_dev(card, &dev->dev);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200373 ret = snd_card_register(card);
374 if (ret == 0) {
Russell King3ae5eae2005-11-09 22:32:44 +0000375 platform_set_drvdata(dev, card);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200376 return 0;
377 }
378
379 err:
380 if (card)
381 snd_card_free(card);
Mark Brown93873fb2008-03-04 11:14:25 +0100382 if (ac97_clk) {
Takashi Iwai2c484df2005-06-30 18:54:04 +0200383 GCR |= GCR_ACLINK_OFF;
384 free_irq(IRQ_AC97, NULL);
Mark Brown93873fb2008-03-04 11:14:25 +0100385 clk_disable(ac97_clk);
386 clk_put(ac97_clk);
387 ac97_clk = NULL;
Takashi Iwai2c484df2005-06-30 18:54:04 +0200388 }
Mark Brown93873fb2008-03-04 11:14:25 +0100389#ifdef CONFIG_PXA27x
390 if (ac97conf_clk) {
391 clk_put(ac97conf_clk);
392 ac97conf_clk = NULL;
393 }
394#endif
Takashi Iwai2c484df2005-06-30 18:54:04 +0200395 return ret;
396}
397
Prarit Bhargava788c6042007-02-13 13:11:11 +0100398static int __devexit pxa2xx_ac97_remove(struct platform_device *dev)
Takashi Iwai2c484df2005-06-30 18:54:04 +0200399{
Takashi Iwaid18f8372005-11-17 15:10:38 +0100400 struct snd_card *card = platform_get_drvdata(dev);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200401
402 if (card) {
403 snd_card_free(card);
Russell King3ae5eae2005-11-09 22:32:44 +0000404 platform_set_drvdata(dev, NULL);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200405 GCR |= GCR_ACLINK_OFF;
406 free_irq(IRQ_AC97, NULL);
Mark Brown93873fb2008-03-04 11:14:25 +0100407 clk_disable(ac97_clk);
408 clk_put(ac97_clk);
409 ac97_clk = NULL;
410#ifdef CONFIG_PXA27x
411 clk_put(ac97conf_clk);
412 ac97conf_clk = NULL;
413#endif
Takashi Iwai2c484df2005-06-30 18:54:04 +0200414 }
415
416 return 0;
417}
418
Russell King3ae5eae2005-11-09 22:32:44 +0000419static struct platform_driver pxa2xx_ac97_driver = {
Takashi Iwai2c484df2005-06-30 18:54:04 +0200420 .probe = pxa2xx_ac97_probe,
Prarit Bhargava788c6042007-02-13 13:11:11 +0100421 .remove = __devexit_p(pxa2xx_ac97_remove),
Takashi Iwai2c484df2005-06-30 18:54:04 +0200422 .suspend = pxa2xx_ac97_suspend,
423 .resume = pxa2xx_ac97_resume,
Russell King3ae5eae2005-11-09 22:32:44 +0000424 .driver = {
425 .name = "pxa2xx-ac97",
426 },
Takashi Iwai2c484df2005-06-30 18:54:04 +0200427};
428
429static int __init pxa2xx_ac97_init(void)
430{
Russell King3ae5eae2005-11-09 22:32:44 +0000431 return platform_driver_register(&pxa2xx_ac97_driver);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200432}
433
434static void __exit pxa2xx_ac97_exit(void)
435{
Russell King3ae5eae2005-11-09 22:32:44 +0000436 platform_driver_unregister(&pxa2xx_ac97_driver);
Takashi Iwai2c484df2005-06-30 18:54:04 +0200437}
438
439module_init(pxa2xx_ac97_init);
440module_exit(pxa2xx_ac97_exit);
441
442MODULE_AUTHOR("Nicolas Pitre");
443MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip");
444MODULE_LICENSE("GPL");