Changeset 58443 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Oct 28, 2015 1:32:20 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r58413 r58443 166 166 AC97_6Ch_Vol_L_R_Surround_Mute = 0x38, 167 167 AC97_Vendor_Reserved = 0x58, 168 AC97_AD_Misc = 0x76, 168 169 AC97_Vendor_ID1 = 0x7c, 169 170 AC97_Vendor_ID2 = 0x7e 170 171 }; 171 172 173 /* Codec models. */ 174 enum { 175 Codec_STAC9700 = 0, /* SigmaTel STAC9700 */ 176 Codec_AD1980, /* Analog Devices AD1980 */ 177 Codec_AD1981B /* Analog Devices AD1981B */ 178 }; 179 180 /* Analog Devices miscellaneous regiter bits used in AD1980. */ 181 #define AD_MISC_LOSEL RT_BIT(5) /* Surround (rear) goes to line out outputs. */ 182 #define AD_MISC_HPSEL RT_BIT(10) /* PCM (front) goes to headphone outputs. */ 172 183 173 184 /********************************************************************************************************************************* … … 302 313 /** Size of the temporary scratch read/write buffer. */ 303 314 uint32_t cbReadWriteBuf; 315 /** Codec model. */ 316 uint32_t uCodecModel; 304 317 } AC97STATE; 305 318 /** Pointer to the AC97 device state. */ … … 501 514 if (i + 2 > sizeof(pThis->mixer_data)) 502 515 { 503 LogFlowFunc(("mixer_ store: index %d out of bounds %d\n", i, sizeof(pThis->mixer_data)));516 LogFlowFunc(("mixer_load: index %d out of bounds %d\n", i, sizeof(pThis->mixer_data))); 504 517 val = 0xffff; 505 518 } … … 909 922 ichac97MixerStore(pThis, AC97_MIC_ADC_Rate , 0xbb80); 910 923 911 if ( PCIDevGetSubSystemVendorId(&pThis->PciDev) == 0x1028)924 if (pThis->uCodecModel == Codec_AD1980) 912 925 { 913 926 /* Analog Devices 1980 (AD1980) */ 927 ichac97MixerStore(pThis, AC97_Reset , 0x0010); /* Headphones. */ 914 928 ichac97MixerStore(pThis, AC97_Vendor_ID1 , 0x4144); 915 929 ichac97MixerStore(pThis, AC97_Vendor_ID2 , 0x5370); 930 ichac97MixerStore(pThis, AC97_Headphone_Volume_Mute , 0x8000); 931 } 932 else if (pThis->uCodecModel == Codec_AD1981B) 933 { 934 /* Analog Devices 1981B (AD1981B) */ 935 ichac97MixerStore(pThis, AC97_Vendor_ID1 , 0x4144); 936 ichac97MixerStore(pThis, AC97_Vendor_ID2 , 0x5374); 916 937 } 917 938 else … … 1712 1733 break; 1713 1734 case AC97_Master_Volume_Mute: 1735 if (pThis->uCodecModel == Codec_AD1980) 1736 if (ichac97MixerLoad(pThis, AC97_AD_Misc) & AD_MISC_LOSEL) 1737 break; /* Register controls surround (rear), do nothing. */ 1714 1738 ichac97SetVolume(pThis, index, PDMAUDIOMIXERCTL_VOLUME, u32); 1739 break; 1740 case AC97_Headphone_Volume_Mute: 1741 if (pThis->uCodecModel == Codec_AD1980) 1742 if (ichac97MixerLoad(pThis, AC97_AD_Misc) & AD_MISC_HPSEL) 1743 /* Register controls PCM (front) outputs. */ 1744 ichac97SetVolume(pThis, index, PDMAUDIOMIXERCTL_VOLUME, u32); 1715 1745 break; 1716 1746 case AC97_PCM_Out_Volume_Mute: … … 1914 1944 V_(AC97_Line_In_Volume_Mute, PDMAUDIOMIXERCTL_LINE_IN); 1915 1945 # undef V_ 1946 if (pThis->uCodecModel == Codec_AD1980) 1947 if (ichac97MixerLoad(pThis, AC97_AD_Misc) & AD_MISC_HPSEL) 1948 ichac97SetVolume(pThis, AC97_Headphone_Volume_Mute, PDMAUDIOMIXERCTL_VOLUME, 1949 ichac97MixerLoad(pThis, AC97_Headphone_Volume_Mute)); 1950 1916 1951 ichac97ResetStreams(pThis, active); 1917 1952 … … 2103 2138 * The AD1980 codec (with corresponding PCI subsystem vendor ID) is whitelisted 2104 2139 * in the Linux kernel; Linux makes no attempt to measure the data rate and assumes 2105 * 48 kHz rate, which is exactly what we need. 2140 * 48 kHz rate, which is exactly what we need. Same goes for AD1981B. 2106 2141 */ 2107 2142 bool fChipAD1980 = false; 2108 2143 if (!strcmp(szCodec, "STAC9700")) 2109 fChipAD1980 = false;2144 pThis->uCodecModel = Codec_STAC9700; 2110 2145 else if (!strcmp(szCodec, "AD1980")) 2111 fChipAD1980 = true; 2146 pThis->uCodecModel = Codec_AD1980; 2147 else if (!strcmp(szCodec, "AD1981B")) 2148 pThis->uCodecModel = Codec_AD1981B; 2112 2149 else 2113 2150 { … … 2141 2178 PCIDevSetInterruptPin (&pThis->PciDev, 0x01); /* 3d ro - INTA#. */ Assert(pThis->PciDev.config[0x3d] == 0x01); 2142 2179 2143 if ( fChipAD1980)2180 if (pThis->uCodecModel == Codec_AD1980) 2144 2181 { 2145 2182 PCIDevSetSubSystemVendorId(&pThis->PciDev, 0x1028); /* 2c ro - Dell.) */ 2146 2183 PCIDevSetSubSystemId (&pThis->PciDev, 0x0177); /* 2e ro. */ 2184 } 2185 else if (pThis->uCodecModel == Codec_AD1981B) 2186 { 2187 PCIDevSetSubSystemVendorId(&pThis->PciDev, 0x1028); /* 2c ro - Dell.) */ 2188 PCIDevSetSubSystemId (&pThis->PciDev, 0x01ad); /* 2e ro. */ 2147 2189 } 2148 2190 else
Note:
See TracChangeset
for help on using the changeset viewer.