Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2933856ybf; Mon, 2 Mar 2020 19:03:49 -0800 (PST) X-Google-Smtp-Source: ADFU+vsAYYiiboQEteNFVvfYTwcgMhhhCJOB13DCf3cACbSppEUm8AeVqn+bNZ8dOI8cgWYGdUHZ X-Received: by 2002:a05:6830:57d:: with SMTP id f29mr637311otc.164.1583204629019; Mon, 02 Mar 2020 19:03:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583204629; cv=none; d=google.com; s=arc-20160816; b=Dsj9bT4swvvr4TRIMofYwlVvNwazibWXrM8/KrwDPJFUsdt2U5JSTHLKuaV7G71zU2 nQ+JblXLV0gjnuSPN3OB1Qb/RK4vySqNB5zcalw8j8CWb7moJlm/Ty/kw1XV2+wknpOb XPRQC80Hb3F9jJuQyXweyioli3MkxXA8+PYeE2MV7H9I2BICkEdK/IMGU3a3Wo4X5lzE 5IukhkbN8sJg5i9KGYFY4TK8bAX2nj4+2fF0PN7P6oEfYQAh5lwp2RP9ORWNqPfxpkN5 GrYoYAX6P1fO8FotI77g0Ggqw+wXahGQrCK/nONeCqzD7/3qThOdnMJqxu5pqwcuurkr wNWA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=8nWtERWbBM5SPcEoN3PUsW9hc9O4L2EimSi9QkMGA0M=; b=IB8qRoWXJ/DbQ9wEyyEtWAU5l6fpkiKH3UOF5TbrWSUKX18Pk1S5sr2Oy37zy23Dd+ wa4/Y1I+K9RXZGqQ6MvqQkIxhnlaoM3ruFXp9QkDzl6nAqi6PjQ8BwRxOcbXHmzTNL2J BKdCLladg1sV8A+rCFCaBdzEPWDVlLFFZ6Uuteo8OHYDeWdtJ41RwHwVSfgHXsXvhcl/ oW3AZCVkppsjnTIwmsTbCYQBYAHJFFsPiQ9DmDDgPrKRHHkKvu0//WcyreEEnDpNQNFw CDNLQ8dyJTIW/p1wTorNAZ5gDyjyXesGJYRBXBlQBQy42qtBBDaQ0ABb08q+Px7GU6MQ yccQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xKzP7lUJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a21si6240991oib.166.2020.03.02.19.03.37; Mon, 02 Mar 2020 19:03:49 -0800 (PST) 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=xKzP7lUJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727052AbgCCCqT (ORCPT + 99 others); Mon, 2 Mar 2020 21:46:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:40550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbgCCCqS (ORCPT ); Mon, 2 Mar 2020 21:46:18 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D92B52465E; Tue, 3 Mar 2020 02:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583203577; bh=8zSyvj3eyDdfA65LUCwZBtK20UW9f3gErYuT4Yv70vQ=; h=From:To:Cc:Subject:Date:From; b=xKzP7lUJ5Q4ZJdEW7E5cni6VrppR42ewt3/qKqoXwT6DGq6xoscUTWCvgZeMH44q/ 5BUJHWG0K8eZRvP8z8sk6myUOzS6gkIHIMt6ywtclce/WfBGvtH5Y2p+zyyI1SpYOu WwHtaw58b+aRxWfoPY5zJktEFPjueFkzOFPCOWEM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kai Vehmanen , Ranjani Sridharan , Pierre-Louis Bossart , Takashi Iwai , Mark Brown , Sasha Levin , alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.5 01/66] ALSA: hda: do not override bus codec_mask in link_get() Date: Mon, 2 Mar 2020 21:45:10 -0500 Message-Id: <20200303024615.8889-1-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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