Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2932542ybk; Mon, 18 May 2020 11:25:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzB3q8MgDKWpG5JLzTCnMphODrl6mWnKdsyf4wbRtJGa5ODpRUWnaqd/ho2rvCwptQH+dL X-Received: by 2002:a17:906:4e13:: with SMTP id z19mr15085263eju.339.1589826334959; Mon, 18 May 2020 11:25:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589826334; cv=none; d=google.com; s=arc-20160816; b=hQja4dTJfogOCQUsZZ/NspywlAQBqG/bagaYTS/shsDCa7WSSEHvJKFMwWLo/cdYFJ k7rnGJsqP+43ZvdaLrXWBCHc/FC6c8+ptCWK37pTXq9tolQw9TTehb8BQsHIFY1SI4ng 2RWm9QjbdqWzAXUnjzDoTvfZVUkhpizjqF6NNrMXcqvtby9qj0JFh/D4X7YCCWgoRdZX MgNlHiDqjoNxdv9MTYOt9eHvgwFIpBKd7k7GVTanAPJx5o0GUdOhyI1TiPyMZRDijcxk ETWE+o2M5rG1Az4ly32V0ozM7QAUMpTiCB0Ek/Yb0ypBUNgWObAuiKV2CvU2TvlHyTd2 XUzA== 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=3eY1yxhG1H1z0L9v0pR7Wjgi7McPGz6Nu96KPGG5zIg=; b=OCZVEyad/+cdWE2wPzHI45lXnSxX738MIyNQOaaKCnhtUNcP1U5XpogUXKG3Bzg4Jk RkE8g9qe10GxQPHSahgFADsLmPCymXyI5bd1fkJEY1dUC7/Xa/9Z0N0BMtXuiCT6t5MY EzQIYXB7nRAhgZD3nD8AlNGxiSjIFwt9y//QtqSjd+3Me+5QFPHRl1x75pTkdCSzupaR pW+mDRxNUZ97vapGD6inyLyVlZROSmLph/KMBBH3mbRGwQEHfY9Kkr/So4d5/FJYorJt QoNxS3HVKaGRAyPp0QfXmTswl/w+KY8EKTnpaPLQVMnKBTYntNHHRPZbBfK/jcLkccOu 4oQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H0Lb0J1l; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds11si5275014ejc.16.2020.05.18.11.25.11; Mon, 18 May 2020 11:25:34 -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=@kernel.org header.s=default header.b=H0Lb0J1l; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732974AbgERSUt (ORCPT + 99 others); Mon, 18 May 2020 14:20:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:55586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730966AbgERRwW (ORCPT ); Mon, 18 May 2020 13:52:22 -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 4AC2B20674; Mon, 18 May 2020 17:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589824341; bh=He+A6CTlKyr17xpE/1/977g8PsjHdNLClOrWgkyMqLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H0Lb0J1lHGLotF3R0FhzEaMJ1RvwSAtdSNtldCxmqQeMKybLVY6ROnvsoNK0v2jgi TAvt4m5O0ik6pudmYSmCOj2J4WrOqODl+F7J+uIPfEk/PGRDuijE/iCe9uua29ziLF WCLpqmaAQS/w1EiZBcpar1vimVTx66PXFpGGGctg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Takashi Iwai , Sasha Levin Subject: [PATCH 4.19 26/80] ALSA: hda/hdmi: fix race in monitor detection during probe Date: Mon, 18 May 2020 19:36:44 +0200 Message-Id: <20200518173455.620680477@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518173450.097837707@linuxfoundation.org> References: <20200518173450.097837707@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: Kai Vehmanen [ Upstream commit ca76282b6faffc83601c25bd2a95f635c03503ef ] A race exists between build_pcms() and build_controls() phases of codec setup. Build_pcms() sets up notifier for jack events. If a monitor event is received before build_controls() is run, the initial jack state is lost and never reported via mixer controls. The problem can be hit at least with SOF as the controller driver. SOF calls snd_hda_codec_build_controls() in its workqueue-based probe and this can be delayed enough to hit the race condition. Fix the issue by invalidating the per-pin ELD information when build_controls() is called. The existing call to hdmi_present_sense() will update the ELD contents. This ensures initial monitor state is correctly reflected via mixer controls. BugLink: https://github.com/thesofproject/linux/issues/1687 Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20200428123836.24512-1-kai.vehmanen@linux.intel.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 12a064f994b1a..1d83c3c59e1ac 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2211,7 +2211,9 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); + struct hdmi_eld *pin_eld = &per_pin->sink_eld; + pin_eld->eld_valid = false; hdmi_present_sense(per_pin, 0); } -- 2.20.1