From patchwork Mon Oct 30 05:23:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 739310 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 48D34C4332F for ; Mon, 30 Oct 2023 05:26:30 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 65D8FA4B; Mon, 30 Oct 2023 06:25:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 65D8FA4B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698643587; bh=Mqn3rsr9s+F26WEnT9DSH+0oK3TcYgO8P7joFGRFFiQ=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=nAA+aj5pDbQxwM9zKGL4dZC8XeS7zQyD4/akCbpRkqloUPhnFtbePn/TE0020Z2pI REHOSszoVQXXj4DLjGtNKJUP9+UsLWvP2QWwdCITdtvbTUW6043Cmu8WciteTF8UR/ QPgnYrbkYStb74gFGZpOnF0c3+OC/3cU6a0DCd/U= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5565CF80494; Mon, 30 Oct 2023 06:25:27 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D59C7F8016D; Mon, 30 Oct 2023 06:25:25 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5B455F8016D; Mon, 30 Oct 2023 06:24:07 +0100 (CET) Received: from muru.com (muru.com [72.249.23.125]) by alsa1.perex.cz (Postfix) with ESMTP id 618DDF8014B for ; Mon, 30 Oct 2023 06:24:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 618DDF8014B Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 0746380EE; Mon, 30 Oct 2023 05:23:55 +0000 (UTC) From: Tony Lindgren To: Peter Ujfalusi , Jarkko Nikula , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: Andreas Kemnade , alsa-devel@alsa-project.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings Date: Mon, 30 Oct 2023 07:23:38 +0200 Message-ID: <20231030052340.13415-1-tony@atomide.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Message-ID-Hash: 66CARZQO4TEYKLBUWKMG4U7XKFVEIN24 X-Message-ID-Hash: 66CARZQO4TEYKLBUWKMG4U7XKFVEIN24 X-MailFrom: tony@atomide.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: We need to check for an active device as otherwise we get warnings for some mcbsp instances for "Runtime PM usage count underflow!". Reported-by: Andreas Kemnade Signed-off-by: Tony Lindgren --- sound/soc/ti/omap-mcbsp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c --- a/sound/soc/ti/omap-mcbsp.c +++ b/sound/soc/ti/omap-mcbsp.c @@ -74,14 +74,16 @@ static int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id) return 0; } - pm_runtime_put_sync(mcbsp->dev); + if (mcbsp->active) + pm_runtime_put_sync(mcbsp->dev); r = clk_set_parent(mcbsp->fclk, fck_src); if (r) dev_err(mcbsp->dev, "CLKS: could not clk_set_parent() to %s\n", src); - pm_runtime_get_sync(mcbsp->dev); + if (mcbsp->active) + pm_runtime_get_sync(mcbsp->dev); clk_put(fck_src);