From patchwork Tue Sep 29 10:57:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 291146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7ADCAC4741F for ; Tue, 29 Sep 2020 11:35:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 382D323B4B for ; Tue, 29 Sep 2020 11:35:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379354; bh=64VOfE9/+OA65A6IGYIhcvmlZseuy8KUgWCKGTp63J8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ogo+USv7/faWgA3u6lcnsqspADdx+tZs7H2cpZcaU1fH2cS4BsqKYXkEX6KHM0/W9 xJDGoaSQKQIvQ85tDdwdZ1q/lMJv+lxlb3Vu52lqMHmJbqW/zNLu60Do88pyTScqyA tjLvoqBb+J1HbDatG0Zld7Pt6sLc7Zrlu3QDLUgA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729854AbgI2Lfx (ORCPT ); Tue, 29 Sep 2020 07:35:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:49134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729871AbgI2Lfg (ORCPT ); Tue, 29 Sep 2020 07:35:36 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AFE1A23AA1; Tue, 29 Sep 2020 11:22:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378526; bh=64VOfE9/+OA65A6IGYIhcvmlZseuy8KUgWCKGTp63J8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ZwjhBxgTJ/s+eGq5yylh1iYzTmUiM6MQ4ZU4VJdrYzkY4qXK3sESZ+U/3RjGhDq8 IrKu+v+8LU0YWfC/ZLM6VQZqnF1Jec6V4QSdHnKgl1ef7oMHUrA06kbVxjCbKaxFwU jhSEi7kr5Rn6V9Z1tuKAsGYNGFu6gXPX1UjtQte0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kailang Yang , Hui Wang , Takashi Iwai Subject: [PATCH 4.19 015/245] ALSA: hda/realtek - Couldnt detect Mic if booting with headset plugged Date: Tue, 29 Sep 2020 12:57:46 +0200 Message-Id: <20200929105947.732203702@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hui Wang commit 3f74249057827c5f6676c41c18f6be12ce1469ce upstream. We found a Mic detection issue on many Lenovo laptops, those laptops belong to differnt models and they have different audio design like internal mic connects to the codec or PCH, they all have this problem, the problem is if plugging a headset before powerup/reboot the machine, after booting up, the headphone could be detected but Mic couldn't. If we plug out and plug in the headset, both headphone and Mic could be detected then. Through debugging we found the codec on those laptops are same, it is alc257, and if we don't disable the 3k pulldown in alc256_shutup(), the issue will be fixed. So far there is no pop noise or power consumption regression on those laptops after this change. Cc: Kailang Yang Cc: Signed-off-by: Hui Wang Link: https://lore.kernel.org/r/20200914065118.19238-1-hui.wang@canonical.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3290,7 +3290,11 @@ static void alc256_shutup(struct hda_cod /* 3k pull low control for Headset jack. */ /* NOTE: call this before clearing the pin, otherwise codec stalls */ - alc_update_coef_idx(codec, 0x46, 0, 3 << 12); + /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly + * when booting with headset plugged. So skip setting it for the codec alc257 + */ + if (codec->core.vendor_id != 0x10ec0257) + alc_update_coef_idx(codec, 0x46, 0, 3 << 12); if (!spec->no_shutup_pins) snd_hda_codec_write(codec, hp_pin, 0,