Lines Matching +full:deep +full:- +full:touch
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2015, 2017-2018, The Linux Foundation. All rights reserved.
16 #include <linux/reset-controller.h>
60 if (sc->flags & POLL_CFG_GDSCR) in gdsc_check_status()
61 reg = sc->gdscr + CFG_GDSCR_OFFSET; in gdsc_check_status()
62 else if (sc->gds_hw_ctrl) in gdsc_check_status()
63 reg = sc->gds_hw_ctrl; in gdsc_check_status()
65 reg = sc->gdscr; in gdsc_check_status()
67 ret = regmap_read(sc->regmap, reg, &val); in gdsc_check_status()
71 if (sc->flags & POLL_CFG_GDSCR) { in gdsc_check_status()
87 return -EINVAL; in gdsc_check_status()
94 return regmap_update_bits(sc->regmap, sc->gdscr, HW_CONTROL_MASK, val); in gdsc_hwctrl()
110 return -ETIMEDOUT; in gdsc_poll_status()
118 if (status == GDSC_ON && sc->rsupply) { in gdsc_toggle_logic()
119 ret = regulator_enable(sc->rsupply); in gdsc_toggle_logic()
124 ret = regmap_update_bits(sc->regmap, sc->gdscr, SW_COLLAPSE_MASK, val); in gdsc_toggle_logic()
129 if ((sc->flags & VOTABLE) && status == GDSC_OFF) { in gdsc_toggle_logic()
139 if (sc->gds_hw_ctrl) { in gdsc_toggle_logic()
141 * The gds hw controller asserts/de-asserts the status bit soon in gdsc_toggle_logic()
154 WARN(ret, "%s status stuck at 'o%s'", sc->pd.name, status ? "ff" : "n"); in gdsc_toggle_logic()
156 if (!ret && status == GDSC_OFF && sc->rsupply) { in gdsc_toggle_logic()
157 ret = regulator_disable(sc->rsupply); in gdsc_toggle_logic()
169 for (i = 0; i < sc->reset_count; i++) in gdsc_deassert_reset()
170 sc->rcdev->ops->deassert(sc->rcdev, sc->resets[i]); in gdsc_deassert_reset()
178 for (i = 0; i < sc->reset_count; i++) in gdsc_assert_reset()
179 sc->rcdev->ops->assert(sc->rcdev, sc->resets[i]); in gdsc_assert_reset()
188 for (i = 0; i < sc->cxc_count; i++) in gdsc_force_mem_on()
189 regmap_update_bits(sc->regmap, sc->cxcs[i], mask, mask); in gdsc_force_mem_on()
197 for (i = 0; i < sc->cxc_count; i++) in gdsc_clear_mem_on()
198 regmap_update_bits(sc->regmap, sc->cxcs[i], mask, 0); in gdsc_clear_mem_on()
203 regmap_update_bits(sc->regmap, sc->clamp_io_ctrl, in gdsc_deassert_clamp_io()
209 regmap_update_bits(sc->regmap, sc->clamp_io_ctrl, in gdsc_assert_clamp_io()
215 regmap_update_bits(sc->regmap, sc->clamp_io_ctrl, in gdsc_assert_reset_aon()
218 regmap_update_bits(sc->regmap, sc->clamp_io_ctrl, in gdsc_assert_reset_aon()
226 regmap_update_bits(sc->regmap, sc->gdscr, mask, mask); in gdsc_retain_ff_on()
234 if (sc->pwrsts == PWRSTS_ON) in gdsc_enable()
237 if (sc->flags & SW_RESET) { in gdsc_enable()
243 if (sc->flags & CLAMP_IO) { in gdsc_enable()
244 if (sc->flags & AON_RESET) in gdsc_enable()
253 if (sc->pwrsts & PWRSTS_OFF) in gdsc_enable()
258 * additional 4 clock cycles to re-enable after the power domain is in gdsc_enable()
266 if (sc->flags & HW_CTRL) { in gdsc_enable()
281 if (sc->flags & RETAIN_FF_ENABLE) in gdsc_enable()
292 if (sc->pwrsts == PWRSTS_ON) in gdsc_disable()
296 if (sc->flags & HW_CTRL) { in gdsc_disable()
313 if (sc->pwrsts & PWRSTS_OFF) in gdsc_disable()
320 if (sc->flags & CLAMP_IO) in gdsc_disable()
333 * Disable SW override: Use hardware state-machine for sequencing. in gdsc_init()
339 ret = regmap_update_bits(sc->regmap, sc->gdscr, mask, val); in gdsc_init()
344 if (sc->pwrsts == PWRSTS_ON) { in gdsc_init()
358 if ((sc->flags & VOTABLE) && on) in gdsc_init()
359 gdsc_enable(&sc->pd); in gdsc_init()
366 if ((sc->flags & RETAIN_FF_ENABLE) && on) in gdsc_init()
370 if (sc->flags & ALWAYS_ON) { in gdsc_init()
372 gdsc_enable(&sc->pd); in gdsc_init()
374 sc->pd.flags |= GENPD_FLAG_ALWAYS_ON; in gdsc_init()
377 if (on || (sc->pwrsts & PWRSTS_RET)) in gdsc_init()
382 if (!sc->pd.power_off) in gdsc_init()
383 sc->pd.power_off = gdsc_disable; in gdsc_init()
384 if (!sc->pd.power_on) in gdsc_init()
385 sc->pd.power_on = gdsc_enable; in gdsc_init()
386 pm_genpd_init(&sc->pd, NULL, !on); in gdsc_init()
396 struct device *dev = desc->dev; in gdsc_register()
397 struct gdsc **scs = desc->scs; in gdsc_register()
398 size_t num = desc->num; in gdsc_register()
402 return -ENOMEM; in gdsc_register()
404 data->domains = devm_kcalloc(dev, num, sizeof(*data->domains), in gdsc_register()
406 if (!data->domains) in gdsc_register()
407 return -ENOMEM; in gdsc_register()
410 if (!scs[i] || !scs[i]->supply) in gdsc_register()
413 scs[i]->rsupply = devm_regulator_get(dev, scs[i]->supply); in gdsc_register()
414 if (IS_ERR(scs[i]->rsupply)) in gdsc_register()
415 return PTR_ERR(scs[i]->rsupply); in gdsc_register()
418 data->num_domains = num; in gdsc_register()
422 scs[i]->regmap = regmap; in gdsc_register()
423 scs[i]->rcdev = rcdev; in gdsc_register()
427 data->domains[i] = &scs[i]->pd; in gdsc_register()
434 if (scs[i]->parent) in gdsc_register()
435 pm_genpd_add_subdomain(scs[i]->parent, &scs[i]->pd); in gdsc_register()
438 return of_genpd_add_provider_onecell(dev->of_node, data); in gdsc_register()
444 struct device *dev = desc->dev; in gdsc_unregister()
445 struct gdsc **scs = desc->scs; in gdsc_unregister()
446 size_t num = desc->num; in gdsc_unregister()
452 if (scs[i]->parent) in gdsc_unregister()
453 pm_genpd_remove_subdomain(scs[i]->parent, &scs[i]->pd); in gdsc_unregister()
455 of_genpd_del_provider(dev->of_node); in gdsc_unregister()
466 * way to reach in and touch that register from deep inside the GPU driver we
475 * is *really* off - this gives us a semi standard way of doing what we need.