Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp297297yba; Mon, 20 May 2019 08:54:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRr/Y8Rro1HNOtbHIp+kB4oz4Wk9VYVIMpDW2k0KJOpONjSLsxdpZFNahutxV4B5yDsDRg X-Received: by 2002:aa7:9356:: with SMTP id 22mr4732310pfn.188.1558367657300; Mon, 20 May 2019 08:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558367657; cv=none; d=google.com; s=arc-20160816; b=KnUWoQRkZGvtxS9TeNFGShw9XUTb14QLHOfamrTnX70f6aSBWpyrZ0Ksi8GGyU2nXD jeq+xqTtKPc6XRf6DGR6EJ4j8hejoB+EBUQ/CdsyX7NMKm7YzU5bgo0lX7ygX3e8PQqi MIKUvQ+28y+nFxx9Ny9CB+r6AS0zKXQb+HT1RnRA3LQV7Jo1u03hdLvBweoUURboQsys AopzmE1lgsTfyJbkQe/mFwQrM892FzkP4WOJYjO1WvdxItvRFIo/7eYziJ6HGV/hEw29 T4roE4Gvq8++ApXs+ha9eYh01GawN3JaWaeev/JZKMG+egYvAZH4XClVtN+rE8bSYSIH pYhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AkTIwGpBjkdACjTplHiO/XG6Uu1BtP4ZVJasBWaIfLI=; b=U8O17VOrJz86Sg+wTGE0QgClHGNUJ5YMw2uOqsn0ZBFr7T+gtgaceogCG0FEpgKnTY LWj3G0ARx1GplmibdOyi8Q+l508gbtgkfydYQDInq6SHTaukbPCa/Bgy0D/QMu9EjuDy iF7kmjDTtqYE82YCpyj7qwympTEUJTM1CX4CjOFkghhdwgOrp4/wkwFSRF5r8WAZVxwp tY2bXi3qZebC6ogfliRbRG4ExIfI+Lj2xn8Lc8Pun0I4Vpnl9Pz/iB/JiQHBSGO7nJmR OlRfSRmaPH3rUVYyIK74AgxG3oo4Wpq65ms0vRpkcFSCb+p+JmllbZL767f09pzWf+gw yTnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CEsncRty; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p7si19429684pfa.207.2019.05.20.08.54.02; Mon, 20 May 2019 08:54:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CEsncRty; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389081AbfETMZ1 (ORCPT + 99 others); Mon, 20 May 2019 08:25:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:40538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389059AbfETMZ0 (ORCPT ); Mon, 20 May 2019 08:25:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 E287320675; Mon, 20 May 2019 12:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355125; bh=s0RGvyqC7nuSJTpCF2VB3TyaIORNOqn0wLd18iuFbGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CEsncRtyCC1VP87d5vLlR4s+AcHuQvgLb6AlY3zekuw3jfQJMV0cvDQLKbmGcNQQs i6l84fAWdsD8AsucU6fZhxB2Tfbrg8bOj5/EQ6G0ixmAVLFw/IoV+B8CDyUbhmLMwV 6jcnOc43uc+7XjxF/GQV+ICaCtlM4Scvm0g1O4hQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kailang Yang , Takashi Iwai Subject: [PATCH 4.19 090/105] ALSA: hda/realtek - Fixup headphone noise via runtime suspend Date: Mon, 20 May 2019 14:14:36 +0200 Message-Id: <20190520115253.495222002@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kailang Yang commit dad3197da7a3817f27bb24f7fd3c135ffa707202 upstream. Dell platform with ALC298. system enter to runtime suspend. Headphone had noise. Let Headset Mic not shutup will solve this issue. [ Fixed minor coding style issues by tiwai ] Signed-off-by: Kailang Yang Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 59 ++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 24 deletions(-) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -477,12 +477,45 @@ static void alc_auto_setup_eapd(struct h set_eapd(codec, *p, on); } +static int find_ext_mic_pin(struct hda_codec *codec); + +static void alc_headset_mic_no_shutup(struct hda_codec *codec) +{ + const struct hda_pincfg *pin; + int mic_pin = find_ext_mic_pin(codec); + int i; + + /* don't shut up pins when unloading the driver; otherwise it breaks + * the default pin setup at the next load of the driver + */ + if (codec->bus->shutdown) + return; + + snd_array_for_each(&codec->init_pins, i, pin) { + /* use read here for syncing after issuing each verb */ + if (pin->nid != mic_pin) + snd_hda_codec_read(codec, pin->nid, 0, + AC_VERB_SET_PIN_WIDGET_CONTROL, 0); + } + + codec->pins_shutup = 1; +} + static void alc_shutup_pins(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; - if (!spec->no_shutup_pins) - snd_hda_shutup_pins(codec); + switch (codec->core.vendor_id) { + case 0x10ec0286: + case 0x10ec0288: + case 0x10ec0298: + alc_headset_mic_no_shutup(codec); + break; + default: + if (!spec->no_shutup_pins) + snd_hda_shutup_pins(codec); + break; + } } /* generic shutup callback; @@ -2923,27 +2956,6 @@ static int alc269_parse_auto_config(stru return alc_parse_auto_config(codec, alc269_ignore, ssids); } -static int find_ext_mic_pin(struct hda_codec *codec); - -static void alc286_shutup(struct hda_codec *codec) -{ - const struct hda_pincfg *pin; - int i; - int mic_pin = find_ext_mic_pin(codec); - /* don't shut up pins when unloading the driver; otherwise it breaks - * the default pin setup at the next load of the driver - */ - if (codec->bus->shutdown) - return; - snd_array_for_each(&codec->init_pins, i, pin) { - /* use read here for syncing after issuing each verb */ - if (pin->nid != mic_pin) - snd_hda_codec_read(codec, pin->nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, 0); - } - codec->pins_shutup = 1; -} - static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) { alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); @@ -7611,7 +7623,6 @@ static int patch_alc269(struct hda_codec case 0x10ec0286: case 0x10ec0288: spec->codec_variant = ALC269_TYPE_ALC286; - spec->shutup = alc286_shutup; break; case 0x10ec0298: spec->codec_variant = ALC269_TYPE_ALC298;