• Home
  • Raw
  • Download

Lines Matching full:sc

59 static int gdsc_check_status(struct gdsc *sc, enum gdsc_status status)  in gdsc_check_status()  argument
65 if (sc->flags & POLL_CFG_GDSCR) in gdsc_check_status()
66 reg = sc->gdscr + CFG_GDSCR_OFFSET; in gdsc_check_status()
67 else if (sc->gds_hw_ctrl) in gdsc_check_status()
68 reg = sc->gds_hw_ctrl; in gdsc_check_status()
70 reg = sc->gdscr; in gdsc_check_status()
72 ret = regmap_read(sc->regmap, reg, &val); in gdsc_check_status()
76 if (sc->flags & POLL_CFG_GDSCR) { in gdsc_check_status()
95 static int gdsc_hwctrl(struct gdsc *sc, bool en) in gdsc_hwctrl() argument
99 return regmap_update_bits(sc->regmap, sc->gdscr, HW_CONTROL_MASK, val); in gdsc_hwctrl()
102 static int gdsc_poll_status(struct gdsc *sc, enum gdsc_status status) in gdsc_poll_status() argument
108 if (gdsc_check_status(sc, status)) in gdsc_poll_status()
112 if (gdsc_check_status(sc, status)) in gdsc_poll_status()
118 static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status) in gdsc_toggle_logic() argument
123 ret = regmap_update_bits(sc->regmap, sc->gdscr, SW_COLLAPSE_MASK, val); in gdsc_toggle_logic()
128 if ((sc->flags & VOTABLE) && status == GDSC_OFF) { in gdsc_toggle_logic()
138 if (sc->gds_hw_ctrl) { in gdsc_toggle_logic()
152 return gdsc_poll_status(sc, status); in gdsc_toggle_logic()
155 static inline int gdsc_deassert_reset(struct gdsc *sc) in gdsc_deassert_reset() argument
159 for (i = 0; i < sc->reset_count; i++) in gdsc_deassert_reset()
160 sc->rcdev->ops->deassert(sc->rcdev, sc->resets[i]); in gdsc_deassert_reset()
164 static inline int gdsc_assert_reset(struct gdsc *sc) in gdsc_assert_reset() argument
168 for (i = 0; i < sc->reset_count; i++) in gdsc_assert_reset()
169 sc->rcdev->ops->assert(sc->rcdev, sc->resets[i]); in gdsc_assert_reset()
173 static inline void gdsc_force_mem_on(struct gdsc *sc) in gdsc_force_mem_on() argument
178 for (i = 0; i < sc->cxc_count; i++) in gdsc_force_mem_on()
179 regmap_update_bits(sc->regmap, sc->cxcs[i], mask, mask); in gdsc_force_mem_on()
182 static inline void gdsc_clear_mem_on(struct gdsc *sc) in gdsc_clear_mem_on() argument
187 for (i = 0; i < sc->cxc_count; i++) in gdsc_clear_mem_on()
188 regmap_update_bits(sc->regmap, sc->cxcs[i], mask, 0); in gdsc_clear_mem_on()
191 static inline void gdsc_deassert_clamp_io(struct gdsc *sc) in gdsc_deassert_clamp_io() argument
193 regmap_update_bits(sc->regmap, sc->clamp_io_ctrl, in gdsc_deassert_clamp_io()
197 static inline void gdsc_assert_clamp_io(struct gdsc *sc) in gdsc_assert_clamp_io() argument
199 regmap_update_bits(sc->regmap, sc->clamp_io_ctrl, in gdsc_assert_clamp_io()
203 static inline void gdsc_assert_reset_aon(struct gdsc *sc) in gdsc_assert_reset_aon() argument
205 regmap_update_bits(sc->regmap, sc->clamp_io_ctrl, in gdsc_assert_reset_aon()
208 regmap_update_bits(sc->regmap, sc->clamp_io_ctrl, in gdsc_assert_reset_aon()
213 struct gdsc *sc = domain_to_gdsc(domain); in gdsc_enable() local
216 if (sc->pwrsts == PWRSTS_ON) in gdsc_enable()
217 return gdsc_deassert_reset(sc); in gdsc_enable()
219 if (sc->flags & SW_RESET) { in gdsc_enable()
220 gdsc_assert_reset(sc); in gdsc_enable()
222 gdsc_deassert_reset(sc); in gdsc_enable()
225 if (sc->flags & CLAMP_IO) { in gdsc_enable()
226 if (sc->flags & AON_RESET) in gdsc_enable()
227 gdsc_assert_reset_aon(sc); in gdsc_enable()
228 gdsc_deassert_clamp_io(sc); in gdsc_enable()
231 ret = gdsc_toggle_logic(sc, GDSC_ON); in gdsc_enable()
235 if (sc->pwrsts & PWRSTS_OFF) in gdsc_enable()
236 gdsc_force_mem_on(sc); in gdsc_enable()
248 if (sc->flags & HW_CTRL) { in gdsc_enable()
249 ret = gdsc_hwctrl(sc, true); in gdsc_enable()
268 struct gdsc *sc = domain_to_gdsc(domain); in gdsc_disable() local
271 if (sc->pwrsts == PWRSTS_ON) in gdsc_disable()
272 return gdsc_assert_reset(sc); in gdsc_disable()
275 if (sc->flags & HW_CTRL) { in gdsc_disable()
276 ret = gdsc_hwctrl(sc, false); in gdsc_disable()
287 ret = gdsc_poll_status(sc, GDSC_ON); in gdsc_disable()
292 if (sc->pwrsts & PWRSTS_OFF) in gdsc_disable()
293 gdsc_clear_mem_on(sc); in gdsc_disable()
295 ret = gdsc_toggle_logic(sc, GDSC_OFF); in gdsc_disable()
299 if (sc->flags & CLAMP_IO) in gdsc_disable()
300 gdsc_assert_clamp_io(sc); in gdsc_disable()
305 static int gdsc_init(struct gdsc *sc) in gdsc_init() argument
318 ret = regmap_update_bits(sc->regmap, sc->gdscr, mask, val); in gdsc_init()
323 if (sc->pwrsts == PWRSTS_ON) { in gdsc_init()
324 ret = gdsc_toggle_logic(sc, GDSC_ON); in gdsc_init()
329 on = gdsc_check_status(sc, GDSC_ON); in gdsc_init()
337 if ((sc->flags & VOTABLE) && on) in gdsc_init()
338 gdsc_enable(&sc->pd); in gdsc_init()
341 if (sc->flags & ALWAYS_ON) { in gdsc_init()
343 gdsc_enable(&sc->pd); in gdsc_init()
345 sc->pd.flags |= GENPD_FLAG_ALWAYS_ON; in gdsc_init()
348 if (on || (sc->pwrsts & PWRSTS_RET)) in gdsc_init()
349 gdsc_force_mem_on(sc); in gdsc_init()
351 gdsc_clear_mem_on(sc); in gdsc_init()
353 sc->pd.power_off = gdsc_disable; in gdsc_init()
354 sc->pd.power_on = gdsc_enable; in gdsc_init()
355 pm_genpd_init(&sc->pd, NULL, !on); in gdsc_init()