From patchwork Fri Aug 13 08:12:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 496592 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2AC6C4338F for ; Fri, 13 Aug 2021 08:13:37 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A23806109E for ; Fri, 13 Aug 2021 08:13:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A23806109E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 685331840; Fri, 13 Aug 2021 10:12:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 685331840 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1628842414; bh=UgvaUMvAevIEjFzqkuQdwCaUc3bAtLEAhUZTqMF1Xgw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=X67nrhFsP5ZP35O91hcGuNceptAcAN/VCbLCxRr4yzNUrXd1UAaspMRy3ky6jaoni f3j6JE8Rz9E16wjI5PHlCQNAkMwsLvVqI7vmvWZ2i65lfuxXxJdUPRBusGczWSty1K XEpNxl9VuMCCHgFAgWEqUJj2TQyDLv59wUP7n/jk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E7E9DF800E5; Fri, 13 Aug 2021 10:12:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 73F0AF804AE; Fri, 13 Aug 2021 10:12:41 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 83792F80129 for ; Fri, 13 Aug 2021 10:12:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 83792F80129 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="TierabmI"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="KTHy3qsb" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id B887D1FF91; Fri, 13 Aug 2021 08:12:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1628842353; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ecistz0P34c1ZnwoqgdwDCtvVgS9yvBwKzKIW6MuPLs=; b=TierabmIMB9ccPYpD6IHjJpjAG4BkU82xKvG9G/ECzIkviny6ntfvSMsiXNNizHjf+NFbr 7yTIRjkX6vvpkjHP9xi00nfX1G9teKJGF3/4tt9zZsKhEpYq7SITjdidJpfWr0grvNwjaK VjjpiPJnFHNxsT5ser65WGwo0P66RxQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1628842353; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ecistz0P34c1ZnwoqgdwDCtvVgS9yvBwKzKIW6MuPLs=; b=KTHy3qsbIrvqupf1+bFLRRGGbhT4s8r2oIFhKoHhcYdRZ4p4qX1OVYVaPJPqc5D/zC08r6 U/Jr28igqvcj/wDw== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id B1B8CA3B85; Fri, 13 Aug 2021 08:12:33 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 1/3] ALSA: hda: conexant: Turn off EAPD at suspend, too Date: Fri, 13 Aug 2021 10:12:28 +0200 Message-Id: <20210813081230.4268-2-tiwai@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210813081230.4268-1-tiwai@suse.de> References: <20210813081230.4268-1-tiwai@suse.de> MIME-Version: 1.0 Cc: youling257@gmail.com, Imre Deak X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Conexant codecs have a workaround for the noise at shutdown to turn off EAPD, but it wasn't applied at suspend. In the later patch, we'll switch from reboot_notify callback to the general suspend-at-shutdown, so let's apply the workaround to the suspend case, too. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214045 Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index d111258c6f45..6d2bdef7f017 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -177,13 +177,18 @@ static int cx_auto_init(struct hda_codec *codec) return 0; } -static void cx_auto_reboot_notify(struct hda_codec *codec) +static void cx_auto_shutdown(struct hda_codec *codec) { struct conexant_spec *spec = codec->spec; /* Turn the problematic codec into D3 to avoid spurious noises from the internal speaker during (and after) reboot */ cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); +} + +static void cx_auto_reboot_notify(struct hda_codec *codec) +{ + cx_auto_shutdown(codec); snd_hda_gen_reboot_notify(codec); } @@ -193,6 +198,14 @@ static void cx_auto_free(struct hda_codec *codec) snd_hda_gen_free(codec); } +#ifdef CONFIG_PM +static int cx_auto_suspend(struct hda_codec *codec) +{ + cx_auto_shutdown(codec); + return 0; +} +#endif + static const struct hda_codec_ops cx_auto_patch_ops = { .build_controls = snd_hda_gen_build_controls, .build_pcms = snd_hda_gen_build_pcms, @@ -201,6 +214,7 @@ static const struct hda_codec_ops cx_auto_patch_ops = { .free = cx_auto_free, .unsol_event = snd_hda_jack_unsol_event, #ifdef CONFIG_PM + .suspend = cx_auto_suspend, .check_power_status = snd_hda_gen_check_power_status, #endif }; From patchwork Fri Aug 13 08:12:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 496591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10334C4338F for ; Fri, 13 Aug 2021 08:14:32 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 323296109D for ; Fri, 13 Aug 2021 08:14:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 323296109D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B151818AA; Fri, 13 Aug 2021 10:13:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B151818AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1628842469; bh=O2WDgH+c9Pv3ANP55FW7qfrJC4O9ap0ZmbdKA4qc5hw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=U5Gc3EzqOYxqicicfAO1bR8YNHJ66G5exkYqmzr5IR17U1MSk3nJPMHxW+YNBa8XW zuuHR13B/NBip/rno7nsAu6Q717fEl+CgFYnLsSYNh7POC0TJgNneqe0bkpiiDj6mQ vVCOCU5aR2xryr5ZW/9V9GHDnoblPEZGT9A1ztAc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7A18EF804CC; Fri, 13 Aug 2021 10:12:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 309D2F800E5; Fri, 13 Aug 2021 10:12:43 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 21DB9F8020D for ; Fri, 13 Aug 2021 10:12:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 21DB9F8020D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="QGv7J7Xs"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="rgK4CzFt" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id C7DF41FF92; Fri, 13 Aug 2021 08:12:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1628842353; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m4+UxHz4KctRKPRH8eFHP0qmf4PAjEeGlaTx/nOdT9Q=; b=QGv7J7Xsy2O9EfwqX0WgLzYmOkHK57daPCcw9uYRupq3Q81M8ZRWcjQsbZDWv7uc9EsBCL XSj2hSgHaMTCJj9pg8sFlaqTccqtpzZrf0u5JHjfECECUubLpp4vdiGLJzPJ9rbyIITeqt D2plGTI8gqUHnjaym02ASKr3fbWjkhk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1628842353; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m4+UxHz4KctRKPRH8eFHP0qmf4PAjEeGlaTx/nOdT9Q=; b=rgK4CzFtKbzhb6iLbkbkh9YtagR6aCHLxTAq/IFDO/G5/OffkzzG6NMuT2CqIDpQyExnoL yBSG84emgxfn9NCQ== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id B5C6CA3B8B; Fri, 13 Aug 2021 08:12:33 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 2/3] ALSA: hda: Suspend codec at shutdown Date: Fri, 13 Aug 2021 10:12:29 +0200 Message-Id: <20210813081230.4268-3-tiwai@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210813081230.4268-1-tiwai@suse.de> References: <20210813081230.4268-1-tiwai@suse.de> MIME-Version: 1.0 Cc: youling257@gmail.com, Imre Deak X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" So far we have a few workarounds at shutdown for each codec, e.g. turning off the display power and setting the codec to D3. But all those are basically a part of the suspend procedure. Moreover, the streams are still active after that call, hence it might hit the update on the codec that has been already put to D3. In this patch, instead of calling each reboot_notify callback, simply put the codec into the runtime-suspended state after the manual suspend of all PCM streams. It makes the code and the behavior more consistent. The reboot_notify callback is no longer used after this patch, and will be cleaned up later. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214045 Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_bind.c | 8 +------- sound/pci/hda/hda_codec.c | 14 ++++++++++++++ sound/pci/hda/hda_local.h | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c index e8dee24c309d..2523b23389e9 100644 --- a/sound/pci/hda/hda_bind.c +++ b/sound/pci/hda/hda_bind.c @@ -165,13 +165,7 @@ static int hda_codec_driver_remove(struct device *dev) static void hda_codec_driver_shutdown(struct device *dev) { - struct hda_codec *codec = dev_to_hda_codec(dev); - - if (!pm_runtime_suspended(dev)) { - if (codec->patch_ops.reboot_notify) - codec->patch_ops.reboot_notify(codec); - snd_hda_codec_display_power(codec, false); - } + snd_hda_codec_shutdown(dev_to_hda_codec(dev)); } int __hda_codec_driver_register(struct hda_codec_driver *drv, const char *name, diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 7a717e151156..2c91c92c9ab2 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2981,6 +2981,20 @@ const struct dev_pm_ops hda_codec_driver_pm = { NULL) }; +/* suspend the codec at shutdown; called from driver's shutdown callback */ +void snd_hda_codec_shutdown(struct hda_codec *codec) +{ + struct hda_pcm *cpcm; + + if (pm_runtime_suspended(hda_codec_dev(codec))) + return; + + list_for_each_entry(cpcm, &codec->pcm_list_head, list) + snd_pcm_suspend_all(cpcm->pcm); + + pm_runtime_suspend(hda_codec_dev(codec)); +} + /* * add standard channel maps if not specified */ diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 8d2503e8dad8..ea8ab8b43337 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -615,6 +615,8 @@ unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec, hda_nid_t nid, unsigned int power_state); +void snd_hda_codec_shutdown(struct hda_codec *codec); + /* * AMP control callbacks */ From patchwork Fri Aug 13 08:12:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 497118 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9FEDC4338F for ; Fri, 13 Aug 2021 08:15:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 32265610A5 for ; Fri, 13 Aug 2021 08:15:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 32265610A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AA60318CE; Fri, 13 Aug 2021 10:14:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AA60318CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1628842503; bh=aWC30nq6Er6OdKy4XaKcx8M9+gvmU//ddbEEXBz+2sU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bsfTWgZpuO6mHC+3yckOiQcBg4MQihYG8rFemDTOWoAJ03BbuH508ZM3xxCchSpsy G7FNItOzVipp1zJ6klrGaxiThrRmJRDzAjp1EvUrkLML6eOkqIcHNkilYyIEZmrN5F X4qr/ja2nPQeOsIOxB73A3DiVi/qiKfEGg+IHllc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2C814F804E3; Fri, 13 Aug 2021 10:12:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DD403F802D2; Fri, 13 Aug 2021 10:12:43 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6B537F802D2 for ; Fri, 13 Aug 2021 10:12:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6B537F802D2 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="HEBijw9y"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="kSOu0HNe" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id D741622288; Fri, 13 Aug 2021 08:12:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1628842353; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sbxqOtTsgrC8b+w0RtyRHNpkZXH11btK90z3YXULBdM=; b=HEBijw9yqpeqxk9GiXH0BogNsUYDMyXFb1rQZyNaNdarA8Er0zmqmDuqXJXlEOh6ShKMVw 5A7X8OwRs287NFCSCctEYwtkp2GLWqd8sdMPSMeRw0DzscwRRuukJNxzTPYUO0bLHPXMf+ yQKnqr9/lpajlMJbw3GIG/nOeGJx2Kk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1628842353; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sbxqOtTsgrC8b+w0RtyRHNpkZXH11btK90z3YXULBdM=; b=kSOu0HNeWBXxQXpVA/NsM+QHWIYdU11QOoriPm6bGhVZ+qNM6raZ01ojxDr1tajF3XJCE+ //46UiMseTjwbeDA== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id C4D67A3B84; Fri, 13 Aug 2021 08:12:33 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 3/3] ALSA: hda: Nuke unused reboot_notify callback Date: Fri, 13 Aug 2021 10:12:30 +0200 Message-Id: <20210813081230.4268-4-tiwai@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210813081230.4268-1-tiwai@suse.de> References: <20210813081230.4268-1-tiwai@suse.de> MIME-Version: 1.0 Cc: youling257@gmail.com, Imre Deak X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" As reboot_notify callback is no longer used by the codec core, let's get rid of the unused code. Conexant codec needs a slight code change as it used to call the reboot_notify at the codec removal, too. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214045 Signed-off-by: Takashi Iwai --- include/sound/hda_codec.h | 1 - sound/pci/hda/hda_generic.c | 19 ------------------- sound/pci/hda/hda_generic.h | 1 - sound/pci/hda/patch_analog.c | 1 - sound/pci/hda/patch_ca0132.c | 6 ------ sound/pci/hda/patch_conexant.c | 9 +-------- sound/pci/hda/patch_realtek.c | 13 ------------- sound/pci/hda/patch_sigmatel.c | 1 - 8 files changed, 1 insertion(+), 50 deletions(-) diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h index 2e8d51937acd..01570dbda503 100644 --- a/include/sound/hda_codec.h +++ b/include/sound/hda_codec.h @@ -114,7 +114,6 @@ struct hda_codec_ops { int (*resume)(struct hda_codec *codec); int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid); #endif - void (*reboot_notify)(struct hda_codec *codec); void (*stream_pm)(struct hda_codec *codec, hda_nid_t nid, bool on); }; diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index e97d00585e8e..f46d4e7f499c 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -6000,24 +6000,6 @@ void snd_hda_gen_free(struct hda_codec *codec) } EXPORT_SYMBOL_GPL(snd_hda_gen_free); -/** - * snd_hda_gen_reboot_notify - Make codec enter D3 before rebooting - * @codec: the HDA codec - * - * This can be put as patch_ops reboot_notify function. - */ -void snd_hda_gen_reboot_notify(struct hda_codec *codec) -{ - /* Make the codec enter D3 to avoid spurious noises from the internal - * speaker during (and after) reboot - */ - snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); - snd_hda_codec_write(codec, codec->core.afg, 0, - AC_VERB_SET_POWER_STATE, AC_PWRST_D3); - msleep(10); -} -EXPORT_SYMBOL_GPL(snd_hda_gen_reboot_notify); - #ifdef CONFIG_PM /** * snd_hda_gen_check_power_status - check the loopback power save state @@ -6045,7 +6027,6 @@ static const struct hda_codec_ops generic_patch_ops = { .init = snd_hda_gen_init, .free = snd_hda_gen_free, .unsol_event = snd_hda_jack_unsol_event, - .reboot_notify = snd_hda_gen_reboot_notify, #ifdef CONFIG_PM .check_power_status = snd_hda_gen_check_power_status, #endif diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h index d4dd1b8a2e7e..c43bd0f0338e 100644 --- a/sound/pci/hda/hda_generic.h +++ b/sound/pci/hda/hda_generic.h @@ -324,7 +324,6 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec, struct auto_pin_cfg *cfg); int snd_hda_gen_build_controls(struct hda_codec *codec); int snd_hda_gen_build_pcms(struct hda_codec *codec); -void snd_hda_gen_reboot_notify(struct hda_codec *codec); /* standard jack event callbacks */ void snd_hda_gen_hp_automute(struct hda_codec *codec, diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 2132b2acec4d..a356e1662929 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -168,7 +168,6 @@ static const struct hda_codec_ops ad198x_auto_patch_ops = { .check_power_status = snd_hda_gen_check_power_status, .suspend = ad198x_suspend, #endif - .reboot_notify = ad198x_shutup, }; diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 50ca72ee586e..208933792787 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -9682,11 +9682,6 @@ static void dbpro_free(struct hda_codec *codec) kfree(codec->spec); } -static void ca0132_reboot_notify(struct hda_codec *codec) -{ - codec->patch_ops.free(codec); -} - #ifdef CONFIG_PM static int ca0132_suspend(struct hda_codec *codec) { @@ -9706,7 +9701,6 @@ static const struct hda_codec_ops ca0132_patch_ops = { #ifdef CONFIG_PM .suspend = ca0132_suspend, #endif - .reboot_notify = ca0132_reboot_notify, }; static const struct hda_codec_ops dbpro_patch_ops = { diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 6d2bdef7f017..0515137a75b0 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -186,15 +186,9 @@ static void cx_auto_shutdown(struct hda_codec *codec) cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); } -static void cx_auto_reboot_notify(struct hda_codec *codec) -{ - cx_auto_shutdown(codec); - snd_hda_gen_reboot_notify(codec); -} - static void cx_auto_free(struct hda_codec *codec) { - cx_auto_reboot_notify(codec); + cx_auto_shutdown(codec); snd_hda_gen_free(codec); } @@ -210,7 +204,6 @@ static const struct hda_codec_ops cx_auto_patch_ops = { .build_controls = snd_hda_gen_build_controls, .build_pcms = snd_hda_gen_build_pcms, .init = cx_auto_init, - .reboot_notify = cx_auto_reboot_notify, .free = cx_auto_free, .unsol_event = snd_hda_jack_unsol_event, #ifdef CONFIG_PM diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 4043a2362f27..4f2296d062d5 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -109,7 +109,6 @@ struct alc_spec { void (*power_hook)(struct hda_codec *codec); #endif void (*shutup)(struct hda_codec *codec); - void (*reboot_notify)(struct hda_codec *codec); int init_amp; int codec_variant; /* flag for other variants */ @@ -897,16 +896,6 @@ static inline void alc_shutup(struct hda_codec *codec) alc_shutup_pins(codec); } -static void alc_reboot_notify(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - if (spec && spec->reboot_notify) - spec->reboot_notify(codec); - else - alc_shutup(codec); -} - #define alc_free snd_hda_gen_free #ifdef CONFIG_PM @@ -952,7 +941,6 @@ static const struct hda_codec_ops alc_patch_ops = { .suspend = alc_suspend, .check_power_status = snd_hda_gen_check_power_status, #endif - .reboot_notify = alc_reboot_notify, }; @@ -5773,7 +5761,6 @@ static void alc_fixup_tpt440_dock(struct hda_codec *codec, struct alc_spec *spec = codec->spec; if (action == HDA_FIXUP_ACT_PRE_PROBE) { - spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */ spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; codec->power_save_node = 0; /* avoid click noises */ snd_hda_apply_pincfgs(codec, pincfgs); diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3bd592e126a3..3e00116db86e 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4460,7 +4460,6 @@ static const struct hda_codec_ops stac_patch_ops = { #ifdef CONFIG_PM .suspend = stac_suspend, #endif - .reboot_notify = stac_shutup, }; static int alloc_stac_spec(struct hda_codec *codec)