[PATCH 09/10] clk: qcom: cpu-8996: program the MSM8996 Pro droop code register

From: Dmitry Baryshkov

Date: Mon Oct 19 2026 - 09:47:17 EST


When the vendor kernel enables ACD on MSM8996 Pro, it also programs the
MDD droop code register of both clusters, so that they switch to the
always-on clock source when entering the D2-D5 low power states and
gate the limits management clock while asleep. This driver enables ACD
on MSM8996 Pro as well, but leaves the register at its reset value.

Program it on MSM8996 Pro before the clusters switch to the ACD leg.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
---
drivers/clk/qcom/clk-cpu-8996.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/clk/qcom/clk-cpu-8996.c b/drivers/clk/qcom/clk-cpu-8996.c
index f22dd80919fa..d428043ecbee 100644
--- a/drivers/clk/qcom/clk-cpu-8996.c
+++ b/drivers/clk/qcom/clk-cpu-8996.c
@@ -56,6 +56,7 @@
#include <linux/clk-provider.h>
#include <linux/io.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <soc/qcom/kryo-l2-accessors.h>
@@ -80,6 +81,7 @@ enum _pmux_input {
#define MUX_OFFSET 0x40
#define CLK_CTL_OFFSET 0x44
#define CLK_CTL_AUTO_CLK_SEL BIT(8)
+#define MDD_DROOP_CODE_OFFSET 0x7c
#define ALT_PLL_OFFSET 0x100
#define SSSCTL_OFFSET 0x160
#define PSCTL_OFFSET 0x164
@@ -471,6 +473,15 @@ static int qcom_cpu_clk_msm8996_register_clks(struct device *dev,
/* Ensure write goes through before muxes are switched */
udelay(5);

+ if (of_device_is_compatible(dev->of_node, "qcom,msm8996pro-apcc")) {
+ /*
+ * Switch to the always-on source on D2-D5 entry and gate the
+ * limits management clock in sleep.
+ */
+ regmap_write(regmap, PWRCL_REG_OFFSET + MDD_DROOP_CODE_OFFSET, 0x3);
+ regmap_write(regmap, PERFCL_REG_OFFSET + MDD_DROOP_CODE_OFFSET, 0x3);
+ }
+
qcom_cpu_clk_msm8996_acd_init(regmap);

/* Pulse swallower and soft-start settings */

--
2.47.3