Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp271545yba; Mon, 20 May 2019 08:26:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEj12ViM53qpLLTczj6RTSYEohJQqsZEuxSP0Pwh6fNzuR/xZ9ItHa0kejr/QB+N/q3/QG X-Received: by 2002:a63:ec02:: with SMTP id j2mr51300882pgh.340.1558366019456; Mon, 20 May 2019 08:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558366019; cv=none; d=google.com; s=arc-20160816; b=jFLGB2+2iix+i6+FDKi1QQcaexELu5yAf1dWc8G1XhVB86OQbuH6ymcH0RcaDeoAhB A4ZwfrkE6YGMFIYWHpWp76S/7EI3xVsOyX+RUDQrv9s0wBs9e0vQYwOuxxhxQQHocX+Y ZG9X92cjDsyI91v+4juIeYwUme6qTFTCL+yPQM5Uop9Azr+wk59W9LyskUK7cN4goOWw erlfnUFlO4uPzTGAgpisZOxCvekYEeZPS7OXvm4VdzvJ2qnfKdRVV5lFy+oqXJJWHlDK 0A/LGna/8Rry16OErkh9pQneTY8B5BKrWRUFRA0hB0EoslWa/n3Hcsj5EvBvT6xYKaZX 3x1w== 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=lytKH49sPxq5aq82ZprjKHzz+PzvTz7Ty9OYKAZ3oSM=; b=BfTrRj1dJXQdeeasPQkFB+Hqv7lFDUnEliyCE/y9mbveB31nZ3xb27onEy6xC09XFg hdrVzQvFkih5tzixAJKkXEPN6nBD7GprGTaqBumkMdPuS+nResicehjHjpdcyWRffkWD ALtyTFth4EPd7E8NPyvSFqD+fqKuasuAMfApU56i46PG/eWK8OasK4Jj9MWz/LPL24Sp iCCrtD+6tgjEEHBBL6vaFTvVEQFU7uZ3POhoN+DBvubA3zRKqxTgw54d2txe4t2rOoNp 1w9lymG8FiU9VKf7XdTLeOcCAdXi5lBctOaXvHocj73SjhCQ4V3clACe71rrOe9mVdiG 65vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TUCKBKdO; 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 l35si19364890plb.276.2019.05.20.08.26.44; Mon, 20 May 2019 08:26:59 -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=TUCKBKdO; 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 S2388406AbfETMW1 (ORCPT + 99 others); Mon, 20 May 2019 08:22:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:36414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387927AbfETMWY (ORCPT ); Mon, 20 May 2019 08:22:24 -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 D5AAE205ED; Mon, 20 May 2019 12:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354943; bh=ZcfGYjcTJYQ2Gn8coona0MK2VNNKyljTHwHSF+fKYWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TUCKBKdOZbPcnhUFSD4Th2jorJFuCOkQ2AyFvXwnYNYYwVy3Ttj+HvJaUCsMeoIWp IXPBHkmmGkP8jja+kI375bsISMtT5+NrLbkKe5qY1bgQECw6nQzyq2PqDeR8Dj4E9A VajeC5VrW5kyp9D9/T/MiChw6kIw7l2MMm5rYLFw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hui Wang , Takashi Iwai Subject: [PATCH 4.19 036/105] ALSA: hda/hdmi - Consider eld_valid when reporting jack event Date: Mon, 20 May 2019 14:13:42 +0200 Message-Id: <20190520115249.532929589@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: Hui Wang commit 7f641e26a6df9269cb25dd7a4b0a91d6586ed441 upstream. On the machines with AMD GPU or Nvidia GPU, we often meet this issue: after s3, there are 4 HDMI/DP audio devices in the gnome-sound-setting even there is no any monitors plugged. When this problem happens, we check the /proc/asound/cardX/eld#N.M, we will find the monitor_present=1, eld_valid=0. The root cause is BIOS or GPU driver makes the PRESENCE valid even no monitor plugged, and of course the driver will not get the valid eld_data subsequently. In this situation, we should not report the jack_plugged event, to do so, let us change the function hdmi_present_sense_via_verbs(). In this function, it reads the pin_sense via snd_hda_pin_sense(), after calling this function, the jack_dirty is 0, and before exiting via_verbs(), we change the shadow pin_sense according to both monitor_present and eld_valid, then in the snd_hda_jack_report_sync(), since the jack_dirty is still 0, it will report jack event according to this modified shadow pin_sense. After this change, the driver will not report Jack_is_plugged event through hdmi_present_sense_via_verbs() if monitor_present is 1 and eld_valid is 0. Signed-off-by: Hui Wang Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_hdmi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -1548,9 +1548,11 @@ static bool hdmi_present_sense_via_verbs ret = !repoll || !eld->monitor_present || eld->eld_valid; jack = snd_hda_jack_tbl_get(codec, pin_nid); - if (jack) + if (jack) { jack->block_report = !ret; - + jack->pin_sense = (eld->monitor_present && eld->eld_valid) ? + AC_PINSENSE_PRESENCE : 0; + } mutex_unlock(&per_pin->lock); return ret; }