Skip to content

Commit c062166

Browse files
Thor-x86tiwai
authored andcommitted
ALSA: hda/realtek: fix ALC285 issues on HP Envy x360 laptops
Realtek codec on HP Envy laptop series are heavily modified by vendor. Therefore, need intervention to make it work properly. The patch fixes: - B&O soundbar speakers (between lid and keyboard) activation - Enable LED on mute button - Add missing process coefficient which affects the output amplifier - Volume control synchronization between B&O soundbar and side speakers - Unmute headset output on several HP Envy models - Auto-enable headset mic when plugged This patch was tested on HP Envy x360 13-AR0107AU with Realtek ALC285 The only unsolved problem is output amplifier of all built-in speakers is too weak, which causes volume of built-in speakers cannot be loud as vendor's proprietary driver due to missing _DSD parameter in the firmware. The solution is currently on research. Expected to has another patch in the future. Potential fix to related issues, need test before close those issues: - https://bugzilla.kernel.org/show_bug.cgi?id=189331 - https://bugzilla.kernel.org/show_bug.cgi?id=216632 - https://bugzilla.kernel.org/show_bug.cgi?id=216311 - https://bugzilla.kernel.org/show_bug.cgi?id=213507 Signed-off-by: Athaariq Ardhiansyah <foss@athaariq.my.id> Message-ID: <20240310140249.3695-1-foss@athaariq.my.id> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 14b9e4a commit c062166

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6695,6 +6695,60 @@ static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
66956695
}
66966696
}
66976697

6698+
static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6699+
const struct hda_fixup *fix,
6700+
int action)
6701+
{
6702+
static const struct coef_fw coefs[] = {
6703+
WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6704+
WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6705+
WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6706+
WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6707+
WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6708+
WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6709+
WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6710+
WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6711+
WRITE_COEF(0x6e, 0x1005), { }
6712+
};
6713+
6714+
static const struct hda_pintbl pincfgs[] = {
6715+
{ 0x12, 0xb7a60130 }, /* Internal microphone*/
6716+
{ 0x14, 0x90170150 }, /* B&O soundbar speakers */
6717+
{ 0x17, 0x90170153 }, /* Side speakers */
6718+
{ 0x19, 0x03a11040 }, /* Headset microphone */
6719+
{ }
6720+
};
6721+
6722+
switch (action) {
6723+
case HDA_FIXUP_ACT_PRE_PROBE:
6724+
snd_hda_apply_pincfgs(codec, pincfgs);
6725+
6726+
/* Fixes volume control problem for side speakers */
6727+
alc295_fixup_disable_dac3(codec, fix, action);
6728+
6729+
/* Fixes no sound from headset speaker */
6730+
snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6731+
6732+
/* Auto-enable headset mic when plugged */
6733+
snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6734+
6735+
/* Headset mic volume enhancement */
6736+
snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6737+
break;
6738+
case HDA_FIXUP_ACT_INIT:
6739+
alc_process_coef_fw(codec, coefs);
6740+
break;
6741+
case HDA_FIXUP_ACT_BUILD:
6742+
rename_ctl(codec, "Bass Speaker Playback Volume",
6743+
"B&O-Tuned Playback Volume");
6744+
rename_ctl(codec, "Front Playback Switch",
6745+
"B&O Soundbar Playback Switch");
6746+
rename_ctl(codec, "Bass Speaker Playback Switch",
6747+
"Side Speaker Playback Switch");
6748+
break;
6749+
}
6750+
}
6751+
66986752
/* for hda_fixup_thinkpad_acpi() */
66996753
#include "thinkpad_helper.c"
67006754

@@ -7136,6 +7190,7 @@ enum {
71367190
ALC280_FIXUP_HP_9480M,
71377191
ALC245_FIXUP_HP_X360_AMP,
71387192
ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7193+
ALC285_FIXUP_HP_ENVY_X360,
71397194
ALC288_FIXUP_DELL_HEADSET_MODE,
71407195
ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
71417196
ALC288_FIXUP_DELL_XPS_13,
@@ -9113,6 +9168,12 @@ static const struct hda_fixup alc269_fixups[] = {
91139168
.type = HDA_FIXUP_FUNC,
91149169
.v.func = alc285_fixup_hp_spectre_x360_eb1
91159170
},
9171+
[ALC285_FIXUP_HP_ENVY_X360] = {
9172+
.type = HDA_FIXUP_FUNC,
9173+
.v.func = alc285_fixup_hp_envy_x360,
9174+
.chained = true,
9175+
.chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9176+
},
91169177
[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
91179178
.type = HDA_FIXUP_FUNC,
91189179
.v.func = alc285_fixup_ideapad_s740_coef,
@@ -9707,6 +9768,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
97079768
SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
97089769
SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
97099770
SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9771+
SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
97109772
SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
97119773
SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
97129774
SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
@@ -10446,6 +10508,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
1044610508
{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
1044710509
{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
1044810510
{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10511+
{.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
1044910512
{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
1045010513
{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
1045110514
{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},

0 commit comments

Comments
 (0)