Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2961510ybk; Mon, 18 May 2020 12:10:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwGdpE7jAuB6ukSJrAL8f8KjbEHPW4sHU1b3fvC1Yk4ctBSGdaORB2CHkgRNRdHYo9uSxK X-Received: by 2002:a17:906:5004:: with SMTP id s4mr16819966ejj.13.1589829027016; Mon, 18 May 2020 12:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589829027; cv=none; d=google.com; s=arc-20160816; b=PuxaPWfdXXsODKx/n+dyQ06ZYlbicYpzE/KUGH2b0MBdQ5h50KQk4nNLaRSVTP4FPZ 72GbsZLkGU5rwWkoCDrXI29KUyfDsupkxzTSjqTLoiL84TaprirvkSOlcH4bcfvkdYQu kd2oDEw/ZTLomj1gU8KCRNNVb8Ru8fwkhnBnbnCLS7wdVwtX66zCgEClnCsA3dh67B5k OSM+jWWIrlr7RN9Isx5oHxuIoEfrRZrUoW7T3VjwfAOKy8hGekTHb6VDu840ULb6V2b8 3iyRYWZ+zBnsYlw3r2sfrUIstxa1Z/o9fh+lTevRM/DUAPCy4rbHhzrmJiKWhe6whmxi DKpQ== 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=IAgac6hIhofdoe6egubgOV1KX8u0cnZ9YTHmx8YQYwM=; b=vmqsjpUxE2wb4Hnt2Y5GWXSTYIPKO2sVosH53FjX8HyhacSRKV4xYFek3ehiOohuOJ i8dG4t9xqNl26JVo0x7hS4+VQpKn77wNWZQKd6XaBJ0LQu7pXxRuaEStl+osnM/aJlFF uxfNwzwzjCgTOGH21R2tWt2d+bXktKIlTlXQurwYE5nJyo/yi16eZbuWVRzi10sbZytg WixgTqqLoOOlxLvXmIMwCivnb9MvX0t4EcvBhU6ojpIfyZ5yXykKWrtCs7ly8wFERqfa 6gWZLICtIJ5ttUD1U13T4XsPTdFfcc/BR7wNr3/w6wXDkwUBDiG9zbwxVknYtaGQtItU mRWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f2Ojgfx3; 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 n22si6844105ejd.119.2020.05.18.12.10.03; Mon, 18 May 2020 12:10:27 -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=f2Ojgfx3; 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 S1729641AbgERRnt (ORCPT + 99 others); Mon, 18 May 2020 13:43:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:41566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729631AbgERRnq (ORCPT ); Mon, 18 May 2020 13:43:46 -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 4ED8620715; Mon, 18 May 2020 17:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589823825; bh=yrf3570OBu5h8HxEqgfHQx3jMZEKbBNA9EJShkhX+tg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2Ojgfx3Xl+p/eCIN1Y8rM4R4+gnPWj3MTn+N7pd1OyuIxFl2s/A45lAp1FIvXssi 3y7cxZYKOC78Y1Pw3hWvopUGIOaGGCYxDQ7Aux8zui1uQWGEtNohHc89TzyPnznJzn +z+ofYFpi5S08hLLG6iGOmgBiNy/x9RbGHmIWgqU= 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.9 51/90] ALSA: hda/hdmi: fix race in monitor detection during probe Date: Mon, 18 May 2020 19:36:29 +0200 Message-Id: <20200518173501.555862582@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518173450.930655662@linuxfoundation.org> References: <20200518173450.930655662@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 e19f447e27ae1..a866a20349c32 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2044,7 +2044,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