]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
clk: qcom: gdsc: Support enabling interconnect path for power domain
authorLuca Weiss <luca.weiss@fairphone.com>
Fri, 1 May 2026 09:18:31 +0000 (11:18 +0200)
committerBjorn Andersson <andersson@kernel.org>
Sun, 7 Jun 2026 00:51:15 +0000 (19:51 -0500)
On newer SoCs like Milos the CAMSS_TOP_GDSC power domains requires the
enablement of the multimedia NoC, otherwise the GDSC will be stuck on
'off'.

Add support for getting an interconnect path as specified in the SoC
clock driver, and enabling/disabling that interconnect path when the
GDSC is being enabled/disabled.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
Link: https://lore.kernel.org/r/20260501-milos-camcc-icc-v2-3-bb83c1256cc3@fairphone.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/clk/qcom/gdsc.c
drivers/clk/qcom/gdsc.h

index 95aa071202455421d818171d04f95d15e2b581fa..ee5f86ca50cb77372da9fd51590b846d66274b28 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/export.h>
+#include <linux/interconnect.h>
 #include <linux/jiffies.h>
 #include <linux/kernel.h>
 #include <linux/ktime.h>
@@ -147,6 +148,12 @@ static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status,
                        return ret;
        }
 
+       if (status == GDSC_ON) {
+               ret = icc_set_bw(sc->icc_path, 1, 1);
+               if (ret)
+                       goto err_disable_supply;
+       }
+
        ret = gdsc_update_collapse_bit(sc, status == GDSC_OFF);
 
        /* If disabling votable gdscs, don't poll on status */
@@ -177,6 +184,12 @@ static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status,
        ret = gdsc_poll_status(sc, status);
        WARN(ret, "%s status stuck at 'o%s'", sc->pd.name, status ? "ff" : "n");
 
+       if (!ret && status == GDSC_OFF) {
+               ret = icc_set_bw(sc->icc_path, 0, 0);
+               if (ret)
+                       return ret;
+       }
+
        if (!ret && status == GDSC_OFF && sc->rsupply) {
                ret = regulator_disable(sc->rsupply);
                if (ret < 0)
@@ -184,6 +197,12 @@ static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status,
        }
 
        return ret;
+
+err_disable_supply:
+       if (status == GDSC_ON && sc->rsupply)
+               regulator_disable(sc->rsupply);
+
+       return ret;
 }
 
 static inline int gdsc_deassert_reset(struct gdsc *sc)
@@ -584,6 +603,20 @@ int gdsc_register(struct gdsc_desc *desc,
        if (!data->domains)
                return -ENOMEM;
 
+       for (i = 0; i < num; i++) {
+               if (!scs[i] || !scs[i]->needs_icc)
+                       continue;
+
+               scs[i]->icc_path = devm_of_icc_get_by_index(dev, scs[i]->icc_path_index);
+               if (IS_ERR(scs[i]->icc_path)) {
+                       ret = PTR_ERR(scs[i]->icc_path);
+                       if (ret != -ENODEV)
+                               return ret;
+
+                       scs[i]->icc_path = NULL;
+               }
+       }
+
        for (i = 0; i < num; i++) {
                if (!scs[i] || !scs[i]->supply)
                        continue;
index dd843e86c05b2f30e6d9e978681580016333839d..92ff6bcce7b1c18a38b38dfa881b6a4e04f43aba 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/err.h>
 #include <linux/pm_domain.h>
 
+struct icc_path;
 struct regmap;
 struct regulator;
 struct reset_controller_dev;
@@ -74,6 +75,10 @@ struct gdsc {
 
        const char                      *supply;
        struct regulator                *rsupply;
+
+       bool                            needs_icc;
+       unsigned int                    icc_path_index;
+       struct icc_path                 *icc_path;
 };
 
 struct gdsc_desc {