@@ -117,6 +117,7 @@ struct alc_spec {
117
117
int codec_variant ; /* flag for other variants */
118
118
unsigned int has_alc5505_dsp :1 ;
119
119
unsigned int no_depop_delay :1 ;
120
+ unsigned int done_hp_init :1 ;
120
121
121
122
/* for PLL fix */
122
123
hda_nid_t pll_nid ;
@@ -3372,6 +3373,48 @@ static void alc_default_shutup(struct hda_codec *codec)
3372
3373
snd_hda_shutup_pins (codec );
3373
3374
}
3374
3375
3376
+ static void alc294_hp_init (struct hda_codec * codec )
3377
+ {
3378
+ struct alc_spec * spec = codec -> spec ;
3379
+ hda_nid_t hp_pin = spec -> gen .autocfg .hp_pins [0 ];
3380
+ int i , val ;
3381
+
3382
+ if (!hp_pin )
3383
+ return ;
3384
+
3385
+ snd_hda_codec_write (codec , hp_pin , 0 ,
3386
+ AC_VERB_SET_AMP_GAIN_MUTE , AMP_OUT_MUTE );
3387
+
3388
+ msleep (100 );
3389
+
3390
+ snd_hda_codec_write (codec , hp_pin , 0 ,
3391
+ AC_VERB_SET_PIN_WIDGET_CONTROL , 0x0 );
3392
+
3393
+ alc_update_coef_idx (codec , 0x6f , 0x000f , 0 );/* Set HP depop to manual mode */
3394
+ alc_update_coefex_idx (codec , 0x58 , 0x00 , 0x8000 , 0x8000 ); /* HP depop procedure start */
3395
+
3396
+ /* Wait for depop procedure finish */
3397
+ val = alc_read_coefex_idx (codec , 0x58 , 0x01 );
3398
+ for (i = 0 ; i < 20 && val & 0x0080 ; i ++ ) {
3399
+ msleep (50 );
3400
+ val = alc_read_coefex_idx (codec , 0x58 , 0x01 );
3401
+ }
3402
+ /* Set HP depop to auto mode */
3403
+ alc_update_coef_idx (codec , 0x6f , 0x000f , 0x000b );
3404
+ msleep (50 );
3405
+ }
3406
+
3407
+ static void alc294_init (struct hda_codec * codec )
3408
+ {
3409
+ struct alc_spec * spec = codec -> spec ;
3410
+
3411
+ if (!spec -> done_hp_init ) {
3412
+ alc294_hp_init (codec );
3413
+ spec -> done_hp_init = true;
3414
+ }
3415
+ alc_default_init (codec );
3416
+ }
3417
+
3375
3418
static void alc5505_coef_set (struct hda_codec * codec , unsigned int index_reg ,
3376
3419
unsigned int val )
3377
3420
{
@@ -7373,37 +7416,6 @@ static void alc269_fill_coef(struct hda_codec *codec)
7373
7416
alc_update_coef_idx (codec , 0x4 , 0 , 1 <<11 );
7374
7417
}
7375
7418
7376
- static void alc294_hp_init (struct hda_codec * codec )
7377
- {
7378
- struct alc_spec * spec = codec -> spec ;
7379
- hda_nid_t hp_pin = spec -> gen .autocfg .hp_pins [0 ];
7380
- int i , val ;
7381
-
7382
- if (!hp_pin )
7383
- return ;
7384
-
7385
- snd_hda_codec_write (codec , hp_pin , 0 ,
7386
- AC_VERB_SET_AMP_GAIN_MUTE , AMP_OUT_MUTE );
7387
-
7388
- msleep (100 );
7389
-
7390
- snd_hda_codec_write (codec , hp_pin , 0 ,
7391
- AC_VERB_SET_PIN_WIDGET_CONTROL , 0x0 );
7392
-
7393
- alc_update_coef_idx (codec , 0x6f , 0x000f , 0 );/* Set HP depop to manual mode */
7394
- alc_update_coefex_idx (codec , 0x58 , 0x00 , 0x8000 , 0x8000 ); /* HP depop procedure start */
7395
-
7396
- /* Wait for depop procedure finish */
7397
- val = alc_read_coefex_idx (codec , 0x58 , 0x01 );
7398
- for (i = 0 ; i < 20 && val & 0x0080 ; i ++ ) {
7399
- msleep (50 );
7400
- val = alc_read_coefex_idx (codec , 0x58 , 0x01 );
7401
- }
7402
- /* Set HP depop to auto mode */
7403
- alc_update_coef_idx (codec , 0x6f , 0x000f , 0x000b );
7404
- msleep (50 );
7405
- }
7406
-
7407
7419
/*
7408
7420
*/
7409
7421
static int patch_alc269 (struct hda_codec * codec )
@@ -7529,7 +7541,7 @@ static int patch_alc269(struct hda_codec *codec)
7529
7541
spec -> codec_variant = ALC269_TYPE_ALC294 ;
7530
7542
spec -> gen .mixer_nid = 0 ; /* ALC2x4 does not have any loopback mixer path */
7531
7543
alc_update_coef_idx (codec , 0x6b , 0x0018 , (1 <<4 ) | (1 <<3 )); /* UAJ MIC Vref control by verb */
7532
- alc294_hp_init ( codec ) ;
7544
+ spec -> init_hook = alc294_init ;
7533
7545
break ;
7534
7546
case 0x10ec0300 :
7535
7547
spec -> codec_variant = ALC269_TYPE_ALC300 ;
@@ -7541,7 +7553,7 @@ static int patch_alc269(struct hda_codec *codec)
7541
7553
spec -> codec_variant = ALC269_TYPE_ALC700 ;
7542
7554
spec -> gen .mixer_nid = 0 ; /* ALC700 does not have any loopback mixer path */
7543
7555
alc_update_coef_idx (codec , 0x4a , 1 << 15 , 0 ); /* Combo jack auto trigger control */
7544
- alc294_hp_init ( codec ) ;
7556
+ spec -> init_hook = alc294_init ;
7545
7557
break ;
7546
7558
7547
7559
}
0 commit comments