diff options
Diffstat (limited to 'sound/pci/intel8x0m.c')
-rw-r--r-- | sound/pci/intel8x0m.c | 55 |
1 files changed, 23 insertions, 32 deletions
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 9e2060d56c24..acfb197a833c 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz> | 4 | * Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz> |
5 | * | 5 | * |
6 | * This is modified (by Sasha Khapyorsky <sashak@smlink.com>) version | 6 | * This is modified (by Sasha Khapyorsky <sashak@alsa-project.org>) version |
7 | * of ALSA ICH sound driver intel8x0.c . | 7 | * of ALSA ICH sound driver intel8x0.c . |
8 | * | 8 | * |
9 | * | 9 | * |
@@ -56,20 +56,21 @@ MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH}," | |||
56 | "{NVidia,NForce3 Modem}," | 56 | "{NVidia,NForce3 Modem}," |
57 | "{AMD,AMD768}}"); | 57 | "{AMD,AMD768}}"); |
58 | 58 | ||
59 | static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ | 59 | static int index = -2; /* Exclude the first card */ |
60 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 60 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
61 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 61 | static int ac97_clock = 0; |
62 | static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; | ||
63 | 62 | ||
64 | module_param_array(index, int, NULL, 0444); | 63 | module_param(index, int, 0444); |
65 | MODULE_PARM_DESC(index, "Index value for Intel i8x0 modemcard."); | 64 | MODULE_PARM_DESC(index, "Index value for Intel i8x0 modemcard."); |
66 | module_param_array(id, charp, NULL, 0444); | 65 | module_param(id, charp, 0444); |
67 | MODULE_PARM_DESC(id, "ID string for Intel i8x0 modemcard."); | 66 | MODULE_PARM_DESC(id, "ID string for Intel i8x0 modemcard."); |
68 | module_param_array(enable, bool, NULL, 0444); | 67 | module_param(ac97_clock, int, 0444); |
69 | MODULE_PARM_DESC(enable, "Enable Intel i8x0 modemcard."); | ||
70 | module_param_array(ac97_clock, int, NULL, 0444); | ||
71 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); | 68 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); |
72 | 69 | ||
70 | /* just for backward compatibility */ | ||
71 | static int enable; | ||
72 | module_param(enable, bool, 0444); | ||
73 | |||
73 | /* | 74 | /* |
74 | * Direct registers | 75 | * Direct registers |
75 | */ | 76 | */ |
@@ -362,7 +363,7 @@ static int snd_intel8x0m_codec_semaphore(intel8x0_t *chip, unsigned int codec) | |||
362 | /* access to some forbidden (non existant) ac97 registers will not | 363 | /* access to some forbidden (non existant) ac97 registers will not |
363 | * reset the semaphore. So even if you don't get the semaphore, still | 364 | * reset the semaphore. So even if you don't get the semaphore, still |
364 | * continue the access. We don't need the semaphore anyway. */ | 365 | * continue the access. We don't need the semaphore anyway. */ |
365 | snd_printk("codec_semaphore: semaphore is not ready [0x%x][0x%x]\n", | 366 | snd_printk(KERN_ERR "codec_semaphore: semaphore is not ready [0x%x][0x%x]\n", |
366 | igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA))); | 367 | igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA))); |
367 | iagetword(chip, 0); /* clear semaphore flag */ | 368 | iagetword(chip, 0); /* clear semaphore flag */ |
368 | /* I don't care about the semaphore */ | 369 | /* I don't care about the semaphore */ |
@@ -377,7 +378,7 @@ static void snd_intel8x0_codec_write(ac97_t *ac97, | |||
377 | 378 | ||
378 | if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { | 379 | if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { |
379 | if (! chip->in_ac97_init) | 380 | if (! chip->in_ac97_init) |
380 | snd_printk("codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); | 381 | snd_printk(KERN_ERR "codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); |
381 | } | 382 | } |
382 | iaputword(chip, reg + ac97->num * 0x80, val); | 383 | iaputword(chip, reg + ac97->num * 0x80, val); |
383 | } | 384 | } |
@@ -391,7 +392,7 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97, | |||
391 | 392 | ||
392 | if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { | 393 | if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { |
393 | if (! chip->in_ac97_init) | 394 | if (! chip->in_ac97_init) |
394 | snd_printk("codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); | 395 | snd_printk(KERN_ERR "codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); |
395 | res = 0xffff; | 396 | res = 0xffff; |
396 | } else { | 397 | } else { |
397 | res = iagetword(chip, reg + ac97->num * 0x80); | 398 | res = iagetword(chip, reg + ac97->num * 0x80); |
@@ -399,7 +400,7 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97, | |||
399 | /* reset RCS and preserve other R/WC bits */ | 400 | /* reset RCS and preserve other R/WC bits */ |
400 | iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI)); | 401 | iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI)); |
401 | if (! chip->in_ac97_init) | 402 | if (! chip->in_ac97_init) |
402 | snd_printk("codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); | 403 | snd_printk(KERN_ERR "codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); |
403 | res = 0xffff; | 404 | res = 0xffff; |
404 | } | 405 | } |
405 | } | 406 | } |
@@ -746,6 +747,7 @@ static int __devinit snd_intel8x0_pcm1(intel8x0_t *chip, int device, struct ich_ | |||
746 | 747 | ||
747 | pcm->private_data = chip; | 748 | pcm->private_data = chip; |
748 | pcm->info_flags = 0; | 749 | pcm->info_flags = 0; |
750 | pcm->dev_class = SNDRV_PCM_CLASS_MODEM; | ||
749 | if (rec->suffix) | 751 | if (rec->suffix) |
750 | sprintf(pcm->name, "%s - %s", chip->card->shortname, rec->suffix); | 752 | sprintf(pcm->name, "%s - %s", chip->card->shortname, rec->suffix); |
751 | else | 753 | else |
@@ -854,7 +856,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock) | |||
854 | if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) | 856 | if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) |
855 | goto __err; | 857 | goto __err; |
856 | pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; | 858 | pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; |
857 | pbus->shared_type = AC97_SHARED_TYPE_ICH; /* shared with audio driver */ | ||
858 | if (ac97_clock >= 8000 && ac97_clock <= 48000) | 859 | if (ac97_clock >= 8000 && ac97_clock <= 48000) |
859 | pbus->clock = ac97_clock; | 860 | pbus->clock = ac97_clock; |
860 | chip->ac97_bus = pbus; | 861 | chip->ac97_bus = pbus; |
@@ -889,8 +890,7 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock) | |||
889 | */ | 890 | */ |
890 | 891 | ||
891 | #define do_delay(chip) do {\ | 892 | #define do_delay(chip) do {\ |
892 | set_current_state(TASK_UNINTERRUPTIBLE);\ | 893 | schedule_timeout_uninterruptible(1);\ |
893 | schedule_timeout(1);\ | ||
894 | } while (0) | 894 | } while (0) |
895 | 895 | ||
896 | static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) | 896 | static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) |
@@ -916,7 +916,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) | |||
916 | goto __ok; | 916 | goto __ok; |
917 | do_delay(chip); | 917 | do_delay(chip); |
918 | } while (time_after_eq(end_time, jiffies)); | 918 | } while (time_after_eq(end_time, jiffies)); |
919 | snd_printk("AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); | 919 | snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); |
920 | return -EIO; | 920 | return -EIO; |
921 | 921 | ||
922 | __ok: | 922 | __ok: |
@@ -1142,7 +1142,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card, | |||
1142 | chip->remap_addr = ioremap_nocache(chip->addr, | 1142 | chip->remap_addr = ioremap_nocache(chip->addr, |
1143 | pci_resource_len(pci, 2)); | 1143 | pci_resource_len(pci, 2)); |
1144 | if (chip->remap_addr == NULL) { | 1144 | if (chip->remap_addr == NULL) { |
1145 | snd_printk("AC'97 space ioremap problem\n"); | 1145 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); |
1146 | snd_intel8x0_free(chip); | 1146 | snd_intel8x0_free(chip); |
1147 | return -EIO; | 1147 | return -EIO; |
1148 | } | 1148 | } |
@@ -1155,7 +1155,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card, | |||
1155 | chip->remap_bmaddr = ioremap_nocache(chip->bmaddr, | 1155 | chip->remap_bmaddr = ioremap_nocache(chip->bmaddr, |
1156 | pci_resource_len(pci, 3)); | 1156 | pci_resource_len(pci, 3)); |
1157 | if (chip->remap_bmaddr == NULL) { | 1157 | if (chip->remap_bmaddr == NULL) { |
1158 | snd_printk("Controller space ioremap problem\n"); | 1158 | snd_printk(KERN_ERR "Controller space ioremap problem\n"); |
1159 | snd_intel8x0_free(chip); | 1159 | snd_intel8x0_free(chip); |
1160 | return -EIO; | 1160 | return -EIO; |
1161 | } | 1161 | } |
@@ -1165,7 +1165,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card, | |||
1165 | 1165 | ||
1166 | port_inited: | 1166 | port_inited: |
1167 | if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { | 1167 | if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { |
1168 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 1168 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1169 | snd_intel8x0_free(chip); | 1169 | snd_intel8x0_free(chip); |
1170 | return -EBUSY; | 1170 | return -EBUSY; |
1171 | } | 1171 | } |
@@ -1263,20 +1263,12 @@ static struct shortname_table { | |||
1263 | static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, | 1263 | static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, |
1264 | const struct pci_device_id *pci_id) | 1264 | const struct pci_device_id *pci_id) |
1265 | { | 1265 | { |
1266 | static int dev; | ||
1267 | snd_card_t *card; | 1266 | snd_card_t *card; |
1268 | intel8x0_t *chip; | 1267 | intel8x0_t *chip; |
1269 | int err; | 1268 | int err; |
1270 | struct shortname_table *name; | 1269 | struct shortname_table *name; |
1271 | 1270 | ||
1272 | if (dev >= SNDRV_CARDS) | 1271 | card = snd_card_new(index, id, THIS_MODULE, 0); |
1273 | return -ENODEV; | ||
1274 | if (!enable[dev]) { | ||
1275 | dev++; | ||
1276 | return -ENOENT; | ||
1277 | } | ||
1278 | |||
1279 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
1280 | if (card == NULL) | 1272 | if (card == NULL) |
1281 | return -ENOMEM; | 1273 | return -ENOMEM; |
1282 | 1274 | ||
@@ -1295,7 +1287,7 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, | |||
1295 | return err; | 1287 | return err; |
1296 | } | 1288 | } |
1297 | 1289 | ||
1298 | if ((err = snd_intel8x0_mixer(chip, ac97_clock[dev])) < 0) { | 1290 | if ((err = snd_intel8x0_mixer(chip, ac97_clock)) < 0) { |
1299 | snd_card_free(card); | 1291 | snd_card_free(card); |
1300 | return err; | 1292 | return err; |
1301 | } | 1293 | } |
@@ -1314,7 +1306,6 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, | |||
1314 | return err; | 1306 | return err; |
1315 | } | 1307 | } |
1316 | pci_set_drvdata(pci, card); | 1308 | pci_set_drvdata(pci, card); |
1317 | dev++; | ||
1318 | return 0; | 1309 | return 0; |
1319 | } | 1310 | } |
1320 | 1311 | ||