mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ramón Jesús Miranda" <ramonjesusmiranda@gmail.com>
To: Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] soc: qcom: icc-bwmon: drop the bandwidth vote across system suspend
Date: Sun, 18 Oct 2026 15:54:24 +0000	[thread overview]
Message-ID: <20261018155424.1299645-1-ramonjesusmiranda@gmail.com> (raw)

icc-bwmon has no PM ops: the interconnect vote derived from the last
sample stays in place while the system is suspended. On X1E80100 the CPU
bwmon was left voting 800 MB/s peak on the DDR path during s2idle, which
keeps DDR out of its low power modes (the qcom_stats "ddr" counter never
advances).

Disable the monitor, drop the OPP vote on suspend and restart monitoring
on resume. With this change DDR reaches its low power mode for >99% of
s2idle on a Microsoft Surface Pro 11 (X1E80100).

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramón Jesús Miranda <ramonjesusmiranda@gmail.com>
---
diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c
--- a/drivers/soc/qcom/icc-bwmon.c
+++ b/drivers/soc/qcom/icc-bwmon.c
@@ -815,6 +815,35 @@
 	free_irq(bwmon->irq, bwmon);
 }
 
+/*
+ * The bandwidth vote of the last sample stays in place across system
+ * suspend and keeps DDR out of its low power modes. Drop it while
+ * suspended and restart monitoring on resume.
+ */
+static int bwmon_suspend(struct device *dev)
+{
+	struct icc_bwmon *bwmon = dev_get_drvdata(dev);
+
+	disable_irq(bwmon->irq);
+	bwmon_disable(bwmon);
+	dev_pm_opp_set_opp(dev, NULL);
+	bwmon->current_kbps = 0;
+
+	return 0;
+}
+
+static int bwmon_resume(struct device *dev)
+{
+	struct icc_bwmon *bwmon = dev_get_drvdata(dev);
+
+	bwmon_start(bwmon);
+	enable_irq(bwmon->irq);
+
+	return 0;
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(bwmon_pm_ops, bwmon_suspend, bwmon_resume);
+
 static const struct icc_bwmon_data msm8998_bwmon_data = {
 	.sample_ms = 4,
 	.count_unit_kb = 1024,
@@ -879,6 +907,7 @@
 	.driver = {
 		.name = "qcom-bwmon",
 		.of_match_table = bwmon_of_match,
+		.pm = pm_sleep_ptr(&bwmon_pm_ops),
 	},
 };
 module_platform_driver(bwmon_driver);

             reply	other threads:[~2026-10-18 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 15:54 Ramón Jesús Miranda [this message]
2026-10-19  8:40 ` Konrad Dybcio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261018155424.1299645-1-ramonjesusmiranda@gmail.com \
    --to=ramonjesusmiranda@gmail.com \
    --cc=andersson@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®