From 5a585e470356af7ab39cbf05274dd9bce9f2f85e Mon Sep 17 00:00:00 2001 From: Mike Tipton Date: Tue, 27 Oct 2020 14:54:40 -0700 Subject: [PATCH] clk: qcom: lahaina: Fix providers left active in suspend The PM framework prevents runtime_suspend() callbacks after device_prepare() is called by calling pm_runtime_get_noresume(), which increments the usage_count. If consumers don't disable their clocks until after device_prepare(), then the clock provider will remain active since usage_count=1. This results in regulator votes persisting after suspend, which blocks system low power modes. Register for the standard pm_runtime_force_suspend() and pm_runtime_force_resume() callbacks, which force the device into suspend even if usage_count=1. Register them in suspend_late, since consumer clock votes will be removed earlier in suspend. Change-Id: I73d46bdcc1664239001b7a38ed4aeadba75e57a7 Signed-off-by: Mike Tipton --- drivers/clk/qcom/camcc-lahaina.c | 2 ++ drivers/clk/qcom/dispcc-lahaina.c | 2 ++ drivers/clk/qcom/videocc-lahaina.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/clk/qcom/camcc-lahaina.c b/drivers/clk/qcom/camcc-lahaina.c index 74bfce7e3ebd..ca0de08ef0c0 100644 --- a/drivers/clk/qcom/camcc-lahaina.c +++ b/drivers/clk/qcom/camcc-lahaina.c @@ -3049,6 +3049,8 @@ static void cam_cc_lahaina_sync_state(struct device *dev) static const struct dev_pm_ops cam_cc_lahaina_pm_ops = { SET_RUNTIME_PM_OPS(qcom_cc_runtime_suspend, qcom_cc_runtime_resume, NULL) + SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static struct platform_driver cam_cc_lahaina_driver = { diff --git a/drivers/clk/qcom/dispcc-lahaina.c b/drivers/clk/qcom/dispcc-lahaina.c index 94a412c531fc..daf720731d16 100644 --- a/drivers/clk/qcom/dispcc-lahaina.c +++ b/drivers/clk/qcom/dispcc-lahaina.c @@ -1567,6 +1567,8 @@ static void disp_cc_lahaina_sync_state(struct device *dev) static const struct dev_pm_ops disp_cc_lahaina_pm_ops = { SET_RUNTIME_PM_OPS(qcom_cc_runtime_suspend, qcom_cc_runtime_resume, NULL) + SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static struct platform_driver disp_cc_lahaina_driver = { diff --git a/drivers/clk/qcom/videocc-lahaina.c b/drivers/clk/qcom/videocc-lahaina.c index b4985b3d4367..1c79a7b4666d 100644 --- a/drivers/clk/qcom/videocc-lahaina.c +++ b/drivers/clk/qcom/videocc-lahaina.c @@ -579,6 +579,8 @@ static void video_cc_lahaina_sync_state(struct device *dev) static const struct dev_pm_ops video_cc_lahaina_pm_ops = { SET_RUNTIME_PM_OPS(qcom_cc_runtime_suspend, qcom_cc_runtime_resume, NULL) + SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static struct platform_driver video_cc_lahaina_driver = {