aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-01-14 09:20:13 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-15 02:20:06 -0500
commit0a4278464eba4bf98c0d6304c62a1116553125d3 (patch)
tree9707bae0dece468cfa107cfd83a6d119df1d9f75 /sound/pci/hda/patch_sigmatel.c
parentfe6322ca66bbfa46e2810eed280fb35ef0c86fd6 (diff)
ALSA: hda - Use standard fixup table for STAC922x
Rather straightforward conversion, except for ones for Intel Mac. As Intel Mac have only unique codec SSIDs, we need to remap the fixup again for the codec SSID and call the new fixup there. Also, we can reduce model enums like STAC_MACMINI, which are model aliases for backward compatibility, since they can be pointed directly via hda_model_fixup table. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c483
1 files changed, 312 insertions, 171 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index f66c7d19a7df..60d43dd3e061 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -134,7 +134,6 @@ enum {
134}; 134};
135 135
136enum { 136enum {
137 STAC_922X_AUTO,
138 STAC_D945_REF, 137 STAC_D945_REF,
139 STAC_D945GTP3, 138 STAC_D945GTP3,
140 STAC_D945GTP5, 139 STAC_D945GTP5,
@@ -143,21 +142,13 @@ enum {
143 STAC_INTEL_MAC_V3, 142 STAC_INTEL_MAC_V3,
144 STAC_INTEL_MAC_V4, 143 STAC_INTEL_MAC_V4,
145 STAC_INTEL_MAC_V5, 144 STAC_INTEL_MAC_V5,
146 STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter 145 STAC_INTEL_MAC_AUTO,
147 * is given, one of the above models will be
148 * chosen according to the subsystem id. */
149 /* for backward compatibility */
150 STAC_MACMINI,
151 STAC_MACBOOK,
152 STAC_MACBOOK_PRO_V1,
153 STAC_MACBOOK_PRO_V2,
154 STAC_IMAC_INTEL,
155 STAC_IMAC_INTEL_20,
156 STAC_ECS_202, 146 STAC_ECS_202,
157 STAC_922X_DELL_D81, 147 STAC_922X_DELL_D81,
158 STAC_922X_DELL_D82, 148 STAC_922X_DELL_D82,
159 STAC_922X_DELL_M81, 149 STAC_922X_DELL_M81,
160 STAC_922X_DELL_M82, 150 STAC_922X_DELL_M82,
151 STAC_922X_INTEL_MAC_GPIO,
161 STAC_922X_MODELS 152 STAC_922X_MODELS
162}; 153};
163 154
@@ -2136,10 +2127,18 @@ static const struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
2136 {} /* terminator */ 2127 {} /* terminator */
2137}; 2128};
2138 2129
2139static const unsigned int ref922x_pin_configs[10] = { 2130static const struct hda_pintbl ref922x_pin_configs[] = {
2140 0x01014010, 0x01016011, 0x01012012, 0x0221401f, 2131 { 0x0a, 0x01014010 },
2141 0x01813122, 0x01011014, 0x01441030, 0x01c41030, 2132 { 0x0b, 0x01016011 },
2142 0x40000100, 0x40000100, 2133 { 0x0c, 0x01012012 },
2134 { 0x0d, 0x0221401f },
2135 { 0x0e, 0x01813122 },
2136 { 0x0f, 0x01011014 },
2137 { 0x10, 0x01441030 },
2138 { 0x11, 0x01c41030 },
2139 { 0x15, 0x40000100 },
2140 { 0x1b, 0x40000100 },
2141 {}
2143}; 2142};
2144 2143
2145/* 2144/*
@@ -2150,10 +2149,18 @@ static const unsigned int ref922x_pin_configs[10] = {
2150 102801D1 2149 102801D1
2151 102801D2 2150 102801D2
2152*/ 2151*/
2153static const unsigned int dell_922x_d81_pin_configs[10] = { 2152static const struct hda_pintbl dell_922x_d81_pin_configs[] = {
2154 0x02214030, 0x01a19021, 0x01111012, 0x01114010, 2153 { 0x0a, 0x02214030 },
2155 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1, 2154 { 0x0b, 0x01a19021 },
2156 0x01813122, 0x400001f2, 2155 { 0x0c, 0x01111012 },
2156 { 0x0d, 0x01114010 },
2157 { 0x0e, 0x02a19020 },
2158 { 0x0f, 0x01117011 },
2159 { 0x10, 0x400001f0 },
2160 { 0x11, 0x400001f1 },
2161 { 0x15, 0x01813122 },
2162 { 0x1b, 0x400001f2 },
2163 {}
2157}; 2164};
2158 2165
2159/* 2166/*
@@ -2161,130 +2168,311 @@ static const unsigned int dell_922x_d81_pin_configs[10] = {
2161 102801AC 2168 102801AC
2162 102801D0 2169 102801D0
2163*/ 2170*/
2164static const unsigned int dell_922x_d82_pin_configs[10] = { 2171static const struct hda_pintbl dell_922x_d82_pin_configs[] = {
2165 0x02214030, 0x01a19021, 0x01111012, 0x01114010, 2172 { 0x0a, 0x02214030 },
2166 0x02a19020, 0x01117011, 0x01451140, 0x400001f0, 2173 { 0x0b, 0x01a19021 },
2167 0x01813122, 0x400001f1, 2174 { 0x0c, 0x01111012 },
2175 { 0x0d, 0x01114010 },
2176 { 0x0e, 0x02a19020 },
2177 { 0x0f, 0x01117011 },
2178 { 0x10, 0x01451140 },
2179 { 0x11, 0x400001f0 },
2180 { 0x15, 0x01813122 },
2181 { 0x1b, 0x400001f1 },
2182 {}
2168}; 2183};
2169 2184
2170/* 2185/*
2171 STAC 922X pin configs for 2186 STAC 922X pin configs for
2172 102801BF 2187 102801BF
2173*/ 2188*/
2174static const unsigned int dell_922x_m81_pin_configs[10] = { 2189static const struct hda_pintbl dell_922x_m81_pin_configs[] = {
2175 0x0321101f, 0x01112024, 0x01111222, 0x91174220, 2190 { 0x0a, 0x0321101f },
2176 0x03a11050, 0x01116221, 0x90a70330, 0x01452340, 2191 { 0x0b, 0x01112024 },
2177 0x40C003f1, 0x405003f0, 2192 { 0x0c, 0x01111222 },
2193 { 0x0d, 0x91174220 },
2194 { 0x0e, 0x03a11050 },
2195 { 0x0f, 0x01116221 },
2196 { 0x10, 0x90a70330 },
2197 { 0x11, 0x01452340 },
2198 { 0x15, 0x40C003f1 },
2199 { 0x1b, 0x405003f0 },
2200 {}
2178}; 2201};
2179 2202
2180/* 2203/*
2181 STAC 9221 A1 pin configs for 2204 STAC 9221 A1 pin configs for
2182 102801D7 (Dell XPS M1210) 2205 102801D7 (Dell XPS M1210)
2183*/ 2206*/
2184static const unsigned int dell_922x_m82_pin_configs[10] = { 2207static const struct hda_pintbl dell_922x_m82_pin_configs[] = {
2185 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, 2208 { 0x0a, 0x02211211 },
2186 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, 2209 { 0x0b, 0x408103ff },
2187 0x508003f3, 0x405003f4, 2210 { 0x0c, 0x02a1123e },
2211 { 0x0d, 0x90100310 },
2212 { 0x0e, 0x408003f1 },
2213 { 0x0f, 0x0221121f },
2214 { 0x10, 0x03451340 },
2215 { 0x11, 0x40c003f2 },
2216 { 0x15, 0x508003f3 },
2217 { 0x1b, 0x405003f4 },
2218 {}
2188}; 2219};
2189 2220
2190static const unsigned int d945gtp3_pin_configs[10] = { 2221static const struct hda_pintbl d945gtp3_pin_configs[] = {
2191 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, 2222 { 0x0a, 0x0221401f },
2192 0x40000100, 0x40000100, 0x40000100, 0x40000100, 2223 { 0x0b, 0x01a19022 },
2193 0x02a19120, 0x40000100, 2224 { 0x0c, 0x01813021 },
2225 { 0x0d, 0x01014010 },
2226 { 0x0e, 0x40000100 },
2227 { 0x0f, 0x40000100 },
2228 { 0x10, 0x40000100 },
2229 { 0x11, 0x40000100 },
2230 { 0x15, 0x02a19120 },
2231 { 0x1b, 0x40000100 },
2232 {}
2233};
2234
2235static const struct hda_pintbl d945gtp5_pin_configs[] = {
2236 { 0x0a, 0x0221401f },
2237 { 0x0b, 0x01011012 },
2238 { 0x0c, 0x01813024 },
2239 { 0x0d, 0x01014010 },
2240 { 0x0e, 0x01a19021 },
2241 { 0x0f, 0x01016011 },
2242 { 0x10, 0x01452130 },
2243 { 0x11, 0x40000100 },
2244 { 0x15, 0x02a19320 },
2245 { 0x1b, 0x40000100 },
2246 {}
2194}; 2247};
2195 2248
2196static const unsigned int d945gtp5_pin_configs[10] = { 2249static const struct hda_pintbl intel_mac_v1_pin_configs[] = {
2197 0x0221401f, 0x01011012, 0x01813024, 0x01014010, 2250 { 0x0a, 0x0121e21f },
2198 0x01a19021, 0x01016011, 0x01452130, 0x40000100, 2251 { 0x0b, 0x400000ff },
2199 0x02a19320, 0x40000100, 2252 { 0x0c, 0x9017e110 },
2253 { 0x0d, 0x400000fd },
2254 { 0x0e, 0x400000fe },
2255 { 0x0f, 0x0181e020 },
2256 { 0x10, 0x1145e030 },
2257 { 0x11, 0x11c5e240 },
2258 { 0x15, 0x400000fc },
2259 { 0x1b, 0x400000fb },
2260 {}
2200}; 2261};
2201 2262
2202static const unsigned int intel_mac_v1_pin_configs[10] = { 2263static const struct hda_pintbl intel_mac_v2_pin_configs[] = {
2203 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd, 2264 { 0x0a, 0x0121e21f },
2204 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240, 2265 { 0x0b, 0x90a7012e },
2205 0x400000fc, 0x400000fb, 2266 { 0x0c, 0x9017e110 },
2267 { 0x0d, 0x400000fd },
2268 { 0x0e, 0x400000fe },
2269 { 0x0f, 0x0181e020 },
2270 { 0x10, 0x1145e230 },
2271 { 0x11, 0x500000fa },
2272 { 0x15, 0x400000fc },
2273 { 0x1b, 0x400000fb },
2274 {}
2206}; 2275};
2207 2276
2208static const unsigned int intel_mac_v2_pin_configs[10] = { 2277static const struct hda_pintbl intel_mac_v3_pin_configs[] = {
2209 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, 2278 { 0x0a, 0x0121e21f },
2210 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa, 2279 { 0x0b, 0x90a7012e },
2211 0x400000fc, 0x400000fb, 2280 { 0x0c, 0x9017e110 },
2281 { 0x0d, 0x400000fd },
2282 { 0x0e, 0x400000fe },
2283 { 0x0f, 0x0181e020 },
2284 { 0x10, 0x1145e230 },
2285 { 0x11, 0x11c5e240 },
2286 { 0x15, 0x400000fc },
2287 { 0x1b, 0x400000fb },
2288 {}
2212}; 2289};
2213 2290
2214static const unsigned int intel_mac_v3_pin_configs[10] = { 2291static const struct hda_pintbl intel_mac_v4_pin_configs[] = {
2215 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, 2292 { 0x0a, 0x0321e21f },
2216 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240, 2293 { 0x0b, 0x03a1e02e },
2217 0x400000fc, 0x400000fb, 2294 { 0x0c, 0x9017e110 },
2295 { 0x0d, 0x9017e11f },
2296 { 0x0e, 0x400000fe },
2297 { 0x0f, 0x0381e020 },
2298 { 0x10, 0x1345e230 },
2299 { 0x11, 0x13c5e240 },
2300 { 0x15, 0x400000fc },
2301 { 0x1b, 0x400000fb },
2302 {}
2218}; 2303};
2219 2304
2220static const unsigned int intel_mac_v4_pin_configs[10] = { 2305static const struct hda_pintbl intel_mac_v5_pin_configs[] = {
2221 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, 2306 { 0x0a, 0x0321e21f },
2222 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, 2307 { 0x0b, 0x03a1e02e },
2223 0x400000fc, 0x400000fb, 2308 { 0x0c, 0x9017e110 },
2309 { 0x0d, 0x9017e11f },
2310 { 0x0e, 0x400000fe },
2311 { 0x0f, 0x0381e020 },
2312 { 0x10, 0x1345e230 },
2313 { 0x11, 0x13c5e240 },
2314 { 0x15, 0x400000fc },
2315 { 0x1b, 0x400000fb },
2316 {}
2224}; 2317};
2225 2318
2226static const unsigned int intel_mac_v5_pin_configs[10] = { 2319static const struct hda_pintbl ecs202_pin_configs[] = {
2227 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, 2320 { 0x0a, 0x0221401f },
2228 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, 2321 { 0x0b, 0x02a19020 },
2229 0x400000fc, 0x400000fb, 2322 { 0x0c, 0x01a19020 },
2323 { 0x0d, 0x01114010 },
2324 { 0x0e, 0x408000f0 },
2325 { 0x0f, 0x01813022 },
2326 { 0x10, 0x074510a0 },
2327 { 0x11, 0x40c400f1 },
2328 { 0x15, 0x9037012e },
2329 { 0x1b, 0x40e000f2 },
2330 {}
2230}; 2331};
2231 2332
2232static const unsigned int ecs202_pin_configs[10] = { 2333/* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */
2233 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010, 2334static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = {
2234 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1, 2335 SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1),
2235 0x9037012e, 0x40e000f2, 2336 SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2),
2337 SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2),
2338 SND_PCI_QUIRK(0x106b, 0x0e00, "Mac", STAC_INTEL_MAC_V3),
2339 SND_PCI_QUIRK(0x106b, 0x0f00, "Mac", STAC_INTEL_MAC_V3),
2340 SND_PCI_QUIRK(0x106b, 0x1600, "Mac", STAC_INTEL_MAC_V3),
2341 SND_PCI_QUIRK(0x106b, 0x1700, "Mac", STAC_INTEL_MAC_V3),
2342 SND_PCI_QUIRK(0x106b, 0x0200, "Mac", STAC_INTEL_MAC_V3),
2343 SND_PCI_QUIRK(0x106b, 0x1e00, "Mac", STAC_INTEL_MAC_V3),
2344 SND_PCI_QUIRK(0x106b, 0x1a00, "Mac", STAC_INTEL_MAC_V4),
2345 SND_PCI_QUIRK(0x106b, 0x0a00, "Mac", STAC_INTEL_MAC_V5),
2346 SND_PCI_QUIRK(0x106b, 0x2200, "Mac", STAC_INTEL_MAC_V5),
2347 {}
2236}; 2348};
2237 2349
2238static const unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { 2350static const struct hda_fixup stac922x_fixups[];
2239 [STAC_D945_REF] = ref922x_pin_configs, 2351
2240 [STAC_D945GTP3] = d945gtp3_pin_configs, 2352/* remap the fixup from codec SSID and apply it */
2241 [STAC_D945GTP5] = d945gtp5_pin_configs, 2353static void stac922x_fixup_intel_mac_auto(struct hda_codec *codec,
2242 [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs, 2354 const struct hda_fixup *fix,
2243 [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs, 2355 int action)
2244 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, 2356{
2245 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, 2357 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2246 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, 2358 return;
2247 [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs, 2359 snd_hda_pick_fixup(codec, NULL, stac922x_intel_mac_fixup_tbl,
2248 /* for backward compatibility */ 2360 stac922x_fixups);
2249 [STAC_MACMINI] = intel_mac_v3_pin_configs, 2361 if (codec->fixup_id != STAC_INTEL_MAC_AUTO)
2250 [STAC_MACBOOK] = intel_mac_v5_pin_configs, 2362 snd_hda_apply_fixup(codec, action);
2251 [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs, 2363}
2252 [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, 2364
2253 [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, 2365static void stac922x_fixup_intel_mac_gpio(struct hda_codec *codec,
2254 [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, 2366 const struct hda_fixup *fix,
2255 [STAC_ECS_202] = ecs202_pin_configs, 2367 int action)
2256 [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, 2368{
2257 [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, 2369 struct sigmatel_spec *spec = codec->spec;
2258 [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, 2370
2259 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, 2371 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2260}; 2372 spec->gpio_mask = spec->gpio_dir = 0x03;
2261 2373 spec->gpio_data = 0x03;
2262static const char * const stac922x_models[STAC_922X_MODELS] = { 2374 }
2263 [STAC_922X_AUTO] = "auto", 2375}
2264 [STAC_D945_REF] = "ref", 2376
2265 [STAC_D945GTP5] = "5stack", 2377static const struct hda_fixup stac922x_fixups[] = {
2266 [STAC_D945GTP3] = "3stack", 2378 [STAC_D945_REF] = {
2267 [STAC_INTEL_MAC_V1] = "intel-mac-v1", 2379 .type = HDA_FIXUP_PINS,
2268 [STAC_INTEL_MAC_V2] = "intel-mac-v2", 2380 .v.pins = ref922x_pin_configs,
2269 [STAC_INTEL_MAC_V3] = "intel-mac-v3", 2381 },
2270 [STAC_INTEL_MAC_V4] = "intel-mac-v4", 2382 [STAC_D945GTP3] = {
2271 [STAC_INTEL_MAC_V5] = "intel-mac-v5", 2383 .type = HDA_FIXUP_PINS,
2272 [STAC_INTEL_MAC_AUTO] = "intel-mac-auto", 2384 .v.pins = d945gtp3_pin_configs,
2385 },
2386 [STAC_D945GTP5] = {
2387 .type = HDA_FIXUP_PINS,
2388 .v.pins = d945gtp5_pin_configs,
2389 },
2390 [STAC_INTEL_MAC_AUTO] = {
2391 .type = HDA_FIXUP_FUNC,
2392 .v.func = stac922x_fixup_intel_mac_auto,
2393 },
2394 [STAC_INTEL_MAC_V1] = {
2395 .type = HDA_FIXUP_PINS,
2396 .v.pins = intel_mac_v1_pin_configs,
2397 .chained = true,
2398 .chain_id = STAC_922X_INTEL_MAC_GPIO,
2399 },
2400 [STAC_INTEL_MAC_V2] = {
2401 .type = HDA_FIXUP_PINS,
2402 .v.pins = intel_mac_v2_pin_configs,
2403 .chained = true,
2404 .chain_id = STAC_922X_INTEL_MAC_GPIO,
2405 },
2406 [STAC_INTEL_MAC_V3] = {
2407 .type = HDA_FIXUP_PINS,
2408 .v.pins = intel_mac_v3_pin_configs,
2409 .chained = true,
2410 .chain_id = STAC_922X_INTEL_MAC_GPIO,
2411 },
2412 [STAC_INTEL_MAC_V4] = {
2413 .type = HDA_FIXUP_PINS,
2414 .v.pins = intel_mac_v4_pin_configs,
2415 .chained = true,
2416 .chain_id = STAC_922X_INTEL_MAC_GPIO,
2417 },
2418 [STAC_INTEL_MAC_V5] = {
2419 .type = HDA_FIXUP_PINS,
2420 .v.pins = intel_mac_v5_pin_configs,
2421 .chained = true,
2422 .chain_id = STAC_922X_INTEL_MAC_GPIO,
2423 },
2424 [STAC_922X_INTEL_MAC_GPIO] = {
2425 .type = HDA_FIXUP_FUNC,
2426 .v.func = stac922x_fixup_intel_mac_gpio,
2427 },
2428 [STAC_ECS_202] = {
2429 .type = HDA_FIXUP_PINS,
2430 .v.pins = ecs202_pin_configs,
2431 },
2432 [STAC_922X_DELL_D81] = {
2433 .type = HDA_FIXUP_PINS,
2434 .v.pins = dell_922x_d81_pin_configs,
2435 },
2436 [STAC_922X_DELL_D82] = {
2437 .type = HDA_FIXUP_PINS,
2438 .v.pins = dell_922x_d82_pin_configs,
2439 },
2440 [STAC_922X_DELL_M81] = {
2441 .type = HDA_FIXUP_PINS,
2442 .v.pins = dell_922x_m81_pin_configs,
2443 },
2444 [STAC_922X_DELL_M82] = {
2445 .type = HDA_FIXUP_PINS,
2446 .v.pins = dell_922x_m82_pin_configs,
2447 },
2448};
2449
2450static const struct hda_model_fixup stac922x_models[] = {
2451 { .id = STAC_D945_REF, .name = "ref" },
2452 { .id = STAC_D945GTP5, .name = "5stack" },
2453 { .id = STAC_D945GTP3, .name = "3stack" },
2454 { .id = STAC_INTEL_MAC_V1, .name = "intel-mac-v1" },
2455 { .id = STAC_INTEL_MAC_V2, .name = "intel-mac-v2" },
2456 { .id = STAC_INTEL_MAC_V3, .name = "intel-mac-v3" },
2457 { .id = STAC_INTEL_MAC_V4, .name = "intel-mac-v4" },
2458 { .id = STAC_INTEL_MAC_V5, .name = "intel-mac-v5" },
2459 { .id = STAC_INTEL_MAC_AUTO, .name = "intel-mac-auto" },
2460 { .id = STAC_ECS_202, .name = "ecs202" },
2461 { .id = STAC_922X_DELL_D81, .name = "dell-d81" },
2462 { .id = STAC_922X_DELL_D82, .name = "dell-d82" },
2463 { .id = STAC_922X_DELL_M81, .name = "dell-m81" },
2464 { .id = STAC_922X_DELL_M82, .name = "dell-m82" },
2273 /* for backward compatibility */ 2465 /* for backward compatibility */
2274 [STAC_MACMINI] = "macmini", 2466 { .id = STAC_INTEL_MAC_V3, .name = "macmini" },
2275 [STAC_MACBOOK] = "macbook", 2467 { .id = STAC_INTEL_MAC_V5, .name = "macbook" },
2276 [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1", 2468 { .id = STAC_INTEL_MAC_V3, .name = "macbook-pro-v1" },
2277 [STAC_MACBOOK_PRO_V2] = "macbook-pro", 2469 { .id = STAC_INTEL_MAC_V3, .name = "macbook-pro" },
2278 [STAC_IMAC_INTEL] = "imac-intel", 2470 { .id = STAC_INTEL_MAC_V2, .name = "imac-intel" },
2279 [STAC_IMAC_INTEL_20] = "imac-intel-20", 2471 { .id = STAC_INTEL_MAC_V3, .name = "imac-intel-20" },
2280 [STAC_ECS_202] = "ecs202", 2472 {}
2281 [STAC_922X_DELL_D81] = "dell-d81", 2473};
2282 [STAC_922X_DELL_D82] = "dell-d82", 2474
2283 [STAC_922X_DELL_M81] = "dell-m81", 2475static const struct snd_pci_quirk stac922x_fixup_tbl[] = {
2284 [STAC_922X_DELL_M82] = "dell-m82",
2285};
2286
2287static const struct snd_pci_quirk stac922x_cfg_tbl[] = {
2288 /* SigmaTel reference board */ 2476 /* SigmaTel reference board */
2289 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 2477 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2290 "DFI LanParty", STAC_D945_REF), 2478 "DFI LanParty", STAC_D945_REF),
@@ -2347,9 +2535,10 @@ static const struct snd_pci_quirk stac922x_cfg_tbl[] = {
2347 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204, 2535 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204,
2348 "Intel D945", STAC_D945_REF), 2536 "Intel D945", STAC_D945_REF),
2349 /* other systems */ 2537 /* other systems */
2538
2350 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ 2539 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
2351 SND_PCI_QUIRK(0x8384, 0x7680, 2540 SND_PCI_QUIRK(0x8384, 0x7680, "Mac", STAC_INTEL_MAC_AUTO),
2352 "Mac", STAC_INTEL_MAC_AUTO), 2541
2353 /* Dell systems */ 2542 /* Dell systems */
2354 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, 2543 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
2355 "unknown Dell", STAC_922X_DELL_D81), 2544 "unknown Dell", STAC_922X_DELL_D81),
@@ -6357,54 +6546,9 @@ static int patch_stac922x(struct hda_codec *codec)
6357 6546
6358 spec = codec->spec; 6547 spec = codec->spec;
6359 spec->linear_tone_beep = 1; 6548 spec->linear_tone_beep = 1;
6360 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
6361 stac922x_models,
6362 stac922x_cfg_tbl);
6363 if (spec->board_config == STAC_INTEL_MAC_AUTO) {
6364 spec->gpio_mask = spec->gpio_dir = 0x03;
6365 spec->gpio_data = 0x03;
6366 /* Intel Macs have all same PCI SSID, so we need to check
6367 * codec SSID to distinguish the exact models
6368 */
6369 printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id);
6370 switch (codec->subsystem_id) {
6371 6549
6372 case 0x106b0800: 6550 snd_hda_pick_fixup(codec, stac922x_models, stac922x_fixup_tbl,
6373 spec->board_config = STAC_INTEL_MAC_V1; 6551 stac922x_fixups);
6374 break;
6375 case 0x106b0600:
6376 case 0x106b0700:
6377 spec->board_config = STAC_INTEL_MAC_V2;
6378 break;
6379 case 0x106b0e00:
6380 case 0x106b0f00:
6381 case 0x106b1600:
6382 case 0x106b1700:
6383 case 0x106b0200:
6384 case 0x106b1e00:
6385 spec->board_config = STAC_INTEL_MAC_V3;
6386 break;
6387 case 0x106b1a00:
6388 case 0x00000100:
6389 spec->board_config = STAC_INTEL_MAC_V4;
6390 break;
6391 case 0x106b0a00:
6392 case 0x106b2200:
6393 spec->board_config = STAC_INTEL_MAC_V5;
6394 break;
6395 default:
6396 spec->board_config = STAC_INTEL_MAC_V3;
6397 break;
6398 }
6399 }
6400
6401 again:
6402 if (spec->board_config < 0)
6403 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6404 codec->chip_name);
6405 else
6406 stac92xx_set_config_regs(codec,
6407 stac922x_brd_tbl[spec->board_config]);
6408 6552
6409 spec->adc_nids = stac922x_adc_nids; 6553 spec->adc_nids = stac922x_adc_nids;
6410 spec->mux_nids = stac922x_mux_nids; 6554 spec->mux_nids = stac922x_mux_nids;
@@ -6413,24 +6557,19 @@ static int patch_stac922x(struct hda_codec *codec)
6413 spec->num_dmics = 0; 6557 spec->num_dmics = 0;
6414 spec->num_pwrs = 0; 6558 spec->num_pwrs = 0;
6415 6559
6416 spec->init = stac922x_core_init;
6417
6418 spec->num_caps = STAC922X_NUM_CAPS; 6560 spec->num_caps = STAC922X_NUM_CAPS;
6419 spec->capvols = stac922x_capvols; 6561 spec->capvols = stac922x_capvols;
6420 spec->capsws = stac922x_capsws; 6562 spec->capsws = stac922x_capsws;
6421 6563
6422 spec->multiout.dac_nids = spec->dac_nids; 6564 spec->multiout.dac_nids = spec->dac_nids;
6423 6565
6566 snd_hda_add_verbs(codec, stac922x_core_init);
6567
6568 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6569
6424 err = stac92xx_parse_auto_config(codec); 6570 err = stac92xx_parse_auto_config(codec);
6425 if (!err) { 6571 if (!err)
6426 if (spec->board_config < 0) {
6427 printk(KERN_WARNING "hda_codec: No auto-config is "
6428 "available, default to model=ref\n");
6429 spec->board_config = STAC_D945_REF;
6430 goto again;
6431 }
6432 err = -EINVAL; 6572 err = -EINVAL;
6433 }
6434 if (err < 0) { 6573 if (err < 0) {
6435 stac92xx_free(codec); 6574 stac92xx_free(codec);
6436 return err; 6575 return err;
@@ -6445,6 +6584,8 @@ static int patch_stac922x(struct hda_codec *codec)
6445 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | 6584 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
6446 (0 << AC_AMPCAP_MUTE_SHIFT)); 6585 (0 << AC_AMPCAP_MUTE_SHIFT));
6447 6586
6587 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6588
6448 return 0; 6589 return 0;
6449} 6590}
6450 6591