Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: qcom: gdsc: Add support for gdscs with HW control

Some GDSCs might support a HW control mode, where in the power
domain (gdsc) is brought in and out of low power state (while
unsued) without any SW assistance, saving power.
Such GDSCs can be configured in a HW control mode when powered on
until they are explicitly requested to be powered off by software.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

authored by

Rajendra Nayak and committed by
Stephen Boyd
904bb4f5 5e2035b9

+19
+18
drivers/clk/qcom/gdsc.c
··· 56 56 return !!(val & PWR_ON_MASK); 57 57 } 58 58 59 + static int gdsc_hwctrl(struct gdsc *sc, bool en) 60 + { 61 + u32 val = en ? HW_CONTROL_MASK : 0; 62 + 63 + return regmap_update_bits(sc->regmap, sc->gdscr, HW_CONTROL_MASK, val); 64 + } 65 + 59 66 static int gdsc_toggle_logic(struct gdsc *sc, bool en) 60 67 { 61 68 int ret; ··· 187 180 */ 188 181 udelay(1); 189 182 183 + /* Turn on HW trigger mode if supported */ 184 + if (sc->flags & HW_CTRL) 185 + return gdsc_hwctrl(sc, true); 186 + 190 187 return 0; 191 188 } 192 189 ··· 201 190 202 191 if (sc->pwrsts == PWRSTS_ON) 203 192 return gdsc_assert_reset(sc); 193 + 194 + /* Turn off HW trigger mode if supported */ 195 + if (sc->flags & HW_CTRL) { 196 + ret = gdsc_hwctrl(sc, false); 197 + if (ret < 0) 198 + return ret; 199 + } 204 200 205 201 if (sc->pwrsts & PWRSTS_OFF) 206 202 gdsc_clear_mem_on(sc);
+1
drivers/clk/qcom/gdsc.h
··· 52 52 const u8 flags; 53 53 #define VOTABLE BIT(0) 54 54 #define CLAMP_IO BIT(1) 55 + #define HW_CTRL BIT(2) 55 56 struct reset_controller_dev *rcdev; 56 57 unsigned int *resets; 57 58 unsigned int reset_count;