Received: by 2002:a17:90a:bc8d:0:0:0:0 with SMTP id x13csp1572955pjr; Mon, 18 May 2020 16:45:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4D4yQI0GtQcy1udruyrfpqqkKbH3lRlByAloirR/ESOJyIQ/L/eXLcCDwdWhJCPB93jh4 X-Received: by 2002:a17:906:304d:: with SMTP id d13mr15799142ejd.159.1589845549025; Mon, 18 May 2020 16:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589845549; cv=none; d=google.com; s=arc-20160816; b=NfGSv676hnwEmfov9yJZkEGmY4ZMYFJunxCeLA7blDFFdSU41Ku4+jf2YBNCzLczsZ X8s6FuIYeIAJIL8kRJDkuVBkE422KnlhfcLRAfYH9/mBV4BM6+tku06nQVVukWB6iLV+ S1D1KyVuKZaNXWUHF9wTLDPQM/bgcVRyNwn/ooV7ZlZu3zSv8jmchWSmmAbM/KoMfD73 3JyTVQ+kEgGdjgJZqfe6qiOj9iWunOXYnALc2AG9PMQXQCJrvHAPVFFTg62WJ9UDU/tb o3nkHLxuX2BVpPu70Bxd0PzfqQs/kgXwTTgTCIAz/9SVmkDAEf+NVyIjNjTHPcYKC2I6 X20g== 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=Lam4jL5l8AfM7t6/mKsGfyy6WDvB517YreE4lLz1v7g=; b=vcvA1ly62h+C1SDJNgAs+V8CAcEfLTYrkscA3ziik0vPZnpUafcMM9lbPOyp2t1U46 nV37d5t7OqRl02c9Sb5FqqTceyADrT3RT5Xapa37f8VCjoYh/dVSCe2+cJG5j5HqUJpv 8mbkrd9VOdcjPEW+iYFMcL9y5j7Y7olqgpYy0DjgD58Z/hGXG440dyRkIhMVOQADJse0 sVX6DGa6wlvEJWEuHcelSQetybeGmCHqOqzHyWYRPmDDCy1ovRkT5MsRyI1GZpz6y6cV jY0BmzDh4v+zaG3HfLgpzFCvyduOHgeBn6b6vGA7ph9BfPI8WZ5kK/1qNpXATXmORXbH QOKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aK4HezU8; 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 q11si6204384edb.536.2020.05.18.16.45.26; Mon, 18 May 2020 16:45:49 -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=aK4HezU8; 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 S1732481AbgERSCN (ORCPT + 99 others); Mon, 18 May 2020 14:02:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:45244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731959AbgERSCH (ORCPT ); Mon, 18 May 2020 14:02:07 -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 9AFCC208B3; Mon, 18 May 2020 18:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589824927; bh=c7Z1TziP9EnCo4NzNnJO1mlONXL94kwHUnfD09/x5Gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aK4HezU8jTV+z5bsAX4AMBE7aQpIHYfRjDWh2MHTTj8GHxL5XFwVQgjOVDggJAAdi oJq/+4+zVahCLabZJyAdVDt6T2wTIMR5rpS2Q6msIr7Fcdm9Yeqr34qosCvIh7Ry+N htGJWN+erdItqO48wz+LoByL+aVCbL5r7Q4VEI6Q= 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 5.6 059/194] ALSA: hda/hdmi: fix race in monitor detection during probe Date: Mon, 18 May 2020 19:35:49 +0200 Message-Id: <20200518173536.649783489@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518173531.455604187@linuxfoundation.org> References: <20200518173531.455604187@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 0c1a59d5ad59d..0f3250417b955 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2320,7 +2320,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