From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1497DC6FA89 for ; Wed, 14 Sep 2022 09:03:22 +0000 (UTC) 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 495811841; Wed, 14 Sep 2022 11:02:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 495811841 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663146200; bh=ApP5aHfwt00flHGkbd48EuZBwfzU0RjCtFfNvrtur/U=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=G/Sb1K9J98AA3VE6Ua66Fiom5hFjHjNRgFTHJrNOLrmIJ7+eBmezb6GlrcPtMzJi9 4xP6j67OjCoJQtYDt7qFsVpYH0ApeT5RJosd/KS2CegrLOf7VH6Nb5Ec0zkfQ+xPcS Lnv4qfNYvjLjRcjxDbt63NNY5CJ8ci5tKuVllji0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B0C05F80537; Wed, 14 Sep 2022 11:01:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DA207F80536; Wed, 14 Sep 2022 11:01:51 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EE9A9F80536 for ; Wed, 14 Sep 2022 11:01:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EE9A9F80536 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EyuDioy4" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B2B96619BA; Wed, 14 Sep 2022 09:01:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E6D4C433D6; Wed, 14 Sep 2022 09:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663146103; bh=ApP5aHfwt00flHGkbd48EuZBwfzU0RjCtFfNvrtur/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EyuDioy4d65TyJ+oaPj8+xwLzHrCI6whkUkyACMufccrgNR6jgesP3lNe8vyz/umY 3sXxT7JbgJxN7vCnrCEM6+Ma0/tTPgOqyu4cMZOUzYiKPvqt0wB6gSi+5mmiAJ+tp+ Y64bmQGfCliyb2v5MJ3fUlVN1m7WxVSa40lAWNezsclrfJCv19t7GC423LtnPCZfOb nIQLvTYsvMs0NPgEdMc7dSXP2IUwYKQVySpRJ7o++SYt2NZUu3F1wUyi7U0Lh+sBB4 qQ1K4WcxAWXs1RPMytiy+RRTIO1h3rbRcCmRjQYTjobNz+PBOGtvlHNymGJpeJAJGx sUmTCoAGIzZZw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 11/22] ALSA: hda/sigmatel: Keep power up while beep is enabled Date: Wed, 14 Sep 2022 05:00:52 -0400 Message-Id: <20220914090103.470630-11-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220914090103.470630-1-sashal@kernel.org> References: <20220914090103.470630-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Cc: Takashi Iwai , Sasha Levin , alsa-devel@alsa-project.org, tiwai@suse.com 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" From: Takashi Iwai [ Upstream commit 414d38ba871092aeac4ed097ac4ced89486646f7 ] It seems that the beep playback doesn't work well on IDT codec devices when the codec auto-pm is enabled. Keep the power on while the beep switch is enabled. Link: https://bugzilla.suse.com/show_bug.cgi?id=1200544 Link: https://lore.kernel.org/r/20220904072750.26164-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_sigmatel.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 61df4d33c48ff..066bfccd25877 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -209,6 +209,7 @@ struct sigmatel_spec { /* beep widgets */ hda_nid_t anabeep_nid; + bool beep_power_on; /* SPDIF-out mux */ const char * const *spdif_labels; @@ -4443,6 +4444,26 @@ static int stac_suspend(struct hda_codec *codec) return 0; } + +static int stac_check_power_status(struct hda_codec *codec, hda_nid_t nid) +{ + struct sigmatel_spec *spec = codec->spec; + int ret = snd_hda_gen_check_power_status(codec, nid); + +#ifdef CONFIG_SND_HDA_INPUT_BEEP + if (nid == spec->gen.beep_nid && codec->beep) { + if (codec->beep->enabled != spec->beep_power_on) { + spec->beep_power_on = codec->beep->enabled; + if (spec->beep_power_on) + snd_hda_power_up_pm(codec); + else + snd_hda_power_down_pm(codec); + } + ret |= spec->beep_power_on; + } +#endif + return ret; +} #else #define stac_suspend NULL #endif /* CONFIG_PM */ @@ -4455,6 +4476,7 @@ static const struct hda_codec_ops stac_patch_ops = { .unsol_event = snd_hda_jack_unsol_event, #ifdef CONFIG_PM .suspend = stac_suspend, + .check_power_status = stac_check_power_status, #endif }; -- 2.35.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD3B9ECAAD8 for ; Wed, 14 Sep 2022 09:02:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230250AbiINJC4 (ORCPT ); Wed, 14 Sep 2022 05:02:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230382AbiINJB5 (ORCPT ); Wed, 14 Sep 2022 05:01:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7218275CD6; Wed, 14 Sep 2022 02:01:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1F017B816A9; Wed, 14 Sep 2022 09:01:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E6D4C433D6; Wed, 14 Sep 2022 09:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663146103; bh=ApP5aHfwt00flHGkbd48EuZBwfzU0RjCtFfNvrtur/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EyuDioy4d65TyJ+oaPj8+xwLzHrCI6whkUkyACMufccrgNR6jgesP3lNe8vyz/umY 3sXxT7JbgJxN7vCnrCEM6+Ma0/tTPgOqyu4cMZOUzYiKPvqt0wB6gSi+5mmiAJ+tp+ Y64bmQGfCliyb2v5MJ3fUlVN1m7WxVSa40lAWNezsclrfJCv19t7GC423LtnPCZfOb nIQLvTYsvMs0NPgEdMc7dSXP2IUwYKQVySpRJ7o++SYt2NZUu3F1wUyi7U0Lh+sBB4 qQ1K4WcxAWXs1RPMytiy+RRTIO1h3rbRcCmRjQYTjobNz+PBOGtvlHNymGJpeJAJGx sUmTCoAGIzZZw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Iwai , Sasha Levin , perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.19 11/22] ALSA: hda/sigmatel: Keep power up while beep is enabled Date: Wed, 14 Sep 2022 05:00:52 -0400 Message-Id: <20220914090103.470630-11-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220914090103.470630-1-sashal@kernel.org> References: <20220914090103.470630-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Takashi Iwai [ Upstream commit 414d38ba871092aeac4ed097ac4ced89486646f7 ] It seems that the beep playback doesn't work well on IDT codec devices when the codec auto-pm is enabled. Keep the power on while the beep switch is enabled. Link: https://bugzilla.suse.com/show_bug.cgi?id=1200544 Link: https://lore.kernel.org/r/20220904072750.26164-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_sigmatel.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 61df4d33c48ff..066bfccd25877 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -209,6 +209,7 @@ struct sigmatel_spec { /* beep widgets */ hda_nid_t anabeep_nid; + bool beep_power_on; /* SPDIF-out mux */ const char * const *spdif_labels; @@ -4443,6 +4444,26 @@ static int stac_suspend(struct hda_codec *codec) return 0; } + +static int stac_check_power_status(struct hda_codec *codec, hda_nid_t nid) +{ + struct sigmatel_spec *spec = codec->spec; + int ret = snd_hda_gen_check_power_status(codec, nid); + +#ifdef CONFIG_SND_HDA_INPUT_BEEP + if (nid == spec->gen.beep_nid && codec->beep) { + if (codec->beep->enabled != spec->beep_power_on) { + spec->beep_power_on = codec->beep->enabled; + if (spec->beep_power_on) + snd_hda_power_up_pm(codec); + else + snd_hda_power_down_pm(codec); + } + ret |= spec->beep_power_on; + } +#endif + return ret; +} #else #define stac_suspend NULL #endif /* CONFIG_PM */ @@ -4455,6 +4476,7 @@ static const struct hda_codec_ops stac_patch_ops = { .unsol_event = snd_hda_jack_unsol_event, #ifdef CONFIG_PM .suspend = stac_suspend, + .check_power_status = stac_check_power_status, #endif }; -- 2.35.1