Changeset 679 for GPL/trunk/alsa-kernel/pci/atiixp.c
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/pci/atiixp.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * ALSA driver for ATI IXP 150/200/250/300 AC97 controllers 3 4 * 4 5 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 */ 21 22 #include <asm/io.h> 6 */ 7 8 #include <linux/io.h> 23 9 #include <linux/delay.h> 24 10 #include <linux/interrupt.h> … … 26 12 #include <linux/pci.h> 27 13 #include <linux/slab.h> 28 #include <linux/module param.h>14 #include <linux/module.h> 29 15 #include <linux/mutex.h> 30 16 #include <sound/core.h> … … 35 21 #include <sound/initval.h> 36 22 23 #ifdef TARGET_OS2 24 #define KBUILD_MODNAME "atiixp" 25 #endif 26 37 27 MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); 38 28 MODULE_DESCRIPTION("ATI IXP AC97 controller"); … … 44 34 static int ac97_clock = 48000; 45 35 static char *ac97_quirk; 46 static intspdif_aclink = 1;36 static bool spdif_aclink = 1; 47 37 static int ac97_codec = -1; 48 38 … … 61 51 62 52 /* just for backward compatibility */ 63 //static intenable;53 //static bool enable; 64 54 module_param(enable, bool, 0444); 65 55 … … 208 198 209 199 struct atiixp_dma_desc { 210 u32 addr; /* DMA buffer address */200 __le32 addr; /* DMA buffer address */ 211 201 u16 status; /* status bits */ 212 202 u16 size; /* size of the packet in dwords */ 213 u32 next; /* address of the next packet descriptor */203 __le32 next; /* address of the next packet descriptor */ 214 204 }; 215 205 … … 287 277 /* 288 278 */ 289 static DEFINE_PCI_DEVICE_TABLE(snd_atiixp_ids)= {279 static const struct pci_device_id snd_atiixp_ids[] = { 290 280 { PCI_VDEVICE(ATI, 0x4341), 0 }, /* SB200 */ 291 281 { PCI_VDEVICE(ATI, 0x4361), 0 }, /* SB300 */ … … 297 287 MODULE_DEVICE_TABLE(pci, snd_atiixp_ids); 298 288 299 static struct snd_pci_quirk atiixp_quirks[] __devinitdata= {289 static const struct snd_pci_quirk atiixp_quirks[] = { 300 290 SND_PCI_QUIRK(0x105b, 0x0c81, "Foxconn RC4107MA-RS2", 0), 301 291 SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0), … … 352 342 * a static RING of buffer descriptors is used. 353 343 * 354 * the ring is built in this function, and is set up to the hardware. 344 * the ring is built in this function, and is set up to the hardware. 355 345 */ 356 346 static int atiixp_build_dma_packets(struct atiixp *chip, struct atiixp_dma *dma, … … 368 358 if (dma->desc_buf.area == NULL) { 369 359 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, 370 snd_dma_pci_data(chip->pci),360 &chip->pci->dev, 371 361 ATI_DESC_LIST_SIZE, 372 362 &dma->desc_buf) < 0) … … 436 426 while (atiixp_read(chip, PHYS_OUT_ADDR) & ATI_REG_PHYS_OUT_ADDR_EN) { 437 427 if (! timeout--) { 438 snd_printk(KERN_WARNING "atiixp:codec acquire timeout\n");428 dev_warn(chip->card->dev, "codec acquire timeout\n"); 439 429 return -EBUSY; 440 430 } … … 467 457 /* time out may happen during reset */ 468 458 if (reg < 0x7c) 469 snd_printk(KERN_WARNING "atiixp:codec read timeout (reg %x)\n", reg);459 dev_warn(chip->card->dev, "codec read timeout (reg %x)\n", reg); 470 460 return 0xffff; 471 461 } … … 476 466 { 477 467 unsigned int data; 478 468 479 469 if (snd_atiixp_acquire_codec(chip) < 0) 480 470 return; … … 491 481 struct atiixp *chip = ac97->private_data; 492 482 return snd_atiixp_codec_read(chip, ac97->num, reg); 493 483 494 484 } 495 485 … … 518 508 udelay(10); 519 509 atiixp_update(chip, CMD, ATI_REG_CMD_AC_SOFT_RESET, 0); 520 510 521 511 timeout = 10; 522 512 while (! (atiixp_read(chip, CMD) & ATI_REG_CMD_ACLINK_ACTIVE)) { … … 527 517 mdelay(1); 528 518 atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET); 529 if ( --timeout) {530 snd_printk(KERN_ERR "atiixp:codec reset timeout\n");519 if (!--timeout) { 520 dev_err(chip->card->dev, "codec reset timeout\n"); 531 521 break; 532 522 } … … 541 531 } 542 532 543 #ifdef CONFIG_PM 533 #ifdef CONFIG_PM_SLEEP 544 534 static int snd_atiixp_aclink_down(struct atiixp *chip) 545 535 { … … 567 557 #define CODEC_CHECK_BITS (ALL_CODEC_NOT_READY|ATI_REG_ISR_NEW_FRAME) 568 558 569 static int __devinitac97_probing_bugs(struct pci_dev *pci)559 static int ac97_probing_bugs(struct pci_dev *pci) 570 560 { 571 561 const struct snd_pci_quirk *q; … … 573 563 q = snd_pci_quirk_lookup(pci, atiixp_quirks); 574 564 if (q) { 575 #ifndef TARGET_OS2 576 snd_printdd(KERN_INFO "Atiixp quirk for %s. " 577 "Forcing codec %d\n", q->name, q->value); 578 #endif 565 dev_dbg(&pci->dev, "atiixp quirk for %s. Forcing codec %d\n", 566 snd_pci_quirk_name(q), q->value); 567 579 568 return q->value; 580 569 } … … 583 572 } 584 573 585 static int __devinitsnd_atiixp_codec_detect(struct atiixp *chip)574 static int snd_atiixp_codec_detect(struct atiixp *chip) 586 575 { 587 576 int timeout; … … 607 596 608 597 if ((chip->codec_not_ready_bits & ALL_CODEC_NOT_READY) == ALL_CODEC_NOT_READY) { 609 snd_printk(KERN_ERR "atiixp:no codec detected!\n");598 dev_err(chip->card->dev, "no codec detected!\n"); 610 599 return -ENXIO; 611 600 } … … 683 672 return bytes_to_frames(runtime, curptr); 684 673 } 685 snd_printd("atiixp:invalid DMA pointer read 0x%x (buf=%x)\n",674 dev_dbg(chip->card->dev, "invalid DMA pointer read 0x%x (buf=%x)\n", 686 675 readl(chip->remap_addr + dma->ops->dt_cur), dma->buf_addr); 687 676 return 0; … … 695 684 if (! dma->substream || ! dma->running) 696 685 return; 697 snd_printdd("atiixp:XRUN detected (DMA %d)\n", dma->ops->type);698 snd_pcm_stop (dma->substream, SNDRV_PCM_STATE_XRUN);686 dev_dbg(chip->card->dev, "XRUN detected (DMA %d)\n", dma->ops->type); 687 snd_pcm_stop_xrun(dma->substream); 699 688 } 700 689 … … 741 730 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 742 731 case SNDRV_PCM_TRIGGER_RESUME: 732 if (dma->running && dma->suspended && 733 cmd == SNDRV_PCM_TRIGGER_RESUME) 734 writel(dma->saved_curptr, chip->remap_addr + 735 dma->ops->dt_cur); 743 736 dma->ops->enable_transfer(chip, 1); 744 737 dma->running = 1; … … 748 741 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 749 742 case SNDRV_PCM_TRIGGER_SUSPEND: 743 dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND; 744 if (dma->running && dma->suspended) 745 dma->saved_curptr = readl(chip->remap_addr + 746 dma->ops->dt_cur); 750 747 dma->ops->enable_transfer(chip, 0); 751 748 dma->running = 0; 752 dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND;753 749 break; 754 750 default: … … 911 907 data |= ATI_REG_OUT_DMA_SLOT_BIT(10) | 912 908 ATI_REG_OUT_DMA_SLOT_BIT(11); 913 /* fallthru */909 fallthrough; 914 910 case 6: 915 911 data |= ATI_REG_OUT_DMA_SLOT_BIT(7) | 916 912 ATI_REG_OUT_DMA_SLOT_BIT(8); 917 /* fallthru */913 fallthrough; 918 914 case 4: 919 915 data |= ATI_REG_OUT_DMA_SLOT_BIT(6) | 920 916 ATI_REG_OUT_DMA_SLOT_BIT(9); 921 /* fallthru */917 fallthrough; 922 918 default: 923 919 data |= ATI_REG_OUT_DMA_SLOT_BIT(3) | … … 939 935 atiixp_update(chip, 6CH_REORDER, ATI_REG_6CH_REORDER_EN, 940 936 substream->runtime->channels >= 6 ? ATI_REG_6CH_REORDER_EN: 0); 941 937 942 938 spin_unlock_irq(&chip->reg_lock); 943 939 return 0; … … 967 963 int err; 968 964 969 err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));970 if (err < 0)971 return err;972 965 dma->buf_addr = substream->runtime->dma_addr; 973 966 dma->buf_bytes = params_buffer_bytes(hw_params); … … 1009 1002 } 1010 1003 atiixp_clear_dma_packets(chip, dma, substream); 1011 snd_pcm_lib_free_pages(substream);1012 1004 return 0; 1013 1005 } … … 1017 1009 * pcm hardware definition, identical for all DMA types 1018 1010 */ 1019 static struct snd_pcm_hardware snd_atiixp_pcm_hw =1011 static const struct snd_pcm_hardware snd_atiixp_pcm_hw = 1020 1012 { 1021 1013 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 1156 1148 1157 1149 /* AC97 playback */ 1158 static struct snd_pcm_ops snd_atiixp_playback_ops = {1150 static const struct snd_pcm_ops snd_atiixp_playback_ops = { 1159 1151 .open = snd_atiixp_playback_open, 1160 1152 .close = snd_atiixp_playback_close, 1161 .ioctl = snd_pcm_lib_ioctl,1162 1153 .hw_params = snd_atiixp_pcm_hw_params, 1163 1154 .hw_free = snd_atiixp_pcm_hw_free, … … 1168 1159 1169 1160 /* AC97 capture */ 1170 static struct snd_pcm_ops snd_atiixp_capture_ops = {1161 static const struct snd_pcm_ops snd_atiixp_capture_ops = { 1171 1162 .open = snd_atiixp_capture_open, 1172 1163 .close = snd_atiixp_capture_close, 1173 .ioctl = snd_pcm_lib_ioctl,1174 1164 .hw_params = snd_atiixp_pcm_hw_params, 1175 1165 .hw_free = snd_atiixp_pcm_hw_free, … … 1180 1170 1181 1171 /* SPDIF playback */ 1182 static struct snd_pcm_ops snd_atiixp_spdif_ops = {1172 static const struct snd_pcm_ops snd_atiixp_spdif_ops = { 1183 1173 .open = snd_atiixp_spdif_open, 1184 1174 .close = snd_atiixp_spdif_close, 1185 .ioctl = snd_pcm_lib_ioctl,1186 1175 .hw_params = snd_atiixp_pcm_hw_params, 1187 1176 .hw_free = snd_atiixp_pcm_hw_free, … … 1191 1180 }; 1192 1181 1193 static struct ac97_pcm atiixp_pcm_defs[] __devinitdata= {1182 static const struct ac97_pcm atiixp_pcm_defs[] = { 1194 1183 /* front PCM */ 1195 1184 { … … 1227 1216 }; 1228 1217 1229 static struct atiixp_dma_ops snd_atiixp_playback_dma_ops = {1218 static const struct atiixp_dma_ops snd_atiixp_playback_dma_ops = { 1230 1219 .type = ATI_DMA_PLAYBACK, 1231 1220 .llp_offset = ATI_REG_OUT_DMA_LINKPTR, … … 1236 1225 }; 1237 1226 1238 static struct atiixp_dma_ops snd_atiixp_capture_dma_ops = {1227 static const struct atiixp_dma_ops snd_atiixp_capture_dma_ops = { 1239 1228 .type = ATI_DMA_CAPTURE, 1240 1229 .llp_offset = ATI_REG_IN_DMA_LINKPTR, … … 1245 1234 }; 1246 1235 1247 static struct atiixp_dma_ops snd_atiixp_spdif_dma_ops = {1236 static const struct atiixp_dma_ops snd_atiixp_spdif_dma_ops = { 1248 1237 .type = ATI_DMA_SPDIF, 1249 1238 .llp_offset = ATI_REG_SPDF_DMA_LINKPTR, … … 1255 1244 1256 1245 1257 static int __devinitsnd_atiixp_pcm_new(struct atiixp *chip)1246 static int snd_atiixp_pcm_new(struct atiixp *chip) 1258 1247 { 1259 1248 struct snd_pcm *pcm; 1249 struct snd_pcm_chmap *chmap; 1260 1250 struct snd_ac97_bus *pbus = chip->ac97_bus; 1261 1251 int err, i, num_pcms; … … 1297 1287 chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm; 1298 1288 1299 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1300 snd_dma_pci_data(chip->pci), 1301 64*1024, 128*1024); 1289 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, 1290 &chip->pci->dev, 64*1024, 128*1024); 1291 1292 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, 1293 snd_pcm_alt_chmaps, chip->max_channels, 0, 1294 &chmap); 1295 if (err < 0) 1296 return err; 1297 chmap->channel_mask = SND_PCM_CHMAP_MASK_2468; 1298 chip->ac97[0]->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; 1302 1299 1303 1300 /* no SPDIF support on codec? */ … … 1322 1319 chip->pcmdevs[ATI_PCMDEV_DIGITAL] = pcm; 1323 1320 1324 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1325 snd_dma_pci_data(chip->pci), 1326 64*1024, 128*1024); 1321 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, 1322 &chip->pci->dev, 64*1024, 128*1024); 1327 1323 1328 1324 /* pre-select AC97 SPDIF slots 10/11 */ … … 1389 1385 */ 1390 1386 1391 static struct ac97_quirk ac97_quirks[] __devinitdata= {1387 static const struct ac97_quirk ac97_quirks[] = { 1392 1388 { 1393 1389 .subvendor = 0x103c, … … 1411 1407 }; 1412 1408 1413 static int __devinitsnd_atiixp_mixer_new(struct atiixp *chip, int clock,1414 1409 static int snd_atiixp_mixer_new(struct atiixp *chip, int clock, 1410 const char *quirk_override) 1415 1411 { 1416 1412 struct snd_ac97_bus *pbus; … … 1418 1414 int i, err; 1419 1415 int codec_count; 1420 static struct snd_ac97_bus_ops ops = {1416 static const struct snd_ac97_bus_ops ops = { 1421 1417 .write = snd_atiixp_ac97_write, 1422 1418 .read = snd_atiixp_ac97_read, 1423 1419 }; 1424 static unsigned int codec_skip[NUM_ATI_CODECS] = {1420 static const unsigned int codec_skip[NUM_ATI_CODECS] = { 1425 1421 ATI_REG_ISR_CODEC0_NOT_READY, 1426 1422 ATI_REG_ISR_CODEC1_NOT_READY, … … 1449 1445 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) { 1450 1446 chip->ac97[i] = NULL; /* to be sure */ 1451 snd_printdd("atiixp: codec %d not available for audio\n", i); 1447 dev_dbg(chip->card->dev, 1448 "codec %d not available for audio\n", i); 1452 1449 continue; 1453 1450 } … … 1456 1453 1457 1454 if (! codec_count) { 1458 snd_printk(KERN_ERR "atiixp:no codec available\n");1455 dev_err(chip->card->dev, "no codec available\n"); 1459 1456 return -ENODEV; 1460 1457 } … … 1466 1463 1467 1464 1468 #ifdef CONFIG_PM 1465 #ifdef CONFIG_PM_SLEEP 1469 1466 /* 1470 1467 * power management 1471 1468 */ 1472 static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)1473 { 1474 struct snd_card *card = pci_get_drvdata(pci);1469 static int snd_atiixp_suspend(struct device *dev) 1470 { 1471 struct snd_card *card = dev_get_drvdata(dev); 1475 1472 struct atiixp *chip = card->private_data; 1476 1473 int i; 1477 1474 1478 1475 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 1479 for (i = 0; i < NUM_ATI_PCMDEVS; i++)1480 if (chip->pcmdevs[i]) {1481 struct atiixp_dma *dma = &chip->dmas[i];1482 if (dma->substream && dma->running)1483 dma->saved_curptr = readl(chip->remap_addr +1484 dma->ops->dt_cur);1485 snd_pcm_suspend_all(chip->pcmdevs[i]);1486 }1487 1476 for (i = 0; i < NUM_ATI_CODECS; i++) 1488 1477 snd_ac97_suspend(chip->ac97[i]); 1489 1478 snd_atiixp_aclink_down(chip); 1490 1479 snd_atiixp_chip_stop(chip); 1491 1492 pci_disable_device(pci); 1493 pci_save_state(pci); 1494 pci_set_power_state(pci, pci_choose_state(pci, state)); 1495 return 0; 1496 } 1497 1498 static int snd_atiixp_resume(struct pci_dev *pci) 1499 { 1500 struct snd_card *card = pci_get_drvdata(pci); 1480 return 0; 1481 } 1482 1483 static int snd_atiixp_resume(struct device *dev) 1484 { 1485 struct snd_card *card = dev_get_drvdata(dev); 1501 1486 struct atiixp *chip = card->private_data; 1502 1487 int i; 1503 1504 pci_set_power_state(pci, PCI_D0);1505 pci_restore_state(pci);1506 if (pci_enable_device(pci) < 0) {1507 printk(KERN_ERR "atiixp: pci_enable_device failed, "1508 "disabling device\n");1509 snd_card_disconnect(card);1510 return -EIO;1511 }1512 pci_set_master(pci);1513 1488 1514 1489 snd_atiixp_aclink_reset(chip); … … 1526 1501 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, 1527 1502 chip->remap_addr + dma->ops->llp_offset); 1528 writel(dma->saved_curptr, chip->remap_addr +1529 dma->ops->dt_cur);1530 1503 } 1531 1504 } … … 1534 1507 return 0; 1535 1508 } 1536 #endif /* CONFIG_PM */ 1537 1538 1539 #ifdef CONFIG_PROC_FS 1509 1510 static SIMPLE_DEV_PM_OPS(snd_atiixp_pm, snd_atiixp_suspend, snd_atiixp_resume); 1511 #define SND_ATIIXP_PM_OPS &snd_atiixp_pm 1512 #else 1513 #define SND_ATIIXP_PM_OPS NULL 1514 #endif /* CONFIG_PM_SLEEP */ 1515 1516 1540 1517 /* 1541 1518 * proc interface for register dump … … 1552 1529 } 1553 1530 1554 static void __devinit snd_atiixp_proc_init(struct atiixp *chip) 1555 { 1556 struct snd_info_entry *entry; 1557 1558 if (! snd_card_proc_new(chip->card, "atiixp", &entry)) 1559 snd_info_set_text_ops(entry, chip, snd_atiixp_proc_read); 1560 } 1561 #else /* !CONFIG_PROC_FS */ 1562 #define snd_atiixp_proc_init(chip) 1563 #endif 1531 static void snd_atiixp_proc_init(struct atiixp *chip) 1532 { 1533 snd_card_ro_proc_new(chip->card, "atiixp", chip, snd_atiixp_proc_read); 1534 } 1564 1535 1565 1536 … … 1577 1548 if (chip->irq >= 0) 1578 1549 free_irq(chip->irq, chip); 1579 if (chip->remap_addr) 1580 iounmap(chip->remap_addr); 1550 iounmap(chip->remap_addr); 1581 1551 pci_release_regions(chip->pci); 1582 1552 pci_disable_device(chip->pci); … … 1594 1564 * constructor for chip instance 1595 1565 */ 1596 static int __devinitsnd_atiixp_create(struct snd_card *card,1597 1598 1599 { 1600 static struct snd_device_ops ops = {1566 static int snd_atiixp_create(struct snd_card *card, 1567 struct pci_dev *pci, 1568 struct atiixp **r_chip) 1569 { 1570 static const struct snd_device_ops ops = { 1601 1571 .dev_free = snd_atiixp_dev_free, 1602 1572 }; … … 1626 1596 chip->remap_addr = pci_ioremap_bar(pci, 0); 1627 1597 if (chip->remap_addr == NULL) { 1628 snd_printk(KERN_ERR"AC'97 space ioremap problem\n");1598 dev_err(card->dev, "AC'97 space ioremap problem\n"); 1629 1599 snd_atiixp_free(chip); 1630 1600 return -EIO; … … 1632 1602 1633 1603 if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED, 1634 card->shortname, chip)) {1635 snd_printk(KERN_ERR"unable to grab IRQ %d\n", pci->irq);1604 KBUILD_MODNAME, chip)) { 1605 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); 1636 1606 snd_atiixp_free(chip); 1637 1607 return -EBUSY; 1638 1608 } 1639 1609 chip->irq = pci->irq; 1610 card->sync_irq = chip->irq; 1640 1611 pci_set_master(pci); 1641 synchronize_irq(chip->irq);1642 1612 1643 1613 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { … … 1646 1616 } 1647 1617 1648 snd_card_set_dev(card, &pci->dev);1649 1650 1618 *r_chip = chip; 1651 1619 return 0; … … 1653 1621 1654 1622 1655 static int __devinitsnd_atiixp_probe(struct pci_dev *pci,1656 1623 static int snd_atiixp_probe(struct pci_dev *pci, 1624 const struct pci_device_id *pci_id) 1657 1625 { 1658 1626 struct snd_card *card; … … 1660 1628 int err; 1661 1629 1662 err = snd_card_ create(index, id, THIS_MODULE, 0, &card);1630 err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card); 1663 1631 if (err < 0) 1664 1632 return err; … … 1706 1674 } 1707 1675 1708 static void __devexitsnd_atiixp_remove(struct pci_dev *pci)1676 static void snd_atiixp_remove(struct pci_dev *pci) 1709 1677 { 1710 1678 snd_card_free(pci_get_drvdata(pci)); 1711 pci_set_drvdata(pci, NULL); 1712 } 1713 1714 static struct pci_driver driver = { 1715 .name = "ATI IXP AC97 controller", 1679 } 1680 1681 static struct pci_driver atiixp_driver = { 1682 .name = KBUILD_MODNAME, 1716 1683 .id_table = snd_atiixp_ids, 1717 1684 .probe = snd_atiixp_probe, 1718 .remove = __devexit_p(snd_atiixp_remove), 1719 #ifdef CONFIG_PM 1720 .suspend = snd_atiixp_suspend, 1721 .resume = snd_atiixp_resume, 1722 #endif 1685 .remove = snd_atiixp_remove, 1686 .driver = { 1687 .pm = SND_ATIIXP_PM_OPS, 1688 }, 1723 1689 }; 1724 1690 1725 1726 static int __init alsa_card_atiixp_init(void) 1727 { 1728 return pci_register_driver(&driver); 1729 } 1730 1731 static void __exit alsa_card_atiixp_exit(void) 1732 { 1733 pci_unregister_driver(&driver); 1734 } 1735 1736 module_init(alsa_card_atiixp_init) 1737 module_exit(alsa_card_atiixp_exit) 1691 module_pci_driver(atiixp_driver);
Note:
See TracChangeset
for help on using the changeset viewer.