13 #include <linux/module.h>
14 #include <linux/slab.h>
15 #include <linux/device.h>
32 static int nuc900_checkready(
void)
43 static unsigned short nuc900_ac97_read(
struct snd_ac97 *ac97,
51 val = nuc900_checkready();
53 dev_err(nuc900_audio->
dev,
"AC97 codec is not ready\n");
73 dev_err(nuc900_audio->
dev,
"AC97 read register time out !\n");
84 "R_INDEX of REG_ACTL_ACIS1 not match!\n");
96 static void nuc900_ac97_write(
struct snd_ac97 *ac97,
unsigned short reg,
100 unsigned long tmp, timeout = 0x10000;
104 tmp = nuc900_checkready();
106 dev_err(nuc900_audio->
dev,
"AC97 codec is not ready\n");
127 dev_err(nuc900_audio->
dev,
"AC97 write register time out !\n");
137 static void nuc900_ac97_warm_reset(
struct snd_ac97 *ac97)
151 val = nuc900_checkready();
153 dev_err(nuc900_audio->
dev,
"AC97 codec is not ready\n");
158 static void nuc900_ac97_cold_reset(
struct snd_ac97 *ac97)
201 .read = nuc900_ac97_read,
202 .write = nuc900_ac97_write,
203 .reset = nuc900_ac97_cold_reset,
204 .warm_reset = nuc900_ac97_warm_reset,
266 static int nuc900_ac97_probe(
struct snd_soc_dai *dai)
286 static int nuc900_ac97_remove(
struct snd_soc_dai *dai)
295 .trigger = nuc900_ac97_trigger,
299 .probe = nuc900_ac97_probe,
300 .remove = nuc900_ac97_remove,
314 .ops = &nuc900_ac97_dai_ops,
319 struct nuc900_audio *nuc900_audio;
322 if (nuc900_ac97_data)
325 nuc900_audio = kzalloc(
sizeof(
struct nuc900_audio),
GFP_KERNEL);
332 if (!nuc900_audio->
res) {
338 resource_size(nuc900_audio->
res), pdev->
name)) {
344 resource_size(nuc900_audio->
res));
345 if (!nuc900_audio->
mmio) {
351 if (IS_ERR(nuc900_audio->
clk)) {
352 ret = PTR_ERR(nuc900_audio->
clk);
362 nuc900_ac97_data = nuc900_audio;
379 resource_size(nuc900_audio->
res));
392 resource_size(nuc900_ac97_data->
res));
394 kfree(nuc900_ac97_data);
395 nuc900_ac97_data =
NULL;
402 .name =
"nuc900-ac97",
405 .probe = nuc900_ac97_drvprobe,