Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp871857ybl; Wed, 11 Dec 2019 08:47:16 -0800 (PST) X-Google-Smtp-Source: APXvYqz3Q+bcbId02kEWXDmwpnsyNsQv13g4Xml994HDBPnfn/zM8NnJ4+Ht2owMTcWmysoMjth3 X-Received: by 2002:aca:4850:: with SMTP id v77mr3376205oia.70.1576082836204; Wed, 11 Dec 2019 08:47:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576082836; cv=none; d=google.com; s=arc-20160816; b=d6Gv4naH+a+1kDe1Yv2L13RlWjIo+NaPAoioFraI/6bCKy1PzyYQ0d0+oxLgoXSCvY 6JriTpJffPpVzYEF5m5AhbYHIpWFW633EaAy0/F36Mj8KBwRMTDisQo3H5JljSDbIYmH JG0TNLqOCpw5GtfVQR+1NCoLnG3/Vab8l3nhCqNa2SJ0e9a0c7sTZQgk4fRidJ3ie+iV Qkag/sLkVTdPpiA3EoM/dnwzaqjodfV1CWlQVdgnzW1HJ9XIH1zftE1Y7blm6uEhmLMx VbY8jgXWcocbxDozkvuXugNZRxEW5oSVgztoX2f/U3L+VD1ES2E3V6t+oT9dXEyX7ij/ LBEg== 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=Eb1bWBcsEO584aGN0dChFdWPTwq9DmfNCpsqKJnfE0k=; b=yPLzV3JBCj2BoA3vmOzd9X87LVmjWq+s0udmf32PAo2ZSD9iE4P0V42KJHHM4Nuz0t QwAA2MeVZi0tgq/ubRJxybx9u6/A16TxnTDjS9ZfHHJIK9ck2A9O3VZ1zOrzQ+dHqln8 URW0P73CGgeLOaLWBRsqmdN6VHfbzl1nTUnwG5UWRl9aXzYD7lvff8f0Ex4Qixqq94S0 PPKnGpZgP0QVrcGCXvnksTdCx6HPM4pydKkv2PdolpYyzBjUmt2HbHiq0Sz/A4cf9xHz LNPStHH+J63ajovmgXhlvDFNHx9rfIX6JCnOByKQ3KDITOyn5y3t5G1v2a5+kUo0pBHD oXoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ICSvGbXx; 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 d20si1474635otq.157.2019.12.11.08.46.59; Wed, 11 Dec 2019 08:47:16 -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=ICSvGbXx; 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 S1731261AbfLKQNK (ORCPT + 99 others); Wed, 11 Dec 2019 11:13:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:56058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730375AbfLKPI2 (ORCPT ); Wed, 11 Dec 2019 10:08:28 -0500 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 2A5282173E; Wed, 11 Dec 2019 15:08:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576076907; bh=G1JJ7gfWeu4OxtOizcMo67AaxaqVvWp53DVz/+7WWCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ICSvGbXxZ3ZAlbLyikzuHTN3EE+c/YM6t2/QdQ82zd0ZpuzNtAOOggUh7LCAkE53d ybVxjGCNrCBv4YLbgdS5MXVNE/4ZfMnoLu2WHVzkSuN8UYbLat7ncQAD3VlNFtSkBm m7IWfhRquarC73tWWUGHBz5AqwT4X+YJR1yY0aVU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Pobega , Takashi Iwai Subject: [PATCH 5.4 35/92] ALSA: hda: Modify stream stripe mask only when needed Date: Wed, 11 Dec 2019 16:05:26 +0100 Message-Id: <20191211150237.977324939@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.977775294@linuxfoundation.org> References: <20191211150221.977775294@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: Takashi Iwai commit e38e486d66e2a3b902768fd71c32dbf10f77e1cb upstream. The recent commit in HD-audio stream management for changing the stripe control seems causing a regression on some platforms. The stripe control is currently used only by HDMI codec, and applying the stripe mask unconditionally may lead to scratchy and static noises as seen on some MacBooks. For addressing the regression, this patch changes the stream management code to apply the stripe mask conditionally only when the codec driver requested. Fixes: 9b6f7e7a296e ("ALSA: hda: program stripe bits for controller") BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204477 Tested-by: Michael Pobega Cc: Link: https://lore.kernel.org/r/20191202074947.1617-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- include/sound/hdaudio.h | 1 + sound/hda/hdac_stream.c | 19 ++++++++++++------- sound/pci/hda/patch_hdmi.c | 5 +++++ 3 files changed, 18 insertions(+), 7 deletions(-) --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -493,6 +493,7 @@ struct hdac_stream { bool prepared:1; bool no_period_wakeup:1; bool locked:1; + bool stripe:1; /* apply stripe control */ /* timestamp */ unsigned long start_wallclk; /* start + minimum wallclk */ --- a/sound/hda/hdac_stream.c +++ b/sound/hda/hdac_stream.c @@ -96,12 +96,14 @@ void snd_hdac_stream_start(struct hdac_s 1 << azx_dev->index, 1 << azx_dev->index); /* set stripe control */ - if (azx_dev->substream) - stripe_ctl = snd_hdac_get_stream_stripe_ctl(bus, azx_dev->substream); - else - stripe_ctl = 0; - snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK, - stripe_ctl); + if (azx_dev->stripe) { + if (azx_dev->substream) + stripe_ctl = snd_hdac_get_stream_stripe_ctl(bus, azx_dev->substream); + else + stripe_ctl = 0; + snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK, + stripe_ctl); + } /* set DMA start and interrupt mask */ snd_hdac_stream_updateb(azx_dev, SD_CTL, 0, SD_CTL_DMA_START | SD_INT_MASK); @@ -118,7 +120,10 @@ void snd_hdac_stream_clear(struct hdac_s snd_hdac_stream_updateb(azx_dev, SD_CTL, SD_CTL_DMA_START | SD_INT_MASK, 0); snd_hdac_stream_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */ - snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK, 0); + if (azx_dev->stripe) { + snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK, 0); + azx_dev->stripe = 0; + } azx_dev->running = false; } EXPORT_SYMBOL_GPL(snd_hdac_stream_clear); --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -32,6 +32,7 @@ #include #include "hda_local.h" #include "hda_jack.h" +#include "hda_controller.h" static bool static_hdmi_pcm; module_param(static_hdmi_pcm, bool, 0644); @@ -1240,6 +1241,10 @@ static int hdmi_pcm_open(struct hda_pcm_ per_pin->cvt_nid = per_cvt->cvt_nid; hinfo->nid = per_cvt->cvt_nid; + /* flip stripe flag for the assigned stream if supported */ + if (get_wcaps(codec, per_cvt->cvt_nid) & AC_WCAP_STRIPE) + azx_stream(get_azx_dev(substream))->stripe = 1; + snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id); snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0, AC_VERB_SET_CONNECT_SEL,