On 4/13/2024 8:50 PM, Jagadeesh Kona wrote:
Some power-domains may be capable of relying on the HW to control the power for a device that's hooked up to it. Typically, for these kinds of configurations the consumer driver should be able to change the behavior of power domain at runtime, control the power domain in SW mode for certain configurations and handover the control to HW mode for other usecases. To allow a consumer driver to change the behaviour of the PM domain for its device, let's provide a new function, dev_pm_genpd_set_hwmode(). Moreover, let's add a corresponding optional genpd callback, ->set_hwmode_dev(), which the genpd provider should implement if it can support switching between HW controlled mode and SW controlled mode. Similarly, add the dev_pm_genpd_get_hwmode() to allow consumers to read the current mode and its corresponding optional genpd callback, ->get_hwmode_dev(), which the genpd provider can also implement to synchronize the initial HW mode state in genpd_add_device() by reading back the mode from the hardware. Signed-off-by: Ulf Hansson<ulf.hansson@xxxxxxxxxx> Signed-off-by: Abel Vesa<abel.vesa@xxxxxxxxxx> Signed-off-by: Jagadeesh Kona<quic_jkona@xxxxxxxxxxx> Reviewed-by: Dmitry Baryshkov<dmitry.baryshkov@xxxxxxxxxx> Reviewed-by: Dhruva Gole<d-gole@xxxxxx> --- drivers/pmdomain/core.c | 64 +++++++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 17 +++++++++++ 2 files changed, 81 insertions(+)
Reviewed-by: Taniya Das <quic_tdas@xxxxxxxxxxx> -- Thanks & Regards, Taniya Das.