Received: by 10.223.185.116 with SMTP id b49csp5464184wrg; Wed, 7 Mar 2018 12:12:24 -0800 (PST) X-Google-Smtp-Source: AG47ELvY5yw0ffGG034QXYZT05WdyLyy6THWLNqadc72h4vQG3AwYs76pHXFCdbX8UiPD18AjvVM X-Received: by 10.101.69.134 with SMTP id o6mr19561301pgq.340.1520453544611; Wed, 07 Mar 2018 12:12:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520453544; cv=none; d=google.com; s=arc-20160816; b=n4T+s9HhxcmejTv+6NmmbnAt4VZEp+b7vA4UZTubktT4LsB4rEl7sC0L+NoBekU12H RoejpGpythePGvY1Js6TE11xwfNHfRCD1MjeGkX2t+1SjhL+U8j4xf6aXQzgGYpM738T E/W2/hRxycwDznSKvJUWi31FhiiAfD9OYlYDOJycZA+L+Dq+cDdqLZPBn+uEcoUWik1b WjtuAC+9ixgssTVFZrXSLVT7bAJjK1IUKyy2pBM5vbTmWZLStmnRuSKJ2VNuNkA2dP+r /v5vOa5L/WuiAPWAof1BU+VpQueIUQuaFg+kddwuCZn2f/SXD4tRGq/X8xZtStsLoAZ2 eY/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=u9uhnggtGACh2qOcRDwgLE6w0K/szulS2M1aOgD7E1U=; b=wK+3y2eMFb1e6D+XN+7tbLHvwqDZRWcNk3H1Vfn3nQV9usOWsE4nisXan39igQxIp0 74UnSaDLE2hAlfs9Iax4k9pjyFiEuYU2bqIMLQglFwr1uQdD910GHB6L/jFGY7QFOONy h5ZeJhpxy8WZlt0h0G/gp0UpDkDwsVSrWcUJzKfdcLerBsLSdZtPOUZlGBhc1mJSntqU NV5+Dhi12GGU+XQMbVhaWbGqMbS5iMnkuz/KFHgDFRRyDy3XF3UYMrb18yzjok4ghLh7 +bBxUYLSCqs3rqJJY5MgRsJA7dzQVGILLtRF0UEnhLF/UKnDPMivADPZ3mArv/vRKo/H dyWg== ARC-Authentication-Results: i=1; mx.google.com; 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 e9si4995160pgt.774.2018.03.07.12.12.10; Wed, 07 Mar 2018 12:12:24 -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; 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 S965308AbeCGTpX (ORCPT + 99 others); Wed, 7 Mar 2018 14:45:23 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44140 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965297AbeCGTpT (ORCPT ); Wed, 7 Mar 2018 14:45:19 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 21714F30; Wed, 7 Mar 2018 19:45:19 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Takashi Iwai Subject: [PATCH 4.14 013/110] ALSA: hda: Add a power_save blacklist Date: Wed, 7 Mar 2018 11:37:56 -0800 Message-Id: <20180307191041.443023164@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans de Goede commit 1ba8f9d308174e647b864c36209b4d7934d99888 upstream. On some boards setting power_save to a non 0 value leads to clicking / popping sounds when ever we enter/leave powersaving mode. Ideally we would figure out how to avoid these sounds, but that is not always feasible. This commit adds a blacklist for devices where powersaving is known to cause problems and disables it on these devices. Note I tried to put this blacklist in userspace first: https://github.com/systemd/systemd/pull/8128 But the systemd maintainers rightfully pointed out that it would be impossible to then later remove entries once we actually find a way to make power-saving work on listed boards without issues. Having this list in the kernel will allow removal of the blacklist entry in the same commit which fixes the clicks / plops. The blacklist only applies to the default power_save module-option value, if a user explicitly sets the module-option then the blacklist is not used. [ added an ifdef CONFIG_PM for the build error -- tiwai] BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1525104 BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=198611 Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/hda_intel.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -181,7 +181,7 @@ static const struct kernel_param_ops par }; #define param_check_xint param_check_int -static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; +static int power_save = -1; module_param(power_save, xint, 0644); MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " "(in second, 0 = disable)."); @@ -2186,6 +2186,24 @@ out_free: return err; } +#ifdef CONFIG_PM +/* On some boards setting power_save to a non 0 value leads to clicking / + * popping sounds when ever we enter/leave powersaving mode. Ideally we would + * figure out how to avoid these sounds, but that is not always feasible. + * So we keep a list of devices where we disable powersaving as its known + * to causes problems on these devices. + */ +static struct snd_pci_quirk power_save_blacklist[] = { + /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ + SND_PCI_QUIRK(0x1849, 0x0c0c, "Asrock B85M-ITX", 0), + /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ + SND_PCI_QUIRK(0x1043, 0x8733, "Asus Prime X370-Pro", 0), + /* https://bugzilla.kernel.org/show_bug.cgi?id=198611 */ + SND_PCI_QUIRK(0x17aa, 0x2227, "Lenovo X1 Carbon 3rd Gen", 0), + {} +}; +#endif /* CONFIG_PM */ + /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { [AZX_DRIVER_NVIDIA] = 8, @@ -2198,6 +2216,7 @@ static int azx_probe_continue(struct azx struct hdac_bus *bus = azx_bus(chip); struct pci_dev *pci = chip->pci; int dev = chip->dev_index; + int val; int err; hda->probe_continued = 1; @@ -2278,7 +2297,22 @@ static int azx_probe_continue(struct azx chip->running = 1; azx_add_card_list(chip); - snd_hda_set_power_save(&chip->bus, power_save * 1000); + + val = power_save; +#ifdef CONFIG_PM + if (val == -1) { + const struct snd_pci_quirk *q; + + val = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; + q = snd_pci_quirk_lookup(chip->pci, power_save_blacklist); + if (q && val) { + dev_info(chip->card->dev, "device %04x:%04x is on the power_save blacklist, forcing power_save to 0\n", + q->subvendor, q->subdevice); + val = 0; + } + } +#endif /* CONFIG_PM */ + snd_hda_set_power_save(&chip->bus, val * 1000); if (azx_has_pm_runtime(chip) || hda->use_vga_switcheroo) pm_runtime_put_autosuspend(&pci->dev);