@@ -478,12 +478,45 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
478
478
set_eapd (codec , * p , on );
479
479
}
480
480
481
+ static int find_ext_mic_pin (struct hda_codec * codec );
482
+
483
+ static void alc_headset_mic_no_shutup (struct hda_codec * codec )
484
+ {
485
+ const struct hda_pincfg * pin ;
486
+ int mic_pin = find_ext_mic_pin (codec );
487
+ int i ;
488
+
489
+ /* don't shut up pins when unloading the driver; otherwise it breaks
490
+ * the default pin setup at the next load of the driver
491
+ */
492
+ if (codec -> bus -> shutdown )
493
+ return ;
494
+
495
+ snd_array_for_each (& codec -> init_pins , i , pin ) {
496
+ /* use read here for syncing after issuing each verb */
497
+ if (pin -> nid != mic_pin )
498
+ snd_hda_codec_read (codec , pin -> nid , 0 ,
499
+ AC_VERB_SET_PIN_WIDGET_CONTROL , 0 );
500
+ }
501
+
502
+ codec -> pins_shutup = 1 ;
503
+ }
504
+
481
505
static void alc_shutup_pins (struct hda_codec * codec )
482
506
{
483
507
struct alc_spec * spec = codec -> spec ;
484
508
485
- if (!spec -> no_shutup_pins )
486
- snd_hda_shutup_pins (codec );
509
+ switch (codec -> core .vendor_id ) {
510
+ case 0x10ec0286 :
511
+ case 0x10ec0288 :
512
+ case 0x10ec0298 :
513
+ alc_headset_mic_no_shutup (codec );
514
+ break ;
515
+ default :
516
+ if (!spec -> no_shutup_pins )
517
+ snd_hda_shutup_pins (codec );
518
+ break ;
519
+ }
487
520
}
488
521
489
522
/* generic shutup callback;
@@ -502,7 +535,6 @@ static void alc_eapd_shutup(struct hda_codec *codec)
502
535
/* generic EAPD initialization */
503
536
static void alc_auto_init_amp (struct hda_codec * codec , int type )
504
537
{
505
- alc_fill_eapd_coef (codec );
506
538
alc_auto_setup_eapd (codec , true);
507
539
alc_write_gpio (codec );
508
540
switch (type ) {
@@ -797,10 +829,22 @@ static int alc_build_controls(struct hda_codec *codec)
797
829
* Common callbacks
798
830
*/
799
831
832
+ static void alc_pre_init (struct hda_codec * codec )
833
+ {
834
+ alc_fill_eapd_coef (codec );
835
+ }
836
+
837
+ #define is_s4_resume (codec ) \
838
+ ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
839
+
800
840
static int alc_init (struct hda_codec * codec )
801
841
{
802
842
struct alc_spec * spec = codec -> spec ;
803
843
844
+ /* hibernation resume needs the full chip initialization */
845
+ if (is_s4_resume (codec ))
846
+ alc_pre_init (codec );
847
+
804
848
if (spec -> init_hook )
805
849
spec -> init_hook (codec );
806
850
@@ -1538,6 +1582,8 @@ static int patch_alc880(struct hda_codec *codec)
1538
1582
1539
1583
codec -> patch_ops .unsol_event = alc880_unsol_event ;
1540
1584
1585
+ alc_pre_init (codec );
1586
+
1541
1587
snd_hda_pick_fixup (codec , alc880_fixup_models , alc880_fixup_tbl ,
1542
1588
alc880_fixups );
1543
1589
snd_hda_apply_fixup (codec , HDA_FIXUP_ACT_PRE_PROBE );
@@ -1789,6 +1835,8 @@ static int patch_alc260(struct hda_codec *codec)
1789
1835
1790
1836
spec -> shutup = alc_eapd_shutup ;
1791
1837
1838
+ alc_pre_init (codec );
1839
+
1792
1840
snd_hda_pick_fixup (codec , alc260_fixup_models , alc260_fixup_tbl ,
1793
1841
alc260_fixups );
1794
1842
snd_hda_apply_fixup (codec , HDA_FIXUP_ACT_PRE_PROBE );
@@ -2492,6 +2540,8 @@ static int patch_alc882(struct hda_codec *codec)
2492
2540
break ;
2493
2541
}
2494
2542
2543
+ alc_pre_init (codec );
2544
+
2495
2545
snd_hda_pick_fixup (codec , alc882_fixup_models , alc882_fixup_tbl ,
2496
2546
alc882_fixups );
2497
2547
snd_hda_apply_fixup (codec , HDA_FIXUP_ACT_PRE_PROBE );
@@ -2666,6 +2716,8 @@ static int patch_alc262(struct hda_codec *codec)
2666
2716
#endif
2667
2717
alc_fix_pll_init (codec , 0x20 , 0x0a , 10 );
2668
2718
2719
+ alc_pre_init (codec );
2720
+
2669
2721
snd_hda_pick_fixup (codec , alc262_fixup_models , alc262_fixup_tbl ,
2670
2722
alc262_fixups );
2671
2723
snd_hda_apply_fixup (codec , HDA_FIXUP_ACT_PRE_PROBE );
@@ -2810,6 +2862,8 @@ static int patch_alc268(struct hda_codec *codec)
2810
2862
2811
2863
spec -> shutup = alc_eapd_shutup ;
2812
2864
2865
+ alc_pre_init (codec );
2866
+
2813
2867
snd_hda_pick_fixup (codec , alc268_fixup_models , alc268_fixup_tbl , alc268_fixups );
2814
2868
snd_hda_apply_fixup (codec , HDA_FIXUP_ACT_PRE_PROBE );
2815
2869
@@ -2924,27 +2978,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
2924
2978
return alc_parse_auto_config (codec , alc269_ignore , ssids );
2925
2979
}
2926
2980
2927
- static int find_ext_mic_pin (struct hda_codec * codec );
2928
-
2929
- static void alc286_shutup (struct hda_codec * codec )
2930
- {
2931
- const struct hda_pincfg * pin ;
2932
- int i ;
2933
- int mic_pin = find_ext_mic_pin (codec );
2934
- /* don't shut up pins when unloading the driver; otherwise it breaks
2935
- * the default pin setup at the next load of the driver
2936
- */
2937
- if (codec -> bus -> shutdown )
2938
- return ;
2939
- snd_array_for_each (& codec -> init_pins , i , pin ) {
2940
- /* use read here for syncing after issuing each verb */
2941
- if (pin -> nid != mic_pin )
2942
- snd_hda_codec_read (codec , pin -> nid , 0 ,
2943
- AC_VERB_SET_PIN_WIDGET_CONTROL , 0 );
2944
- }
2945
- codec -> pins_shutup = 1 ;
2946
- }
2947
-
2948
2981
static void alc269vb_toggle_power_output (struct hda_codec * codec , int power_up )
2949
2982
{
2950
2983
alc_update_coef_idx (codec , 0x04 , 1 << 11 , power_up ? (1 << 11 ) : 0 );
@@ -6964,7 +6997,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6964
6997
SND_PCI_QUIRK (0x1462 , 0xb171 , "Cubi N 8GL (MS-B171)" , ALC283_FIXUP_HEADSET_MIC ),
6965
6998
SND_PCI_QUIRK (0x1558 , 0x1325 , "System76 Darter Pro (darp5)" , ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),
6966
6999
SND_PCI_QUIRK (0x1558 , 0x8550 , "System76 Gazelle (gaze14)" , ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),
6967
- SND_PCI_QUIRK (0x1558 , 0x8560 , "System76 Gazelle (gaze14)" , ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),
7000
+ SND_PCI_QUIRK (0x1558 , 0x8551 , "System76 Gazelle (gaze14)" , ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),
7001
+ SND_PCI_QUIRK (0x1558 , 0x8560 , "System76 Gazelle (gaze14)" , ALC269_FIXUP_HEADSET_MIC ),
7002
+ SND_PCI_QUIRK (0x1558 , 0x8561 , "System76 Gazelle (gaze14)" , ALC269_FIXUP_HEADSET_MIC ),
6968
7003
SND_PCI_QUIRK (0x17aa , 0x1036 , "Lenovo P520" , ALC233_FIXUP_LENOVO_MULTI_CODECS ),
6969
7004
SND_PCI_QUIRK (0x17aa , 0x20f2 , "Thinkpad SL410/510" , ALC269_FIXUP_SKU_IGNORE ),
6970
7005
SND_PCI_QUIRK (0x17aa , 0x215e , "Thinkpad L512" , ALC269_FIXUP_SKU_IGNORE ),
@@ -7007,7 +7042,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
7007
7042
SND_PCI_QUIRK (0x17aa , 0x313c , "ThinkCentre Station" , ALC294_FIXUP_LENOVO_MIC_LOCATION ),
7008
7043
SND_PCI_QUIRK (0x17aa , 0x3902 , "Lenovo E50-80" , ALC269_FIXUP_DMIC_THINKPAD_ACPI ),
7009
7044
SND_PCI_QUIRK (0x17aa , 0x3977 , "IdeaPad S210" , ALC283_FIXUP_INT_MIC ),
7010
- SND_PCI_QUIRK (0x17aa , 0x3978 , "IdeaPad Y410P " , ALC269_FIXUP_NO_SHUTUP ),
7045
+ SND_PCI_QUIRK (0x17aa , 0x3978 , "Lenovo B50-70 " , ALC269_FIXUP_DMIC_THINKPAD_ACPI ),
7011
7046
SND_PCI_QUIRK (0x17aa , 0x5013 , "Thinkpad" , ALC269_FIXUP_LIMIT_INT_MIC_BOOST ),
7012
7047
SND_PCI_QUIRK (0x17aa , 0x501a , "Thinkpad" , ALC283_FIXUP_INT_MIC ),
7013
7048
SND_PCI_QUIRK (0x17aa , 0x501e , "Thinkpad L440" , ALC292_FIXUP_TPT440_DOCK ),
@@ -7736,7 +7771,6 @@ static int patch_alc269(struct hda_codec *codec)
7736
7771
case 0x10ec0286 :
7737
7772
case 0x10ec0288 :
7738
7773
spec -> codec_variant = ALC269_TYPE_ALC286 ;
7739
- spec -> shutup = alc286_shutup ;
7740
7774
break ;
7741
7775
case 0x10ec0298 :
7742
7776
spec -> codec_variant = ALC269_TYPE_ALC298 ;
@@ -7805,6 +7839,8 @@ static int patch_alc269(struct hda_codec *codec)
7805
7839
spec -> init_hook = alc5505_dsp_init ;
7806
7840
}
7807
7841
7842
+ alc_pre_init (codec );
7843
+
7808
7844
snd_hda_pick_fixup (codec , alc269_fixup_models ,
7809
7845
alc269_fixup_tbl , alc269_fixups );
7810
7846
snd_hda_pick_pin_fixup (codec , alc269_pin_fixup_tbl , alc269_fixups );
@@ -7947,6 +7983,8 @@ static int patch_alc861(struct hda_codec *codec)
7947
7983
spec -> power_hook = alc_power_eapd ;
7948
7984
#endif
7949
7985
7986
+ alc_pre_init (codec );
7987
+
7950
7988
snd_hda_pick_fixup (codec , NULL , alc861_fixup_tbl , alc861_fixups );
7951
7989
snd_hda_apply_fixup (codec , HDA_FIXUP_ACT_PRE_PROBE );
7952
7990
@@ -8044,6 +8082,8 @@ static int patch_alc861vd(struct hda_codec *codec)
8044
8082
8045
8083
spec -> shutup = alc_eapd_shutup ;
8046
8084
8085
+ alc_pre_init (codec );
8086
+
8047
8087
snd_hda_pick_fixup (codec , NULL , alc861vd_fixup_tbl , alc861vd_fixups );
8048
8088
snd_hda_apply_fixup (codec , HDA_FIXUP_ACT_PRE_PROBE );
8049
8089
@@ -8779,6 +8819,8 @@ static int patch_alc662(struct hda_codec *codec)
8779
8819
break ;
8780
8820
}
8781
8821
8822
+ alc_pre_init (codec );
8823
+
8782
8824
snd_hda_pick_fixup (codec , alc662_fixup_models ,
8783
8825
alc662_fixup_tbl , alc662_fixups );
8784
8826
snd_hda_pick_pin_fixup (codec , alc662_pin_fixup_tbl , alc662_fixups );
0 commit comments