- Timestamp:
- May 16, 2020, 10:05:07 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-linux-3.2.102/alsa-kernel/pci/intel8x0.c
r598 r612 25 25 26 26 * 27 */ 27 */ 28 29 #ifdef TARGET_OS2 30 #define KBUILD_MODNAME "intel8x0" 31 #endif 28 32 29 33 #include <asm/io.h> … … 33 37 #include <linux/pci.h> 34 38 #include <linux/slab.h> 35 #include <linux/module param.h>39 #include <linux/module.h> 36 40 #include <sound/core.h> 37 41 #include <sound/pcm.h> … … 42 46 #include <asm/pgtable.h> 43 47 #include <asm/cacheflush.h> 48 49 #ifdef CONFIG_KVM_GUEST 50 #include <linux/kvm_para.h> 51 #else 52 #define kvm_para_available() (0) 53 #endif 44 54 45 55 MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); … … 78 88 static int xbox; 79 89 static int spdif_aclink = -1; 90 static int inside_vm = -1; 80 91 81 92 module_param(index, int, 0444); … … 95 106 module_param(spdif_aclink, int, 0444); 96 107 MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link."); 108 module_param(inside_vm, bool, 0444); 109 MODULE_PARM_DESC(inside_vm, "KVM/Parallels optimization."); 97 110 98 111 /* just for backward compatibility */ … … 269 282 270 283 /* interrupts for the whole chip by interrupt status register finish */ 271 284 272 285 #define ALI_INT_MICIN2 (1<<26) 273 286 #define ALI_INT_PCMIN2 (1<<25) … … 313 326 314 327 /* 315 * 328 * 316 329 */ 317 330 … … 401 414 unsigned xbox: 1; /* workaround for Xbox AC'97 detection */ 402 415 unsigned buggy_semaphore: 1; /* workaround for buggy codec semaphore */ 416 unsigned inside_vm: 1; /* enable VM optimization */ 403 417 404 418 int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */ … … 535 549 } while (time--); 536 550 537 /* access to some forbidden (non exist ant) ac97 registers will not551 /* access to some forbidden (non existent) ac97 registers will not 538 552 * reset the semaphore. So even if you don't get the semaphore, still 539 553 * continue the access. We don't need the semaphore anyway. */ … … 544 558 return -EBUSY; 545 559 } 546 560 547 561 static void snd_intel8x0_codec_write(struct snd_ac97 *ac97, 548 562 unsigned short reg, … … 662 676 * DMA I/O 663 677 */ 664 static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ichdev) 678 static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ichdev) 665 679 { 666 680 int idx; … … 886 900 /* clear FIFO for synchronization of channels */ 887 901 fifo = igetdword(chip, fiforeg[ichdev->ali_slot / 4]); 888 fifo &= ~(0xff << (ichdev->ali_slot % 4)); 889 fifo |= 0x83 << (ichdev->ali_slot % 4); 902 fifo &= ~(0xff << (ichdev->ali_slot % 4)); 903 fifo |= 0x83 << (ichdev->ali_slot % 4); 890 904 iputdword(chip, fiforeg[ichdev->ali_slot / 4], fifo); 891 905 } … … 1066 1080 continue; 1067 1081 } 1068 if (civ == igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV) && 1069 ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) 1082 if (civ != igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV)) 1083 continue; 1084 1085 /* IO read operation is very expensive inside virtual machine 1086 * as it is emulated. The probability that subsequent PICB read 1087 * will return different result is high enough to loop till 1088 * timeout here. 1089 * Same CIV is strict enough condition to be sure that PICB 1090 * is valid inside VM on emulated card. */ 1091 if (chip->inside_vm) 1092 break; 1093 if (ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) 1070 1094 break; 1071 1095 } while (timeout--); … … 1684 1708 { 1685 1709 .exclusive = 1, 1686 .r = 1687 { 1688 { 1710 .r = { { 1689 1711 .slots = (1 << AC97_SLOT_PCM_LEFT) | 1690 1712 (1 << AC97_SLOT_PCM_RIGHT) | … … 1753 1775 1754 1776 static struct ac97_quirk ac97_quirks[] __devinitdata = { 1755 {1777 { 1756 1778 .subvendor = 0x0e11, 1757 1779 .subdevice = 0x000e, 1758 1780 .name = "Compaq Deskpro EN", /* AD1885 */ 1759 1781 .type = AC97_TUNE_HP_ONLY 1760 },1782 }, 1761 1783 { 1762 1784 .subvendor = 0x0e11, … … 1770 1792 .name = "Compaq Evo D510C", 1771 1793 .type = AC97_TUNE_HP_ONLY 1772 1773 1794 }, 1795 { 1774 1796 .subvendor = 0x0e11, 1775 1797 .subdevice = 0x0860, 1776 1798 .name = "HP/Compaq nx7010", 1777 1799 .type = AC97_TUNE_MUTE_LED 1778 },1800 }, 1779 1801 { 1780 1802 .subvendor = 0x1014, … … 1884 1906 .name = "Dell Inspiron 6000", 1885 1907 .type = AC97_TUNE_HP_MUTE_LED /* cf. Malone #41015 */ 1908 }, 1909 { 1910 .subvendor = 0x1028, 1911 .subdevice = 0x0189, 1912 .name = "Dell Inspiron 9300", 1913 .type = AC97_TUNE_HP_MUTE_LED 1886 1914 }, 1887 1915 { … … 2076 2104 .name = "MSI P4 ATX 645 Ultra", 2077 2105 .type = AC97_TUNE_HP_ONLY 2106 }, 2107 { 2108 .subvendor = 0x161f, 2109 .subdevice = 0x202f, 2110 .name = "Gateway M520", 2111 .type = AC97_TUNE_INV_EAPD 2078 2112 }, 2079 2113 { … … 2658 2692 snd_intel8x0_chip_init(chip, 0); 2659 2693 if (request_irq(pci->irq, snd_intel8x0_interrupt, 2660 IRQF_SHARED, card->shortname, chip)) {2694 IRQF_SHARED, KBUILD_MODNAME, chip)) { 2661 2695 printk(KERN_ERR "intel8x0: unable to grab IRQ %d, " 2662 2696 "disabling device\n", pci->irq); … … 2810 2844 t *= 1000000; 2811 2845 t += (stop_time.tv_nsec - start_time.tv_nsec) / 1000; 2812 dprintf(("%s: measured %lu usecs (%lu samples)\n", __func__, t, pos));2846 printk(KERN_INFO "%s: measured %lu usecs (%lu samples)\n", __func__, t, pos); 2813 2847 if (t == 0) { 2814 2848 snd_printk(KERN_ERR "intel8x0: ?? calculation error..\n"); … … 2831 2865 chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos; 2832 2866 __end: 2833 dprintf(("intel8x0: clocking to %d\n", chip->ac97_bus->clock));2867 printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97_bus->clock); 2834 2868 snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0); 2835 2869 } … … 2837 2871 static struct snd_pci_quirk intel8x0_clock_list[] __devinitdata = { 2838 2872 SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000), 2873 SND_PCI_QUIRK(0x1014, 0x0581, "AD1981B", 48000), 2839 2874 SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100), 2840 2875 SND_PCI_QUIRK(0x1028, 0x0177, "AD1980", 48000), … … 2921 2956 ICH_PCR, ICH_SCR, ICH_SIS_TCR 2922 2957 }; 2958 2959 static int __devinit snd_intel8x0_inside_vm(struct pci_dev *pci) 2960 { 2961 int result = inside_vm; 2962 char *msg = NULL; 2963 2964 /* check module parameter first (override detection) */ 2965 if (result >= 0) { 2966 msg = result ? "enable (forced) VM" : "disable (forced) VM"; 2967 goto fini; 2968 } 2969 2970 /* detect KVM and Parallels virtual environments */ 2971 result = kvm_para_available(); 2972 #ifdef X86_FEATURE_HYPERVISOR 2973 result = result || boot_cpu_has(X86_FEATURE_HYPERVISOR); 2974 #endif 2975 if (!result) 2976 goto fini; 2977 2978 /* check for known (emulated) devices */ 2979 if (pci->subsystem_vendor == 0x1af4 && 2980 pci->subsystem_device == 0x1100) { 2981 /* KVM emulated sound, PCI SSID: 1af4:1100 */ 2982 msg = "enable KVM"; 2983 } else if (pci->subsystem_vendor == 0x1ab8) { 2984 /* Parallels VM emulated sound, PCI SSID: 1ab8:xxxx */ 2985 msg = "enable Parallels VM"; 2986 } else { 2987 msg = "disable (unknown or VT-d) VM"; 2988 result = 0; 2989 } 2990 2991 fini: 2992 if (msg != NULL) 2993 printk(KERN_INFO "intel8x0: %s optimization\n", msg); 2994 2995 return result; 2996 } 2923 2997 2924 2998 static int __devinit snd_intel8x0_create(struct snd_card *card, … … 2989 3063 chip->xbox = 1; 2990 3064 3065 chip->inside_vm = snd_intel8x0_inside_vm(pci); 3066 2991 3067 if (pci->vendor == PCI_VENDOR_ID_INTEL && 2992 3068 pci->device == PCI_DEVICE_ID_INTEL_440MX) … … 3117 3193 /* request irq after initializaing int_sta_mask, etc */ 3118 3194 if (request_irq(pci->irq, snd_intel8x0_interrupt, 3119 IRQF_SHARED, card->shortname, chip)) {3195 IRQF_SHARED, KBUILD_MODNAME, chip)) { 3120 3196 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 3121 3197 snd_intel8x0_free(chip); … … 3281 3357 3282 3358 static struct pci_driver driver = { 3283 .name = "Intel ICH",3359 .name = KBUILD_MODNAME, 3284 3360 .id_table = snd_intel8x0_ids, 3285 3361 .probe = snd_intel8x0_probe,
Note:
See TracChangeset
for help on using the changeset viewer.