aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2011-02-15 04:24:31 -0500
committerJiri Kosina <jkosina@suse.cz>2011-02-15 04:24:31 -0500
commit0a9d59a2461477bd9ed143c01af9df3f8f00fa81 (patch)
treedf997d1cfb0786427a0df1fbd6f0640fa4248cf4 /sound/pci
parenta23ce6da9677d245aa0aadc99f4197030350ab54 (diff)
parent795abaf1e4e188c4171e3cd3dbb11a9fcacaf505 (diff)
Merge branch 'master' into for-next
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ac97/ac97_codec.c2
-rw-r--r--sound/pci/ac97/ac97_patch.c62
-rw-r--r--sound/pci/au88x0/au88x0_pcm.c24
-rw-r--r--sound/pci/azt3328.c38
-rw-r--r--sound/pci/cs5535audio/cs5535audio_pm.c7
-rw-r--r--sound/pci/hda/hda_codec.c10
-rw-r--r--sound/pci/hda/hda_eld.c2
-rw-r--r--sound/pci/hda/hda_generic.c7
-rw-r--r--sound/pci/hda/hda_intel.c4
-rw-r--r--sound/pci/hda/hda_local.h6
-rw-r--r--sound/pci/hda/hda_proc.c2
-rw-r--r--sound/pci/hda/patch_analog.c208
-rw-r--r--sound/pci/hda/patch_cirrus.c4
-rw-r--r--sound/pci/hda/patch_cmedia.c2
-rw-r--r--sound/pci/hda/patch_conexant.c163
-rw-r--r--sound/pci/hda/patch_hdmi.c14
-rw-r--r--sound/pci/hda/patch_realtek.c422
-rw-r--r--sound/pci/hda/patch_sigmatel.c89
-rw-r--r--sound/pci/hda/patch_via.c28
-rw-r--r--sound/pci/ice1712/delta.c7
-rw-r--r--sound/pci/oxygen/oxygen.h2
-rw-r--r--sound/pci/oxygen/oxygen_mixer.c2
-rw-r--r--sound/pci/oxygen/xonar_cs43xx.c2
-rw-r--r--sound/pci/oxygen/xonar_dg.c38
24 files changed, 749 insertions, 396 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 0fc614ce16c1..cb62d178b3e0 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1961,7 +1961,7 @@ static int snd_ac97_dev_disconnect(struct snd_device *device)
1961} 1961}
1962 1962
1963/* build_ops to do nothing */ 1963/* build_ops to do nothing */
1964static struct snd_ac97_build_ops null_build_ops; 1964static const struct snd_ac97_build_ops null_build_ops;
1965 1965
1966#ifdef CONFIG_SND_AC97_POWER_SAVE 1966#ifdef CONFIG_SND_AC97_POWER_SAVE
1967static void do_update_power(struct work_struct *work) 1967static void do_update_power(struct work_struct *work)
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index e68c98ef4041..bf47574ca1f0 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -371,7 +371,7 @@ static int patch_yamaha_ymf743_build_spdif(struct snd_ac97 *ac97)
371 return 0; 371 return 0;
372} 372}
373 373
374static struct snd_ac97_build_ops patch_yamaha_ymf743_ops = { 374static const struct snd_ac97_build_ops patch_yamaha_ymf743_ops = {
375 .build_spdif = patch_yamaha_ymf743_build_spdif, 375 .build_spdif = patch_yamaha_ymf743_build_spdif,
376 .build_3d = patch_yamaha_ymf7x3_3d, 376 .build_3d = patch_yamaha_ymf7x3_3d,
377}; 377};
@@ -455,7 +455,7 @@ static int patch_yamaha_ymf753_post_spdif(struct snd_ac97 * ac97)
455 return 0; 455 return 0;
456} 456}
457 457
458static struct snd_ac97_build_ops patch_yamaha_ymf753_ops = { 458static const struct snd_ac97_build_ops patch_yamaha_ymf753_ops = {
459 .build_3d = patch_yamaha_ymf7x3_3d, 459 .build_3d = patch_yamaha_ymf7x3_3d,
460 .build_post_spdif = patch_yamaha_ymf753_post_spdif 460 .build_post_spdif = patch_yamaha_ymf753_post_spdif
461}; 461};
@@ -502,7 +502,7 @@ static int patch_wolfson_wm9703_specific(struct snd_ac97 * ac97)
502 return 0; 502 return 0;
503} 503}
504 504
505static struct snd_ac97_build_ops patch_wolfson_wm9703_ops = { 505static const struct snd_ac97_build_ops patch_wolfson_wm9703_ops = {
506 .build_specific = patch_wolfson_wm9703_specific, 506 .build_specific = patch_wolfson_wm9703_specific,
507}; 507};
508 508
@@ -533,7 +533,7 @@ static int patch_wolfson_wm9704_specific(struct snd_ac97 * ac97)
533 return 0; 533 return 0;
534} 534}
535 535
536static struct snd_ac97_build_ops patch_wolfson_wm9704_ops = { 536static const struct snd_ac97_build_ops patch_wolfson_wm9704_ops = {
537 .build_specific = patch_wolfson_wm9704_specific, 537 .build_specific = patch_wolfson_wm9704_specific,
538}; 538};
539 539
@@ -677,7 +677,7 @@ static int patch_wolfson_wm9711_specific(struct snd_ac97 * ac97)
677 return 0; 677 return 0;
678} 678}
679 679
680static struct snd_ac97_build_ops patch_wolfson_wm9711_ops = { 680static const struct snd_ac97_build_ops patch_wolfson_wm9711_ops = {
681 .build_specific = patch_wolfson_wm9711_specific, 681 .build_specific = patch_wolfson_wm9711_specific,
682}; 682};
683 683
@@ -871,7 +871,7 @@ static void patch_wolfson_wm9713_resume (struct snd_ac97 * ac97)
871} 871}
872#endif 872#endif
873 873
874static struct snd_ac97_build_ops patch_wolfson_wm9713_ops = { 874static const struct snd_ac97_build_ops patch_wolfson_wm9713_ops = {
875 .build_specific = patch_wolfson_wm9713_specific, 875 .build_specific = patch_wolfson_wm9713_specific,
876 .build_3d = patch_wolfson_wm9713_3d, 876 .build_3d = patch_wolfson_wm9713_3d,
877#ifdef CONFIG_PM 877#ifdef CONFIG_PM
@@ -976,7 +976,7 @@ static int patch_sigmatel_stac97xx_specific(struct snd_ac97 * ac97)
976 return 0; 976 return 0;
977} 977}
978 978
979static struct snd_ac97_build_ops patch_sigmatel_stac9700_ops = { 979static const struct snd_ac97_build_ops patch_sigmatel_stac9700_ops = {
980 .build_3d = patch_sigmatel_stac9700_3d, 980 .build_3d = patch_sigmatel_stac9700_3d,
981 .build_specific = patch_sigmatel_stac97xx_specific 981 .build_specific = patch_sigmatel_stac97xx_specific
982}; 982};
@@ -1023,7 +1023,7 @@ static int patch_sigmatel_stac9708_specific(struct snd_ac97 *ac97)
1023 return patch_sigmatel_stac97xx_specific(ac97); 1023 return patch_sigmatel_stac97xx_specific(ac97);
1024} 1024}
1025 1025
1026static struct snd_ac97_build_ops patch_sigmatel_stac9708_ops = { 1026static const struct snd_ac97_build_ops patch_sigmatel_stac9708_ops = {
1027 .build_3d = patch_sigmatel_stac9708_3d, 1027 .build_3d = patch_sigmatel_stac9708_3d,
1028 .build_specific = patch_sigmatel_stac9708_specific 1028 .build_specific = patch_sigmatel_stac9708_specific
1029}; 1029};
@@ -1252,7 +1252,7 @@ static int patch_sigmatel_stac9758_specific(struct snd_ac97 *ac97)
1252 return 0; 1252 return 0;
1253} 1253}
1254 1254
1255static struct snd_ac97_build_ops patch_sigmatel_stac9758_ops = { 1255static const struct snd_ac97_build_ops patch_sigmatel_stac9758_ops = {
1256 .build_3d = patch_sigmatel_stac9700_3d, 1256 .build_3d = patch_sigmatel_stac9700_3d,
1257 .build_specific = patch_sigmatel_stac9758_specific 1257 .build_specific = patch_sigmatel_stac9758_specific
1258}; 1258};
@@ -1327,7 +1327,7 @@ static int patch_cirrus_build_spdif(struct snd_ac97 * ac97)
1327 return 0; 1327 return 0;
1328} 1328}
1329 1329
1330static struct snd_ac97_build_ops patch_cirrus_ops = { 1330static const struct snd_ac97_build_ops patch_cirrus_ops = {
1331 .build_spdif = patch_cirrus_build_spdif 1331 .build_spdif = patch_cirrus_build_spdif
1332}; 1332};
1333 1333
@@ -1384,7 +1384,7 @@ static int patch_conexant_build_spdif(struct snd_ac97 * ac97)
1384 return 0; 1384 return 0;
1385} 1385}
1386 1386
1387static struct snd_ac97_build_ops patch_conexant_ops = { 1387static const struct snd_ac97_build_ops patch_conexant_ops = {
1388 .build_spdif = patch_conexant_build_spdif 1388 .build_spdif = patch_conexant_build_spdif
1389}; 1389};
1390 1390
@@ -1560,7 +1560,7 @@ static void patch_ad1881_chained(struct snd_ac97 * ac97, int unchained_idx, int
1560 } 1560 }
1561} 1561}
1562 1562
1563static struct snd_ac97_build_ops patch_ad1881_build_ops = { 1563static const struct snd_ac97_build_ops patch_ad1881_build_ops = {
1564#ifdef CONFIG_PM 1564#ifdef CONFIG_PM
1565 .resume = ad18xx_resume 1565 .resume = ad18xx_resume
1566#endif 1566#endif
@@ -1647,7 +1647,7 @@ static int patch_ad1885_specific(struct snd_ac97 * ac97)
1647 return 0; 1647 return 0;
1648} 1648}
1649 1649
1650static struct snd_ac97_build_ops patch_ad1885_build_ops = { 1650static const struct snd_ac97_build_ops patch_ad1885_build_ops = {
1651 .build_specific = &patch_ad1885_specific, 1651 .build_specific = &patch_ad1885_specific,
1652#ifdef CONFIG_PM 1652#ifdef CONFIG_PM
1653 .resume = ad18xx_resume 1653 .resume = ad18xx_resume
@@ -1674,7 +1674,7 @@ static int patch_ad1886_specific(struct snd_ac97 * ac97)
1674 return 0; 1674 return 0;
1675} 1675}
1676 1676
1677static struct snd_ac97_build_ops patch_ad1886_build_ops = { 1677static const struct snd_ac97_build_ops patch_ad1886_build_ops = {
1678 .build_specific = &patch_ad1886_specific, 1678 .build_specific = &patch_ad1886_specific,
1679#ifdef CONFIG_PM 1679#ifdef CONFIG_PM
1680 .resume = ad18xx_resume 1680 .resume = ad18xx_resume
@@ -1881,7 +1881,7 @@ static int patch_ad1981a_specific(struct snd_ac97 * ac97)
1881 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense)); 1881 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));
1882} 1882}
1883 1883
1884static struct snd_ac97_build_ops patch_ad1981a_build_ops = { 1884static const struct snd_ac97_build_ops patch_ad1981a_build_ops = {
1885 .build_post_spdif = patch_ad198x_post_spdif, 1885 .build_post_spdif = patch_ad198x_post_spdif,
1886 .build_specific = patch_ad1981a_specific, 1886 .build_specific = patch_ad1981a_specific,
1887#ifdef CONFIG_PM 1887#ifdef CONFIG_PM
@@ -1936,7 +1936,7 @@ static int patch_ad1981b_specific(struct snd_ac97 *ac97)
1936 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense)); 1936 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));
1937} 1937}
1938 1938
1939static struct snd_ac97_build_ops patch_ad1981b_build_ops = { 1939static const struct snd_ac97_build_ops patch_ad1981b_build_ops = {
1940 .build_post_spdif = patch_ad198x_post_spdif, 1940 .build_post_spdif = patch_ad198x_post_spdif,
1941 .build_specific = patch_ad1981b_specific, 1941 .build_specific = patch_ad1981b_specific,
1942#ifdef CONFIG_PM 1942#ifdef CONFIG_PM
@@ -2075,7 +2075,7 @@ static int patch_ad1888_specific(struct snd_ac97 *ac97)
2075 return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls)); 2075 return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls));
2076} 2076}
2077 2077
2078static struct snd_ac97_build_ops patch_ad1888_build_ops = { 2078static const struct snd_ac97_build_ops patch_ad1888_build_ops = {
2079 .build_post_spdif = patch_ad198x_post_spdif, 2079 .build_post_spdif = patch_ad198x_post_spdif,
2080 .build_specific = patch_ad1888_specific, 2080 .build_specific = patch_ad1888_specific,
2081#ifdef CONFIG_PM 2081#ifdef CONFIG_PM
@@ -2124,7 +2124,7 @@ static int patch_ad1980_specific(struct snd_ac97 *ac97)
2124 return patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1); 2124 return patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1);
2125} 2125}
2126 2126
2127static struct snd_ac97_build_ops patch_ad1980_build_ops = { 2127static const struct snd_ac97_build_ops patch_ad1980_build_ops = {
2128 .build_post_spdif = patch_ad198x_post_spdif, 2128 .build_post_spdif = patch_ad198x_post_spdif,
2129 .build_specific = patch_ad1980_specific, 2129 .build_specific = patch_ad1980_specific,
2130#ifdef CONFIG_PM 2130#ifdef CONFIG_PM
@@ -2239,7 +2239,7 @@ static int patch_ad1985_specific(struct snd_ac97 *ac97)
2239 ARRAY_SIZE(snd_ac97_ad1985_controls)); 2239 ARRAY_SIZE(snd_ac97_ad1985_controls));
2240} 2240}
2241 2241
2242static struct snd_ac97_build_ops patch_ad1985_build_ops = { 2242static const struct snd_ac97_build_ops patch_ad1985_build_ops = {
2243 .build_post_spdif = patch_ad198x_post_spdif, 2243 .build_post_spdif = patch_ad198x_post_spdif,
2244 .build_specific = patch_ad1985_specific, 2244 .build_specific = patch_ad1985_specific,
2245#ifdef CONFIG_PM 2245#ifdef CONFIG_PM
@@ -2531,7 +2531,7 @@ static int patch_ad1986_specific(struct snd_ac97 *ac97)
2531 ARRAY_SIZE(snd_ac97_ad1985_controls)); 2531 ARRAY_SIZE(snd_ac97_ad1985_controls));
2532} 2532}
2533 2533
2534static struct snd_ac97_build_ops patch_ad1986_build_ops = { 2534static const struct snd_ac97_build_ops patch_ad1986_build_ops = {
2535 .build_post_spdif = patch_ad198x_post_spdif, 2535 .build_post_spdif = patch_ad198x_post_spdif,
2536 .build_specific = patch_ad1986_specific, 2536 .build_specific = patch_ad1986_specific,
2537#ifdef CONFIG_PM 2537#ifdef CONFIG_PM
@@ -2636,7 +2636,7 @@ static int patch_alc650_specific(struct snd_ac97 * ac97)
2636 return 0; 2636 return 0;
2637} 2637}
2638 2638
2639static struct snd_ac97_build_ops patch_alc650_ops = { 2639static const struct snd_ac97_build_ops patch_alc650_ops = {
2640 .build_specific = patch_alc650_specific, 2640 .build_specific = patch_alc650_specific,
2641 .update_jacks = alc650_update_jacks 2641 .update_jacks = alc650_update_jacks
2642}; 2642};
@@ -2788,7 +2788,7 @@ static int patch_alc655_specific(struct snd_ac97 * ac97)
2788 return 0; 2788 return 0;
2789} 2789}
2790 2790
2791static struct snd_ac97_build_ops patch_alc655_ops = { 2791static const struct snd_ac97_build_ops patch_alc655_ops = {
2792 .build_specific = patch_alc655_specific, 2792 .build_specific = patch_alc655_specific,
2793 .update_jacks = alc655_update_jacks 2793 .update_jacks = alc655_update_jacks
2794}; 2794};
@@ -2900,7 +2900,7 @@ static int patch_alc850_specific(struct snd_ac97 *ac97)
2900 return 0; 2900 return 0;
2901} 2901}
2902 2902
2903static struct snd_ac97_build_ops patch_alc850_ops = { 2903static const struct snd_ac97_build_ops patch_alc850_ops = {
2904 .build_specific = patch_alc850_specific, 2904 .build_specific = patch_alc850_specific,
2905 .update_jacks = alc850_update_jacks 2905 .update_jacks = alc850_update_jacks
2906}; 2906};
@@ -2962,7 +2962,7 @@ static int patch_cm9738_specific(struct snd_ac97 * ac97)
2962 return patch_build_controls(ac97, snd_ac97_cm9738_controls, ARRAY_SIZE(snd_ac97_cm9738_controls)); 2962 return patch_build_controls(ac97, snd_ac97_cm9738_controls, ARRAY_SIZE(snd_ac97_cm9738_controls));
2963} 2963}
2964 2964
2965static struct snd_ac97_build_ops patch_cm9738_ops = { 2965static const struct snd_ac97_build_ops patch_cm9738_ops = {
2966 .build_specific = patch_cm9738_specific, 2966 .build_specific = patch_cm9738_specific,
2967 .update_jacks = cm9738_update_jacks 2967 .update_jacks = cm9738_update_jacks
2968}; 2968};
@@ -3053,7 +3053,7 @@ static int patch_cm9739_post_spdif(struct snd_ac97 * ac97)
3053 return patch_build_controls(ac97, snd_ac97_cm9739_controls_spdif, ARRAY_SIZE(snd_ac97_cm9739_controls_spdif)); 3053 return patch_build_controls(ac97, snd_ac97_cm9739_controls_spdif, ARRAY_SIZE(snd_ac97_cm9739_controls_spdif));
3054} 3054}
3055 3055
3056static struct snd_ac97_build_ops patch_cm9739_ops = { 3056static const struct snd_ac97_build_ops patch_cm9739_ops = {
3057 .build_specific = patch_cm9739_specific, 3057 .build_specific = patch_cm9739_specific,
3058 .build_post_spdif = patch_cm9739_post_spdif, 3058 .build_post_spdif = patch_cm9739_post_spdif,
3059 .update_jacks = cm9739_update_jacks 3059 .update_jacks = cm9739_update_jacks
@@ -3227,7 +3227,7 @@ static int patch_cm9761_specific(struct snd_ac97 * ac97)
3227 return patch_build_controls(ac97, snd_ac97_cm9761_controls, ARRAY_SIZE(snd_ac97_cm9761_controls)); 3227 return patch_build_controls(ac97, snd_ac97_cm9761_controls, ARRAY_SIZE(snd_ac97_cm9761_controls));
3228} 3228}
3229 3229
3230static struct snd_ac97_build_ops patch_cm9761_ops = { 3230static const struct snd_ac97_build_ops patch_cm9761_ops = {
3231 .build_specific = patch_cm9761_specific, 3231 .build_specific = patch_cm9761_specific,
3232 .build_post_spdif = patch_cm9761_post_spdif, 3232 .build_post_spdif = patch_cm9761_post_spdif,
3233 .update_jacks = cm9761_update_jacks 3233 .update_jacks = cm9761_update_jacks
@@ -3323,7 +3323,7 @@ static int patch_cm9780_specific(struct snd_ac97 *ac97)
3323 return patch_build_controls(ac97, cm9780_controls, ARRAY_SIZE(cm9780_controls)); 3323 return patch_build_controls(ac97, cm9780_controls, ARRAY_SIZE(cm9780_controls));
3324} 3324}
3325 3325
3326static struct snd_ac97_build_ops patch_cm9780_ops = { 3326static const struct snd_ac97_build_ops patch_cm9780_ops = {
3327 .build_specific = patch_cm9780_specific, 3327 .build_specific = patch_cm9780_specific,
3328 .build_post_spdif = patch_cm9761_post_spdif /* identical with CM9761 */ 3328 .build_post_spdif = patch_cm9761_post_spdif /* identical with CM9761 */
3329}; 3329};
@@ -3443,7 +3443,7 @@ static int patch_vt1616_specific(struct snd_ac97 * ac97)
3443 return 0; 3443 return 0;
3444} 3444}
3445 3445
3446static struct snd_ac97_build_ops patch_vt1616_ops = { 3446static const struct snd_ac97_build_ops patch_vt1616_ops = {
3447 .build_specific = patch_vt1616_specific 3447 .build_specific = patch_vt1616_specific
3448}; 3448};
3449 3449
@@ -3797,7 +3797,7 @@ static int patch_it2646_specific(struct snd_ac97 * ac97)
3797 return 0; 3797 return 0;
3798} 3798}
3799 3799
3800static struct snd_ac97_build_ops patch_it2646_ops = { 3800static const struct snd_ac97_build_ops patch_it2646_ops = {
3801 .build_specific = patch_it2646_specific, 3801 .build_specific = patch_it2646_specific,
3802 .update_jacks = it2646_update_jacks 3802 .update_jacks = it2646_update_jacks
3803}; 3803};
@@ -3831,7 +3831,7 @@ static int patch_si3036_specific(struct snd_ac97 * ac97)
3831 return 0; 3831 return 0;
3832} 3832}
3833 3833
3834static struct snd_ac97_build_ops patch_si3036_ops = { 3834static const struct snd_ac97_build_ops patch_si3036_ops = {
3835 .build_specific = patch_si3036_specific, 3835 .build_specific = patch_si3036_specific,
3836}; 3836};
3837 3837
@@ -3898,7 +3898,7 @@ static int patch_ucb1400_specific(struct snd_ac97 * ac97)
3898 return 0; 3898 return 0;
3899} 3899}
3900 3900
3901static struct snd_ac97_build_ops patch_ucb1400_ops = { 3901static const struct snd_ac97_build_ops patch_ucb1400_ops = {
3902 .build_specific = patch_ucb1400_specific, 3902 .build_specific = patch_ucb1400_specific,
3903}; 3903};
3904 3904
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index b9d2f202cf9b..5439d662d104 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -42,11 +42,7 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_adb = {
42 .rate_min = 5000, 42 .rate_min = 5000,
43 .rate_max = 48000, 43 .rate_max = 48000,
44 .channels_min = 1, 44 .channels_min = 1,
45#ifdef CHIP_AU8830
46 .channels_max = 4,
47#else
48 .channels_max = 2, 45 .channels_max = 2,
49#endif
50 .buffer_bytes_max = 0x10000, 46 .buffer_bytes_max = 0x10000,
51 .period_bytes_min = 0x1, 47 .period_bytes_min = 0x1,
52 .period_bytes_max = 0x1000, 48 .period_bytes_max = 0x1000,
@@ -115,6 +111,17 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_wt = {
115 .periods_max = 64, 111 .periods_max = 64,
116}; 112};
117#endif 113#endif
114#ifdef CHIP_AU8830
115static unsigned int au8830_channels[3] = {
116 1, 2, 4,
117};
118
119static struct snd_pcm_hw_constraint_list hw_constraints_au8830_channels = {
120 .count = ARRAY_SIZE(au8830_channels),
121 .list = au8830_channels,
122 .mask = 0,
123};
124#endif
118/* open callback */ 125/* open callback */
119static int snd_vortex_pcm_open(struct snd_pcm_substream *substream) 126static int snd_vortex_pcm_open(struct snd_pcm_substream *substream)
120{ 127{
@@ -156,6 +163,15 @@ static int snd_vortex_pcm_open(struct snd_pcm_substream *substream)
156 if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB 163 if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB
157 || VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_I2S) 164 || VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_I2S)
158 runtime->hw = snd_vortex_playback_hw_adb; 165 runtime->hw = snd_vortex_playback_hw_adb;
166#ifdef CHIP_AU8830
167 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
168 VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB) {
169 runtime->hw.channels_max = 4;
170 snd_pcm_hw_constraint_list(runtime, 0,
171 SNDRV_PCM_HW_PARAM_CHANNELS,
172 &hw_constraints_au8830_channels);
173 }
174#endif
159 substream->runtime->private_data = NULL; 175 substream->runtime->private_data = NULL;
160 } 176 }
161#ifndef CHIP_AU8810 177#ifndef CHIP_AU8810
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 6117595fc075..573594bf3225 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -979,31 +979,25 @@ snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec,
979 979
980 snd_azf3328_dbgcallenter(); 980 snd_azf3328_dbgcallenter();
981 switch (bitrate) { 981 switch (bitrate) {
982#define AZF_FMT_XLATE(in_freq, out_bits) \ 982 case AZF_FREQ_4000: freq = SOUNDFORMAT_FREQ_SUSPECTED_4000; break;
983 do { \ 983 case AZF_FREQ_4800: freq = SOUNDFORMAT_FREQ_SUSPECTED_4800; break;
984 case AZF_FREQ_ ## in_freq: \ 984 case AZF_FREQ_5512:
985 freq = SOUNDFORMAT_FREQ_ ## out_bits; \ 985 /* the AZF3328 names it "5510" for some strange reason */
986 break; \ 986 freq = SOUNDFORMAT_FREQ_5510; break;
987 } while (0); 987 case AZF_FREQ_6620: freq = SOUNDFORMAT_FREQ_6620; break;
988 AZF_FMT_XLATE(4000, SUSPECTED_4000) 988 case AZF_FREQ_8000: freq = SOUNDFORMAT_FREQ_8000; break;
989 AZF_FMT_XLATE(4800, SUSPECTED_4800) 989 case AZF_FREQ_9600: freq = SOUNDFORMAT_FREQ_9600; break;
990 /* the AZF3328 names it "5510" for some strange reason: */ 990 case AZF_FREQ_11025: freq = SOUNDFORMAT_FREQ_11025; break;
991 AZF_FMT_XLATE(5512, 5510) 991 case AZF_FREQ_13240: freq = SOUNDFORMAT_FREQ_SUSPECTED_13240; break;
992 AZF_FMT_XLATE(6620, 6620) 992 case AZF_FREQ_16000: freq = SOUNDFORMAT_FREQ_16000; break;
993 AZF_FMT_XLATE(8000, 8000) 993 case AZF_FREQ_22050: freq = SOUNDFORMAT_FREQ_22050; break;
994 AZF_FMT_XLATE(9600, 9600) 994 case AZF_FREQ_32000: freq = SOUNDFORMAT_FREQ_32000; break;
995 AZF_FMT_XLATE(11025, 11025)
996 AZF_FMT_XLATE(13240, SUSPECTED_13240)
997 AZF_FMT_XLATE(16000, 16000)
998 AZF_FMT_XLATE(22050, 22050)
999 AZF_FMT_XLATE(32000, 32000)
1000 default: 995 default:
1001 snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate); 996 snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate);
1002 /* fall-through */ 997 /* fall-through */
1003 AZF_FMT_XLATE(44100, 44100) 998 case AZF_FREQ_44100: freq = SOUNDFORMAT_FREQ_44100; break;
1004 AZF_FMT_XLATE(48000, 48000) 999 case AZF_FREQ_48000: freq = SOUNDFORMAT_FREQ_48000; break;
1005 AZF_FMT_XLATE(66200, SUSPECTED_66200) 1000 case AZF_FREQ_66200: freq = SOUNDFORMAT_FREQ_SUSPECTED_66200; break;
1006#undef AZF_FMT_XLATE
1007 } 1001 }
1008 /* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */ 1002 /* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */
1009 /* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */ 1003 /* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */
diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c
index a3301cc4ab82..185b00088320 100644
--- a/sound/pci/cs5535audio/cs5535audio_pm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pm.c
@@ -90,12 +90,7 @@ int snd_cs5535audio_resume(struct pci_dev *pci)
90 int i; 90 int i;
91 91
92 pci_set_power_state(pci, PCI_D0); 92 pci_set_power_state(pci, PCI_D0);
93 if (pci_restore_state(pci) < 0) { 93 pci_restore_state(pci);
94 printk(KERN_ERR "cs5535audio: pci_restore_state failed, "
95 "disabling device\n");
96 snd_card_disconnect(card);
97 return -EIO;
98 }
99 if (pci_enable_device(pci) < 0) { 94 if (pci_enable_device(pci) < 0) {
100 printk(KERN_ERR "cs5535audio: pci_enable_device failed, " 95 printk(KERN_ERR "cs5535audio: pci_enable_device failed, "
101 "disabling device\n"); 96 "disabling device\n");
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 05e5ec88c2d9..ae5c5d5e4b7c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2134,10 +2134,10 @@ int snd_hda_codec_reset(struct hda_codec *codec)
2134 * This function returns zero if successful or a negative error code. 2134 * This function returns zero if successful or a negative error code.
2135 */ 2135 */
2136int snd_hda_add_vmaster(struct hda_codec *codec, char *name, 2136int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
2137 unsigned int *tlv, const char **slaves) 2137 unsigned int *tlv, const char * const *slaves)
2138{ 2138{
2139 struct snd_kcontrol *kctl; 2139 struct snd_kcontrol *kctl;
2140 const char **s; 2140 const char * const *s;
2141 int err; 2141 int err;
2142 2142
2143 for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++) 2143 for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++)
@@ -3689,7 +3689,7 @@ EXPORT_SYMBOL_HDA(snd_hda_build_pcms);
3689 * If no entries are matching, the function returns a negative value. 3689 * If no entries are matching, the function returns a negative value.
3690 */ 3690 */
3691int snd_hda_check_board_config(struct hda_codec *codec, 3691int snd_hda_check_board_config(struct hda_codec *codec,
3692 int num_configs, const char **models, 3692 int num_configs, const char * const *models,
3693 const struct snd_pci_quirk *tbl) 3693 const struct snd_pci_quirk *tbl)
3694{ 3694{
3695 if (codec->modelname && models) { 3695 if (codec->modelname && models) {
@@ -3753,7 +3753,7 @@ EXPORT_SYMBOL_HDA(snd_hda_check_board_config);
3753 * If no entries are matching, the function returns a negative value. 3753 * If no entries are matching, the function returns a negative value.
3754 */ 3754 */
3755int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, 3755int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
3756 int num_configs, const char **models, 3756 int num_configs, const char * const *models,
3757 const struct snd_pci_quirk *tbl) 3757 const struct snd_pci_quirk *tbl)
3758{ 3758{
3759 const struct snd_pci_quirk *q; 3759 const struct snd_pci_quirk *q;
@@ -4690,7 +4690,7 @@ const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin,
4690 int check_location) 4690 int check_location)
4691{ 4691{
4692 unsigned int def_conf; 4692 unsigned int def_conf;
4693 static const char *mic_names[] = { 4693 static const char * const mic_names[] = {
4694 "Internal Mic", "Dock Mic", "Mic", "Front Mic", "Rear Mic", 4694 "Internal Mic", "Dock Mic", "Mic", "Front Mic", "Rear Mic",
4695 }; 4695 };
4696 int attr; 4696 int attr;
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 4a663471dadc..74b0560289c0 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -381,7 +381,7 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a)
381 snd_print_pcm_rates(a->rates, buf, sizeof(buf)); 381 snd_print_pcm_rates(a->rates, buf, sizeof(buf));
382 382
383 if (a->format == AUDIO_CODING_TYPE_LPCM) 383 if (a->format == AUDIO_CODING_TYPE_LPCM)
384 snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2 - 8)); 384 snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8);
385 else if (a->max_bitrate) 385 else if (a->max_bitrate)
386 snprintf(buf2, sizeof(buf2), 386 snprintf(buf2, sizeof(buf2),
387 ", max bitrate = %d", a->max_bitrate); 387 ", max bitrate = %d", a->max_bitrate);
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index fb0582f8d725..a63c54d9d767 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -762,7 +762,8 @@ static int check_existing_control(struct hda_codec *codec, const char *type, con
762/* 762/*
763 * build output mixer controls 763 * build output mixer controls
764 */ 764 */
765static int create_output_mixers(struct hda_codec *codec, const char **names) 765static int create_output_mixers(struct hda_codec *codec,
766 const char * const *names)
766{ 767{
767 struct hda_gspec *spec = codec->spec; 768 struct hda_gspec *spec = codec->spec;
768 int i, err; 769 int i, err;
@@ -780,8 +781,8 @@ static int create_output_mixers(struct hda_codec *codec, const char **names)
780static int build_output_controls(struct hda_codec *codec) 781static int build_output_controls(struct hda_codec *codec)
781{ 782{
782 struct hda_gspec *spec = codec->spec; 783 struct hda_gspec *spec = codec->spec;
783 static const char *types_speaker[] = { "Speaker", "Headphone" }; 784 static const char * const types_speaker[] = { "Speaker", "Headphone" };
784 static const char *types_line[] = { "Front", "Headphone" }; 785 static const char * const types_line[] = { "Front", "Headphone" };
785 786
786 switch (spec->pcm_vol_nodes) { 787 switch (spec->pcm_vol_nodes) {
787 case 1: 788 case 1:
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index d3d18be483e1..0baffcdee8f9 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2703,7 +2703,7 @@ static int __devinit azx_probe(struct pci_dev *pci,
2703 if (err < 0) 2703 if (err < 0)
2704 goto out_free; 2704 goto out_free;
2705#ifdef CONFIG_SND_HDA_PATCH_LOADER 2705#ifdef CONFIG_SND_HDA_PATCH_LOADER
2706 if (patch[dev]) { 2706 if (patch[dev] && *patch[dev]) {
2707 snd_printk(KERN_ERR SFX "Applying patch firmware '%s'\n", 2707 snd_printk(KERN_ERR SFX "Applying patch firmware '%s'\n",
2708 patch[dev]); 2708 patch[dev]);
2709 err = snd_hda_load_patch(chip->bus, patch[dev]); 2709 err = snd_hda_load_patch(chip->bus, patch[dev]);
@@ -2809,6 +2809,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
2809#endif 2809#endif
2810 /* Vortex86MX */ 2810 /* Vortex86MX */
2811 { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC }, 2811 { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC },
2812 /* VMware HDAudio */
2813 { PCI_DEVICE(0x15ad, 0x1977), .driver_data = AZX_DRIVER_GENERIC },
2812 /* AMD/ATI Generic, PCI class code and Vendor ID for HD Audio */ 2814 /* AMD/ATI Generic, PCI class code and Vendor ID for HD Audio */
2813 { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID), 2815 { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID),
2814 .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, 2816 .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 46bbefe2e4a9..3ab5e7a303db 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -140,7 +140,7 @@ void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir,
140struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, 140struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
141 const char *name); 141 const char *name);
142int snd_hda_add_vmaster(struct hda_codec *codec, char *name, 142int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
143 unsigned int *tlv, const char **slaves); 143 unsigned int *tlv, const char * const *slaves);
144int snd_hda_codec_reset(struct hda_codec *codec); 144int snd_hda_codec_reset(struct hda_codec *codec);
145 145
146/* amp value bits */ 146/* amp value bits */
@@ -341,10 +341,10 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen);
341 * Misc 341 * Misc
342 */ 342 */
343int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, 343int snd_hda_check_board_config(struct hda_codec *codec, int num_configs,
344 const char **modelnames, 344 const char * const *modelnames,
345 const struct snd_pci_quirk *pci_list); 345 const struct snd_pci_quirk *pci_list);
346int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, 346int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
347 int num_configs, const char **models, 347 int num_configs, const char * const *models,
348 const struct snd_pci_quirk *tbl); 348 const struct snd_pci_quirk *tbl);
349int snd_hda_add_new_ctls(struct hda_codec *codec, 349int snd_hda_add_new_ctls(struct hda_codec *codec,
350 struct snd_kcontrol_new *knew); 350 struct snd_kcontrol_new *knew);
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index f025200f2a62..bfe74c2fb079 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -418,7 +418,7 @@ static void print_digital_conv(struct snd_info_buffer *buffer,
418 418
419static const char *get_pwr_state(u32 state) 419static const char *get_pwr_state(u32 state)
420{ 420{
421 static const char *buf[4] = { 421 static const char * const buf[4] = {
422 "D0", "D1", "D2", "D3" 422 "D0", "D1", "D2", "D3"
423 }; 423 };
424 if (state < 4) 424 if (state < 4)
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 46780670162b..8dabab798689 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -46,6 +46,9 @@ struct ad198x_spec {
46 unsigned int cur_eapd; 46 unsigned int cur_eapd;
47 unsigned int need_dac_fix; 47 unsigned int need_dac_fix;
48 48
49 hda_nid_t *alt_dac_nid;
50 struct hda_pcm_stream *stream_analog_alt_playback;
51
49 /* capture */ 52 /* capture */
50 unsigned int num_adc_nids; 53 unsigned int num_adc_nids;
51 hda_nid_t *adc_nids; 54 hda_nid_t *adc_nids;
@@ -81,8 +84,8 @@ struct ad198x_spec {
81#endif 84#endif
82 /* for virtual master */ 85 /* for virtual master */
83 hda_nid_t vmaster_nid; 86 hda_nid_t vmaster_nid;
84 const char **slave_vols; 87 const char * const *slave_vols;
85 const char **slave_sws; 88 const char * const *slave_sws;
86}; 89};
87 90
88/* 91/*
@@ -130,7 +133,7 @@ static int ad198x_init(struct hda_codec *codec)
130 return 0; 133 return 0;
131} 134}
132 135
133static const char *ad_slave_vols[] = { 136static const char * const ad_slave_vols[] = {
134 "Front Playback Volume", 137 "Front Playback Volume",
135 "Surround Playback Volume", 138 "Surround Playback Volume",
136 "Center Playback Volume", 139 "Center Playback Volume",
@@ -143,7 +146,7 @@ static const char *ad_slave_vols[] = {
143 NULL 146 NULL
144}; 147};
145 148
146static const char *ad_slave_sws[] = { 149static const char * const ad_slave_sws[] = {
147 "Front Playback Switch", 150 "Front Playback Switch",
148 "Surround Playback Switch", 151 "Surround Playback Switch",
149 "Center Playback Switch", 152 "Center Playback Switch",
@@ -156,6 +159,25 @@ static const char *ad_slave_sws[] = {
156 NULL 159 NULL
157}; 160};
158 161
162static const char * const ad1988_6stack_fp_slave_vols[] = {
163 "Front Playback Volume",
164 "Surround Playback Volume",
165 "Center Playback Volume",
166 "LFE Playback Volume",
167 "Side Playback Volume",
168 "IEC958 Playback Volume",
169 NULL
170};
171
172static const char * const ad1988_6stack_fp_slave_sws[] = {
173 "Front Playback Switch",
174 "Surround Playback Switch",
175 "Center Playback Switch",
176 "LFE Playback Switch",
177 "Side Playback Switch",
178 "IEC958 Playback Switch",
179 NULL
180};
159static void ad198x_free_kctls(struct hda_codec *codec); 181static void ad198x_free_kctls(struct hda_codec *codec);
160 182
161#ifdef CONFIG_SND_HDA_INPUT_BEEP 183#ifdef CONFIG_SND_HDA_INPUT_BEEP
@@ -309,6 +331,38 @@ static int ad198x_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
309 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); 331 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
310} 332}
311 333
334static int ad198x_alt_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
335 struct hda_codec *codec,
336 unsigned int stream_tag,
337 unsigned int format,
338 struct snd_pcm_substream *substream)
339{
340 struct ad198x_spec *spec = codec->spec;
341 snd_hda_codec_setup_stream(codec, spec->alt_dac_nid[0], stream_tag,
342 0, format);
343 return 0;
344}
345
346static int ad198x_alt_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
347 struct hda_codec *codec,
348 struct snd_pcm_substream *substream)
349{
350 struct ad198x_spec *spec = codec->spec;
351 snd_hda_codec_cleanup_stream(codec, spec->alt_dac_nid[0]);
352 return 0;
353}
354
355static struct hda_pcm_stream ad198x_pcm_analog_alt_playback = {
356 .substreams = 1,
357 .channels_min = 2,
358 .channels_max = 2,
359 /* NID is set in ad198x_build_pcms */
360 .ops = {
361 .prepare = ad198x_alt_playback_pcm_prepare,
362 .cleanup = ad198x_alt_playback_pcm_cleanup
363 },
364};
365
312/* 366/*
313 * Digital out 367 * Digital out
314 */ 368 */
@@ -446,6 +500,17 @@ static int ad198x_build_pcms(struct hda_codec *codec)
446 } 500 }
447 } 501 }
448 502
503 if (spec->alt_dac_nid && spec->stream_analog_alt_playback) {
504 codec->num_pcms++;
505 info = spec->pcm_rec + 2;
506 info->name = "AD198x Headphone";
507 info->pcm_type = HDA_PCM_TYPE_AUDIO;
508 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
509 *spec->stream_analog_alt_playback;
510 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
511 spec->alt_dac_nid[0];
512 }
513
449 return 0; 514 return 0;
450} 515}
451 516
@@ -1069,7 +1134,7 @@ enum {
1069 AD1986A_MODELS 1134 AD1986A_MODELS
1070}; 1135};
1071 1136
1072static const char *ad1986a_models[AD1986A_MODELS] = { 1137static const char * const ad1986a_models[AD1986A_MODELS] = {
1073 [AD1986A_6STACK] = "6stack", 1138 [AD1986A_6STACK] = "6stack",
1074 [AD1986A_3STACK] = "3stack", 1139 [AD1986A_3STACK] = "3stack",
1075 [AD1986A_LAPTOP] = "laptop", 1140 [AD1986A_LAPTOP] = "laptop",
@@ -1813,7 +1878,7 @@ enum {
1813 AD1981_MODELS 1878 AD1981_MODELS
1814}; 1879};
1815 1880
1816static const char *ad1981_models[AD1981_MODELS] = { 1881static const char * const ad1981_models[AD1981_MODELS] = {
1817 [AD1981_HP] = "hp", 1882 [AD1981_HP] = "hp",
1818 [AD1981_THINKPAD] = "thinkpad", 1883 [AD1981_THINKPAD] = "thinkpad",
1819 [AD1981_BASIC] = "basic", 1884 [AD1981_BASIC] = "basic",
@@ -2015,6 +2080,7 @@ static int patch_ad1981(struct hda_codec *codec)
2015enum { 2080enum {
2016 AD1988_6STACK, 2081 AD1988_6STACK,
2017 AD1988_6STACK_DIG, 2082 AD1988_6STACK_DIG,
2083 AD1988_6STACK_DIG_FP,
2018 AD1988_3STACK, 2084 AD1988_3STACK,
2019 AD1988_3STACK_DIG, 2085 AD1988_3STACK_DIG,
2020 AD1988_LAPTOP, 2086 AD1988_LAPTOP,
@@ -2047,6 +2113,10 @@ static hda_nid_t ad1988_6stack_dac_nids_rev2[4] = {
2047 0x04, 0x05, 0x0a, 0x06 2113 0x04, 0x05, 0x0a, 0x06
2048}; 2114};
2049 2115
2116static hda_nid_t ad1988_alt_dac_nid[1] = {
2117 0x03
2118};
2119
2050static hda_nid_t ad1988_3stack_dac_nids_rev2[3] = { 2120static hda_nid_t ad1988_3stack_dac_nids_rev2[3] = {
2051 0x04, 0x0a, 0x06 2121 0x04, 0x0a, 0x06
2052}; 2122};
@@ -2166,6 +2236,35 @@ static struct snd_kcontrol_new ad1988_6stack_mixers2[] = {
2166 { } /* end */ 2236 { } /* end */
2167}; 2237};
2168 2238
2239static struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = {
2240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
2241
2242 HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT),
2243 HDA_BIND_MUTE("Surround Playback Switch", 0x2a, 2, HDA_INPUT),
2244 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x27, 1, 2, HDA_INPUT),
2245 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x27, 2, 2, HDA_INPUT),
2246 HDA_BIND_MUTE("Side Playback Switch", 0x28, 2, HDA_INPUT),
2247 HDA_BIND_MUTE("Headphone Playback Switch", 0x22, 2, HDA_INPUT),
2248 HDA_BIND_MUTE("Mono Playback Switch", 0x1e, 2, HDA_INPUT),
2249
2250 HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x6, HDA_INPUT),
2251 HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x6, HDA_INPUT),
2252 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x0, HDA_INPUT),
2253 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x0, HDA_INPUT),
2254 HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT),
2255 HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT),
2256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT),
2257 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT),
2258
2259 HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT),
2260 HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT),
2261
2262 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x39, 0x0, HDA_OUTPUT),
2263 HDA_CODEC_VOLUME("Mic Boost Volume", 0x3c, 0x0, HDA_OUTPUT),
2264
2265 { } /* end */
2266};
2267
2169/* 3-stack mode */ 2268/* 3-stack mode */
2170static struct snd_kcontrol_new ad1988_3stack_mixers1[] = { 2269static struct snd_kcontrol_new ad1988_3stack_mixers1[] = {
2171 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), 2270 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
@@ -2445,6 +2544,68 @@ static struct hda_verb ad1988_6stack_init_verbs[] = {
2445 { } 2544 { }
2446}; 2545};
2447 2546
2547static struct hda_verb ad1988_6stack_fp_init_verbs[] = {
2548 /* Front, Surround, CLFE, side DAC; unmute as default */
2549 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2550 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2551 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2552 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2553 /* Headphone; unmute as default */
2554 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2555 /* Port-A front headphon path */
2556 {0x37, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC0:03h */
2557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2558 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2559 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2560 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2561 /* Port-D line-out path */
2562 {0x29, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2563 {0x29, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2564 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2565 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2566 /* Port-F surround path */
2567 {0x2a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2568 {0x2a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2569 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2570 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2571 /* Port-G CLFE path */
2572 {0x27, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2573 {0x27, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2575 {0x24, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2576 /* Port-H side path */
2577 {0x28, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2578 {0x28, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2579 {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2580 {0x25, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2581 /* Mono out path */
2582 {0x36, AC_VERB_SET_CONNECT_SEL, 0x1}, /* DAC1:04h */
2583 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2584 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2585 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2586 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, 0xb01f}, /* unmute, 0dB */
2587 /* Port-B front mic-in path */
2588 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2590 {0x39, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2591 /* Port-C line-in path */
2592 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2593 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2594 {0x3a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2595 {0x33, AC_VERB_SET_CONNECT_SEL, 0x0},
2596 /* Port-E mic-in path */
2597 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2598 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2599 {0x3c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2600 {0x34, AC_VERB_SET_CONNECT_SEL, 0x0},
2601 /* Analog CD Input */
2602 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2603 /* Analog Mix output amp */
2604 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */
2605
2606 { }
2607};
2608
2448static struct hda_verb ad1988_capture_init_verbs[] = { 2609static struct hda_verb ad1988_capture_init_verbs[] = {
2449 /* mute analog mix */ 2610 /* mute analog mix */
2450 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 2611 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
@@ -2792,7 +2953,9 @@ static int ad1988_auto_create_multi_out_ctls(struct ad198x_spec *spec,
2792 const struct auto_pin_cfg *cfg) 2953 const struct auto_pin_cfg *cfg)
2793{ 2954{
2794 char name[32]; 2955 char name[32];
2795 static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; 2956 static const char * const chname[4] = {
2957 "Front", "Surround", NULL /*CLFE*/, "Side"
2958 };
2796 hda_nid_t nid; 2959 hda_nid_t nid;
2797 int i, err; 2960 int i, err;
2798 2961
@@ -3074,13 +3237,13 @@ static int ad1988_auto_init(struct hda_codec *codec)
3074 return 0; 3237 return 0;
3075} 3238}
3076 3239
3077
3078/* 3240/*
3079 */ 3241 */
3080 3242
3081static const char *ad1988_models[AD1988_MODEL_LAST] = { 3243static const char * const ad1988_models[AD1988_MODEL_LAST] = {
3082 [AD1988_6STACK] = "6stack", 3244 [AD1988_6STACK] = "6stack",
3083 [AD1988_6STACK_DIG] = "6stack-dig", 3245 [AD1988_6STACK_DIG] = "6stack-dig",
3246 [AD1988_6STACK_DIG_FP] = "6stack-dig-fp",
3084 [AD1988_3STACK] = "3stack", 3247 [AD1988_3STACK] = "3stack",
3085 [AD1988_3STACK_DIG] = "3stack-dig", 3248 [AD1988_3STACK_DIG] = "3stack-dig",
3086 [AD1988_LAPTOP] = "laptop", 3249 [AD1988_LAPTOP] = "laptop",
@@ -3140,6 +3303,7 @@ static int patch_ad1988(struct hda_codec *codec)
3140 switch (board_config) { 3303 switch (board_config) {
3141 case AD1988_6STACK: 3304 case AD1988_6STACK:
3142 case AD1988_6STACK_DIG: 3305 case AD1988_6STACK_DIG:
3306 case AD1988_6STACK_DIG_FP:
3143 spec->multiout.max_channels = 8; 3307 spec->multiout.max_channels = 8;
3144 spec->multiout.num_dacs = 4; 3308 spec->multiout.num_dacs = 4;
3145 if (is_rev2(codec)) 3309 if (is_rev2(codec))
@@ -3152,10 +3316,22 @@ static int patch_ad1988(struct hda_codec *codec)
3152 spec->mixers[0] = ad1988_6stack_mixers1_rev2; 3316 spec->mixers[0] = ad1988_6stack_mixers1_rev2;
3153 else 3317 else
3154 spec->mixers[0] = ad1988_6stack_mixers1; 3318 spec->mixers[0] = ad1988_6stack_mixers1;
3155 spec->mixers[1] = ad1988_6stack_mixers2; 3319 if (board_config == AD1988_6STACK_DIG_FP) {
3320 spec->mixers[1] = ad1988_6stack_fp_mixers;
3321 spec->slave_vols = ad1988_6stack_fp_slave_vols;
3322 spec->slave_sws = ad1988_6stack_fp_slave_sws;
3323 spec->alt_dac_nid = ad1988_alt_dac_nid;
3324 spec->stream_analog_alt_playback =
3325 &ad198x_pcm_analog_alt_playback;
3326 } else
3327 spec->mixers[1] = ad1988_6stack_mixers2;
3156 spec->num_init_verbs = 1; 3328 spec->num_init_verbs = 1;
3157 spec->init_verbs[0] = ad1988_6stack_init_verbs; 3329 if (board_config == AD1988_6STACK_DIG_FP)
3158 if (board_config == AD1988_6STACK_DIG) { 3330 spec->init_verbs[0] = ad1988_6stack_fp_init_verbs;
3331 else
3332 spec->init_verbs[0] = ad1988_6stack_init_verbs;
3333 if ((board_config == AD1988_6STACK_DIG) ||
3334 (board_config == AD1988_6STACK_DIG_FP)) {
3159 spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; 3335 spec->multiout.dig_out_nid = AD1988_SPDIF_OUT;
3160 spec->dig_in_nid = AD1988_SPDIF_IN; 3336 spec->dig_in_nid = AD1988_SPDIF_IN;
3161 } 3337 }
@@ -3399,7 +3575,7 @@ static struct hda_amp_list ad1884_loopbacks[] = {
3399}; 3575};
3400#endif 3576#endif
3401 3577
3402static const char *ad1884_slave_vols[] = { 3578static const char * const ad1884_slave_vols[] = {
3403 "PCM Playback Volume", 3579 "PCM Playback Volume",
3404 "Mic Playback Volume", 3580 "Mic Playback Volume",
3405 "Mono Playback Volume", 3581 "Mono Playback Volume",
@@ -3637,7 +3813,7 @@ enum {
3637 AD1984_MODELS 3813 AD1984_MODELS
3638}; 3814};
3639 3815
3640static const char *ad1984_models[AD1984_MODELS] = { 3816static const char * const ad1984_models[AD1984_MODELS] = {
3641 [AD1984_BASIC] = "basic", 3817 [AD1984_BASIC] = "basic",
3642 [AD1984_THINKPAD] = "thinkpad", 3818 [AD1984_THINKPAD] = "thinkpad",
3643 [AD1984_DELL_DESKTOP] = "dell_desktop", 3819 [AD1984_DELL_DESKTOP] = "dell_desktop",
@@ -4308,7 +4484,7 @@ enum {
4308 AD1884A_MODELS 4484 AD1884A_MODELS
4309}; 4485};
4310 4486
4311static const char *ad1884a_models[AD1884A_MODELS] = { 4487static const char * const ad1884a_models[AD1884A_MODELS] = {
4312 [AD1884A_DESKTOP] = "desktop", 4488 [AD1884A_DESKTOP] = "desktop",
4313 [AD1884A_LAPTOP] = "laptop", 4489 [AD1884A_LAPTOP] = "laptop",
4314 [AD1884A_MOBILE] = "mobile", 4490 [AD1884A_MOBILE] = "mobile",
@@ -4696,7 +4872,7 @@ enum {
4696 AD1882_MODELS 4872 AD1882_MODELS
4697}; 4873};
4698 4874
4699static const char *ad1882_models[AD1986A_MODELS] = { 4875static const char * const ad1882_models[AD1986A_MODELS] = {
4700 [AD1882_3STACK] = "3stack", 4876 [AD1882_3STACK] = "3stack",
4701 [AD1882_6STACK] = "6stack", 4877 [AD1882_6STACK] = "6stack",
4702}; 4878};
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 18af38ebf757..a07b031090d8 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -490,7 +490,7 @@ static int parse_digital_input(struct hda_codec *codec)
490 * create mixer controls 490 * create mixer controls
491 */ 491 */
492 492
493static const char *dir_sfx[2] = { "Playback", "Capture" }; 493static const char * const dir_sfx[2] = { "Playback", "Capture" };
494 494
495static int add_mute(struct hda_codec *codec, const char *name, int index, 495static int add_mute(struct hda_codec *codec, const char *name, int index,
496 unsigned int pval, int dir, struct snd_kcontrol **kctlp) 496 unsigned int pval, int dir, struct snd_kcontrol **kctlp)
@@ -1156,7 +1156,7 @@ static int cs_parse_auto_config(struct hda_codec *codec)
1156 return 0; 1156 return 0;
1157} 1157}
1158 1158
1159static const char *cs420x_models[CS420X_MODELS] = { 1159static const char * const cs420x_models[CS420X_MODELS] = {
1160 [CS420X_MBP53] = "mbp53", 1160 [CS420X_MBP53] = "mbp53",
1161 [CS420X_MBP55] = "mbp55", 1161 [CS420X_MBP55] = "mbp55",
1162 [CS420X_IMAC27] = "imac27", 1162 [CS420X_IMAC27] = "imac27",
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index ff60908f4554..1f8bbcd0f802 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -608,7 +608,7 @@ static void cmi9880_free(struct hda_codec *codec)
608/* 608/*
609 */ 609 */
610 610
611static const char *cmi9880_models[CMI_MODELS] = { 611static const char * const cmi9880_models[CMI_MODELS] = {
612 [CMI_MINIMAL] = "minimal", 612 [CMI_MINIMAL] = "minimal",
613 [CMI_MIN_FP] = "min_fp", 613 [CMI_MIN_FP] = "min_fp",
614 [CMI_FULL] = "full", 614 [CMI_FULL] = "full",
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index e96581fcdbdb..fbe97d32140d 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -85,6 +85,7 @@ struct conexant_spec {
85 unsigned int auto_mic; 85 unsigned int auto_mic;
86 int auto_mic_ext; /* autocfg.inputs[] index for ext mic */ 86 int auto_mic_ext; /* autocfg.inputs[] index for ext mic */
87 unsigned int need_dac_fix; 87 unsigned int need_dac_fix;
88 hda_nid_t slave_dig_outs[2];
88 89
89 /* capture */ 90 /* capture */
90 unsigned int num_adc_nids; 91 unsigned int num_adc_nids;
@@ -127,6 +128,7 @@ struct conexant_spec {
127 unsigned int ideapad:1; 128 unsigned int ideapad:1;
128 unsigned int thinkpad:1; 129 unsigned int thinkpad:1;
129 unsigned int hp_laptop:1; 130 unsigned int hp_laptop:1;
131 unsigned int asus:1;
130 132
131 unsigned int ext_mic_present; 133 unsigned int ext_mic_present;
132 unsigned int recording; 134 unsigned int recording;
@@ -352,6 +354,8 @@ static int conexant_build_pcms(struct hda_codec *codec)
352 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 354 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
353 spec->dig_in_nid; 355 spec->dig_in_nid;
354 } 356 }
357 if (spec->slave_dig_outs[0])
358 codec->slave_dig_outs = spec->slave_dig_outs;
355 } 359 }
356 360
357 return 0; 361 return 0;
@@ -403,10 +407,16 @@ static int conexant_add_jack(struct hda_codec *codec,
403 struct conexant_spec *spec; 407 struct conexant_spec *spec;
404 struct conexant_jack *jack; 408 struct conexant_jack *jack;
405 const char *name; 409 const char *name;
406 int err; 410 int i, err;
407 411
408 spec = codec->spec; 412 spec = codec->spec;
409 snd_array_init(&spec->jacks, sizeof(*jack), 32); 413 snd_array_init(&spec->jacks, sizeof(*jack), 32);
414
415 jack = spec->jacks.list;
416 for (i = 0; i < spec->jacks.used; i++, jack++)
417 if (jack->nid == nid)
418 return 0 ; /* already present */
419
410 jack = snd_array_new(&spec->jacks); 420 jack = snd_array_new(&spec->jacks);
411 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; 421 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
412 422
@@ -537,13 +547,13 @@ static struct snd_kcontrol_new cxt_beep_mixer[] = {
537}; 547};
538#endif 548#endif
539 549
540static const char *slave_vols[] = { 550static const char * const slave_vols[] = {
541 "Headphone Playback Volume", 551 "Headphone Playback Volume",
542 "Speaker Playback Volume", 552 "Speaker Playback Volume",
543 NULL 553 NULL
544}; 554};
545 555
546static const char *slave_sws[] = { 556static const char * const slave_sws[] = {
547 "Headphone Playback Switch", 557 "Headphone Playback Switch",
548 "Speaker Playback Switch", 558 "Speaker Playback Switch",
549 NULL 559 NULL
@@ -1134,7 +1144,7 @@ enum {
1134 CXT5045_MODELS 1144 CXT5045_MODELS
1135}; 1145};
1136 1146
1137static const char *cxt5045_models[CXT5045_MODELS] = { 1147static const char * const cxt5045_models[CXT5045_MODELS] = {
1138 [CXT5045_LAPTOP_HPSENSE] = "laptop-hpsense", 1148 [CXT5045_LAPTOP_HPSENSE] = "laptop-hpsense",
1139 [CXT5045_LAPTOP_MICSENSE] = "laptop-micsense", 1149 [CXT5045_LAPTOP_MICSENSE] = "laptop-micsense",
1140 [CXT5045_LAPTOP_HPMICSENSE] = "laptop-hpmicsense", 1150 [CXT5045_LAPTOP_HPMICSENSE] = "laptop-hpmicsense",
@@ -1579,7 +1589,7 @@ enum {
1579 CXT5047_MODELS 1589 CXT5047_MODELS
1580}; 1590};
1581 1591
1582static const char *cxt5047_models[CXT5047_MODELS] = { 1592static const char * const cxt5047_models[CXT5047_MODELS] = {
1583 [CXT5047_LAPTOP] = "laptop", 1593 [CXT5047_LAPTOP] = "laptop",
1584 [CXT5047_LAPTOP_HP] = "laptop-hp", 1594 [CXT5047_LAPTOP_HP] = "laptop-hp",
1585 [CXT5047_LAPTOP_EAPD] = "laptop-eapd", 1595 [CXT5047_LAPTOP_EAPD] = "laptop-eapd",
@@ -1995,7 +2005,7 @@ enum {
1995 CXT5051_MODELS 2005 CXT5051_MODELS
1996}; 2006};
1997 2007
1998static const char *cxt5051_models[CXT5051_MODELS] = { 2008static const char *const cxt5051_models[CXT5051_MODELS] = {
1999 [CXT5051_LAPTOP] = "laptop", 2009 [CXT5051_LAPTOP] = "laptop",
2000 [CXT5051_HP] = "hp", 2010 [CXT5051_HP] = "hp",
2001 [CXT5051_HP_DV6736] = "hp-dv6736", 2011 [CXT5051_HP_DV6736] = "hp-dv6736",
@@ -2100,7 +2110,7 @@ static int patch_cxt5051(struct hda_codec *codec)
2100static hda_nid_t cxt5066_dac_nids[1] = { 0x10 }; 2110static hda_nid_t cxt5066_dac_nids[1] = { 0x10 };
2101static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 }; 2111static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 };
2102static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 }; 2112static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 };
2103#define CXT5066_SPDIF_OUT 0x21 2113static hda_nid_t cxt5066_digout_pin_nids[2] = { 0x20, 0x22 };
2104 2114
2105/* OLPC's microphone port is DC coupled for use with external sensors, 2115/* OLPC's microphone port is DC coupled for use with external sensors,
2106 * therefore we use a 50% mic bias in order to center the input signal with 2116 * therefore we use a 50% mic bias in order to center the input signal with
@@ -2312,6 +2322,19 @@ static void cxt5066_ideapad_automic(struct hda_codec *codec)
2312 } 2322 }
2313} 2323}
2314 2324
2325
2326/* toggle input of built-in digital mic and mic jack appropriately */
2327static void cxt5066_asus_automic(struct hda_codec *codec)
2328{
2329 unsigned int present;
2330
2331 present = snd_hda_jack_detect(codec, 0x1b);
2332 snd_printdd("CXT5066: external microphone present=%d\n", present);
2333 snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_CONNECT_SEL,
2334 present ? 1 : 0);
2335}
2336
2337
2315/* toggle input of built-in digital mic and mic jack appropriately */ 2338/* toggle input of built-in digital mic and mic jack appropriately */
2316static void cxt5066_hp_laptop_automic(struct hda_codec *codec) 2339static void cxt5066_hp_laptop_automic(struct hda_codec *codec)
2317{ 2340{
@@ -2387,79 +2410,55 @@ static void cxt5066_hp_automute(struct hda_codec *codec)
2387 cxt5066_update_speaker(codec); 2410 cxt5066_update_speaker(codec);
2388} 2411}
2389 2412
2390/* unsolicited event for jack sensing */ 2413/* Dispatch the right mic autoswitch function */
2391static void cxt5066_olpc_unsol_event(struct hda_codec *codec, unsigned int res) 2414static void cxt5066_automic(struct hda_codec *codec)
2392{ 2415{
2393 struct conexant_spec *spec = codec->spec; 2416 struct conexant_spec *spec = codec->spec;
2394 snd_printdd("CXT5066: unsol event %x (%x)\n", res, res >> 26);
2395 switch (res >> 26) {
2396 case CONEXANT_HP_EVENT:
2397 cxt5066_hp_automute(codec);
2398 break;
2399 case CONEXANT_MIC_EVENT:
2400 /* ignore mic events in DC mode; we're always using the jack */
2401 if (!spec->dc_enable)
2402 cxt5066_olpc_automic(codec);
2403 break;
2404 }
2405}
2406 2417
2407/* unsolicited event for jack sensing */ 2418 if (spec->dell_vostro)
2408static void cxt5066_vostro_event(struct hda_codec *codec, unsigned int res)
2409{
2410 snd_printdd("CXT5066_vostro: unsol event %x (%x)\n", res, res >> 26);
2411 switch (res >> 26) {
2412 case CONEXANT_HP_EVENT:
2413 cxt5066_hp_automute(codec);
2414 break;
2415 case CONEXANT_MIC_EVENT:
2416 cxt5066_vostro_automic(codec); 2419 cxt5066_vostro_automic(codec);
2417 break; 2420 else if (spec->ideapad)
2418 }
2419}
2420
2421/* unsolicited event for jack sensing */
2422static void cxt5066_ideapad_event(struct hda_codec *codec, unsigned int res)
2423{
2424 snd_printdd("CXT5066_ideapad: unsol event %x (%x)\n", res, res >> 26);
2425 switch (res >> 26) {
2426 case CONEXANT_HP_EVENT:
2427 cxt5066_hp_automute(codec);
2428 break;
2429 case CONEXANT_MIC_EVENT:
2430 cxt5066_ideapad_automic(codec); 2421 cxt5066_ideapad_automic(codec);
2431 break; 2422 else if (spec->thinkpad)
2432 } 2423 cxt5066_thinkpad_automic(codec);
2424 else if (spec->hp_laptop)
2425 cxt5066_hp_laptop_automic(codec);
2426 else if (spec->asus)
2427 cxt5066_asus_automic(codec);
2433} 2428}
2434 2429
2435/* unsolicited event for jack sensing */ 2430/* unsolicited event for jack sensing */
2436static void cxt5066_hp_laptop_event(struct hda_codec *codec, unsigned int res) 2431static void cxt5066_olpc_unsol_event(struct hda_codec *codec, unsigned int res)
2437{ 2432{
2438 snd_printdd("CXT5066_hp_laptop: unsol event %x (%x)\n", res, res >> 26); 2433 struct conexant_spec *spec = codec->spec;
2434 snd_printdd("CXT5066: unsol event %x (%x)\n", res, res >> 26);
2439 switch (res >> 26) { 2435 switch (res >> 26) {
2440 case CONEXANT_HP_EVENT: 2436 case CONEXANT_HP_EVENT:
2441 cxt5066_hp_automute(codec); 2437 cxt5066_hp_automute(codec);
2442 break; 2438 break;
2443 case CONEXANT_MIC_EVENT: 2439 case CONEXANT_MIC_EVENT:
2444 cxt5066_hp_laptop_automic(codec); 2440 /* ignore mic events in DC mode; we're always using the jack */
2441 if (!spec->dc_enable)
2442 cxt5066_olpc_automic(codec);
2445 break; 2443 break;
2446 } 2444 }
2447} 2445}
2448 2446
2449/* unsolicited event for jack sensing */ 2447/* unsolicited event for jack sensing */
2450static void cxt5066_thinkpad_event(struct hda_codec *codec, unsigned int res) 2448static void cxt5066_unsol_event(struct hda_codec *codec, unsigned int res)
2451{ 2449{
2452 snd_printdd("CXT5066_thinkpad: unsol event %x (%x)\n", res, res >> 26); 2450 snd_printdd("CXT5066: unsol event %x (%x)\n", res, res >> 26);
2453 switch (res >> 26) { 2451 switch (res >> 26) {
2454 case CONEXANT_HP_EVENT: 2452 case CONEXANT_HP_EVENT:
2455 cxt5066_hp_automute(codec); 2453 cxt5066_hp_automute(codec);
2456 break; 2454 break;
2457 case CONEXANT_MIC_EVENT: 2455 case CONEXANT_MIC_EVENT:
2458 cxt5066_thinkpad_automic(codec); 2456 cxt5066_automic(codec);
2459 break; 2457 break;
2460 } 2458 }
2461} 2459}
2462 2460
2461
2463static const struct hda_input_mux cxt5066_analog_mic_boost = { 2462static const struct hda_input_mux cxt5066_analog_mic_boost = {
2464 .num_items = 5, 2463 .num_items = 5,
2465 .items = { 2464 .items = {
@@ -2633,6 +2632,27 @@ static void cxt5066_olpc_capture_cleanup(struct hda_codec *codec)
2633 spec->recording = 0; 2632 spec->recording = 0;
2634} 2633}
2635 2634
2635static void conexant_check_dig_outs(struct hda_codec *codec,
2636 hda_nid_t *dig_pins,
2637 int num_pins)
2638{
2639 struct conexant_spec *spec = codec->spec;
2640 hda_nid_t *nid_loc = &spec->multiout.dig_out_nid;
2641 int i;
2642
2643 for (i = 0; i < num_pins; i++, dig_pins++) {
2644 unsigned int cfg = snd_hda_codec_get_pincfg(codec, *dig_pins);
2645 if (get_defcfg_connect(cfg) == AC_JACK_PORT_NONE)
2646 continue;
2647 if (snd_hda_get_connections(codec, *dig_pins, nid_loc, 1) != 1)
2648 continue;
2649 if (spec->slave_dig_outs[0])
2650 nid_loc++;
2651 else
2652 nid_loc = spec->slave_dig_outs;
2653 }
2654}
2655
2636static struct hda_input_mux cxt5066_capture_source = { 2656static struct hda_input_mux cxt5066_capture_source = {
2637 .num_items = 4, 2657 .num_items = 4,
2638 .items = { 2658 .items = {
@@ -3039,20 +3059,11 @@ static struct hda_verb cxt5066_init_verbs_hp_laptop[] = {
3039/* initialize jack-sensing, too */ 3059/* initialize jack-sensing, too */
3040static int cxt5066_init(struct hda_codec *codec) 3060static int cxt5066_init(struct hda_codec *codec)
3041{ 3061{
3042 struct conexant_spec *spec = codec->spec;
3043
3044 snd_printdd("CXT5066: init\n"); 3062 snd_printdd("CXT5066: init\n");
3045 conexant_init(codec); 3063 conexant_init(codec);
3046 if (codec->patch_ops.unsol_event) { 3064 if (codec->patch_ops.unsol_event) {
3047 cxt5066_hp_automute(codec); 3065 cxt5066_hp_automute(codec);
3048 if (spec->dell_vostro) 3066 cxt5066_automic(codec);
3049 cxt5066_vostro_automic(codec);
3050 else if (spec->ideapad)
3051 cxt5066_ideapad_automic(codec);
3052 else if (spec->thinkpad)
3053 cxt5066_thinkpad_automic(codec);
3054 else if (spec->hp_laptop)
3055 cxt5066_hp_laptop_automic(codec);
3056 } 3067 }
3057 cxt5066_set_mic_boost(codec); 3068 cxt5066_set_mic_boost(codec);
3058 return 0; 3069 return 0;
@@ -3080,17 +3091,19 @@ enum {
3080 CXT5066_DELL_VOSTRO, /* Dell Vostro 1015i */ 3091 CXT5066_DELL_VOSTRO, /* Dell Vostro 1015i */
3081 CXT5066_IDEAPAD, /* Lenovo IdeaPad U150 */ 3092 CXT5066_IDEAPAD, /* Lenovo IdeaPad U150 */
3082 CXT5066_THINKPAD, /* Lenovo ThinkPad T410s, others? */ 3093 CXT5066_THINKPAD, /* Lenovo ThinkPad T410s, others? */
3094 CXT5066_ASUS, /* Asus K52JU, Lenovo G560 - Int mic at 0x1a and Ext mic at 0x1b */
3083 CXT5066_HP_LAPTOP, /* HP Laptop */ 3095 CXT5066_HP_LAPTOP, /* HP Laptop */
3084 CXT5066_MODELS 3096 CXT5066_MODELS
3085}; 3097};
3086 3098
3087static const char *cxt5066_models[CXT5066_MODELS] = { 3099static const char * const cxt5066_models[CXT5066_MODELS] = {
3088 [CXT5066_LAPTOP] = "laptop", 3100 [CXT5066_LAPTOP] = "laptop",
3089 [CXT5066_DELL_LAPTOP] = "dell-laptop", 3101 [CXT5066_DELL_LAPTOP] = "dell-laptop",
3090 [CXT5066_OLPC_XO_1_5] = "olpc-xo-1_5", 3102 [CXT5066_OLPC_XO_1_5] = "olpc-xo-1_5",
3091 [CXT5066_DELL_VOSTRO] = "dell-vostro", 3103 [CXT5066_DELL_VOSTRO] = "dell-vostro",
3092 [CXT5066_IDEAPAD] = "ideapad", 3104 [CXT5066_IDEAPAD] = "ideapad",
3093 [CXT5066_THINKPAD] = "thinkpad", 3105 [CXT5066_THINKPAD] = "thinkpad",
3106 [CXT5066_ASUS] = "asus",
3094 [CXT5066_HP_LAPTOP] = "hp-laptop", 3107 [CXT5066_HP_LAPTOP] = "hp-laptop",
3095}; 3108};
3096 3109
@@ -3102,7 +3115,9 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3102 SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), 3115 SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO),
3103 SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), 3116 SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
3104 SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), 3117 SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP),
3105 SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP), 3118 SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS),
3119 SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS),
3120 SND_PCI_QUIRK(0x1043, 0x1993, "Asus U50F", CXT5066_ASUS),
3106 SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), 3121 SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD),
3107 SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), 3122 SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
3108 SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), 3123 SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5),
@@ -3111,7 +3126,9 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3111 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), 3126 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5),
3112 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), 3127 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD),
3113 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), 3128 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD),
3129 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS),
3114 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), 3130 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD),
3131 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS),
3115 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */ 3132 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */
3116 {} 3133 {}
3117}; 3134};
@@ -3133,7 +3150,8 @@ static int patch_cxt5066(struct hda_codec *codec)
3133 spec->multiout.max_channels = 2; 3150 spec->multiout.max_channels = 2;
3134 spec->multiout.num_dacs = ARRAY_SIZE(cxt5066_dac_nids); 3151 spec->multiout.num_dacs = ARRAY_SIZE(cxt5066_dac_nids);
3135 spec->multiout.dac_nids = cxt5066_dac_nids; 3152 spec->multiout.dac_nids = cxt5066_dac_nids;
3136 spec->multiout.dig_out_nid = CXT5066_SPDIF_OUT; 3153 conexant_check_dig_outs(codec, cxt5066_digout_pin_nids,
3154 ARRAY_SIZE(cxt5066_digout_pin_nids));
3137 spec->num_adc_nids = 1; 3155 spec->num_adc_nids = 1;
3138 spec->adc_nids = cxt5066_adc_nids; 3156 spec->adc_nids = cxt5066_adc_nids;
3139 spec->capsrc_nids = cxt5066_capsrc_nids; 3157 spec->capsrc_nids = cxt5066_capsrc_nids;
@@ -3167,17 +3185,20 @@ static int patch_cxt5066(struct hda_codec *codec)
3167 spec->num_init_verbs++; 3185 spec->num_init_verbs++;
3168 spec->dell_automute = 1; 3186 spec->dell_automute = 1;
3169 break; 3187 break;
3188 case CXT5066_ASUS:
3170 case CXT5066_HP_LAPTOP: 3189 case CXT5066_HP_LAPTOP:
3171 codec->patch_ops.init = cxt5066_init; 3190 codec->patch_ops.init = cxt5066_init;
3172 codec->patch_ops.unsol_event = cxt5066_hp_laptop_event; 3191 codec->patch_ops.unsol_event = cxt5066_unsol_event;
3173 spec->init_verbs[spec->num_init_verbs] = 3192 spec->init_verbs[spec->num_init_verbs] =
3174 cxt5066_init_verbs_hp_laptop; 3193 cxt5066_init_verbs_hp_laptop;
3175 spec->num_init_verbs++; 3194 spec->num_init_verbs++;
3176 spec->hp_laptop = 1; 3195 spec->hp_laptop = board_config == CXT5066_HP_LAPTOP;
3196 spec->asus = board_config == CXT5066_ASUS;
3177 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; 3197 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master;
3178 spec->mixers[spec->num_mixers++] = cxt5066_mixers; 3198 spec->mixers[spec->num_mixers++] = cxt5066_mixers;
3179 /* no S/PDIF out */ 3199 /* no S/PDIF out */
3180 spec->multiout.dig_out_nid = 0; 3200 if (board_config == CXT5066_HP_LAPTOP)
3201 spec->multiout.dig_out_nid = 0;
3181 /* input source automatically selected */ 3202 /* input source automatically selected */
3182 spec->input_mux = NULL; 3203 spec->input_mux = NULL;
3183 spec->port_d_mode = 0; 3204 spec->port_d_mode = 0;
@@ -3207,7 +3228,7 @@ static int patch_cxt5066(struct hda_codec *codec)
3207 break; 3228 break;
3208 case CXT5066_DELL_VOSTRO: 3229 case CXT5066_DELL_VOSTRO:
3209 codec->patch_ops.init = cxt5066_init; 3230 codec->patch_ops.init = cxt5066_init;
3210 codec->patch_ops.unsol_event = cxt5066_vostro_event; 3231 codec->patch_ops.unsol_event = cxt5066_unsol_event;
3211 spec->init_verbs[0] = cxt5066_init_verbs_vostro; 3232 spec->init_verbs[0] = cxt5066_init_verbs_vostro;
3212 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; 3233 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc;
3213 spec->mixers[spec->num_mixers++] = cxt5066_mixers; 3234 spec->mixers[spec->num_mixers++] = cxt5066_mixers;
@@ -3224,7 +3245,7 @@ static int patch_cxt5066(struct hda_codec *codec)
3224 break; 3245 break;
3225 case CXT5066_IDEAPAD: 3246 case CXT5066_IDEAPAD:
3226 codec->patch_ops.init = cxt5066_init; 3247 codec->patch_ops.init = cxt5066_init;
3227 codec->patch_ops.unsol_event = cxt5066_ideapad_event; 3248 codec->patch_ops.unsol_event = cxt5066_unsol_event;
3228 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; 3249 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master;
3229 spec->mixers[spec->num_mixers++] = cxt5066_mixers; 3250 spec->mixers[spec->num_mixers++] = cxt5066_mixers;
3230 spec->init_verbs[0] = cxt5066_init_verbs_ideapad; 3251 spec->init_verbs[0] = cxt5066_init_verbs_ideapad;
@@ -3240,7 +3261,7 @@ static int patch_cxt5066(struct hda_codec *codec)
3240 break; 3261 break;
3241 case CXT5066_THINKPAD: 3262 case CXT5066_THINKPAD:
3242 codec->patch_ops.init = cxt5066_init; 3263 codec->patch_ops.init = cxt5066_init;
3243 codec->patch_ops.unsol_event = cxt5066_thinkpad_event; 3264 codec->patch_ops.unsol_event = cxt5066_unsol_event;
3244 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; 3265 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master;
3245 spec->mixers[spec->num_mixers++] = cxt5066_mixers; 3266 spec->mixers[spec->num_mixers++] = cxt5066_mixers;
3246 spec->init_verbs[0] = cxt5066_init_verbs_thinkpad; 3267 spec->init_verbs[0] = cxt5066_init_verbs_thinkpad;
@@ -3746,7 +3767,7 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
3746 struct conexant_spec *spec = codec->spec; 3767 struct conexant_spec *spec = codec->spec;
3747 int i, err; 3768 int i, err;
3748 int num_line = 0, num_hp = 0, num_spk = 0; 3769 int num_line = 0, num_hp = 0, num_spk = 0;
3749 static const char *texts[3] = { "Front", "Surround", "CLFE" }; 3770 static const char * const texts[3] = { "Front", "Surround", "CLFE" };
3750 3771
3751 if (spec->dac_info_filled == 1) 3772 if (spec->dac_info_filled == 1)
3752 return cx_auto_add_pb_volume(codec, spec->dac_info[0].dac, 3773 return cx_auto_add_pb_volume(codec, spec->dac_info[0].dac,
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index f29b97b5de8f..a58767736727 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -642,6 +642,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid,
642 hdmi_ai->ver = 0x01; 642 hdmi_ai->ver = 0x01;
643 hdmi_ai->len = 0x0a; 643 hdmi_ai->len = 0x0a;
644 hdmi_ai->CC02_CT47 = channels - 1; 644 hdmi_ai->CC02_CT47 = channels - 1;
645 hdmi_ai->CA = ca;
645 hdmi_checksum_audio_infoframe(hdmi_ai); 646 hdmi_checksum_audio_infoframe(hdmi_ai);
646 } else if (spec->sink_eld[i].conn_type == 1) { /* DisplayPort */ 647 } else if (spec->sink_eld[i].conn_type == 1) { /* DisplayPort */
647 struct dp_audio_infoframe *dp_ai; 648 struct dp_audio_infoframe *dp_ai;
@@ -651,6 +652,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid,
651 dp_ai->len = 0x1b; 652 dp_ai->len = 0x1b;
652 dp_ai->ver = 0x11 << 2; 653 dp_ai->ver = 0x11 << 2;
653 dp_ai->CC02_CT47 = channels - 1; 654 dp_ai->CC02_CT47 = channels - 1;
655 dp_ai->CA = ca;
654 } else { 656 } else {
655 snd_printd("HDMI: unknown connection type at pin %d\n", 657 snd_printd("HDMI: unknown connection type at pin %d\n",
656 pin_nid); 658 pin_nid);
@@ -817,6 +819,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
817 struct hdmi_spec *spec = codec->spec; 819 struct hdmi_spec *spec = codec->spec;
818 struct hdmi_eld *eld; 820 struct hdmi_eld *eld;
819 struct hda_pcm_stream *codec_pars; 821 struct hda_pcm_stream *codec_pars;
822 struct snd_pcm_runtime *runtime = substream->runtime;
820 unsigned int idx; 823 unsigned int idx;
821 824
822 for (idx = 0; idx < spec->num_cvts; idx++) 825 for (idx = 0; idx < spec->num_cvts; idx++)
@@ -844,6 +847,14 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
844 hinfo->formats = codec_pars->formats; 847 hinfo->formats = codec_pars->formats;
845 hinfo->maxbps = codec_pars->maxbps; 848 hinfo->maxbps = codec_pars->maxbps;
846 } 849 }
850 /* store the updated parameters */
851 runtime->hw.channels_min = hinfo->channels_min;
852 runtime->hw.channels_max = hinfo->channels_max;
853 runtime->hw.formats = hinfo->formats;
854 runtime->hw.rates = hinfo->rates;
855
856 snd_pcm_hw_constraint_step(substream->runtime, 0,
857 SNDRV_PCM_HW_PARAM_CHANNELS, 2);
847 return 0; 858 return 0;
848} 859}
849 860
@@ -1238,6 +1249,9 @@ static int simple_playback_pcm_open(struct hda_pcm_stream *hinfo,
1238 snd_pcm_hw_constraint_list(substream->runtime, 0, 1249 snd_pcm_hw_constraint_list(substream->runtime, 0,
1239 SNDRV_PCM_HW_PARAM_CHANNELS, 1250 SNDRV_PCM_HW_PARAM_CHANNELS,
1240 hw_constraints_channels); 1251 hw_constraints_channels);
1252 } else {
1253 snd_pcm_hw_constraint_step(substream->runtime, 0,
1254 SNDRV_PCM_HW_PARAM_CHANNELS, 2);
1241 } 1255 }
1242 1256
1243 return snd_hda_multi_out_dig_open(codec, &spec->multiout); 1257 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 51c08edd7563..3328a259a242 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -303,6 +303,8 @@ struct alc_customize_define {
303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ 303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
304}; 304};
305 305
306struct alc_fixup;
307
306struct alc_spec { 308struct alc_spec {
307 /* codec parameterization */ 309 /* codec parameterization */
308 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ 310 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
@@ -404,6 +406,11 @@ struct alc_spec {
404 /* for PLL fix */ 406 /* for PLL fix */
405 hda_nid_t pll_nid; 407 hda_nid_t pll_nid;
406 unsigned int pll_coef_idx, pll_coef_bit; 408 unsigned int pll_coef_idx, pll_coef_bit;
409
410 /* fix-up list */
411 int fixup_id;
412 const struct alc_fixup *fixup_list;
413 const char *fixup_name;
407}; 414};
408 415
409/* 416/*
@@ -1683,88 +1690,133 @@ struct alc_model_fixup {
1683}; 1690};
1684 1691
1685struct alc_fixup { 1692struct alc_fixup {
1686 unsigned int sku; 1693 int type;
1687 const struct alc_pincfg *pins; 1694 bool chained;
1688 const struct hda_verb *verbs; 1695 int chain_id;
1689 void (*func)(struct hda_codec *codec, const struct alc_fixup *fix, 1696 union {
1690 int pre_init); 1697 unsigned int sku;
1698 const struct alc_pincfg *pins;
1699 const struct hda_verb *verbs;
1700 void (*func)(struct hda_codec *codec,
1701 const struct alc_fixup *fix,
1702 int action);
1703 } v;
1691}; 1704};
1692 1705
1693static void __alc_pick_fixup(struct hda_codec *codec, 1706enum {
1694 const struct alc_fixup *fix, 1707 ALC_FIXUP_INVALID,
1695 const char *modelname, 1708 ALC_FIXUP_SKU,
1696 int pre_init) 1709 ALC_FIXUP_PINS,
1697{ 1710 ALC_FIXUP_VERBS,
1698 const struct alc_pincfg *cfg; 1711 ALC_FIXUP_FUNC,
1699 struct alc_spec *spec; 1712};
1700 1713
1701 cfg = fix->pins; 1714enum {
1702 if (pre_init && fix->sku) { 1715 ALC_FIXUP_ACT_PRE_PROBE,
1703#ifdef CONFIG_SND_DEBUG_VERBOSE 1716 ALC_FIXUP_ACT_PROBE,
1704 snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n", 1717 ALC_FIXUP_ACT_INIT,
1705 codec->chip_name, modelname); 1718};
1706#endif
1707 spec = codec->spec;
1708 spec->cdefine.sku_cfg = fix->sku;
1709 spec->cdefine.fixup = 1;
1710 }
1711 if (pre_init && cfg) {
1712#ifdef CONFIG_SND_DEBUG_VERBOSE
1713 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1714 codec->chip_name, modelname);
1715#endif
1716 for (; cfg->nid; cfg++)
1717 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1718 }
1719 if (!pre_init && fix->verbs) {
1720#ifdef CONFIG_SND_DEBUG_VERBOSE
1721 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1722 codec->chip_name, modelname);
1723#endif
1724 add_verb(codec->spec, fix->verbs);
1725 }
1726 if (fix->func) {
1727#ifdef CONFIG_SND_DEBUG_VERBOSE
1728 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n",
1729 codec->chip_name, modelname);
1730#endif
1731 fix->func(codec, fix, pre_init);
1732 }
1733}
1734 1719
1735static void alc_pick_fixup(struct hda_codec *codec, 1720static void alc_apply_fixup(struct hda_codec *codec, int action)
1736 const struct snd_pci_quirk *quirk,
1737 const struct alc_fixup *fix,
1738 int pre_init)
1739{ 1721{
1740 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); 1722 struct alc_spec *spec = codec->spec;
1741 if (quirk) { 1723 int id = spec->fixup_id;
1742 fix += quirk->value;
1743#ifdef CONFIG_SND_DEBUG_VERBOSE 1724#ifdef CONFIG_SND_DEBUG_VERBOSE
1744 __alc_pick_fixup(codec, fix, quirk->name, pre_init); 1725 const char *modelname = spec->fixup_name;
1745#else
1746 __alc_pick_fixup(codec, fix, NULL, pre_init);
1747#endif 1726#endif
1727 int depth = 0;
1728
1729 if (!spec->fixup_list)
1730 return;
1731
1732 while (id >= 0) {
1733 const struct alc_fixup *fix = spec->fixup_list + id;
1734 const struct alc_pincfg *cfg;
1735
1736 switch (fix->type) {
1737 case ALC_FIXUP_SKU:
1738 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1739 break;;
1740 snd_printdd(KERN_INFO "hda_codec: %s: "
1741 "Apply sku override for %s\n",
1742 codec->chip_name, modelname);
1743 spec->cdefine.sku_cfg = fix->v.sku;
1744 spec->cdefine.fixup = 1;
1745 break;
1746 case ALC_FIXUP_PINS:
1747 cfg = fix->v.pins;
1748 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1749 break;
1750 snd_printdd(KERN_INFO "hda_codec: %s: "
1751 "Apply pincfg for %s\n",
1752 codec->chip_name, modelname);
1753 for (; cfg->nid; cfg++)
1754 snd_hda_codec_set_pincfg(codec, cfg->nid,
1755 cfg->val);
1756 break;
1757 case ALC_FIXUP_VERBS:
1758 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1759 break;
1760 snd_printdd(KERN_INFO "hda_codec: %s: "
1761 "Apply fix-verbs for %s\n",
1762 codec->chip_name, modelname);
1763 add_verb(codec->spec, fix->v.verbs);
1764 break;
1765 case ALC_FIXUP_FUNC:
1766 if (!fix->v.func)
1767 break;
1768 snd_printdd(KERN_INFO "hda_codec: %s: "
1769 "Apply fix-func for %s\n",
1770 codec->chip_name, modelname);
1771 fix->v.func(codec, fix, action);
1772 break;
1773 default:
1774 snd_printk(KERN_ERR "hda_codec: %s: "
1775 "Invalid fixup type %d\n",
1776 codec->chip_name, fix->type);
1777 break;
1778 }
1779 if (!fix[id].chained)
1780 break;
1781 if (++depth > 10)
1782 break;
1783 id = fix[id].chain_id;
1748 } 1784 }
1749} 1785}
1750 1786
1751static void alc_pick_fixup_model(struct hda_codec *codec, 1787static void alc_pick_fixup(struct hda_codec *codec,
1752 const struct alc_model_fixup *models, 1788 const struct alc_model_fixup *models,
1753 const struct snd_pci_quirk *quirk, 1789 const struct snd_pci_quirk *quirk,
1754 const struct alc_fixup *fix, 1790 const struct alc_fixup *fixlist)
1755 int pre_init)
1756{ 1791{
1792 struct alc_spec *spec = codec->spec;
1793 int id = -1;
1794 const char *name = NULL;
1795
1757 if (codec->modelname && models) { 1796 if (codec->modelname && models) {
1758 while (models->name) { 1797 while (models->name) {
1759 if (!strcmp(codec->modelname, models->name)) { 1798 if (!strcmp(codec->modelname, models->name)) {
1760 fix += models->id; 1799 id = models->id;
1800 name = models->name;
1761 break; 1801 break;
1762 } 1802 }
1763 models++; 1803 models++;
1764 } 1804 }
1765 __alc_pick_fixup(codec, fix, codec->modelname, pre_init); 1805 }
1766 } else { 1806 if (id < 0) {
1767 alc_pick_fixup(codec, quirk, fix, pre_init); 1807 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1808 if (quirk) {
1809 id = quirk->value;
1810#ifdef CONFIG_SND_DEBUG_VERBOSE
1811 name = quirk->name;
1812#endif
1813 }
1814 }
1815
1816 spec->fixup_id = id;
1817 if (id >= 0) {
1818 spec->fixup_list = fixlist;
1819 spec->fixup_name = name;
1768 } 1820 }
1769} 1821}
1770 1822
@@ -2238,6 +2290,29 @@ static struct snd_kcontrol_new alc888_base_mixer[] = {
2238 { } /* end */ 2290 { } /* end */
2239}; 2291};
2240 2292
2293static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2294 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2295 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2296 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2297 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2298 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0f, 2, 0x0,
2299 HDA_OUTPUT),
2300 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0f, 2, 2, HDA_INPUT),
2301 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
2302 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
2303 HDA_CODEC_VOLUME("Side Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2304 HDA_BIND_MUTE("Side Playback Switch", 0x0e, 2, HDA_INPUT),
2305 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2306 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2307 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2308 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2309 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2310 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2311 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2312 { } /* end */
2313};
2314
2315
2241static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { 2316static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2317 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 2318 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
@@ -2866,7 +2941,7 @@ static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2866/* 2941/*
2867 * slave controls for virtual master 2942 * slave controls for virtual master
2868 */ 2943 */
2869static const char *alc_slave_vols[] = { 2944static const char * const alc_slave_vols[] = {
2870 "Front Playback Volume", 2945 "Front Playback Volume",
2871 "Surround Playback Volume", 2946 "Surround Playback Volume",
2872 "Center Playback Volume", 2947 "Center Playback Volume",
@@ -2880,7 +2955,7 @@ static const char *alc_slave_vols[] = {
2880 NULL, 2955 NULL,
2881}; 2956};
2882 2957
2883static const char *alc_slave_sws[] = { 2958static const char * const alc_slave_sws[] = {
2884 "Front Playback Switch", 2959 "Front Playback Switch",
2885 "Surround Playback Switch", 2960 "Surround Playback Switch",
2886 "Center Playback Switch", 2961 "Center Playback Switch",
@@ -3861,6 +3936,8 @@ static int alc_init(struct hda_codec *codec)
3861 if (spec->init_hook) 3936 if (spec->init_hook)
3862 spec->init_hook(codec); 3937 spec->init_hook(codec);
3863 3938
3939 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
3940
3864 hda_call_check_power_status(codec, 0x01); 3941 hda_call_check_power_status(codec, 0x01);
3865 return 0; 3942 return 0;
3866} 3943}
@@ -4559,7 +4636,7 @@ static struct hda_verb alc880_test_init_verbs[] = {
4559/* 4636/*
4560 */ 4637 */
4561 4638
4562static const char *alc880_models[ALC880_MODEL_LAST] = { 4639static const char * const alc880_models[ALC880_MODEL_LAST] = {
4563 [ALC880_3ST] = "3stack", 4640 [ALC880_3ST] = "3stack",
4564 [ALC880_TCL_S700] = "tcl", 4641 [ALC880_TCL_S700] = "tcl",
4565 [ALC880_3ST_DIG] = "3stack-digout", 4642 [ALC880_3ST_DIG] = "3stack-digout",
@@ -5092,7 +5169,7 @@ static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5092static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, 5169static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5093 const struct auto_pin_cfg *cfg) 5170 const struct auto_pin_cfg *cfg)
5094{ 5171{
5095 static const char *chname[4] = { 5172 static const char * const chname[4] = {
5096 "Front", "Surround", NULL /*CLFE*/, "Side" 5173 "Front", "Surround", NULL /*CLFE*/, "Side"
5097 }; 5174 };
5098 const char *pfx = alc_get_line_out_pfx(cfg, false); 5175 const char *pfx = alc_get_line_out_pfx(cfg, false);
@@ -7090,7 +7167,8 @@ enum {
7090 7167
7091static const struct alc_fixup alc260_fixups[] = { 7168static const struct alc_fixup alc260_fixups[] = {
7092 [PINFIX_HP_DC5750] = { 7169 [PINFIX_HP_DC5750] = {
7093 .pins = (const struct alc_pincfg[]) { 7170 .type = ALC_FIXUP_PINS,
7171 .v.pins = (const struct alc_pincfg[]) {
7094 { 0x11, 0x90130110 }, /* speaker */ 7172 { 0x11, 0x90130110 }, /* speaker */
7095 { } 7173 { }
7096 } 7174 }
@@ -7105,7 +7183,7 @@ static struct snd_pci_quirk alc260_fixup_tbl[] = {
7105/* 7183/*
7106 * ALC260 configurations 7184 * ALC260 configurations
7107 */ 7185 */
7108static const char *alc260_models[ALC260_MODEL_LAST] = { 7186static const char * const alc260_models[ALC260_MODEL_LAST] = {
7109 [ALC260_BASIC] = "basic", 7187 [ALC260_BASIC] = "basic",
7110 [ALC260_HP] = "hp", 7188 [ALC260_HP] = "hp",
7111 [ALC260_HP_3013] = "hp-3013", 7189 [ALC260_HP_3013] = "hp-3013",
@@ -7301,8 +7379,10 @@ static int patch_alc260(struct hda_codec *codec)
7301 board_config = ALC260_AUTO; 7379 board_config = ALC260_AUTO;
7302 } 7380 }
7303 7381
7304 if (board_config == ALC260_AUTO) 7382 if (board_config == ALC260_AUTO) {
7305 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); 7383 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7384 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7385 }
7306 7386
7307 if (board_config == ALC260_AUTO) { 7387 if (board_config == ALC260_AUTO) {
7308 /* automatic parse from the BIOS config */ 7388 /* automatic parse from the BIOS config */
@@ -7350,8 +7430,7 @@ static int patch_alc260(struct hda_codec *codec)
7350 set_capture_mixer(codec); 7430 set_capture_mixer(codec);
7351 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); 7431 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7352 7432
7353 if (board_config == ALC260_AUTO) 7433 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7354 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7355 7434
7356 spec->vmaster_nid = 0x08; 7435 spec->vmaster_nid = 0x08;
7357 7436
@@ -9727,7 +9806,7 @@ static hda_nid_t alc1200_slave_dig_outs[] = {
9727/* 9806/*
9728 * configuration and preset 9807 * configuration and preset
9729 */ 9808 */
9730static const char *alc882_models[ALC882_MODEL_LAST] = { 9809static const char * const alc882_models[ALC882_MODEL_LAST] = {
9731 [ALC882_3ST_DIG] = "3stack-dig", 9810 [ALC882_3ST_DIG] = "3stack-dig",
9732 [ALC882_6ST_DIG] = "6stack-dig", 9811 [ALC882_6ST_DIG] = "6stack-dig",
9733 [ALC882_ARIMA] = "arima", 9812 [ALC882_ARIMA] = "arima",
@@ -10303,7 +10382,7 @@ static struct alc_config_preset alc882_presets[] = {
10303 .init_hook = alc_automute_amp, 10382 .init_hook = alc_automute_amp,
10304 }, 10383 },
10305 [ALC888_ACER_ASPIRE_4930G] = { 10384 [ALC888_ACER_ASPIRE_4930G] = {
10306 .mixers = { alc888_base_mixer, 10385 .mixers = { alc888_acer_aspire_4930g_mixer,
10307 alc883_chmode_mixer }, 10386 alc883_chmode_mixer },
10308 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 10387 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10309 alc888_acer_aspire_4930g_verbs }, 10388 alc888_acer_aspire_4930g_verbs },
@@ -10678,7 +10757,8 @@ enum {
10678 10757
10679static const struct alc_fixup alc882_fixups[] = { 10758static const struct alc_fixup alc882_fixups[] = {
10680 [PINFIX_ABIT_AW9D_MAX] = { 10759 [PINFIX_ABIT_AW9D_MAX] = {
10681 .pins = (const struct alc_pincfg[]) { 10760 .type = ALC_FIXUP_PINS,
10761 .v.pins = (const struct alc_pincfg[]) {
10682 { 0x15, 0x01080104 }, /* side */ 10762 { 0x15, 0x01080104 }, /* side */
10683 { 0x16, 0x01011012 }, /* rear */ 10763 { 0x16, 0x01011012 }, /* rear */
10684 { 0x17, 0x01016011 }, /* clfe */ 10764 { 0x17, 0x01016011 }, /* clfe */
@@ -10686,13 +10766,15 @@ static const struct alc_fixup alc882_fixups[] = {
10686 } 10766 }
10687 }, 10767 },
10688 [PINFIX_PB_M5210] = { 10768 [PINFIX_PB_M5210] = {
10689 .verbs = (const struct hda_verb[]) { 10769 .type = ALC_FIXUP_VERBS,
10770 .v.verbs = (const struct hda_verb[]) {
10690 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, 10771 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10691 {} 10772 {}
10692 } 10773 }
10693 }, 10774 },
10694 [PINFIX_ACER_ASPIRE_7736] = { 10775 [PINFIX_ACER_ASPIRE_7736] = {
10695 .sku = ALC_FIXUP_SKU_IGNORE, 10776 .type = ALC_FIXUP_SKU,
10777 .v.sku = ALC_FIXUP_SKU_IGNORE,
10696 }, 10778 },
10697}; 10779};
10698 10780
@@ -10873,9 +10955,6 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
10873 return 0; 10955 return 0;
10874} 10956}
10875 10957
10876static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
10877 const struct auto_pin_cfg *cfg);
10878
10879/* almost identical with ALC880 parser... */ 10958/* almost identical with ALC880 parser... */
10880static int alc882_parse_auto_config(struct hda_codec *codec) 10959static int alc882_parse_auto_config(struct hda_codec *codec)
10881{ 10960{
@@ -10893,10 +10972,7 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
10893 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); 10972 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10894 if (err < 0) 10973 if (err < 0)
10895 return err; 10974 return err;
10896 if (codec->vendor_id == 0x10ec0887) 10975 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10897 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
10898 else
10899 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10900 if (err < 0) 10976 if (err < 0)
10901 return err; 10977 return err;
10902 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], 10978 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
@@ -10984,8 +11060,10 @@ static int patch_alc882(struct hda_codec *codec)
10984 board_config = ALC882_AUTO; 11060 board_config = ALC882_AUTO;
10985 } 11061 }
10986 11062
10987 if (board_config == ALC882_AUTO) 11063 if (board_config == ALC882_AUTO) {
10988 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); 11064 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11065 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11066 }
10989 11067
10990 alc_auto_parse_customize_define(codec); 11068 alc_auto_parse_customize_define(codec);
10991 11069
@@ -11061,8 +11139,7 @@ static int patch_alc882(struct hda_codec *codec)
11061 if (has_cdefine_beep(codec)) 11139 if (has_cdefine_beep(codec))
11062 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 11140 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11063 11141
11064 if (board_config == ALC882_AUTO) 11142 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11065 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
11066 11143
11067 spec->vmaster_nid = 0x0c; 11144 spec->vmaster_nid = 0x0c;
11068 11145
@@ -12452,19 +12529,14 @@ enum {
12452 12529
12453static const struct alc_fixup alc262_fixups[] = { 12530static const struct alc_fixup alc262_fixups[] = {
12454 [PINFIX_FSC_H270] = { 12531 [PINFIX_FSC_H270] = {
12455 .pins = (const struct alc_pincfg[]) { 12532 .type = ALC_FIXUP_PINS,
12533 .v.pins = (const struct alc_pincfg[]) {
12456 { 0x14, 0x99130110 }, /* speaker */ 12534 { 0x14, 0x99130110 }, /* speaker */
12457 { 0x15, 0x0221142f }, /* front HP */ 12535 { 0x15, 0x0221142f }, /* front HP */
12458 { 0x1b, 0x0121141f }, /* rear HP */ 12536 { 0x1b, 0x0121141f }, /* rear HP */
12459 { } 12537 { }
12460 } 12538 }
12461 }, 12539 },
12462 [PINFIX_PB_M5210] = {
12463 .verbs = (const struct hda_verb[]) {
12464 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12465 {}
12466 }
12467 },
12468}; 12540};
12469 12541
12470static struct snd_pci_quirk alc262_fixup_tbl[] = { 12542static struct snd_pci_quirk alc262_fixup_tbl[] = {
@@ -12554,7 +12626,7 @@ static void alc262_auto_init(struct hda_codec *codec)
12554/* 12626/*
12555 * configuration and preset 12627 * configuration and preset
12556 */ 12628 */
12557static const char *alc262_models[ALC262_MODEL_LAST] = { 12629static const char * const alc262_models[ALC262_MODEL_LAST] = {
12558 [ALC262_BASIC] = "basic", 12630 [ALC262_BASIC] = "basic",
12559 [ALC262_HIPPO] = "hippo", 12631 [ALC262_HIPPO] = "hippo",
12560 [ALC262_HIPPO_1] = "hippo_1", 12632 [ALC262_HIPPO_1] = "hippo_1",
@@ -12582,6 +12654,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
12582 ALC262_HP_BPC), 12654 ALC262_HP_BPC),
12583 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", 12655 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12584 ALC262_HP_BPC), 12656 ALC262_HP_BPC),
12657 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12658 ALC262_HP_BPC),
12585 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", 12659 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12586 ALC262_HP_BPC), 12660 ALC262_HP_BPC),
12587 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), 12661 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
@@ -12895,8 +12969,10 @@ static int patch_alc262(struct hda_codec *codec)
12895 board_config = ALC262_AUTO; 12969 board_config = ALC262_AUTO;
12896 } 12970 }
12897 12971
12898 if (board_config == ALC262_AUTO) 12972 if (board_config == ALC262_AUTO) {
12899 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); 12973 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12974 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12975 }
12900 12976
12901 if (board_config == ALC262_AUTO) { 12977 if (board_config == ALC262_AUTO) {
12902 /* automatic parse from the BIOS config */ 12978 /* automatic parse from the BIOS config */
@@ -12966,8 +13042,7 @@ static int patch_alc262(struct hda_codec *codec)
12966 if (!spec->no_analog && has_cdefine_beep(codec)) 13042 if (!spec->no_analog && has_cdefine_beep(codec))
12967 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 13043 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12968 13044
12969 if (board_config == ALC262_AUTO) 13045 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
12970 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12971 13046
12972 spec->vmaster_nid = 0x0c; 13047 spec->vmaster_nid = 0x0c;
12973 13048
@@ -13741,7 +13816,7 @@ static void alc268_auto_init(struct hda_codec *codec)
13741/* 13816/*
13742 * configuration and preset 13817 * configuration and preset
13743 */ 13818 */
13744static const char *alc268_models[ALC268_MODEL_LAST] = { 13819static const char * const alc268_models[ALC268_MODEL_LAST] = {
13745 [ALC267_QUANTA_IL1] = "quanta-il1", 13820 [ALC267_QUANTA_IL1] = "quanta-il1",
13746 [ALC268_3ST] = "3stack", 13821 [ALC268_3ST] = "3stack",
13747 [ALC268_TOSHIBA] = "toshiba", 13822 [ALC268_TOSHIBA] = "toshiba",
@@ -14822,17 +14897,19 @@ static int alc269_resume(struct hda_codec *codec)
14822#endif /* SND_HDA_NEEDS_RESUME */ 14897#endif /* SND_HDA_NEEDS_RESUME */
14823 14898
14824static void alc269_fixup_hweq(struct hda_codec *codec, 14899static void alc269_fixup_hweq(struct hda_codec *codec,
14825 const struct alc_fixup *fix, int pre_init) 14900 const struct alc_fixup *fix, int action)
14826{ 14901{
14827 int coef; 14902 int coef;
14828 14903
14904 if (action != ALC_FIXUP_ACT_INIT)
14905 return;
14829 coef = alc_read_coef_idx(codec, 0x1e); 14906 coef = alc_read_coef_idx(codec, 0x1e);
14830 alc_write_coef_idx(codec, 0x1e, coef | 0x80); 14907 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14831} 14908}
14832 14909
14833enum { 14910enum {
14834 ALC269_FIXUP_SONY_VAIO, 14911 ALC269_FIXUP_SONY_VAIO,
14835 ALC275_FIX_SONY_VAIO_GPIO2, 14912 ALC275_FIXUP_SONY_VAIO_GPIO2,
14836 ALC269_FIXUP_DELL_M101Z, 14913 ALC269_FIXUP_DELL_M101Z,
14837 ALC269_FIXUP_SKU_IGNORE, 14914 ALC269_FIXUP_SKU_IGNORE,
14838 ALC269_FIXUP_ASUS_G73JW, 14915 ALC269_FIXUP_ASUS_G73JW,
@@ -14842,22 +14919,26 @@ enum {
14842 14919
14843static const struct alc_fixup alc269_fixups[] = { 14920static const struct alc_fixup alc269_fixups[] = {
14844 [ALC269_FIXUP_SONY_VAIO] = { 14921 [ALC269_FIXUP_SONY_VAIO] = {
14845 .verbs = (const struct hda_verb[]) { 14922 .type = ALC_FIXUP_VERBS,
14923 .v.verbs = (const struct hda_verb[]) {
14846 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, 14924 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14847 {} 14925 {}
14848 } 14926 }
14849 }, 14927 },
14850 [ALC275_FIX_SONY_VAIO_GPIO2] = { 14928 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14851 .verbs = (const struct hda_verb[]) { 14929 .type = ALC_FIXUP_VERBS,
14930 .v.verbs = (const struct hda_verb[]) {
14852 {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, 14931 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14853 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, 14932 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14854 {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, 14933 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14856 { } 14934 { }
14857 } 14935 },
14936 .chained = true,
14937 .chain_id = ALC269_FIXUP_SONY_VAIO
14858 }, 14938 },
14859 [ALC269_FIXUP_DELL_M101Z] = { 14939 [ALC269_FIXUP_DELL_M101Z] = {
14860 .verbs = (const struct hda_verb[]) { 14940 .type = ALC_FIXUP_VERBS,
14941 .v.verbs = (const struct hda_verb[]) {
14861 /* Enables internal speaker */ 14942 /* Enables internal speaker */
14862 {0x20, AC_VERB_SET_COEF_INDEX, 13}, 14943 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14863 {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, 14944 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
@@ -14865,40 +14946,42 @@ static const struct alc_fixup alc269_fixups[] = {
14865 } 14946 }
14866 }, 14947 },
14867 [ALC269_FIXUP_SKU_IGNORE] = { 14948 [ALC269_FIXUP_SKU_IGNORE] = {
14868 .sku = ALC_FIXUP_SKU_IGNORE, 14949 .type = ALC_FIXUP_SKU,
14950 .v.sku = ALC_FIXUP_SKU_IGNORE,
14869 }, 14951 },
14870 [ALC269_FIXUP_ASUS_G73JW] = { 14952 [ALC269_FIXUP_ASUS_G73JW] = {
14871 .pins = (const struct alc_pincfg[]) { 14953 .type = ALC_FIXUP_PINS,
14954 .v.pins = (const struct alc_pincfg[]) {
14872 { 0x17, 0x99130111 }, /* subwoofer */ 14955 { 0x17, 0x99130111 }, /* subwoofer */
14873 { } 14956 { }
14874 } 14957 }
14875 }, 14958 },
14876 [ALC269_FIXUP_LENOVO_EAPD] = { 14959 [ALC269_FIXUP_LENOVO_EAPD] = {
14877 .verbs = (const struct hda_verb[]) { 14960 .type = ALC_FIXUP_VERBS,
14961 .v.verbs = (const struct hda_verb[]) {
14878 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, 14962 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14879 {} 14963 {}
14880 } 14964 }
14881 }, 14965 },
14882 [ALC275_FIXUP_SONY_HWEQ] = { 14966 [ALC275_FIXUP_SONY_HWEQ] = {
14883 .func = alc269_fixup_hweq, 14967 .type = ALC_FIXUP_FUNC,
14884 .verbs = (const struct hda_verb[]) { 14968 .v.func = alc269_fixup_hweq,
14885 {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, 14969 .chained = true,
14886 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, 14970 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14887 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14888 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14889 { }
14890 }
14891 } 14971 }
14892}; 14972};
14893 14973
14894static struct snd_pci_quirk alc269_fixup_tbl[] = { 14974static struct snd_pci_quirk alc269_fixup_tbl[] = {
14895 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2), 14975 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14896 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 14976 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14897 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 14977 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14898 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 14978 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14899 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 14979 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14900 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14901 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), 14980 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14981 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
14982 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14983 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
14984 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
14902 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), 14985 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14903 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), 14986 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
14904 {} 14987 {}
@@ -14908,7 +14991,7 @@ static struct snd_pci_quirk alc269_fixup_tbl[] = {
14908/* 14991/*
14909 * configuration and preset 14992 * configuration and preset
14910 */ 14993 */
14911static const char *alc269_models[ALC269_MODEL_LAST] = { 14994static const char * const alc269_models[ALC269_MODEL_LAST] = {
14912 [ALC269_BASIC] = "basic", 14995 [ALC269_BASIC] = "basic",
14913 [ALC269_QUANTA_FL1] = "quanta", 14996 [ALC269_QUANTA_FL1] = "quanta",
14914 [ALC269_AMIC] = "laptop-amic", 14997 [ALC269_AMIC] = "laptop-amic",
@@ -15184,8 +15267,10 @@ static int patch_alc269(struct hda_codec *codec)
15184 board_config = ALC269_AUTO; 15267 board_config = ALC269_AUTO;
15185 } 15268 }
15186 15269
15187 if (board_config == ALC269_AUTO) 15270 if (board_config == ALC269_AUTO) {
15188 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); 15271 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15272 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15273 }
15189 15274
15190 if (board_config == ALC269_AUTO) { 15275 if (board_config == ALC269_AUTO) {
15191 /* automatic parse from the BIOS config */ 15276 /* automatic parse from the BIOS config */
@@ -15246,8 +15331,7 @@ static int patch_alc269(struct hda_codec *codec)
15246 if (has_cdefine_beep(codec)) 15331 if (has_cdefine_beep(codec))
15247 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); 15332 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15248 15333
15249 if (board_config == ALC269_AUTO) 15334 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15250 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15251 15335
15252 spec->vmaster_nid = 0x02; 15336 spec->vmaster_nid = 0x02;
15253 15337
@@ -15950,7 +16034,7 @@ static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15950 const struct auto_pin_cfg *cfg) 16034 const struct auto_pin_cfg *cfg)
15951{ 16035{
15952 struct alc_spec *spec = codec->spec; 16036 struct alc_spec *spec = codec->spec;
15953 static const char *chname[4] = { 16037 static const char * const chname[4] = {
15954 "Front", "Surround", NULL /*CLFE*/, "Side" 16038 "Front", "Surround", NULL /*CLFE*/, "Side"
15955 }; 16039 };
15956 const char *pfx = alc_get_line_out_pfx(cfg, true); 16040 const char *pfx = alc_get_line_out_pfx(cfg, true);
@@ -16156,7 +16240,7 @@ static struct hda_amp_list alc861_loopbacks[] = {
16156/* 16240/*
16157 * configuration and preset 16241 * configuration and preset
16158 */ 16242 */
16159static const char *alc861_models[ALC861_MODEL_LAST] = { 16243static const char * const alc861_models[ALC861_MODEL_LAST] = {
16160 [ALC861_3ST] = "3stack", 16244 [ALC861_3ST] = "3stack",
16161 [ALC660_3ST] = "3stack-660", 16245 [ALC660_3ST] = "3stack-660",
16162 [ALC861_3ST_DIG] = "3stack-dig", 16246 [ALC861_3ST_DIG] = "3stack-dig",
@@ -16306,7 +16390,8 @@ enum {
16306 16390
16307static const struct alc_fixup alc861_fixups[] = { 16391static const struct alc_fixup alc861_fixups[] = {
16308 [PINFIX_FSC_AMILO_PI1505] = { 16392 [PINFIX_FSC_AMILO_PI1505] = {
16309 .pins = (const struct alc_pincfg[]) { 16393 .type = ALC_FIXUP_PINS,
16394 .v.pins = (const struct alc_pincfg[]) {
16310 { 0x0b, 0x0221101f }, /* HP */ 16395 { 0x0b, 0x0221101f }, /* HP */
16311 { 0x0f, 0x90170310 }, /* speaker */ 16396 { 0x0f, 0x90170310 }, /* speaker */
16312 { } 16397 { }
@@ -16341,8 +16426,10 @@ static int patch_alc861(struct hda_codec *codec)
16341 board_config = ALC861_AUTO; 16426 board_config = ALC861_AUTO;
16342 } 16427 }
16343 16428
16344 if (board_config == ALC861_AUTO) 16429 if (board_config == ALC861_AUTO) {
16345 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); 16430 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16431 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16432 }
16346 16433
16347 if (board_config == ALC861_AUTO) { 16434 if (board_config == ALC861_AUTO) {
16348 /* automatic parse from the BIOS config */ 16435 /* automatic parse from the BIOS config */
@@ -16379,8 +16466,7 @@ static int patch_alc861(struct hda_codec *codec)
16379 16466
16380 spec->vmaster_nid = 0x03; 16467 spec->vmaster_nid = 0x03;
16381 16468
16382 if (board_config == ALC861_AUTO) 16469 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16383 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16384 16470
16385 codec->patch_ops = alc_patch_ops; 16471 codec->patch_ops = alc_patch_ops;
16386 if (board_config == ALC861_AUTO) { 16472 if (board_config == ALC861_AUTO) {
@@ -16857,7 +16943,7 @@ static void alc861vd_dallas_setup(struct hda_codec *codec)
16857/* 16943/*
16858 * configuration and preset 16944 * configuration and preset
16859 */ 16945 */
16860static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { 16946static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16861 [ALC660VD_3ST] = "3stack-660", 16947 [ALC660VD_3ST] = "3stack-660",
16862 [ALC660VD_3ST_DIG] = "3stack-660-digout", 16948 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16863 [ALC660VD_ASUS_V1S] = "asus-v1s", 16949 [ALC660VD_ASUS_V1S] = "asus-v1s",
@@ -17072,12 +17158,14 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17072#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) 17158#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17073 17159
17074/* add playback controls from the parsed DAC table */ 17160/* add playback controls from the parsed DAC table */
17075/* Based on ALC880 version. But ALC861VD and ALC887 have separate, 17161/* Based on ALC880 version. But ALC861VD has separate,
17076 * different NIDs for mute/unmute switch and volume control */ 17162 * different NIDs for mute/unmute switch and volume control */
17077static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, 17163static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17078 const struct auto_pin_cfg *cfg) 17164 const struct auto_pin_cfg *cfg)
17079{ 17165{
17080 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; 17166 static const char * const chname[4] = {
17167 "Front", "Surround", "CLFE", "Side"
17168 };
17081 const char *pfx = alc_get_line_out_pfx(cfg, true); 17169 const char *pfx = alc_get_line_out_pfx(cfg, true);
17082 hda_nid_t nid_v, nid_s; 17170 hda_nid_t nid_v, nid_s;
17083 int i, err; 17171 int i, err;
@@ -17262,7 +17350,8 @@ enum {
17262/* reset GPIO1 */ 17350/* reset GPIO1 */
17263static const struct alc_fixup alc861vd_fixups[] = { 17351static const struct alc_fixup alc861vd_fixups[] = {
17264 [ALC660VD_FIX_ASUS_GPIO1] = { 17352 [ALC660VD_FIX_ASUS_GPIO1] = {
17265 .verbs = (const struct hda_verb[]) { 17353 .type = ALC_FIXUP_VERBS,
17354 .v.verbs = (const struct hda_verb[]) {
17266 {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, 17355 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17267 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, 17356 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17268 {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, 17357 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
@@ -17297,8 +17386,10 @@ static int patch_alc861vd(struct hda_codec *codec)
17297 board_config = ALC861VD_AUTO; 17386 board_config = ALC861VD_AUTO;
17298 } 17387 }
17299 17388
17300 if (board_config == ALC861VD_AUTO) 17389 if (board_config == ALC861VD_AUTO) {
17301 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); 17390 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17391 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17392 }
17302 17393
17303 if (board_config == ALC861VD_AUTO) { 17394 if (board_config == ALC861VD_AUTO) {
17304 /* automatic parse from the BIOS config */ 17395 /* automatic parse from the BIOS config */
@@ -17346,8 +17437,7 @@ static int patch_alc861vd(struct hda_codec *codec)
17346 17437
17347 spec->vmaster_nid = 0x02; 17438 spec->vmaster_nid = 0x02;
17348 17439
17349 if (board_config == ALC861VD_AUTO) 17440 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17350 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17351 17441
17352 codec->patch_ops = alc_patch_ops; 17442 codec->patch_ops = alc_patch_ops;
17353 17443
@@ -18630,7 +18720,7 @@ static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18630/* 18720/*
18631 * configuration and preset 18721 * configuration and preset
18632 */ 18722 */
18633static const char *alc662_models[ALC662_MODEL_LAST] = { 18723static const char * const alc662_models[ALC662_MODEL_LAST] = {
18634 [ALC662_3ST_2ch_DIG] = "3stack-dig", 18724 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18635 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", 18725 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18636 [ALC662_3ST_6ch] = "3stack-6ch", 18726 [ALC662_3ST_6ch] = "3stack-6ch",
@@ -18735,6 +18825,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
18735 ALC662_3ST_6ch_DIG), 18825 ALC662_3ST_6ch_DIG),
18736 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", 18826 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18737 ALC663_ASUS_H13), 18827 ALC663_ASUS_H13),
18828 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18738 {} 18829 {}
18739}; 18830};
18740 18831
@@ -19145,7 +19236,7 @@ static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19145 const struct auto_pin_cfg *cfg) 19236 const struct auto_pin_cfg *cfg)
19146{ 19237{
19147 struct alc_spec *spec = codec->spec; 19238 struct alc_spec *spec = codec->spec;
19148 static const char *chname[4] = { 19239 static const char * const chname[4] = {
19149 "Front", "Surround", NULL /*CLFE*/, "Side" 19240 "Front", "Surround", NULL /*CLFE*/, "Side"
19150 }; 19241 };
19151 const char *pfx = alc_get_line_out_pfx(cfg, true); 19242 const char *pfx = alc_get_line_out_pfx(cfg, true);
@@ -19378,7 +19469,10 @@ static void alc662_auto_init(struct hda_codec *codec)
19378} 19469}
19379 19470
19380static void alc272_fixup_mario(struct hda_codec *codec, 19471static void alc272_fixup_mario(struct hda_codec *codec,
19381 const struct alc_fixup *fix, int pre_init) { 19472 const struct alc_fixup *fix, int action)
19473{
19474 if (action != ALC_FIXUP_ACT_PROBE)
19475 return;
19382 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, 19476 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19383 (0x3b << AC_AMPCAP_OFFSET_SHIFT) | 19477 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19384 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | 19478 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
@@ -19392,31 +19486,44 @@ enum {
19392 ALC662_FIXUP_ASPIRE, 19486 ALC662_FIXUP_ASPIRE,
19393 ALC662_FIXUP_IDEAPAD, 19487 ALC662_FIXUP_IDEAPAD,
19394 ALC272_FIXUP_MARIO, 19488 ALC272_FIXUP_MARIO,
19489 ALC662_FIXUP_CZC_P10T,
19395}; 19490};
19396 19491
19397static const struct alc_fixup alc662_fixups[] = { 19492static const struct alc_fixup alc662_fixups[] = {
19398 [ALC662_FIXUP_ASPIRE] = { 19493 [ALC662_FIXUP_ASPIRE] = {
19399 .pins = (const struct alc_pincfg[]) { 19494 .type = ALC_FIXUP_PINS,
19495 .v.pins = (const struct alc_pincfg[]) {
19400 { 0x15, 0x99130112 }, /* subwoofer */ 19496 { 0x15, 0x99130112 }, /* subwoofer */
19401 { } 19497 { }
19402 } 19498 }
19403 }, 19499 },
19404 [ALC662_FIXUP_IDEAPAD] = { 19500 [ALC662_FIXUP_IDEAPAD] = {
19405 .pins = (const struct alc_pincfg[]) { 19501 .type = ALC_FIXUP_PINS,
19502 .v.pins = (const struct alc_pincfg[]) {
19406 { 0x17, 0x99130112 }, /* subwoofer */ 19503 { 0x17, 0x99130112 }, /* subwoofer */
19407 { } 19504 { }
19408 } 19505 }
19409 }, 19506 },
19410 [ALC272_FIXUP_MARIO] = { 19507 [ALC272_FIXUP_MARIO] = {
19411 .func = alc272_fixup_mario, 19508 .type = ALC_FIXUP_FUNC,
19412 } 19509 .v.func = alc272_fixup_mario,
19510 },
19511 [ALC662_FIXUP_CZC_P10T] = {
19512 .type = ALC_FIXUP_VERBS,
19513 .v.verbs = (const struct hda_verb[]) {
19514 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19515 {}
19516 }
19517 },
19413}; 19518};
19414 19519
19415static struct snd_pci_quirk alc662_fixup_tbl[] = { 19520static struct snd_pci_quirk alc662_fixup_tbl[] = {
19521 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19416 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), 19522 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19417 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), 19523 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19418 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), 19524 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19419 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), 19525 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19526 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19420 {} 19527 {}
19421}; 19528};
19422 19529
@@ -19462,7 +19569,9 @@ static int patch_alc662(struct hda_codec *codec)
19462 } 19569 }
19463 19570
19464 if (board_config == ALC662_AUTO) { 19571 if (board_config == ALC662_AUTO) {
19465 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); 19572 alc_pick_fixup(codec, alc662_fixup_models,
19573 alc662_fixup_tbl, alc662_fixups);
19574 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19466 /* automatic parse from the BIOS config */ 19575 /* automatic parse from the BIOS config */
19467 err = alc662_parse_auto_config(codec); 19576 err = alc662_parse_auto_config(codec);
19468 if (err < 0) { 19577 if (err < 0) {
@@ -19520,12 +19629,11 @@ static int patch_alc662(struct hda_codec *codec)
19520 } 19629 }
19521 spec->vmaster_nid = 0x02; 19630 spec->vmaster_nid = 0x02;
19522 19631
19632 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19633
19523 codec->patch_ops = alc_patch_ops; 19634 codec->patch_ops = alc_patch_ops;
19524 if (board_config == ALC662_AUTO) { 19635 if (board_config == ALC662_AUTO)
19525 spec->init_hook = alc662_auto_init; 19636 spec->init_hook = alc662_auto_init;
19526 alc_pick_fixup_model(codec, alc662_fixup_models,
19527 alc662_fixup_tbl, alc662_fixups, 0);
19528 }
19529 19637
19530 alc_init_jacks(codec); 19638 alc_init_jacks(codec);
19531 19639
@@ -19913,7 +20021,7 @@ static void alc680_auto_init(struct hda_codec *codec)
19913/* 20021/*
19914 * configuration and preset 20022 * configuration and preset
19915 */ 20023 */
19916static const char *alc680_models[ALC680_MODEL_LAST] = { 20024static const char * const alc680_models[ALC680_MODEL_LAST] = {
19917 [ALC680_BASE] = "base", 20025 [ALC680_BASE] = "base",
19918 [ALC680_AUTO] = "auto", 20026 [ALC680_AUTO] = "auto",
19919}; 20027};
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 4ab019d0924e..9ea48b425d0b 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -266,7 +266,7 @@ struct sigmatel_spec {
266 struct sigmatel_mic_route int_mic; 266 struct sigmatel_mic_route int_mic;
267 struct sigmatel_mic_route dock_mic; 267 struct sigmatel_mic_route dock_mic;
268 268
269 const char **spdif_labels; 269 const char * const *spdif_labels;
270 270
271 hda_nid_t dig_in_nid; 271 hda_nid_t dig_in_nid;
272 hda_nid_t mono_nid; 272 hda_nid_t mono_nid;
@@ -524,7 +524,7 @@ static unsigned long stac927x_capsws[] = {
524 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), 524 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
525}; 525};
526 526
527static const char *stac927x_spdif_labels[5] = { 527static const char * const stac927x_spdif_labels[5] = {
528 "Digital Playback", "ADAT", "Analog Mux 1", 528 "Digital Playback", "ADAT", "Analog Mux 1",
529 "Analog Mux 2", "Analog Mux 3" 529 "Analog Mux 2", "Analog Mux 3"
530}; 530};
@@ -1062,7 +1062,7 @@ static struct snd_kcontrol_new stac_smux_mixer = {
1062 .put = stac92xx_smux_enum_put, 1062 .put = stac92xx_smux_enum_put,
1063}; 1063};
1064 1064
1065static const char *slave_vols[] = { 1065static const char * const slave_vols[] = {
1066 "Front Playback Volume", 1066 "Front Playback Volume",
1067 "Surround Playback Volume", 1067 "Surround Playback Volume",
1068 "Center Playback Volume", 1068 "Center Playback Volume",
@@ -1073,7 +1073,7 @@ static const char *slave_vols[] = {
1073 NULL 1073 NULL
1074}; 1074};
1075 1075
1076static const char *slave_sws[] = { 1076static const char * const slave_sws[] = {
1077 "Front Playback Switch", 1077 "Front Playback Switch",
1078 "Surround Playback Switch", 1078 "Surround Playback Switch",
1079 "Center Playback Switch", 1079 "Center Playback Switch",
@@ -1354,7 +1354,7 @@ static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1354 [STAC_9200_PANASONIC] = ref9200_pin_configs, 1354 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1355}; 1355};
1356 1356
1357static const char *stac9200_models[STAC_9200_MODELS] = { 1357static const char * const stac9200_models[STAC_9200_MODELS] = {
1358 [STAC_AUTO] = "auto", 1358 [STAC_AUTO] = "auto",
1359 [STAC_REF] = "ref", 1359 [STAC_REF] = "ref",
1360 [STAC_9200_OQO] = "oqo", 1360 [STAC_9200_OQO] = "oqo",
@@ -1500,7 +1500,7 @@ static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1500 [STAC_M6] = stac925xM6_pin_configs, 1500 [STAC_M6] = stac925xM6_pin_configs,
1501}; 1501};
1502 1502
1503static const char *stac925x_models[STAC_925x_MODELS] = { 1503static const char * const stac925x_models[STAC_925x_MODELS] = {
1504 [STAC_925x_AUTO] = "auto", 1504 [STAC_925x_AUTO] = "auto",
1505 [STAC_REF] = "ref", 1505 [STAC_REF] = "ref",
1506 [STAC_M1] = "m1", 1506 [STAC_M1] = "m1",
@@ -1574,7 +1574,7 @@ static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1574 [STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs, 1574 [STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs,
1575}; 1575};
1576 1576
1577static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { 1577static const char * const stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1578 [STAC_92HD73XX_AUTO] = "auto", 1578 [STAC_92HD73XX_AUTO] = "auto",
1579 [STAC_92HD73XX_NO_JD] = "no-jd", 1579 [STAC_92HD73XX_NO_JD] = "no-jd",
1580 [STAC_92HD73XX_REF] = "ref", 1580 [STAC_92HD73XX_REF] = "ref",
@@ -1660,7 +1660,7 @@ static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1660 [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, 1660 [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs,
1661}; 1661};
1662 1662
1663static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { 1663static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1664 [STAC_92HD83XXX_AUTO] = "auto", 1664 [STAC_92HD83XXX_AUTO] = "auto",
1665 [STAC_92HD83XXX_REF] = "ref", 1665 [STAC_92HD83XXX_REF] = "ref",
1666 [STAC_92HD83XXX_PWR_REF] = "mic-ref", 1666 [STAC_92HD83XXX_PWR_REF] = "mic-ref",
@@ -1722,7 +1722,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1722 [STAC_HP_DV4_1222NR] = NULL, 1722 [STAC_HP_DV4_1222NR] = NULL,
1723}; 1723};
1724 1724
1725static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { 1725static const char * const stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1726 [STAC_92HD71BXX_AUTO] = "auto", 1726 [STAC_92HD71BXX_AUTO] = "auto",
1727 [STAC_92HD71BXX_REF] = "ref", 1727 [STAC_92HD71BXX_REF] = "ref",
1728 [STAC_DELL_M4_1] = "dell-m4-1", 1728 [STAC_DELL_M4_1] = "dell-m4-1",
@@ -1915,7 +1915,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1915 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, 1915 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1916}; 1916};
1917 1917
1918static const char *stac922x_models[STAC_922X_MODELS] = { 1918static const char * const stac922x_models[STAC_922X_MODELS] = {
1919 [STAC_922X_AUTO] = "auto", 1919 [STAC_922X_AUTO] = "auto",
1920 [STAC_D945_REF] = "ref", 1920 [STAC_D945_REF] = "ref",
1921 [STAC_D945GTP5] = "5stack", 1921 [STAC_D945GTP5] = "5stack",
@@ -2077,7 +2077,7 @@ static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2077 [STAC_927X_VOLKNOB] = NULL, 2077 [STAC_927X_VOLKNOB] = NULL,
2078}; 2078};
2079 2079
2080static const char *stac927x_models[STAC_927X_MODELS] = { 2080static const char * const stac927x_models[STAC_927X_MODELS] = {
2081 [STAC_927X_AUTO] = "auto", 2081 [STAC_927X_AUTO] = "auto",
2082 [STAC_D965_REF_NO_JD] = "ref-no-jd", 2082 [STAC_D965_REF_NO_JD] = "ref-no-jd",
2083 [STAC_D965_REF] = "ref", 2083 [STAC_D965_REF] = "ref",
@@ -2180,7 +2180,7 @@ static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2180 [STAC_9205_EAPD] = NULL, 2180 [STAC_9205_EAPD] = NULL,
2181}; 2181};
2182 2182
2183static const char *stac9205_models[STAC_9205_MODELS] = { 2183static const char * const stac9205_models[STAC_9205_MODELS] = {
2184 [STAC_9205_AUTO] = "auto", 2184 [STAC_9205_AUTO] = "auto",
2185 [STAC_9205_REF] = "ref", 2185 [STAC_9205_REF] = "ref",
2186 [STAC_9205_DELL_M42] = "dell-m42", 2186 [STAC_9205_DELL_M42] = "dell-m42",
@@ -3123,7 +3123,7 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3123 int type) 3123 int type)
3124{ 3124{
3125 struct sigmatel_spec *spec = codec->spec; 3125 struct sigmatel_spec *spec = codec->spec;
3126 static const char *chname[4] = { 3126 static const char * const chname[4] = {
3127 "Front", "Surround", NULL /*CLFE*/, "Side" 3127 "Front", "Surround", NULL /*CLFE*/, "Side"
3128 }; 3128 };
3129 hda_nid_t nid; 3129 hda_nid_t nid;
@@ -3256,7 +3256,7 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
3256} 3256}
3257 3257
3258/* labels for mono mux outputs */ 3258/* labels for mono mux outputs */
3259static const char *stac92xx_mono_labels[4] = { 3259static const char * const stac92xx_mono_labels[4] = {
3260 "DAC0", "DAC1", "Mixer", "DAC2" 3260 "DAC0", "DAC1", "Mixer", "DAC2"
3261}; 3261};
3262 3262
@@ -3380,7 +3380,7 @@ static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
3380 return 0; 3380 return 0;
3381}; 3381};
3382 3382
3383static const char *stac92xx_spdif_labels[3] = { 3383static const char * const stac92xx_spdif_labels[3] = {
3384 "Digital Playback", "Analog Mux 1", "Analog Mux 2", 3384 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3385}; 3385};
3386 3386
@@ -3388,7 +3388,7 @@ static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3388{ 3388{
3389 struct sigmatel_spec *spec = codec->spec; 3389 struct sigmatel_spec *spec = codec->spec;
3390 struct hda_input_mux *spdif_mux = &spec->private_smux; 3390 struct hda_input_mux *spdif_mux = &spec->private_smux;
3391 const char **labels = spec->spdif_labels; 3391 const char * const *labels = spec->spdif_labels;
3392 int i, num_cons; 3392 int i, num_cons;
3393 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; 3393 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3394 3394
@@ -3409,7 +3409,7 @@ static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3409} 3409}
3410 3410
3411/* labels for dmic mux inputs */ 3411/* labels for dmic mux inputs */
3412static const char *stac92xx_dmic_labels[5] = { 3412static const char * const stac92xx_dmic_labels[5] = {
3413 "Analog Inputs", "Digital Mic 1", "Digital Mic 2", 3413 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
3414 "Digital Mic 3", "Digital Mic 4" 3414 "Digital Mic 3", "Digital Mic 4"
3415}; 3415};
@@ -5333,7 +5333,7 @@ again:
5333 return 0; 5333 return 0;
5334} 5334}
5335 5335
5336static int stac92hd83xxx_set_system_btl_amp(struct hda_codec *codec) 5336static int hp_bnb2011_with_dock(struct hda_codec *codec)
5337{ 5337{
5338 if (codec->vendor_id != 0x111d7605 && 5338 if (codec->vendor_id != 0x111d7605 &&
5339 codec->vendor_id != 0x111d76d1) 5339 codec->vendor_id != 0x111d76d1)
@@ -5348,10 +5348,6 @@ static int stac92hd83xxx_set_system_btl_amp(struct hda_codec *codec)
5348 case 0x103c161d: 5348 case 0x103c161d:
5349 case 0x103c161e: 5349 case 0x103c161e:
5350 case 0x103c161f: 5350 case 0x103c161f:
5351 case 0x103c1620:
5352 case 0x103c1621:
5353 case 0x103c1622:
5354 case 0x103c1623:
5355 5351
5356 case 0x103c162a: 5352 case 0x103c162a:
5357 case 0x103c162b: 5353 case 0x103c162b:
@@ -5360,41 +5356,9 @@ static int stac92hd83xxx_set_system_btl_amp(struct hda_codec *codec)
5360 case 0x103c1631: 5356 case 0x103c1631:
5361 5357
5362 case 0x103c1633: 5358 case 0x103c1633:
5363 5359 case 0x103c1634:
5364 case 0x103c1635: 5360 case 0x103c1635:
5365 5361
5366 case 0x103c164f:
5367
5368 case 0x103c1676:
5369 case 0x103c1677:
5370 case 0x103c1678:
5371 case 0x103c1679:
5372 case 0x103c167a:
5373 case 0x103c167b:
5374 case 0x103c167c:
5375 case 0x103c167d:
5376 case 0x103c167e:
5377 case 0x103c167f:
5378 case 0x103c1680:
5379 case 0x103c1681:
5380 case 0x103c1682:
5381 case 0x103c1683:
5382 case 0x103c1684:
5383 case 0x103c1685:
5384 case 0x103c1686:
5385 case 0x103c1687:
5386 case 0x103c1688:
5387 case 0x103c1689:
5388 case 0x103c168a:
5389 case 0x103c168b:
5390 case 0x103c168c:
5391 case 0x103c168d:
5392 case 0x103c168e:
5393 case 0x103c168f:
5394 case 0x103c1690:
5395 case 0x103c1691:
5396 case 0x103c1692:
5397
5398 case 0x103c3587: 5362 case 0x103c3587:
5399 case 0x103c3588: 5363 case 0x103c3588:
5400 case 0x103c3589: 5364 case 0x103c3589:
@@ -5402,9 +5366,9 @@ static int stac92hd83xxx_set_system_btl_amp(struct hda_codec *codec)
5402 5366
5403 case 0x103c3667: 5367 case 0x103c3667:
5404 case 0x103c3668: 5368 case 0x103c3668:
5405 /* set BTL amp level to 13.43dB for louder speaker output */ 5369 case 0x103c3669:
5406 return snd_hda_codec_write_cache(codec, codec->afg, 0, 5370
5407 0x7F4, 0x14); 5371 return 1;
5408 } 5372 }
5409 return 0; 5373 return 0;
5410} 5374}
@@ -5420,6 +5384,11 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5420 if (spec == NULL) 5384 if (spec == NULL)
5421 return -ENOMEM; 5385 return -ENOMEM;
5422 5386
5387 if (hp_bnb2011_with_dock(codec)) {
5388 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
5389 snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e);
5390 }
5391
5423 /* reset pin power-down; Windows may leave these bits after reboot */ 5392 /* reset pin power-down; Windows may leave these bits after reboot */
5424 snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7EC, 0); 5393 snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7EC, 0);
5425 snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7ED, 0); 5394 snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7ED, 0);
@@ -5546,8 +5515,6 @@ again:
5546 AC_VERB_SET_CONNECT_SEL, num_dacs); 5515 AC_VERB_SET_CONNECT_SEL, num_dacs);
5547 } 5516 }
5548 5517
5549 stac92hd83xxx_set_system_btl_amp(codec);
5550
5551 codec->proc_widget_hook = stac92hd_proc_hook; 5518 codec->proc_widget_hook = stac92hd_proc_hook;
5552 5519
5553 return 0; 5520 return 0;
@@ -6270,7 +6237,7 @@ static unsigned int stac9872_vaio_pin_configs[9] = {
6270 0x90a7013e 6237 0x90a7013e
6271}; 6238};
6272 6239
6273static const char *stac9872_models[STAC_9872_MODELS] = { 6240static const char * const stac9872_models[STAC_9872_MODELS] = {
6274 [STAC_9872_AUTO] = "auto", 6241 [STAC_9872_AUTO] = "auto",
6275 [STAC_9872_VAIO] = "vaio", 6242 [STAC_9872_VAIO] = "vaio",
6276}; 6243};
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 7f4852a478a1..a76c3260d941 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -2281,7 +2281,9 @@ static int vt1708_auto_create_multi_out_ctls(struct via_spec *spec,
2281 const struct auto_pin_cfg *cfg) 2281 const struct auto_pin_cfg *cfg)
2282{ 2282{
2283 char name[32]; 2283 char name[32];
2284 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 2284 static const char * const chname[4] = {
2285 "Front", "Surround", "C/LFE", "Side"
2286 };
2285 hda_nid_t nid, nid_vol, nid_vols[] = {0x17, 0x19, 0x1a, 0x1b}; 2287 hda_nid_t nid, nid_vol, nid_vols[] = {0x17, 0x19, 0x1a, 0x1b};
2286 int i, err; 2288 int i, err;
2287 2289
@@ -2370,7 +2372,7 @@ static void create_hp_imux(struct via_spec *spec)
2370{ 2372{
2371 int i; 2373 int i;
2372 struct hda_input_mux *imux = &spec->private_imux[1]; 2374 struct hda_input_mux *imux = &spec->private_imux[1];
2373 static const char *texts[] = { "OFF", "ON", NULL}; 2375 static const char * const texts[] = { "OFF", "ON", NULL};
2374 2376
2375 /* for hp mode select */ 2377 /* for hp mode select */
2376 for (i = 0; texts[i]; i++) 2378 for (i = 0; texts[i]; i++)
@@ -2890,7 +2892,9 @@ static int vt1709_auto_create_multi_out_ctls(struct via_spec *spec,
2890 const struct auto_pin_cfg *cfg) 2892 const struct auto_pin_cfg *cfg)
2891{ 2893{
2892 char name[32]; 2894 char name[32];
2893 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 2895 static const char * const chname[4] = {
2896 "Front", "Surround", "C/LFE", "Side"
2897 };
2894 hda_nid_t nid, nid_vol, nid_vols[] = {0x18, 0x1a, 0x1b, 0x29}; 2898 hda_nid_t nid, nid_vol, nid_vols[] = {0x18, 0x1a, 0x1b, 0x29};
2895 int i, err; 2899 int i, err;
2896 2900
@@ -3433,7 +3437,9 @@ static int vt1708B_auto_create_multi_out_ctls(struct via_spec *spec,
3433 const struct auto_pin_cfg *cfg) 3437 const struct auto_pin_cfg *cfg)
3434{ 3438{
3435 char name[32]; 3439 char name[32];
3436 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 3440 static const char * const chname[4] = {
3441 "Front", "Surround", "C/LFE", "Side"
3442 };
3437 hda_nid_t nid_vols[] = {0x16, 0x18, 0x26, 0x27}; 3443 hda_nid_t nid_vols[] = {0x16, 0x18, 0x26, 0x27};
3438 hda_nid_t nid, nid_vol = 0; 3444 hda_nid_t nid, nid_vol = 0;
3439 int i, err; 3445 int i, err;
@@ -3861,7 +3867,9 @@ static int vt1708S_auto_create_multi_out_ctls(struct via_spec *spec,
3861 const struct auto_pin_cfg *cfg) 3867 const struct auto_pin_cfg *cfg)
3862{ 3868{
3863 char name[32]; 3869 char name[32];
3864 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 3870 static const char * const chname[4] = {
3871 "Front", "Surround", "C/LFE", "Side"
3872 };
3865 hda_nid_t nid_vols[] = {0x10, 0x11, 0x24, 0x25}; 3873 hda_nid_t nid_vols[] = {0x10, 0x11, 0x24, 0x25};
3866 hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x26, 0x27}; 3874 hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x26, 0x27};
3867 hda_nid_t nid, nid_vol, nid_mute; 3875 hda_nid_t nid, nid_vol, nid_mute;
@@ -4304,7 +4312,7 @@ static int vt1702_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin)
4304{ 4312{
4305 int err, i; 4313 int err, i;
4306 struct hda_input_mux *imux; 4314 struct hda_input_mux *imux;
4307 static const char *texts[] = { "ON", "OFF", NULL}; 4315 static const char * const texts[] = { "ON", "OFF", NULL};
4308 if (!pin) 4316 if (!pin)
4309 return 0; 4317 return 0;
4310 spec->multiout.hp_nid = 0x1D; 4318 spec->multiout.hp_nid = 0x1D;
@@ -4615,7 +4623,9 @@ static int vt1718S_auto_create_multi_out_ctls(struct via_spec *spec,
4615 const struct auto_pin_cfg *cfg) 4623 const struct auto_pin_cfg *cfg)
4616{ 4624{
4617 char name[32]; 4625 char name[32];
4618 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 4626 static const char * const chname[4] = {
4627 "Front", "Surround", "C/LFE", "Side"
4628 };
4619 hda_nid_t nid_vols[] = {0x8, 0x9, 0xa, 0xb}; 4629 hda_nid_t nid_vols[] = {0x8, 0x9, 0xa, 0xb};
4620 hda_nid_t nid_mutes[] = {0x24, 0x25, 0x26, 0x27}; 4630 hda_nid_t nid_mutes[] = {0x24, 0x25, 0x26, 0x27};
4621 hda_nid_t nid, nid_vol, nid_mute = 0; 4631 hda_nid_t nid, nid_vol, nid_mute = 0;
@@ -5064,7 +5074,9 @@ static int vt1716S_auto_create_multi_out_ctls(struct via_spec *spec,
5064 const struct auto_pin_cfg *cfg) 5074 const struct auto_pin_cfg *cfg)
5065{ 5075{
5066 char name[32]; 5076 char name[32];
5067 static const char *chname[3] = { "Front", "Surround", "C/LFE" }; 5077 static const char * const chname[3] = {
5078 "Front", "Surround", "C/LFE"
5079 };
5068 hda_nid_t nid_vols[] = {0x10, 0x11, 0x25}; 5080 hda_nid_t nid_vols[] = {0x10, 0x11, 0x25};
5069 hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x27}; 5081 hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x27};
5070 hda_nid_t nid, nid_vol, nid_mute; 5082 hda_nid_t nid, nid_vol, nid_mute;
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 7b62de089fee..20c6b079d0df 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -580,6 +580,7 @@ static int __devinit snd_ice1712_delta_init(struct snd_ice1712 *ice)
580{ 580{
581 int err; 581 int err;
582 struct snd_akm4xxx *ak; 582 struct snd_akm4xxx *ak;
583 unsigned char tmp;
583 584
584 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010 && 585 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010 &&
585 ice->eeprom.gpiodir == 0x7b) 586 ice->eeprom.gpiodir == 0x7b)
@@ -622,6 +623,12 @@ static int __devinit snd_ice1712_delta_init(struct snd_ice1712 *ice)
622 break; 623 break;
623 } 624 }
624 625
626 /* initialize the SPI clock to high */
627 tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
628 tmp |= ICE1712_DELTA_AP_CCLK;
629 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
630 udelay(5);
631
625 /* initialize spdif */ 632 /* initialize spdif */
626 switch (ice->eeprom.subvendor) { 633 switch (ice->eeprom.subvendor) {
627 case ICE1712_SUBDEVICE_AUDIOPHILE: 634 case ICE1712_SUBDEVICE_AUDIOPHILE:
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h
index c2ae63d17cd2..f53897a708b4 100644
--- a/sound/pci/oxygen/oxygen.h
+++ b/sound/pci/oxygen/oxygen.h
@@ -92,6 +92,8 @@ struct oxygen_model {
92 void (*update_dac_volume)(struct oxygen *chip); 92 void (*update_dac_volume)(struct oxygen *chip);
93 void (*update_dac_mute)(struct oxygen *chip); 93 void (*update_dac_mute)(struct oxygen *chip);
94 void (*update_center_lfe_mix)(struct oxygen *chip, bool mixed); 94 void (*update_center_lfe_mix)(struct oxygen *chip, bool mixed);
95 unsigned int (*adjust_dac_routing)(struct oxygen *chip,
96 unsigned int play_routing);
95 void (*gpio_changed)(struct oxygen *chip); 97 void (*gpio_changed)(struct oxygen *chip);
96 void (*uart_input)(struct oxygen *chip); 98 void (*uart_input)(struct oxygen *chip);
97 void (*ac97_switch)(struct oxygen *chip, 99 void (*ac97_switch)(struct oxygen *chip,
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 9bff14d5895d..26c7e8bcb229 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/sound/pci/oxygen/oxygen_mixer.c
@@ -180,6 +180,8 @@ void oxygen_update_dac_routing(struct oxygen *chip)
180 (1 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | 180 (1 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) |
181 (2 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) | 181 (2 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) |
182 (3 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT); 182 (3 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT);
183 if (chip->model.adjust_dac_routing)
184 reg_value = chip->model.adjust_dac_routing(chip, reg_value);
183 oxygen_write16_masked(chip, OXYGEN_PLAY_ROUTING, reg_value, 185 oxygen_write16_masked(chip, OXYGEN_PLAY_ROUTING, reg_value,
184 OXYGEN_PLAY_DAC0_SOURCE_MASK | 186 OXYGEN_PLAY_DAC0_SOURCE_MASK |
185 OXYGEN_PLAY_DAC1_SOURCE_MASK | 187 OXYGEN_PLAY_DAC1_SOURCE_MASK |
diff --git a/sound/pci/oxygen/xonar_cs43xx.c b/sound/pci/oxygen/xonar_cs43xx.c
index 9f72d424969c..252719101c42 100644
--- a/sound/pci/oxygen/xonar_cs43xx.c
+++ b/sound/pci/oxygen/xonar_cs43xx.c
@@ -392,7 +392,7 @@ static void dump_d1_registers(struct oxygen *chip,
392 unsigned int i; 392 unsigned int i;
393 393
394 snd_iprintf(buffer, "\nCS4398: 7?"); 394 snd_iprintf(buffer, "\nCS4398: 7?");
395 for (i = 2; i <= 8; ++i) 395 for (i = 2; i < 8; ++i)
396 snd_iprintf(buffer, " %02x", data->cs4398_regs[i]); 396 snd_iprintf(buffer, " %02x", data->cs4398_regs[i]);
397 snd_iprintf(buffer, "\n"); 397 snd_iprintf(buffer, "\n");
398 dump_cs4362a_registers(data, buffer); 398 dump_cs4362a_registers(data, buffer);
diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c
index e4de0b8d087a..bc6eb58be380 100644
--- a/sound/pci/oxygen/xonar_dg.c
+++ b/sound/pci/oxygen/xonar_dg.c
@@ -24,6 +24,11 @@
24 * 24 *
25 * SPI 0 -> CS4245 25 * SPI 0 -> CS4245
26 * 26 *
27 * I²S 1 -> CS4245
28 * I²S 2 -> CS4361 (center/LFE)
29 * I²S 3 -> CS4361 (surround)
30 * I²S 4 -> CS4361 (front)
31 *
27 * GPIO 3 <- ? 32 * GPIO 3 <- ?
28 * GPIO 4 <- headphone detect 33 * GPIO 4 <- headphone detect
29 * GPIO 5 -> route input jack to line-in (0) or mic-in (1) 34 * GPIO 5 -> route input jack to line-in (0) or mic-in (1)
@@ -36,6 +41,7 @@
36 * input 1 <- aux 41 * input 1 <- aux
37 * input 2 <- front mic 42 * input 2 <- front mic
38 * input 4 <- line/mic 43 * input 4 <- line/mic
44 * DAC out -> headphones
39 * aux out -> front panel headphones 45 * aux out -> front panel headphones
40 */ 46 */
41 47
@@ -75,7 +81,7 @@ static void cs4245_write(struct oxygen *chip, unsigned int reg, u8 value)
75 OXYGEN_SPI_CEN_LATCH_CLOCK_HI, 81 OXYGEN_SPI_CEN_LATCH_CLOCK_HI,
76 CS4245_SPI_ADDRESS | 82 CS4245_SPI_ADDRESS |
77 CS4245_SPI_WRITE | 83 CS4245_SPI_WRITE |
78 (value << 8) | reg); 84 (reg << 8) | value);
79 data->cs4245_regs[reg] = value; 85 data->cs4245_regs[reg] = value;
80} 86}
81 87
@@ -207,6 +213,35 @@ static void set_cs4245_adc_params(struct oxygen *chip,
207 cs4245_write_cached(chip, CS4245_ADC_CTRL, value); 213 cs4245_write_cached(chip, CS4245_ADC_CTRL, value);
208} 214}
209 215
216static inline unsigned int shift_bits(unsigned int value,
217 unsigned int shift_from,
218 unsigned int shift_to,
219 unsigned int mask)
220{
221 if (shift_from < shift_to)
222 return (value << (shift_to - shift_from)) & mask;
223 else
224 return (value >> (shift_from - shift_to)) & mask;
225}
226
227static unsigned int adjust_dg_dac_routing(struct oxygen *chip,
228 unsigned int play_routing)
229{
230 return (play_routing & OXYGEN_PLAY_DAC0_SOURCE_MASK) |
231 shift_bits(play_routing,
232 OXYGEN_PLAY_DAC2_SOURCE_SHIFT,
233 OXYGEN_PLAY_DAC1_SOURCE_SHIFT,
234 OXYGEN_PLAY_DAC1_SOURCE_MASK) |
235 shift_bits(play_routing,
236 OXYGEN_PLAY_DAC1_SOURCE_SHIFT,
237 OXYGEN_PLAY_DAC2_SOURCE_SHIFT,
238 OXYGEN_PLAY_DAC2_SOURCE_MASK) |
239 shift_bits(play_routing,
240 OXYGEN_PLAY_DAC0_SOURCE_SHIFT,
241 OXYGEN_PLAY_DAC3_SOURCE_SHIFT,
242 OXYGEN_PLAY_DAC3_SOURCE_MASK);
243}
244
210static int output_switch_info(struct snd_kcontrol *ctl, 245static int output_switch_info(struct snd_kcontrol *ctl,
211 struct snd_ctl_elem_info *info) 246 struct snd_ctl_elem_info *info)
212{ 247{
@@ -557,6 +592,7 @@ struct oxygen_model model_xonar_dg = {
557 .resume = dg_resume, 592 .resume = dg_resume,
558 .set_dac_params = set_cs4245_dac_params, 593 .set_dac_params = set_cs4245_dac_params,
559 .set_adc_params = set_cs4245_adc_params, 594 .set_adc_params = set_cs4245_adc_params,
595 .adjust_dac_routing = adjust_dg_dac_routing,
560 .dump_registers = dump_cs4245_registers, 596 .dump_registers = dump_cs4245_registers,
561 .model_data_size = sizeof(struct dg), 597 .model_data_size = sizeof(struct dg),
562 .device_config = PLAYBACK_0_TO_I2S | 598 .device_config = PLAYBACK_0_TO_I2S |