~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/pci/ac97/ac97_codec.c

Version: ~ [ linux-5.0-rc6 ] ~ [ linux-4.20.10 ] ~ [ linux-4.19.23 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.101 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.158 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.174 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.134 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.63 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  3  *  Universal interface for Audio Codec '97
  4  *
  5  *  For more details look to AC '97 component specification revision 2.2
  6  *  by Intel Corporation (http://developer.intel.com).
  7  *
  8  *
  9  *   This program is free software; you can redistribute it and/or modify
 10  *   it under the terms of the GNU General Public License as published by
 11  *   the Free Software Foundation; either version 2 of the License, or
 12  *   (at your option) any later version.
 13  *
 14  *   This program is distributed in the hope that it will be useful,
 15  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 16  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 17  *   GNU General Public License for more details.
 18  *
 19  *   You should have received a copy of the GNU General Public License
 20  *   along with this program; if not, write to the Free Software
 21  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 22  *
 23  */
 24 
 25 #include <linux/delay.h>
 26 #include <linux/init.h>
 27 #include <linux/slab.h>
 28 #include <linux/pci.h>
 29 #include <linux/module.h>
 30 #include <linux/mutex.h>
 31 #include <sound/core.h>
 32 #include <sound/pcm.h>
 33 #include <sound/tlv.h>
 34 #include <sound/ac97_codec.h>
 35 #include <sound/asoundef.h>
 36 #include <sound/initval.h>
 37 #include "ac97_id.h"
 38 
 39 #include "ac97_patch.c"
 40 
 41 MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
 42 MODULE_DESCRIPTION("Universal interface for Audio Codec '97");
 43 MODULE_LICENSE("GPL");
 44 
 45 static bool enable_loopback;
 46 
 47 module_param(enable_loopback, bool, 0444);
 48 MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control");
 49 
 50 #ifdef CONFIG_SND_AC97_POWER_SAVE
 51 static int power_save = CONFIG_SND_AC97_POWER_SAVE_DEFAULT;
 52 module_param(power_save, int, 0644);
 53 MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
 54                  "(in second, 0 = disable).");
 55 #endif
 56 /*
 57 
 58  */
 59 
 60 struct ac97_codec_id {
 61         unsigned int id;
 62         unsigned int mask;
 63         const char *name;
 64         int (*patch)(struct snd_ac97 *ac97);
 65         int (*mpatch)(struct snd_ac97 *ac97);
 66         unsigned int flags;
 67 };
 68 
 69 static const struct ac97_codec_id snd_ac97_codec_id_vendors[] = {
 70 { 0x41445300, 0xffffff00, "Analog Devices",     NULL,   NULL },
 71 { 0x414b4d00, 0xffffff00, "Asahi Kasei",        NULL,   NULL },
 72 { 0x414c4300, 0xffffff00, "Realtek",            NULL,   NULL },
 73 { 0x414c4700, 0xffffff00, "Realtek",            NULL,   NULL },
 74 /*
 75  * This is an _inofficial_ Aztech Labs entry
 76  * (value might differ from unknown official Aztech ID),
 77  * currently used by the AC97 emulation of the almost-AC97 PCI168 card.
 78  */
 79 { 0x415a5400, 0xffffff00, "Aztech Labs (emulated)",     NULL,   NULL },
 80 { 0x434d4900, 0xffffff00, "C-Media Electronics", NULL,  NULL },
 81 { 0x43525900, 0xffffff00, "Cirrus Logic",       NULL,   NULL },
 82 { 0x43585400, 0xffffff00, "Conexant",           NULL,   NULL },
 83 { 0x44543000, 0xffffff00, "Diamond Technology", NULL,   NULL },
 84 { 0x454d4300, 0xffffff00, "eMicro",             NULL,   NULL },
 85 { 0x45838300, 0xffffff00, "ESS Technology",     NULL,   NULL },
 86 { 0x48525300, 0xffffff00, "Intersil",           NULL,   NULL },
 87 { 0x49434500, 0xffffff00, "ICEnsemble",         NULL,   NULL },
 88 { 0x49544500, 0xffffff00, "ITE Tech.Inc",       NULL,   NULL },
 89 { 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL },
 90 { 0x50534300, 0xffffff00, "Philips",            NULL,   NULL },
 91 { 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL,   NULL },
 92 { 0x53544d00, 0xffffff00, "STMicroelectronics", NULL,   NULL },
 93 { 0x54524100, 0xffffff00, "TriTech",            NULL,   NULL },
 94 { 0x54584e00, 0xffffff00, "Texas Instruments",  NULL,   NULL },
 95 { 0x56494100, 0xffffff00, "VIA Technologies",   NULL,   NULL },
 96 { 0x57454300, 0xffffff00, "Winbond",            NULL,   NULL },
 97 { 0x574d4c00, 0xffffff00, "Wolfson",            NULL,   NULL },
 98 { 0x594d4800, 0xffffff00, "Yamaha",             NULL,   NULL },
 99 { 0x83847600, 0xffffff00, "SigmaTel",           NULL,   NULL },
100 { 0,          0,          NULL,                 NULL,   NULL }
101 };
102 
103 static const struct ac97_codec_id snd_ac97_codec_ids[] = {
104 { 0x41445303, 0xffffffff, "AD1819",             patch_ad1819,   NULL },
105 { 0x41445340, 0xffffffff, "AD1881",             patch_ad1881,   NULL },
106 { 0x41445348, 0xffffffff, "AD1881A",            patch_ad1881,   NULL },
107 { 0x41445360, 0xffffffff, "AD1885",             patch_ad1885,   NULL },
108 { 0x41445361, 0xffffffff, "AD1886",             patch_ad1886,   NULL },
109 { 0x41445362, 0xffffffff, "AD1887",             patch_ad1881,   NULL },
110 { 0x41445363, 0xffffffff, "AD1886A",            patch_ad1881,   NULL },
111 { 0x41445368, 0xffffffff, "AD1888",             patch_ad1888,   NULL },
112 { 0x41445370, 0xffffffff, "AD1980",             patch_ad1980,   NULL },
113 { 0x41445372, 0xffffffff, "AD1981A",            patch_ad1981a,  NULL },
114 { 0x41445374, 0xffffffff, "AD1981B",            patch_ad1981b,  NULL },
115 { 0x41445375, 0xffffffff, "AD1985",             patch_ad1985,   NULL },
116 { 0x41445378, 0xffffffff, "AD1986",             patch_ad1986,   NULL },
117 { 0x414b4d00, 0xffffffff, "AK4540",             NULL,           NULL },
118 { 0x414b4d01, 0xffffffff, "AK4542",             NULL,           NULL },
119 { 0x414b4d02, 0xffffffff, "AK4543",             NULL,           NULL },
120 { 0x414b4d06, 0xffffffff, "AK4544A",            NULL,           NULL },
121 { 0x414b4d07, 0xffffffff, "AK4545",             NULL,           NULL },
122 { 0x414c4300, 0xffffff00, "ALC100,100P",        NULL,           NULL },
123 { 0x414c4710, 0xfffffff0, "ALC200,200P",        NULL,           NULL },
124 { 0x414c4721, 0xffffffff, "ALC650D",            NULL,   NULL }, /* already patched */
125 { 0x414c4722, 0xffffffff, "ALC650E",            NULL,   NULL }, /* already patched */
126 { 0x414c4723, 0xffffffff, "ALC650F",            NULL,   NULL }, /* already patched */
127 { 0x414c4720, 0xfffffff0, "ALC650",             patch_alc650,   NULL },
128 { 0x414c4730, 0xffffffff, "ALC101",             NULL,           NULL },
129 { 0x414c4740, 0xfffffff0, "ALC202",             NULL,           NULL },
130 { 0x414c4750, 0xfffffff0, "ALC250",             NULL,           NULL },
131 { 0x414c4760, 0xfffffff0, "ALC655",             patch_alc655,   NULL },
132 { 0x414c4770, 0xfffffff0, "ALC203",             patch_alc203,   NULL },
133 { 0x414c4781, 0xffffffff, "ALC658D",            NULL,   NULL }, /* already patched */
134 { 0x414c4780, 0xfffffff0, "ALC658",             patch_alc655,   NULL },
135 { 0x414c4790, 0xfffffff0, "ALC850",             patch_alc850,   NULL },
136 { 0x415a5401, 0xffffffff, "AZF3328",            patch_aztech_azf3328,   NULL },
137 { 0x434d4941, 0xffffffff, "CMI9738",            patch_cm9738,   NULL },
138 { 0x434d4961, 0xffffffff, "CMI9739",            patch_cm9739,   NULL },
139 { 0x434d4969, 0xffffffff, "CMI9780",            patch_cm9780,   NULL },
140 { 0x434d4978, 0xffffffff, "CMI9761A",           patch_cm9761,   NULL },
141 { 0x434d4982, 0xffffffff, "CMI9761B",           patch_cm9761,   NULL },
142 { 0x434d4983, 0xffffffff, "CMI9761A+",          patch_cm9761,   NULL },
143 { 0x43525900, 0xfffffff8, "CS4297",             NULL,           NULL },
144 { 0x43525910, 0xfffffff8, "CS4297A",            patch_cirrus_spdif,     NULL },
145 { 0x43525920, 0xfffffff8, "CS4298",             patch_cirrus_spdif,             NULL },
146 { 0x43525928, 0xfffffff8, "CS4294",             NULL,           NULL },
147 { 0x43525930, 0xfffffff8, "CS4299",             patch_cirrus_cs4299,    NULL },
148 { 0x43525948, 0xfffffff8, "CS4201",             NULL,           NULL },
149 { 0x43525958, 0xfffffff8, "CS4205",             patch_cirrus_spdif,     NULL },
150 { 0x43525960, 0xfffffff8, "CS4291",             NULL,           NULL },
151 { 0x43525970, 0xfffffff8, "CS4202",             NULL,           NULL },
152 { 0x43585421, 0xffffffff, "HSD11246",           NULL,           NULL }, // SmartMC II
153 { 0x43585428, 0xfffffff8, "Cx20468",            patch_conexant, NULL }, // SmartAMC fixme: the mask might be different
154 { 0x43585430, 0xffffffff, "Cx20468-31",         patch_conexant, NULL },
155 { 0x43585431, 0xffffffff, "Cx20551",           patch_cx20551,  NULL },
156 { 0x44543031, 0xfffffff0, "DT0398",             NULL,           NULL },
157 { 0x454d4328, 0xffffffff, "EM28028",            NULL,           NULL },  // same as TR28028?
158 { 0x45838308, 0xffffffff, "ESS1988",            NULL,           NULL },
159 { 0x48525300, 0xffffff00, "HMP9701",            NULL,           NULL },
160 { 0x49434501, 0xffffffff, "ICE1230",            NULL,           NULL },
161 { 0x49434511, 0xffffffff, "ICE1232",            NULL,           NULL }, // alias VIA VT1611A?
162 { 0x49434514, 0xffffffff, "ICE1232A",           NULL,           NULL },
163 { 0x49434551, 0xffffffff, "VT1616",             patch_vt1616,   NULL }, 
164 { 0x49434552, 0xffffffff, "VT1616i",            patch_vt1616,   NULL }, // VT1616 compatible (chipset integrated)
165 { 0x49544520, 0xffffffff, "IT2226E",            NULL,           NULL },
166 { 0x49544561, 0xffffffff, "IT2646E",            patch_it2646,   NULL },
167 { 0x4e534300, 0xffffffff, "LM4540,43,45,46,48", NULL,           NULL }, // only guess --jk
168 { 0x4e534331, 0xffffffff, "LM4549",             NULL,           NULL },
169 { 0x4e534350, 0xffffffff, "LM4550",             patch_lm4550,   NULL }, // volume wrap fix 
170 { 0x50534304, 0xffffffff, "UCB1400",            patch_ucb1400,  NULL },
171 { 0x53494c20, 0xffffffe0, "Si3036,8",           mpatch_si3036,  mpatch_si3036, AC97_MODEM_PATCH },
172 { 0x53544d02, 0xffffffff, "ST7597",             NULL,           NULL },
173 { 0x54524102, 0xffffffff, "TR28022",            NULL,           NULL },
174 { 0x54524103, 0xffffffff, "TR28023",            NULL,           NULL },
175 { 0x54524106, 0xffffffff, "TR28026",            NULL,           NULL },
176 { 0x54524108, 0xffffffff, "TR28028",            patch_tritech_tr28028,  NULL }, // added by xin jin [07/09/99]
177 { 0x54524123, 0xffffffff, "TR28602",            NULL,           NULL }, // only guess --jk [TR28023 = eMicro EM28023 (new CT1297)]
178 { 0x54584e03, 0xffffffff, "TLV320AIC27",        NULL,           NULL },
179 { 0x54584e20, 0xffffffff, "TLC320AD9xC",        NULL,           NULL },
180 { 0x56494120, 0xfffffff0, "VIA1613",            patch_vt1613,   NULL },
181 { 0x56494161, 0xffffffff, "VIA1612A",           NULL,           NULL }, // modified ICE1232 with S/PDIF
182 { 0x56494170, 0xffffffff, "VIA1617A",           patch_vt1617a,  NULL }, // modified VT1616 with S/PDIF
183 { 0x56494182, 0xffffffff, "VIA1618",            patch_vt1618,   NULL },
184 { 0x57454301, 0xffffffff, "W83971D",            NULL,           NULL },
185 { 0x574d4c00, 0xffffffff, "WM9701,WM9701A",     NULL,           NULL },
186 { 0x574d4C03, 0xffffffff, "WM9703,WM9707,WM9708,WM9717", patch_wolfson03, NULL},
187 { 0x574d4C04, 0xffffffff, "WM9704M,WM9704Q",    patch_wolfson04, NULL},
188 { 0x574d4C05, 0xffffffff, "WM9705,WM9710",      patch_wolfson05, NULL},
189 { 0x574d4C09, 0xffffffff, "WM9709",             NULL,           NULL},
190 { 0x574d4C12, 0xffffffff, "WM9711,WM9712,WM9715",