Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2395032lqp; Sun, 24 Mar 2024 17:35:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVo6ZMnA5NCDrbKjCiJhZNNGHBTTd3DqWv7Buh/ZkGc83rgEmJVMBrrXtMMQClb8fr9C5wFJnd/vJ2tgu3Fxz+IaA203i3zp5jxrP8YFQ== X-Google-Smtp-Source: AGHT+IHNA89MWxlvL6byg/LGloPH71NOPtMDUYPPadBWom2e3RRu6tM6NHLWUAzMzrtcx8le9RZ0 X-Received: by 2002:a17:90a:ad98:b0:2a0:4eeb:1638 with SMTP id s24-20020a17090aad9800b002a04eeb1638mr3688808pjq.7.1711326939466; Sun, 24 Mar 2024 17:35:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711326939; cv=pass; d=google.com; s=arc-20160816; b=eUrC4qF+RGAjLbZas6YYztOVii8kbBhDgfGcsjZgaNzXgMSuetdq2KfaUrM1tKkhl1 tRE9NPdM1uGhoDVfUm7PPCaldbCAjU4Yyws9zo7mzcQYZiAPeuKAB5rjhnA4/LajdBf/ /k5gObpwnpMheC9SBLu08Yh35/elExLnoG3cN8Pmid5OzIKQtlLxXG7piJmfaJbCYkSd 9msqAWKax+rraRgvQDEO8+AyLy1eLayOw4bgUACP/y5BxlOpO36KFGEZ++ef5IL7duCB M7vF026yxdKgcX8HiVDUoo/kl2we457vj6QrJwEvhO3c2hiWKX5+HUE/6wiC8oOxddA7 +SxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=8orw1eOnIoXFTAOZ91bufFx7sddskhmfpzT8jOI/glE=; fh=eDhVXZUglGHGMSKGV0BtqwDf+MSo4EjwurOeOUeBusk=; b=Gj+wMJFg13aa5VlsT7S+b+6eRP6FRGd8iT6HkgpbWKZdytewkiSBxTUro3qETTQj/D YB8b8SNFE94S/U3V2yzlUZZrsjGDIPm8oOxPxqt1/3Lv63YVCQCT5vwmQychoVEpf/CO oYTWyYd8FZTOy5duw3p2/Ewf3ZDVQSU/Jewsdsv9OI4UYPfxPzXl63KfaURxlIz1orua 9DjvOw7UitDPK76cT8/ZKyyVae6ZmQzauhE42iQVqgSKM4i753als6XlSjcbOJBEs77B rzo0HaalUWyX0Kp6RDcufKwlJJRomoRk5sC5O+rMkjrN6BL+Ox9edBlF9B2BqucdbeD2 3UnQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FKdvgGKR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113429-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fw8-20020a17090b128800b002a0726b07dasi585067pjb.118.2024.03.24.17.35.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:35:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113429-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FKdvgGKR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113429-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3E7ED2835F6 for ; Mon, 25 Mar 2024 00:34:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 871561A9F7F; Sun, 24 Mar 2024 22:43:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FKdvgGKR" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 841D11A9F6B; Sun, 24 Mar 2024 22:43:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320232; cv=none; b=MJQUalkJ/krd/O+nez6PhBdbPCfG4rHR4bd0q9s0BmJnQCXBSdVKmDw8x/BsDDF//kUfRXgQ1Nuj4ICkMIpfPMckkkAv9jSJY8piFbyHbHW8PHMoqQgQeRamJpv4ufFYK+fqiQ4uFBY6PgrUbEpGgZWvH5+z0tkGJ3Cs91MujsM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320232; c=relaxed/simple; bh=ia4a/I3h8uwAwz/i1lK2oRimsANu4bYTnEspCeVKQ+8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ThjiUnG16x13wHeJBRmdR6Hhq0ixSxFRSS/QhlvrIvCVicwP7B0oLNe+MX48EQuju+TnpqEcmZ8sjjoDaB1J361puziiqUUozowokDTZwuiEdhJPW/Z0QfSJi/J9GzIDkIuFg9TK4EYLpKt2gHzra+114jCTkw41HfCeAGEqiwY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FKdvgGKR; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AE28C43390; Sun, 24 Mar 2024 22:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320232; bh=ia4a/I3h8uwAwz/i1lK2oRimsANu4bYTnEspCeVKQ+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FKdvgGKRoz/K8ihvNNFl3w8oFBKR9OBPPBnHdTr6Ru0DB5OypZ7X6gD3tBEzuzjqE Srrdz+W9ms/lZgHriU0nFOc66iiF3Dzsi7eIGqFeZ2PSRVWIYs/5M9ibor9SVABEWZ qODRbewWzchIkIXmfhcyAN7O6HShnR3w/U+PRfTFUM0AoWho89Tn//m5AGYTZQIpbL 3nWuqeC4NL6QtiN1vbPMr1G5LNPXOJr7j7oLoGk43LWrD5wDYXCROXidQRjuMfbshR 0F+rkHXOrfd2qLB0nw/oCKuM/cHYwRnOcO7C0CXUxWXPZlz0pF1QWcW7RC0NLsvRsS psjzAm/Nm1Ixg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Athaariq Ardhiansyah , Takashi Iwai , Sasha Levin Subject: [PATCH 6.8 538/715] ALSA: hda/realtek: fix ALC285 issues on HP Envy x360 laptops Date: Sun, 24 Mar 2024 18:31:57 -0400 Message-ID: <20240324223455.1342824-539-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Athaariq Ardhiansyah [ Upstream commit c062166995c9e57d5cd508b332898f79da319802 ] 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 Message-ID: <20240310140249.3695-1-foss@athaariq.my.id> Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_realtek.c | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index a1facdb98d9a0..1dc5eb92ddcad 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6696,6 +6696,60 @@ static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, } } +static void alc285_fixup_hp_envy_x360(struct hda_codec *codec, + const struct hda_fixup *fix, + int action) +{ + static const struct coef_fw coefs[] = { + WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023), + WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03), + WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a), + WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014), + WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15), + WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489), + WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0), + WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000), + WRITE_COEF(0x6e, 0x1005), { } + }; + + static const struct hda_pintbl pincfgs[] = { + { 0x12, 0xb7a60130 }, /* Internal microphone*/ + { 0x14, 0x90170150 }, /* B&O soundbar speakers */ + { 0x17, 0x90170153 }, /* Side speakers */ + { 0x19, 0x03a11040 }, /* Headset microphone */ + { } + }; + + switch (action) { + case HDA_FIXUP_ACT_PRE_PROBE: + snd_hda_apply_pincfgs(codec, pincfgs); + + /* Fixes volume control problem for side speakers */ + alc295_fixup_disable_dac3(codec, fix, action); + + /* Fixes no sound from headset speaker */ + snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0); + + /* Auto-enable headset mic when plugged */ + snd_hda_jack_set_gating_jack(codec, 0x19, 0x21); + + /* Headset mic volume enhancement */ + snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50); + break; + case HDA_FIXUP_ACT_INIT: + alc_process_coef_fw(codec, coefs); + break; + case HDA_FIXUP_ACT_BUILD: + rename_ctl(codec, "Bass Speaker Playback Volume", + "B&O-Tuned Playback Volume"); + rename_ctl(codec, "Front Playback Switch", + "B&O Soundbar Playback Switch"); + rename_ctl(codec, "Bass Speaker Playback Switch", + "Side Speaker Playback Switch"); + break; + } +} + /* for hda_fixup_thinkpad_acpi() */ #include "thinkpad_helper.c" @@ -7297,6 +7351,7 @@ enum { ALC280_FIXUP_HP_9480M, ALC245_FIXUP_HP_X360_AMP, ALC285_FIXUP_HP_SPECTRE_X360_EB1, + ALC285_FIXUP_HP_ENVY_X360, ALC288_FIXUP_DELL_HEADSET_MODE, ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, ALC288_FIXUP_DELL_XPS_13, @@ -9273,6 +9328,12 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_spectre_x360_eb1 }, + [ALC285_FIXUP_HP_ENVY_X360] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_envy_x360, + .chained = true, + .chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT, + }, [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_ideapad_s740_coef, @@ -9861,6 +9922,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360), SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF), + SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360), SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), @@ -10559,6 +10621,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"}, + {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"}, {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"}, {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"}, {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"}, -- 2.43.0