Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp769118ybl; Wed, 11 Dec 2019 07:15:09 -0800 (PST) X-Google-Smtp-Source: APXvYqy8eFDWRtWQPPk14TsCyS/Np2kK8flCkiCr1ERtBboaUeUQutVvIIP3m09hFzC8YIR8gifn X-Received: by 2002:aca:b808:: with SMTP id i8mr3109329oif.66.1576077309481; Wed, 11 Dec 2019 07:15:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576077309; cv=none; d=google.com; s=arc-20160816; b=Uj973QnGSXLf3bwHjXvT/l3tNs6nG3hZEh3MyYzk84R9s2awwk4c+urjnyKEZABtoG wUAhesJIlODc8QPyDP3UEgFIP4OGz8ZQi6FZiJPSvXuXQFK7Cy5YTMTq2uRYgEwpwUx7 pvAzlbPcX/7xa2v3heq4+R2dD/0np6pQtkgw+teAwvHTjkvyye2mDnQ8H1ojuwVsmwlp J18+sfypBB0PaUeCimTZZ1uToz1OERp5zWLn9UfrEphqVACfXykhPf5isaAYxul0tkcj ixgw2aEQxFGJG/wyPzkhHCf7A5x7SO2ufv7yRbH6se4XspxCONwGe3fGAJXCA1MbKKYp aedA== 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=hqFu9YpsHIFt0I+7kgahCq5C3+mvzmjQICRMVwSpvqo=; b=UH+6NGcgN8x3eRg45ZOgCqAaaYLy27o8bjd6OPYWmt7aO4eYlc9N++wO4/LmV2lJIL bjJY9Kz+ZWkttrmNN3/XK0069PPBcSs2LaAZYp+NHL2CzEqkY4Ngi6DB5ahbBO8/HLtk RjkFrEj92BGwJglDyFw0UD0DLCBQBz3nWwI4+ffjEkkvXTSDHUHHtSfhCPyPS0k/36WG w5XW6IzBid94j4nTy5RqSeLS7f5vrfpfNU7wf1T/+hn1oCEzxG1tRglM0EbiGVZ6KabC 29XWrm8rCj61cDWkgxpSmuRM2esCfXTlgm2szrr8nya2B3SRVKlWPCo04UZKxGLS9PPN SmjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k4sMYHp7; 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 w4si1398014oia.56.2019.12.11.07.14.57; Wed, 11 Dec 2019 07:15:09 -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=k4sMYHp7; 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 S1731455AbfLKPNg (ORCPT + 99 others); Wed, 11 Dec 2019 10:13:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:36562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731387AbfLKPNS (ORCPT ); Wed, 11 Dec 2019 10:13:18 -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 653B724680; Wed, 11 Dec 2019 15:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077197; bh=sThiPnci4T/GbAaieAjV2/NYiH/63xnXFMXZsH0FKeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k4sMYHp7P0r44rpgps5C3EcaXNGIIGr6pFKX4J2Gzog35LTGczs6MpiircHOSPHxv 7tSMpqtufBUIMk9Opg4VLDcHvepiiS9iaeXurgR13CY+zJ3OU2RrgMi4p8xsLdG3A+ VKdBP7eKEnJO6yMKGlzuuqHWPyj70/7YPlfiFZl0= 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.3 054/105] ALSA: hda: Modify stream stripe mask only when needed Date: Wed, 11 Dec 2019 16:05:43 +0100 Message-Id: <20191211150242.706861940@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@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 @@ -504,6 +504,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 @@ -31,6 +31,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); @@ -1226,6 +1227,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,