Changeset 679 for GPL/trunk/alsa-kernel/pci/emu10k1/emu10k1x.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/emu10k1/emu10k1x.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Francisco Moraes <fmoraes@nc.rr.com> … … 14 15 * - EMU10K1X-DBQ 15 16 * - STAC 9708T 16 *17 * This program is free software; you can redistribute it and/or modify18 * it under the terms of the GNU General Public License as published by19 * the Free Software Foundation; either version 2 of the License, or20 * (at your option) any later version.21 *22 * This program is distributed in the hope that it will be useful,23 * but WITHOUT ANY WARRANTY; without even the implied warranty of24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the25 * GNU General Public License for more details.26 *27 * You should have received a copy of the GNU General Public License28 * along with this program; if not, write to the Free Software29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA30 *31 17 */ 18 #ifdef TARGET_OS2 19 #define KBUILD_MODNAME "emu10k1" 20 #endif 32 21 #include <linux/init.h> 33 22 #include <linux/interrupt.h> … … 35 24 #include <linux/dma-mapping.h> 36 25 #include <linux/slab.h> 37 #include <linux/module param.h>26 #include <linux/module.h> 38 27 #include <sound/core.h> 39 28 #include <sound/initval.h> … … 51 40 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 52 41 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 53 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;42 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 54 43 55 44 module_param_array(index, int, NULL, 0444); … … 108 97 /********************************************************************************************************/ 109 98 #define PLAYBACK_LIST_ADDR 0x00 /* Base DMA address of a list of pointers to each period/size */ 110 /* One list entry: 4 bytes for DMA address, 99 /* One list entry: 4 bytes for DMA address, 111 100 * 4 bytes for period_size << 16. 112 101 * One list entry is 8 bytes long. … … 181 170 /* From 0x50 - 0x5f, last samples captured */ 182 171 183 /* *172 /* 184 173 * The hardware has 3 channels for playback and 1 for capture. 185 174 * - channel 0 is the front channel … … 187 176 * - channel 2 is the center/lfe channel 188 177 * Volume is controlled by the AC97 for the front and rear channels by 189 * the PCM Playback Volume, Sigmatel Surround Playback Volume and 178 * the PCM Playback Volume, Sigmatel Surround Playback Volume and 190 179 * Surround Playback Volume. The Sigmatel 4-Speaker Stereo switch affects 191 180 * the front/rear channel mixing in the REAR OUT jack. When using the … … 200 189 int number; 201 190 int use; 202 191 203 192 struct emu10k1x_pcm *epcm; 204 193 }; … … 255 244 256 245 /* hardware definition */ 257 static struct snd_pcm_hardware snd_emu10k1x_playback_hw = {258 .info = (SNDRV_PCM_INFO_MMAP | 246 static const struct snd_pcm_hardware snd_emu10k1x_playback_hw = { 247 .info = (SNDRV_PCM_INFO_MMAP | 259 248 SNDRV_PCM_INFO_INTERLEAVED | 260 249 SNDRV_PCM_INFO_BLOCK_TRANSFER | … … 274 263 }; 275 264 276 static struct snd_pcm_hardware snd_emu10k1x_capture_hw = {277 .info = (SNDRV_PCM_INFO_MMAP | 265 static const struct snd_pcm_hardware snd_emu10k1x_capture_hw = { 266 .info = (SNDRV_PCM_INFO_MMAP | 278 267 SNDRV_PCM_INFO_INTERLEAVED | 279 268 SNDRV_PCM_INFO_BLOCK_TRANSFER | … … 293 282 }; 294 283 295 static unsigned int snd_emu10k1x_ptr_read(struct emu10k1x * emu, 296 unsigned int reg, 284 static unsigned int snd_emu10k1x_ptr_read(struct emu10k1x * emu, 285 unsigned int reg, 297 286 unsigned int chn) 298 287 { 299 288 unsigned long flags; 300 289 unsigned int regptr, val; 301 290 302 291 regptr = (reg << 16) | chn; 303 292 … … 370 359 return; 371 360 #if 0 372 snd_printk(KERN_INFO "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n", 361 dev_info(emu->card->dev, 362 "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n", 373 363 epcm->substream->ops->pointer(epcm->substream), 374 364 snd_pcm_lib_period_bytes(epcm->substream), … … 397 387 epcm->emu = chip; 398 388 epcm->substream = substream; 399 389 400 390 runtime->private_data = epcm; 401 391 runtime->private_free = snd_emu10k1x_pcm_free_substream; 402 392 403 393 runtime->hw = snd_emu10k1x_playback_hw; 404 394 … … 425 415 } 426 416 427 return snd_pcm_lib_malloc_pages(substream, 428 params_buffer_bytes(hw_params)); 417 return 0; 429 418 } 430 419 … … 446 435 } 447 436 448 return snd_pcm_lib_free_pages(substream);437 return 0; 449 438 } 450 439 … … 488 477 int result = 0; 489 478 490 // snd_printk(KERN_INFO "trigger - emu10k1x = 0x%x, cmd = %i, pointer = %d\n", (int)emu, cmd, (int)substream->ops->pointer(substream)); 479 /* 480 dev_dbg(emu->card->dev, 481 "trigger - emu10k1x = 0x%x, cmd = %i, pointer = %d\n", 482 (int)emu, cmd, (int)substream->ops->pointer(substream)); 483 */ 491 484 492 485 switch (cmd) { … … 531 524 return 0; 532 525 533 if (ptr3 != ptr4) 526 if (ptr3 != ptr4) 534 527 ptr1 = snd_emu10k1x_ptr_read(emu, PLAYBACK_POINTER, channel); 535 528 ptr2 = bytes_to_frames(runtime, ptr1); … … 544 537 545 538 /* operators */ 546 static struct snd_pcm_ops snd_emu10k1x_playback_ops = {539 static const struct snd_pcm_ops snd_emu10k1x_playback_ops = { 547 540 .open = snd_emu10k1x_playback_open, 548 541 .close = snd_emu10k1x_playback_close, 549 .ioctl = snd_pcm_lib_ioctl,550 542 .hw_params = snd_emu10k1x_pcm_hw_params, 551 543 .hw_free = snd_emu10k1x_pcm_hw_free, … … 604 596 } 605 597 606 return snd_pcm_lib_malloc_pages(substream, 607 params_buffer_bytes(hw_params)); 598 return 0; 608 599 } 609 600 … … 625 616 } 626 617 627 return snd_pcm_lib_free_pages(substream);618 return 0; 628 619 } 629 620 … … 653 644 switch (cmd) { 654 645 case SNDRV_PCM_TRIGGER_START: 655 snd_emu10k1x_intr_enable(emu, INTE_CAP_0_LOOP | 646 snd_emu10k1x_intr_enable(emu, INTE_CAP_0_LOOP | 656 647 INTE_CAP_0_HALF_LOOP); 657 648 snd_emu10k1x_ptr_write(emu, TRIGGER_CHANNEL, 0, snd_emu10k1x_ptr_read(emu, TRIGGER_CHANNEL, 0)|TRIGGER_CAPTURE); … … 660 651 case SNDRV_PCM_TRIGGER_STOP: 661 652 epcm->running = 0; 662 snd_emu10k1x_intr_disable(emu, INTE_CAP_0_LOOP | 653 snd_emu10k1x_intr_disable(emu, INTE_CAP_0_LOOP | 663 654 INTE_CAP_0_HALF_LOOP); 664 655 snd_emu10k1x_ptr_write(emu, TRIGGER_CHANNEL, 0, snd_emu10k1x_ptr_read(emu, TRIGGER_CHANNEL, 0) & ~(TRIGGER_CAPTURE)); … … 690 681 } 691 682 692 static struct snd_pcm_ops snd_emu10k1x_capture_ops = {683 static const struct snd_pcm_ops snd_emu10k1x_capture_ops = { 693 684 .open = snd_emu10k1x_pcm_open_capture, 694 685 .close = snd_emu10k1x_pcm_close_capture, 695 .ioctl = snd_pcm_lib_ioctl,696 686 .hw_params = snd_emu10k1x_pcm_hw_params_capture, 697 687 .hw_free = snd_emu10k1x_pcm_hw_free_capture, … … 707 697 unsigned long flags; 708 698 unsigned short val; 709 699 710 700 spin_lock_irqsave(&emu->emu_lock, flags); 711 701 outb(reg, emu->port + AC97ADDRESS); … … 720 710 struct emu10k1x *emu = ac97->private_data; 721 711 unsigned long flags; 722 712 723 713 spin_lock_irqsave(&emu->emu_lock, flags); 724 714 outb(reg, emu->port + AC97ADDRESS); … … 732 722 struct snd_ac97_template ac97; 733 723 int err; 734 static struct snd_ac97_bus_ops ops = {724 static const struct snd_ac97_bus_ops ops = { 735 725 .write = snd_emu10k1x_ac97_write, 736 726 .read = snd_emu10k1x_ac97_read, 737 727 }; 738 728 739 729 if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus)) < 0) 740 730 return err; … … 799 789 if (cap_voice->use) 800 790 snd_emu10k1x_pcm_interrupt(chip, cap_voice); 801 else 802 snd_emu10k1x_intr_disable(chip, 791 else 792 snd_emu10k1x_intr_disable(chip, 803 793 INTE_CAP_0_LOOP | 804 794 INTE_CAP_0_HALF_LOOP); … … 827 817 outl(status, chip->port + IPR); 828 818 829 / / snd_printk(KERN_INFO "interrupt %08x\n", status);819 /* dev_dbg(chip->card->dev, "interrupt %08x\n", status); */ 830 820 return IRQ_HANDLED; 831 821 } 832 822 833 static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **rpcm) 823 static const struct snd_pcm_chmap_elem surround_map[] = { 824 { .channels = 2, 825 .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, 826 {0} 827 }; 828 829 static const struct snd_pcm_chmap_elem clfe_map[] = { 830 { .channels = 2, 831 .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, 832 {0} 833 }; 834 835 static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device) 834 836 { 835 837 struct snd_pcm *pcm; 838 const struct snd_pcm_chmap_elem *map = NULL; 836 839 int err; 837 840 int capture = 0; 838 839 if (rpcm) 840 *rpcm = NULL; 841 841 842 if (device == 0) 842 843 capture = 1; … … 844 845 if ((err = snd_pcm_new(emu->card, "emu10k1x", device, 1, capture, &pcm)) < 0) 845 846 return err; 846 847 847 848 pcm->private_data = emu; 848 849 … … 862 863 case 0: 863 864 strcpy(pcm->name, "EMU10K1X Front"); 865 map = snd_pcm_std_chmaps; 864 866 break; 865 867 case 1: 866 868 strcpy(pcm->name, "EMU10K1X Rear"); 869 map = surround_map; 867 870 break; 868 871 case 2: 869 872 strcpy(pcm->name, "EMU10K1X Center/LFE"); 873 map = clfe_map; 870 874 break; 871 875 } 872 876 emu->pcm = pcm; 873 877 874 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 875 snd_dma_pci_data(emu->pci), 876 32*1024, 32*1024); 877 878 if (rpcm) 879 *rpcm = pcm; 880 881 return 0; 882 } 883 884 static int __devinit snd_emu10k1x_create(struct snd_card *card, 885 struct pci_dev *pci, 886 struct emu10k1x **rchip) 878 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, 879 &emu->pci->dev, 32*1024, 32*1024); 880 881 return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, 882 1 << 2, NULL); 883 } 884 885 static int snd_emu10k1x_create(struct snd_card *card, 886 struct pci_dev *pci, 887 struct emu10k1x **rchip) 887 888 { 888 889 struct emu10k1x *chip; 889 890 int err; 890 891 int ch; 891 static struct snd_device_ops ops = {892 static const struct snd_device_ops ops = { 892 893 .dev_free = snd_emu10k1x_dev_free, 893 894 }; … … 899 900 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 900 901 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 901 snd_printk(KERN_ERR"error to set 28bit mask DMA\n");902 dev_err(card->dev, "error to set 28bit mask DMA\n"); 902 903 pci_disable_device(pci); 903 904 return -ENXIO; … … 916 917 spin_lock_init(&chip->emu_lock); 917 918 spin_lock_init(&chip->voice_lock); 918 919 919 920 chip->port = pci_resource_start(pci, 0); 920 921 if ((chip->res_port = request_region(chip->port, 8, 921 "EMU10K1X")) == NULL) { 922 snd_printk(KERN_ERR "emu10k1x: cannot allocate the port 0x%lx\n", chip->port); 922 "EMU10K1X")) == NULL) { 923 dev_err(card->dev, "cannot allocate the port 0x%lx\n", 924 chip->port); 923 925 snd_emu10k1x_free(chip); 924 926 return -EBUSY; … … 926 928 927 929 if (request_irq(pci->irq, snd_emu10k1x_interrupt, 928 IRQF_SHARED, "EMU10K1X", chip)) {929 snd_printk(KERN_ERR "emu10k1x:cannot grab irq %d\n", pci->irq);930 IRQF_SHARED, KBUILD_MODNAME, chip)) { 931 dev_err(card->dev, "cannot grab irq %d\n", pci->irq); 930 932 snd_emu10k1x_free(chip); 931 933 return -EBUSY; 932 934 } 933 935 chip->irq = pci->irq; 934 935 if(snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 936 4 * 1024, &chip->dma_buffer) < 0) { 936 card->sync_irq = chip->irq; 937 938 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, 939 4 * 1024, &chip->dma_buffer) < 0) { 937 940 snd_emu10k1x_free(chip); 938 941 return -ENOMEM; … … 948 951 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); 949 952 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); 950 snd_printk(KERN_INFO"Model %04x Rev %08x Serial %08x\n", chip->model,953 dev_info(card->dev, "Model %04x Rev %08x Serial %08x\n", chip->model, 951 954 chip->revision, chip->serial); 952 955 … … 973 976 */ 974 977 snd_emu10k1x_ptr_write(chip, SPCS0, 0, 975 chip->spdif_bits[0] = 978 chip->spdif_bits[0] = 976 979 SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | 977 980 SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | … … 979 982 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT); 980 983 snd_emu10k1x_ptr_write(chip, SPCS1, 0, 981 chip->spdif_bits[1] = 984 chip->spdif_bits[1] = 982 985 SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | 983 986 SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | … … 985 988 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT); 986 989 snd_emu10k1x_ptr_write(chip, SPCS2, 0, 987 chip->spdif_bits[2] = 990 chip->spdif_bits[2] = 988 991 SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | 989 992 SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | … … 1006 1009 } 1007 1010 1008 static void snd_emu10k1x_proc_reg_read(struct snd_info_entry *entry, 1011 static void snd_emu10k1x_proc_reg_read(struct snd_info_entry *entry, 1009 1012 struct snd_info_buffer *buffer) 1010 1013 { … … 1034 1037 } 1035 1038 1036 static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry, 1039 static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry, 1037 1040 struct snd_info_buffer *buffer) 1038 1041 { … … 1045 1048 continue; 1046 1049 1047 if (reg < 0x49 && /* val <= 0xffffffff && DAZ */channel_id <= 2)1050 if (reg < 0x49 && channel_id <= 2) 1048 1051 snd_emu10k1x_ptr_write(emu, reg, channel_id, val); 1049 1052 } 1050 1053 } 1051 1054 1052 static int __devinit snd_emu10k1x_proc_init(struct emu10k1x * emu) 1053 { 1054 struct snd_info_entry *entry; 1055 1056 if(! snd_card_proc_new(emu->card, "emu10k1x_regs", &entry)) { 1057 snd_info_set_text_ops(entry, emu, snd_emu10k1x_proc_reg_read); 1058 entry->c.text.write = snd_emu10k1x_proc_reg_write; 1059 entry->mode |= S_IWUSR; 1060 entry->private_data = emu; 1061 } 1062 1055 static int snd_emu10k1x_proc_init(struct emu10k1x *emu) 1056 { 1057 snd_card_rw_proc_new(emu->card, "emu10k1x_regs", emu, 1058 snd_emu10k1x_proc_reg_read, 1059 snd_emu10k1x_proc_reg_write); 1063 1060 return 0; 1064 1061 } … … 1081 1078 struct emu10k1x *emu = snd_kcontrol_chip(kcontrol); 1082 1079 unsigned int val; 1083 int change = 0;1084 1080 1085 1081 val = ucontrol->value.integer.value[0] ; … … 1096 1092 snd_emu10k1x_gpio_write(emu, 0x1080); 1097 1093 } 1098 return change;1099 } 1100 1101 static struct snd_kcontrol_new snd_emu10k1x_shared_spdif __devinitdata=1094 return 0; 1095 } 1096 1097 static const struct snd_kcontrol_new snd_emu10k1x_shared_spdif = 1102 1098 { 1103 1099 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 1158 1154 } 1159 1155 1160 static struct snd_kcontrol_new snd_emu10k1x_spdif_mask_control =1156 static const struct snd_kcontrol_new snd_emu10k1x_spdif_mask_control = 1161 1157 { 1162 1158 .access = SNDRV_CTL_ELEM_ACCESS_READ, … … 1168 1164 }; 1169 1165 1170 static struct snd_kcontrol_new snd_emu10k1x_spdif_control =1166 static const struct snd_kcontrol_new snd_emu10k1x_spdif_control = 1171 1167 { 1172 1168 .iface = SNDRV_CTL_ELEM_IFACE_PCM, … … 1178 1174 }; 1179 1175 1180 static int __devinitsnd_emu10k1x_mixer(struct emu10k1x *emu)1176 static int snd_emu10k1x_mixer(struct emu10k1x *emu) 1181 1177 { 1182 1178 int err; … … 1232 1228 #ifdef CONFIG_SND_DEBUG 1233 1229 if (timeout <= 0) 1234 snd_printk(KERN_ERR "cmd: clear rx timeout (status = 0x%x)\n", mpu401_read_stat(emu, mpu)); 1230 dev_err(emu->card->dev, 1231 "cmd: clear rx timeout (status = 0x%x)\n", 1232 mpu401_read_stat(emu, mpu)); 1235 1233 #endif 1236 1234 } … … 1306 1304 spin_unlock_irqrestore(&midi->input_lock, flags); 1307 1305 if (!ok) { 1308 snd_printk(KERN_ERR "midi_cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)!!!\n", 1306 dev_err(emu->card->dev, 1307 "midi_cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)!!!\n", 1309 1308 cmd, emu->port, 1310 1309 mpu401_read_stat(emu, midi), … … 1470 1469 */ 1471 1470 1472 static struct snd_rawmidi_ops snd_emu10k1x_midi_output =1471 static const struct snd_rawmidi_ops snd_emu10k1x_midi_output = 1473 1472 { 1474 1473 .open = snd_emu10k1x_midi_output_open, … … 1477 1476 }; 1478 1477 1479 static struct snd_rawmidi_ops snd_emu10k1x_midi_input =1478 static const struct snd_rawmidi_ops snd_emu10k1x_midi_input = 1480 1479 { 1481 1480 .open = snd_emu10k1x_midi_input_open, … … 1491 1490 } 1492 1491 1493 static int __devinit emu10k1x_midi_init(struct emu10k1x *emu, 1494 struct emu10k1x_midi *midi, int device, char *name) 1492 static int emu10k1x_midi_init(struct emu10k1x *emu, 1493 struct emu10k1x_midi *midi, int device, 1494 char *name) 1495 1495 { 1496 1496 struct snd_rawmidi *rmidi; … … 1515 1515 } 1516 1516 1517 static int __devinitsnd_emu10k1x_midi(struct emu10k1x *emu)1517 static int snd_emu10k1x_midi(struct emu10k1x *emu) 1518 1518 { 1519 1519 struct emu10k1x_midi *midi = &emu->midi; … … 1532 1532 } 1533 1533 1534 static int __devinitsnd_emu10k1x_probe(struct pci_dev *pci,1535 1534 static int snd_emu10k1x_probe(struct pci_dev *pci, 1535 const struct pci_device_id *pci_id) 1536 1536 { 1537 1537 static int dev; … … 1547 1547 } 1548 1548 1549 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); 1549 err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, 1550 0, &card); 1550 1551 if (err < 0) 1551 1552 return err; … … 1556 1557 } 1557 1558 1558 if ((err = snd_emu10k1x_pcm(chip, 0 , NULL)) < 0) {1559 if ((err = snd_emu10k1x_pcm(chip, 0)) < 0) { 1559 1560 snd_card_free(card); 1560 1561 return err; 1561 1562 } 1562 if ((err = snd_emu10k1x_pcm(chip, 1 , NULL)) < 0) {1563 if ((err = snd_emu10k1x_pcm(chip, 1)) < 0) { 1563 1564 snd_card_free(card); 1564 1565 return err; 1565 1566 } 1566 if ((err = snd_emu10k1x_pcm(chip, 2 , NULL)) < 0) {1567 if ((err = snd_emu10k1x_pcm(chip, 2)) < 0) { 1567 1568 snd_card_free(card); 1568 1569 return err; … … 1591 1592 card->shortname, chip->port, chip->irq); 1592 1593 1593 snd_card_set_dev(card, &pci->dev);1594 1595 1594 if ((err = snd_card_register(card)) < 0) { 1596 1595 snd_card_free(card); … … 1603 1602 } 1604 1603 1605 static void __devexitsnd_emu10k1x_remove(struct pci_dev *pci)1604 static void snd_emu10k1x_remove(struct pci_dev *pci) 1606 1605 { 1607 1606 snd_card_free(pci_get_drvdata(pci)); 1608 pci_set_drvdata(pci, NULL);1609 1607 } 1610 1608 1611 1609 // PCI IDs 1612 static DEFINE_PCI_DEVICE_TABLE(snd_emu10k1x_ids)= {1610 static const struct pci_device_id snd_emu10k1x_ids[] = { 1613 1611 { PCI_VDEVICE(CREATIVE, 0x0006), 0 }, /* Dell OEM version (EMU10K1) */ 1614 1612 { 0, } … … 1617 1615 1618 1616 // pci_driver definition 1619 static struct pci_driver driver = {1620 .name = "EMU10K1X",1617 static struct pci_driver emu10k1x_driver = { 1618 .name = KBUILD_MODNAME, 1621 1619 .id_table = snd_emu10k1x_ids, 1622 1620 .probe = snd_emu10k1x_probe, 1623 .remove = __devexit_p(snd_emu10k1x_remove),1621 .remove = snd_emu10k1x_remove, 1624 1622 }; 1625 1623 1626 // initialization of the module 1627 static int __init alsa_card_emu10k1x_init(void) 1628 { 1629 return pci_register_driver(&driver); 1630 } 1631 1632 // clean up the module 1633 static void __exit alsa_card_emu10k1x_exit(void) 1634 { 1635 pci_unregister_driver(&driver); 1636 } 1637 1638 module_init(alsa_card_emu10k1x_init) 1639 module_exit(alsa_card_emu10k1x_exit) 1624 module_pci_driver(emu10k1x_driver);
Note:
See TracChangeset
for help on using the changeset viewer.