Thread (14 messages) 14 messages, 4 authors, 2020-03-31

Re: [PATCH 1/4] clk: qcom: gdsc: Handle GDSC regulator supplies

From: Stephen Boyd <sboyd@kernel.org>
Date: 2020-03-20 23:31:03
Also in: linux-arm-msm, linux-clk, lkml

Quoting Bjorn Andersson (2020-03-18 22:38:59)
Certain GDSCs, such as the GPU_GX on MSM8996, requires that the upstream
regulator supply is powered in order to be turned on.

It's not guaranteed that the bootloader will leave these supplies on and
the driver core will attempt to enable any GDSCs before allowing the
individual drivers to probe defer on the PMIC regulator driver not yet
being present.

So the gdsc driver needs to be made aware of supplying regulators and
probe defer on their absence, and it needs to enable and disable the
regulator accordingly.

Voltage adjustments of the supplying regulator are deferred to the
client drivers themselves.

Signed-off-by: Bjorn Andersson <redacted>
---
Ok. Looks mostly fine to me.
quoted hunk ↗ jump to hunk
 drivers/clk/qcom/gdsc.c | 24 ++++++++++++++++++++++++
 drivers/clk/qcom/gdsc.h |  4 ++++
 2 files changed, 28 insertions(+)
diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index a250f59708d8..3528789cc9d0 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -13,6 +13,7 @@
 #include <linux/regmap.h>
 #include <linux/reset-controller.h>
 #include <linux/slab.h>
+#include <linux/regulator/consumer.h>
Alphabetical?
quoted hunk ↗ jump to hunk
 #include "gdsc.h"
 
 #define PWR_ON_MASK            BIT(31)
@@ -371,6 +385,16 @@ int gdsc_register(struct gdsc_desc *desc,
        if (!data->domains)
                return -ENOMEM;
 
+       /* Resolve any regulator supplies */
Drop the comment please, it's just saying what the code is doing.
+       for (i = 0; i < num; i++) {
+               if (!scs[i] || !scs[i]->supply)
+                       continue;
+
+               scs[i]->rsupply = devm_regulator_get(dev, scs[i]->supply);
+               if (IS_ERR(scs[i]->rsupply))
+                       return PTR_ERR(scs[i]->rsupply);
+       }
+
        data->num_domains = num;
        for (i = 0; i < num; i++) {
                if (!scs[i])
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help