Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp685635ybh; Tue, 10 Mar 2020 06:27:29 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuWhU+aOj3cdWarRdb27NTVMLvoUMdi9/J31l3744/vdNRKZVR9vylNb/xO/JCpcxuOmd+E X-Received: by 2002:a9d:4d97:: with SMTP id u23mr9546570otk.293.1583846849025; Tue, 10 Mar 2020 06:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583846849; cv=none; d=google.com; s=arc-20160816; b=QbL+v7Yq6HviQ9JDlyiVj8YK2s/zOXQUqhMHFQhDnU4Orf+MUgEHcnkcF+NaRjIocC Q+roaDm3J1FrcycZbu96+3LNGXbJheUDgu2elk2L6EgdEU2ZatImky9HaRzMQLTJm+nH wE5HYQtoPjy198i1PoVjZAenbVvT3QFMQJ60zQXrgDnZTaiVQiV+LZqKu8wbgkFYtK4Z Z2QIY5J6/cB3n4J/mEmzdDnBLUGyG+CLWYUWB4RLzsKz4vLuYJHmsuV5gyn2sUxJtVqR 9WM+DdQsxqnrB/xGMZNTpp4pJaGVm30t0Z1no5ezoCo7XLcGvcbrxUa6Rt9elW1TMAgT UJ3Q== 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=8nWtERWbBM5SPcEoN3PUsW9hc9O4L2EimSi9QkMGA0M=; b=jFRIPN21iDD54ya0l8Cdci6ZctlXtpZ+KRVP/l5HDlqrI8j3JBrvC8D9GoIQC3Revz 5hOwocFPNfQldAjatuFe8Kw0ak1xykmu/o8zOaFp/LCPV0fVYPhwAYrxeCpTBRNJqj2w 54Yx93yPjXmYTXwXGuOMVa7g/GCjiOgt3bkWR2MlMC4g1Dzrr5Dv1KNMgL9Z23VDG/8I pB6vSd8VvM/CRQsGgfUBpfRLsWDx3P/Zp8kXl2ZZjNBLCOWBvFOmL4DvR3D/YjgoGQsS y7eFCO94KmkxA5sPgjhsNjsG06vRusZsRJYVwjBzG2NQA3M0nXW5jzSUt8k4J/n7MIrX U+Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TESnLAE3; 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 t25si5515552oic.183.2020.03.10.06.27.17; Tue, 10 Mar 2020 06:27:29 -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=TESnLAE3; 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 S1728331AbgCJM4A (ORCPT + 99 others); Tue, 10 Mar 2020 08:56:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:34936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729591AbgCJMz4 (ORCPT ); Tue, 10 Mar 2020 08:55:56 -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 D52952467D; Tue, 10 Mar 2020 12:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583844955; bh=8zSyvj3eyDdfA65LUCwZBtK20UW9f3gErYuT4Yv70vQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TESnLAE3BfBDMfJXXuyZUG04d6hPdTr3y3NGn7JIVg+UETDD0FmXTELp7+1yFRKRI hhP00zg34e+Dj+2n7I3gkEfEcoT0hzSj5Wx6uFct+pZitGPTyPAbpFI7aIqyXQqjBg r53qWwYULxFTi6X54/RSfNypuYuHwLShLPA/xPzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Ranjani Sridharan , Pierre-Louis Bossart , Takashi Iwai , Mark Brown , Sasha Levin Subject: [PATCH 5.5 012/189] ALSA: hda: do not override bus codec_mask in link_get() Date: Tue, 10 Mar 2020 13:37:29 +0100 Message-Id: <20200310123640.773665662@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200310123639.608886314@linuxfoundation.org> References: <20200310123639.608886314@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 43bcb1c0507858cdc95e425017dcc33f8105df39 ] snd_hdac_ext_bus_link_get() does not work correctly in case there are multiple codecs on the bus. It unconditionally resets the bus->codec_mask value. As per documentation in hdaudio.h and existing use in client code, this field should be used to store bit flag of detected codecs on the bus. By overwriting value of the codec_mask, information on all detected codecs is lost. No current user of hdac is impacted, but use of bus->codec_mask is planned in future patches for SOF. Signed-off-by: Kai Vehmanen Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Takashi Iwai Link: https://lore.kernel.org/r/20200206200223.7715-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/hda/ext/hdac_ext_controller.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/hda/ext/hdac_ext_controller.c b/sound/hda/ext/hdac_ext_controller.c index cfab60d88c921..09ff209df4a30 100644 --- a/sound/hda/ext/hdac_ext_controller.c +++ b/sound/hda/ext/hdac_ext_controller.c @@ -254,6 +254,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all); int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *link) { + unsigned long codec_mask; int ret = 0; mutex_lock(&bus->lock); @@ -280,9 +281,11 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, * HDA spec section 4.3 - Codec Discovery */ udelay(521); - bus->codec_mask = snd_hdac_chip_readw(bus, STATESTS); - dev_dbg(bus->dev, "codec_mask = 0x%lx\n", bus->codec_mask); - snd_hdac_chip_writew(bus, STATESTS, bus->codec_mask); + codec_mask = snd_hdac_chip_readw(bus, STATESTS); + dev_dbg(bus->dev, "codec_mask = 0x%lx\n", codec_mask); + snd_hdac_chip_writew(bus, STATESTS, codec_mask); + if (!bus->codec_mask) + bus->codec_mask = codec_mask; } mutex_unlock(&bus->lock); -- 2.20.1