update ALC222 depop optimize
Hi Takashi,
Update ALC222 depop optimize as attach.
BR,
Kailang
From b818b6a4f8bbe031c5a85d325c89fc0bbcbd5e5c Mon Sep 17 00:00:00 2001
From: Kailang Yang <[email protected]>
Date: Wed, 5 Mar 2025 13:54:34 +0800
Subject: [PATCH] ALSA: hda/realtek: update ALC222 depop optimize
Add ALC222 its own depop functions for alc_init and alc_shutup.
sound/pci/hda/patch_realtek.c +76 -0
@@ -3844,6 +3844,79 @@ static void alc225_shutup(struct hda_codec *codec) } } +static void alc222_init (struct hda_codec *codec) +{ +struct alc_spec *spec = codec->spec; +hda_nid_t hp_pin =alc_get_hp_pin (spec); +bool hp1_pin_sense, hp2_pin_sense; + +if (!hp_pin) +return ; + +msleep (30 ); + + hp1_pin_sense =snd_hda_jack_detect (codec, hp_pin); + hp2_pin_sense =snd_hda_jack_detect (codec,0x14 ); + +if (hp1_pin_sense || hp2_pin_sense) { +msleep (2 ); + +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x14 ,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); +msleep (75 ); + +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x14 ,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE ); + +msleep (75 ); + } +} + +static void alc222_shutup (struct hda_codec *codec) +{ +struct alc_spec *spec = codec->spec; +hda_nid_t hp_pin =alc_get_hp_pin (spec); +bool hp1_pin_sense, hp2_pin_sense; + +if (!hp_pin) + hp_pin =0x21 ; + + hp1_pin_sense =snd_hda_jack_detect (codec, hp_pin); + hp2_pin_sense =snd_hda_jack_detect (codec,0x14 ); + +if (hp1_pin_sense || hp2_pin_sense) { +msleep (2 ); + +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x14 ,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); + +msleep (75 ); + +if (hp1_pin_sense) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); +if (hp2_pin_sense) +snd_hda_codec_write (codec,0x14 ,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); + +msleep (75 ); + } +alc_auto_setup_eapd (codec, false); +alc_shutup_pins (codec); +} +static void alc_default_init (struct hda_codec *codec) {struct alc_spec *spec = codec->spec;
@@ -11939,8 +12012,11 @@ static int patch_alc269(struct hda_codec *codec) spec->codec_variant =ALC269_TYPE_ALC300 ; spec->gen.mixer_nid =0 ;/* no loopback on ALC300 */ break ; +case 0x10ec0222 :case 0x10ec0623 : spec->codec_variant =ALC269_TYPE_ALC623 ; + spec->shutup = alc222_shutup; + spec->init_hook = alc222_init;break ;case 0x10ec0700 :case 0x10ec0701 :
Quoted 4 lines · Kailang
Hi Takashi,
Update ALC222 depop optimize as attach.
Could you give a bit more background info why this change is needed? Is it a mandatory change to fix something, or it improves something?
thanks,
Takashi
Quoted 19 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 3:54 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 1 line · Kailang
Quoted 7 lines
Quoted 3 lines
Hi Takashi,
Update ALC222 depop optimize as attach.
Could you give a bit more background info why this change is needed? Is it a mandatory change to fix something, or it improves something?
This codec has two headphone design.
The HP2 was nid 0x14.
Quoted 4 lines
thanks,
Takashi
Quoted 22 lines · Kailang
Quoted 22 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 3:54 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 3 lines · Kailang
Hi Takashi,
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Update ALC222 depop optimize as attach.
Could you give a bit more background info why this change is needed? Is it a mandatory change to fix something, or it improves something?
This codec has two headphone design.
The HP2 was nid0x14.
Sorry not clear enough: do you mean the patch is to fix the depop problems on the models with two headphone pins with ALC222?
thanks,
Takashi
Quoted 43 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 4:17 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 24 lines · Kailang
Quoted 24 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 3:54 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 4 lines · Kailang
Hi Takashi,
Update ALC222 depop optimize as attach.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Could you give a bit more background info why this change is needed? Is it a mandatory change to fix something, or it improves something?
This codec has two headphone design.
The HP2 was nid0x14.Sorry not clear enough: do you mean the patch is to fix the depop problems on the models with two headphone pins with ALC222?
Yes, the original depop was only supported one headphone.
Quoted 5 lines
thanks,
Takashi
Quoted 47 lines · Kailang
Quoted 47 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 4:17 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 27 lines · Kailang
Quoted 27 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 3:54 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 4 lines · Kailang
Hi Takashi,
Update ALC222 depop optimize as attach.
Could you give a bit more background info why this change is needed? Is it a mandatory change to fix something, or it improves something?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
This codec has two headphone design.
The HP2 was nid0x14.Sorry not clear enough: do you mean the patch is to fix the depop problems on the models with two headphone pins with ALC222?
Yes, the original depop was only supported one headphone.
OK, and then would it be a bit risky to blindly assume the second headphone pin 0x14? Isn't it set up via pin config?
thanks,
Takashi
Quoted 68 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 4:50 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 49 lines · Kailang
Quoted 49 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 4:17 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 28 lines · Kailang
Quoted 17 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 3:54 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 9 lines
Quoted 4 lines · Kailang
Hi Takashi,
Update ALC222 depop optimize as attach.
Could you give a bit more background info why this change is needed? Is it a mandatory change to fix something, or it improves something?
This codec has two headphone design.
The HP2 was nid0x14.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Sorry not clear enough: do you mean the patch is to fix the depop problems on the models with two headphone pins with ALC222?
Yes, the original depop was only supported one headphone.
OK, and then would it be a bit risky to blindly assume the second headphone pin
0x14? Isn't it set up via pin config?
It doesn't have risk to set this pin as headphone or line out.
This pin (0x14) can be a line out or headphone. It has JD which driver will get it. Line out and Headhpone were need to do depop procedure.
If pin 0x14 set to speaker, it wouldn't have JD.
hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
This just got JD to do depop.
Quoted 4 lines
thanks,
Takashi
Quoted 77 lines · Kailang
Quoted 69 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 4:50 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 49 lines · Kailang
Quoted 49 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 4:17 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 28 lines · Kailang
Quoted 17 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 3:54 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 9 lines
Quoted 4 lines · Kailang
Hi Takashi,
Update ALC222 depop optimize as attach.
Could you give a bit more background info why this change is needed? Is it a mandatory change to fix something, or it improves something?
This codec has two headphone design.
The HP2 was nid0x14.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Sorry not clear enough: do you mean the patch is to fix the depop problems on the models with two headphone pins with ALC222?
Yes, the original depop was only supported one headphone.
OK, and then would it be a bit risky to blindly assume the second headphone pin
0x14? Isn't it set up via pin config?
Quoted 8 lines
It doesn't have risk to set this pin as headphone or line out.
This pin (0x14) can be a line out or headphone. It has JD which driver will get it. Line out and Headhpone were need to do depop procedure.
If pin0x14set to speaker, it wouldn't have JD.
hp2_pin_sense=snd_hda_jack_detect(codec, 0x14);This just got JD to do depop.
Fair enough, I took the patch now. Thanks.
Takashi
Quoted 100 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 5:30 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 56 lines · Kailang
Quoted 56 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 4:50 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 36 lines · Kailang
Quoted 36 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 4:17 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 17 lines · Kailang
Quoted 17 lines
-----Original Message-----
From: Takashi Iwai <[email protected]>
Sent: Wednesday, March 5, 2025 3:54 PM
To: Kailang <[email protected]>
Cc: ([email protected]) <[email protected]>; [email protected]
Subject: Re: update ALC222 depop optimizeExternal mail : This email originated from outside the organization. Do not reply, click links, or open attachments unless you recognize the sender and know the content is safe.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Kailang
Quoted 4 lines
Hi Takashi,
Update ALC222 depop optimize as attach.
Could you give a bit more background info why this change is
needed?
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Is it a mandatory change to fix something, or it improves
something?
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
This codec has two headphone design.
The HP2 was nid0x14.Sorry not clear enough: do you mean the patch is to fix the depop problems on the models with two headphone pins with ALC222?
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Yes, the original depop was only supported one headphone.
OK, and then would it be a bit risky to blindly assume the second headphone pin
0x14? Isn't it set up via pin config?It doesn't have risk to set this pin as headphone or line out. This pin (
0x14) can be a line out or headphone. It has JD which driver will getit.
Quoted 8 lines
Quoted 6 lines
Line out and Headhpone were need to do depop procedure. If pin
0x14set to speaker, it wouldn't have JD.
hp2_pin_sense=snd_hda_jack_detect(codec, 0x14);This just got JD to do depop.
Fair enough, I took the patch now. Thanks.
This codec speaker pin will be 0x17. 0x14 pin was not have class D amp. So, 0x14 pin will not assign to speaker pin.
Quoted 3 lines
Takashi