summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan+linaro@kernel.org>2022-05-20 12:09:47 +0200
committerBjorn Andersson <bjorn.andersson@linaro.org>2022-06-26 05:38:02 +0200
commit77ea2bd72da4f61f59ad2e839babe83849f35dea (patch)
treea290ed4e88079efab620d47fbeb1affc4666c8f5
parentclk: qcom: gdsc: add collapse-bit helper (diff)
downloadlinux-77ea2bd72da4f61f59ad2e839babe83849f35dea.tar.xz
linux-77ea2bd72da4f61f59ad2e839babe83849f35dea.zip
clk: qcom: gdsc: add support for collapse-vote registers
Recent Qualcomm platforms have APCS collapse-vote registers that allow for sharing GDSCs with other masters (e.g. LPASS). Add support for using such vote registers instead of the control register when updating the GDSC power state. Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220520100948.19622-3-johan+linaro@kernel.org
-rw-r--r--drivers/clk/qcom/gdsc.c9
-rw-r--r--drivers/clk/qcom/gdsc.h4
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index c676416e685f..6f746158d28f 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -137,8 +137,13 @@ static int gdsc_update_collapse_bit(struct gdsc *sc, bool val)
u32 reg, mask;
int ret;
- reg = sc->gdscr;
- mask = SW_COLLAPSE_MASK;
+ if (sc->collapse_mask) {
+ reg = sc->collapse_ctrl;
+ mask = sc->collapse_mask;
+ } else {
+ reg = sc->gdscr;
+ mask = SW_COLLAPSE_MASK;
+ }
ret = regmap_update_bits(sc->regmap, reg, mask, val ? mask : 0);
if (ret)
diff --git a/drivers/clk/qcom/gdsc.h b/drivers/clk/qcom/gdsc.h
index ad313d7210bd..5de48c9439b2 100644
--- a/drivers/clk/qcom/gdsc.h
+++ b/drivers/clk/qcom/gdsc.h
@@ -18,6 +18,8 @@ struct reset_controller_dev;
* @pd: generic power domain
* @regmap: regmap for MMIO accesses
* @gdscr: gsdc control register
+ * @collapse_ctrl: APCS collapse-vote register
+ * @collapse_mask: APCS collapse-vote mask
* @gds_hw_ctrl: gds_hw_ctrl register
* @cxcs: offsets of branch registers to toggle mem/periph bits in
* @cxc_count: number of @cxcs
@@ -35,6 +37,8 @@ struct gdsc {
struct generic_pm_domain *parent;
struct regmap *regmap;
unsigned int gdscr;
+ unsigned int collapse_ctrl;
+ unsigned int collapse_mask;
unsigned int gds_hw_ctrl;
unsigned int clamp_io_ctrl;
unsigned int *cxcs;