diff mbox series

[v2] ALSA: hda/conexant - Fix audio routing for HP EliteOne 1000 G2

Message ID 20241009134248.662175-1-kovalev@altlinux.org (mailing list archive)
State New, archived
Headers show
Series [v2] ALSA: hda/conexant - Fix audio routing for HP EliteOne 1000 G2 | expand

Commit Message

Vasiliy Kovalev Oct. 9, 2024, 1:42 p.m. UTC
There is a problem with simultaneous audio output to headphones and
speakers, and when headphones are turned off, the speakers also turn
off and do not turn them on.

However, it was found that if you boot linux immediately after windows,
there are no such problems. When comparing alsa-info, the only difference
is the different configuration of Node 0x1d:

working conf. (windows): Pin-ctls: 0x80: HP
not working     (linux): Pin-ctls: 0xc0: OUT HP

This patch disable the AC_PINCTL_OUT_EN bit of Node 0x1d and fixes the
described problem.

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
 sound/pci/hda/patch_conexant.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Takashi Iwai Oct. 9, 2024, 1:50 p.m. UTC | #1
On Wed, 09 Oct 2024 15:42:48 +0200,
Vasiliy Kovalev wrote:
> 
> There is a problem with simultaneous audio output to headphones and
> speakers, and when headphones are turned off, the speakers also turn
> off and do not turn them on.
> 
> However, it was found that if you boot linux immediately after windows,
> there are no such problems. When comparing alsa-info, the only difference
> is the different configuration of Node 0x1d:
> 
> working conf. (windows): Pin-ctls: 0x80: HP
> not working     (linux): Pin-ctls: 0xc0: OUT HP
> 
> This patch disable the AC_PINCTL_OUT_EN bit of Node 0x1d and fixes the
> described problem.
> 
> Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>

Thanks, applied now.


Takashi
Kai-Heng Feng Oct. 10, 2024, 3:32 a.m. UTC | #2
On 2024/10/9 9:50 PM, Takashi Iwai wrote:
> On Wed, 09 Oct 2024 15:42:48 +0200,
> Vasiliy Kovalev wrote:
>>
>> There is a problem with simultaneous audio output to headphones and
>> speakers, and when headphones are turned off, the speakers also turn
>> off and do not turn them on.
>>
>> However, it was found that if you boot linux immediately after windows,
>> there are no such problems. When comparing alsa-info, the only difference
>> is the different configuration of Node 0x1d:
>>
>> working conf. (windows): Pin-ctls: 0x80: HP
>> not working     (linux): Pin-ctls: 0xc0: OUT HP
>>
>> This patch disable the AC_PINCTL_OUT_EN bit of Node 0x1d and fixes the
>> described problem.
>>
>> Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
> 
> Thanks, applied now.

Though this is already applied, is it possible to see if the issue also 
happens on S4?

Linux doesn't put PCI devices like HDA to D3 during shutdown and reboot 
while Windows does, that might be the reason boot Linux after Windows 
can workaround the issue.

Linux does put PCI devices to D3 for hibernate (S4), so we can use it as 
an experiment.

Kai-Heng

> 
> 
> Takashi
Takashi Iwai Oct. 10, 2024, 5:17 a.m. UTC | #3
On Thu, 10 Oct 2024 05:32:18 +0200,
Kai-Heng Feng wrote:
> 
> 
> On 2024/10/9 9:50 PM, Takashi Iwai wrote:
> > On Wed, 09 Oct 2024 15:42:48 +0200,
> > Vasiliy Kovalev wrote:
> >> 
> >> There is a problem with simultaneous audio output to headphones and
> >> speakers, and when headphones are turned off, the speakers also turn
> >> off and do not turn them on.
> >> 
> >> However, it was found that if you boot linux immediately after windows,
> >> there are no such problems. When comparing alsa-info, the only difference
> >> is the different configuration of Node 0x1d:
> >> 
> >> working conf. (windows): Pin-ctls: 0x80: HP
> >> not working     (linux): Pin-ctls: 0xc0: OUT HP
> >> 
> >> This patch disable the AC_PINCTL_OUT_EN bit of Node 0x1d and fixes the
> >> described problem.
> >> 
> >> Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
> > 
> > Thanks, applied now.
> 
> Though this is already applied, is it possible to see if the issue
> also happens on S4?
> 
> Linux doesn't put PCI devices like HDA to D3 during shutdown and
> reboot while Windows does, that might be the reason boot Linux after
> Windows can workaround the issue.
> 
> Linux does put PCI devices to D3 for hibernate (S4), so we can use it
> as an experiment.

Right, it should have been the cached version so that the setup is
reapplied automatically; i.e. replace snd_hda_set_pin_ctl() with
snd_hda_set_pin_ctl_cached().

Vasiliy, care to test and submit an incremental fix?


thanks,

Takashi
Vasiliy Kovalev Oct. 10, 2024, 8:36 a.m. UTC | #4
10.10.2024 08:17, Takashi Iwai wrote:
> On Thu, 10 Oct 2024 05:32:18 +0200,
> Kai-Heng Feng wrote:
>>
>>
>> On 2024/10/9 9:50 PM, Takashi Iwai wrote:
>>> On Wed, 09 Oct 2024 15:42:48 +0200,
>>> Vasiliy Kovalev wrote:
>>>>
>>>> There is a problem with simultaneous audio output to headphones and
>>>> speakers, and when headphones are turned off, the speakers also turn
>>>> off and do not turn them on.
>>>>
>>>> However, it was found that if you boot linux immediately after windows,
>>>> there are no such problems. When comparing alsa-info, the only difference
>>>> is the different configuration of Node 0x1d:
>>>>
>>>> working conf. (windows): Pin-ctls: 0x80: HP
>>>> not working     (linux): Pin-ctls: 0xc0: OUT HP
>>>>
>>>> This patch disable the AC_PINCTL_OUT_EN bit of Node 0x1d and fixes the
>>>> described problem.
>>>>
>>>> Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
>>>
>>> Thanks, applied now.
>>
>> Though this is already applied, is it possible to see if the issue
>> also happens on S4?
>>
>> Linux doesn't put PCI devices like HDA to D3 during shutdown and
>> reboot while Windows does, that might be the reason boot Linux after
>> Windows can workaround the issue.
>>
>> Linux does put PCI devices to D3 for hibernate (S4), so we can use it
>> as an experiment.
> 
> Right, it should have been the cached version so that the setup is
> reapplied automatically; i.e. replace snd_hda_set_pin_ctl() with
> snd_hda_set_pin_ctl_cached().
> 
> Vasiliy, care to test and submit an incremental fix?

Ok, I compiled the module with the proposed changes and sent it to the 
user for testing on a machine with this codec. After testing, I will 
write about the result.

> 
> thanks,
> 
> Takashi
--
Thanks,
Vasiliy Kovalev
Vasiliy Kovalev Oct. 16, 2024, 8:14 a.m. UTC | #5
10.10.2024 11:36, Vasiliy Kovalev пишет:
> 
> 10.10.2024 08:17, Takashi Iwai wrote:
>> On Thu, 10 Oct 2024 05:32:18 +0200,
>> Kai-Heng Feng wrote:
>>>
>>>
>>> On 2024/10/9 9:50 PM, Takashi Iwai wrote:
>>>> On Wed, 09 Oct 2024 15:42:48 +0200,
>>>> Vasiliy Kovalev wrote:
>>>>>
>>>>> There is a problem with simultaneous audio output to headphones and
>>>>> speakers, and when headphones are turned off, the speakers also turn
>>>>> off and do not turn them on.
>>>>>
>>>>> However, it was found that if you boot linux immediately after 
>>>>> windows,
>>>>> there are no such problems. When comparing alsa-info, the only 
>>>>> difference
>>>>> is the different configuration of Node 0x1d:
>>>>>
>>>>> working conf. (windows): Pin-ctls: 0x80: HP
>>>>> not working     (linux): Pin-ctls: 0xc0: OUT HP
>>>>>
>>>>> This patch disable the AC_PINCTL_OUT_EN bit of Node 0x1d and fixes the
>>>>> described problem.
>>>
>>> Though this is already applied, is it possible to see if the issue
>>> also happens on S4?
>>>
>>> Linux doesn't put PCI devices like HDA to D3 during shutdown and
>>> reboot while Windows does, that might be the reason boot Linux after
>>> Windows can workaround the issue.
>>>
>>> Linux does put PCI devices to D3 for hibernate (S4), so we can use it
>>> as an experiment.
>>
>> Right, it should have been the cached version so that the setup is
>> reapplied automatically; i.e. replace snd_hda_set_pin_ctl() with
>> snd_hda_set_pin_ctl_cached().
>>
>> Vasiliy, care to test and submit an incremental fix?
> 
> Ok, I compiled the module with the proposed changes and sent it to the 
> user for testing on a machine with this codec. After testing, I will 
> write about the result.

Using the snd_hda_set_pin_ctl_cache() function instead of 
snd_hda_set_pin_ctl() leads to the same positive result, there are no 
problems with sound.  The patch has been sent [1]

[1] https://lore.kernel.org/all/20241016080713.46801-1-kovalev@altlinux.org/

>>
>> thanks,
>>
>> Takashi

--
Thanks,
Vasiliy Kovalev
diff mbox series

Patch

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index b61ce5e6f5ec5..956cb71c3bee1 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -303,6 +303,7 @@  enum {
 	CXT_FIXUP_HP_SPECTRE,
 	CXT_FIXUP_HP_GATE_MIC,
 	CXT_FIXUP_MUTE_LED_GPIO,
+	CXT_FIXUP_HP_ELITEONE_OUT_DIS,
 	CXT_FIXUP_HP_ZBOOK_MUTE_LED,
 	CXT_FIXUP_HEADSET_MIC,
 	CXT_FIXUP_HP_MIC_NO_PRESENCE,
@@ -320,6 +321,19 @@  static void cxt_fixup_stereo_dmic(struct hda_codec *codec,
 	spec->gen.inv_dmic_split = 1;
 }
 
+/* fix widget control pin settings */
+static void cxt_fixup_update_pinctl(struct hda_codec *codec,
+				   const struct hda_fixup *fix, int action)
+{
+	if (action == HDA_FIXUP_ACT_PROBE) {
+		/* Unset OUT_EN for this Node pin, leaving only HP_EN.
+		 * This is the value stored in the codec register after
+		 * the correct initialization of the previous windows boot.
+		 */
+		snd_hda_set_pin_ctl(codec, 0x1d, AC_PINCTL_HP_EN);
+	}
+}
+
 static void cxt5066_increase_mic_boost(struct hda_codec *codec,
 				   const struct hda_fixup *fix, int action)
 {
@@ -971,6 +985,10 @@  static const struct hda_fixup cxt_fixups[] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = cxt_fixup_mute_led_gpio,
 	},
+	[CXT_FIXUP_HP_ELITEONE_OUT_DIS] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = cxt_fixup_update_pinctl,
+	},
 	[CXT_FIXUP_HP_ZBOOK_MUTE_LED] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = cxt_fixup_hp_zbook_mute_led,
@@ -1061,6 +1079,7 @@  static const struct snd_pci_quirk cxt5066_fixups[] = {
 	SND_PCI_QUIRK(0x103c, 0x83b2, "HP EliteBook 840 G5", CXT_FIXUP_HP_DOCK),
 	SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK),
 	SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK),
+	SND_PCI_QUIRK(0x103c, 0x83e5, "HP EliteOne 1000 G2", CXT_FIXUP_HP_ELITEONE_OUT_DIS),
 	SND_PCI_QUIRK(0x103c, 0x8402, "HP ProBook 645 G4", CXT_FIXUP_MUTE_LED_GPIO),
 	SND_PCI_QUIRK(0x103c, 0x8427, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED),
 	SND_PCI_QUIRK(0x103c, 0x844f, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED),