Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3018598pxb; Mon, 18 Oct 2021 06:43:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydVb05sJgEBR9C4X9KUMBfFmy/HS0+a6ycOVkPe8pVo5cHvB+qL0OlEvqg1B6658Fmdmkh X-Received: by 2002:a05:6a00:d43:b0:44d:6d58:41fb with SMTP id n3-20020a056a000d4300b0044d6d5841fbmr28639620pfv.56.1634564581402; Mon, 18 Oct 2021 06:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564581; cv=none; d=google.com; s=arc-20160816; b=w7bC1Zn4NUyxZDFdOoAhoV5aHUM3ZLb7sZCG77lmLEQGoKBXJDa9hKR09sNN7Egfqq VlmIPN+Psr9Cy37X4Cy7CYXa9eSbx2i8UBUeQErRsUmVEalnpo7R5NhhzxcEfFatuhc0 DGm8gzXjt7cSwPtv+CYhF89XFFI599y6p9RBlrpaXrd/QhwJ1zSJCQJN1IVg4I7SVbq+ 7VADvJ+JWM/8mJnMSM6VRX8kWVEam5TL0j3FIwUIjzxh9586SYJ6Lc65XWHc/aO6dLZf PDwzuAt23AwUhkVMNTuy0ShZiN927vKIY2WAa5/vjY8QOeLLPwH0GPtFqVl9tvC1ca4/ EMew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4FE7j0ht1yOmmVmNZebXNJpWOSwfibTqzam7pufaJuw=; b=vrjxXF01qS3NeKtjd+XBleqG5tMHmXMScM0Qf3ZNZZIO5yB4GToDLDKKB+PqiD51XY gGqs7OdZrDqnFkctI7t7Kog+mlBGQViIWqF+cxWIOgWVjIoUE1Rx3dYVG9aHS1OLMpij kgAhhXWKuW3o9YTagGNiC0Tco+57P/zuQJ1+mRyWS3J+DWOJKqxRRAGOJsurxZ3v3fU4 OyybIxcAOHCnFbkJ5a81Aa0y9cQexlgeZIbWx6v/QPp0wwyiR0G7sglpM0i1q6qGm2Go X0mSDCPBmnMDL1pzcziH6prYM0eJC3KdvWTCXZfGSmc8q4fZbAOG1SR54yJLG4Kqs0uF JyMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ml07+t7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si17524306pls.428.2021.10.18.06.42.47; Mon, 18 Oct 2021 06:43:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ml07+t7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232442AbhJRNn4 (ORCPT + 99 others); Mon, 18 Oct 2021 09:43:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:37404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233859AbhJRNl0 (ORCPT ); Mon, 18 Oct 2021 09:41:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4435361391; Mon, 18 Oct 2021 13:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564024; bh=YQufhl9Vo+1zjytj6vfr4lZvpJtukfudroBbDwmOgnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ml07+t7WFIxBy6/XYjet2vVDElSW1hvIsnCkT+Lh19T0n8MoTD0OLJ3MJeaMwqC9c 2wmAHvPx2FwuJ77B4TUhiV4wOcf635/JdQ7iUY/dNe5PUyIf9CfBQCKXQvS5npcrBl WIXdpZb35RMLY4y8tury24An47Viqchv9cgfUwJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Werner Sembach , Takashi Iwai Subject: [PATCH 5.10 009/103] ALSA: hda/realtek: Add quirk for TongFang PHxTxX1 Date: Mon, 18 Oct 2021 15:23:45 +0200 Message-Id: <20211018132335.007976150@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132334.702559133@linuxfoundation.org> References: <20211018132334.702559133@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Werner Sembach commit dd6dd6e3c791db7fdbc5433ec7e450717aa3a0ce upstream. This applies a SND_PCI_QUIRK(...) to the TongFang PHxTxX1 barebone. This fixes the issue of the internal Microphone not working after booting another OS. When booting a certain another OS this barebone keeps some coeff settings even after a cold shutdown. These coeffs prevent the microphone detection from working in Linux, making the Laptop think that there is always an external microphone plugged-in and therefore preventing the use of the internal one. The relevant indexes and values where gathered by naively diff-ing and reading a working and a non-working coeff dump. Signed-off-by: Werner Sembach Cc: Link: https://lore.kernel.org/r/20211006130415.538243-1-wse@tuxedocomputers.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6399,6 +6399,24 @@ static void alc287_fixup_legion_15imhg05 /* for alc285_fixup_ideapad_s740_coef() */ #include "ideapad_s740_helper.c" +static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec, + const struct hda_fixup *fix, + int action) +{ + /* + * A certain other OS sets these coeffs to different values. On at least one TongFang + * barebone these settings might survive even a cold reboot. So to restore a clean slate the + * values are explicitly reset to default here. Without this, the external microphone is + * always in a plugged-in state, while the internal microphone is always in an unplugged + * state, breaking the ability to use the internal microphone. + */ + alc_write_coef_idx(codec, 0x24, 0x0000); + alc_write_coef_idx(codec, 0x26, 0x0000); + alc_write_coef_idx(codec, 0x29, 0x3000); + alc_write_coef_idx(codec, 0x37, 0xfe05); + alc_write_coef_idx(codec, 0x45, 0x5089); +} + enum { ALC269_FIXUP_GPIO2, ALC269_FIXUP_SONY_VAIO, @@ -6612,7 +6630,8 @@ enum { ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS, ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, - ALC287_FIXUP_13S_GEN2_SPEAKERS + ALC287_FIXUP_13S_GEN2_SPEAKERS, + ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS, }; static const struct hda_fixup alc269_fixups[] = { @@ -8304,6 +8323,10 @@ static const struct hda_fixup alc269_fix .chained = true, .chain_id = ALC269_FIXUP_HEADSET_MODE, }, + [ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc256_fixup_tongfang_reset_persistent_settings, + }, }; static const struct snd_pci_quirk alc269_fixup_tbl[] = { @@ -8733,6 +8756,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), + SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS), SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),