diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 8e7fbae0..f3b5544f 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -1122,8 +1122,27 @@ static int gk20a_pm_disable_clk(struct device *dev) | |||
1122 | 1122 | ||
1123 | static void gk20a_pm_shutdown(struct platform_device *pdev) | 1123 | static void gk20a_pm_shutdown(struct platform_device *pdev) |
1124 | { | 1124 | { |
1125 | #ifdef CONFIG_PM_RUNTIME | ||
1126 | unsigned long timeout = jiffies + | ||
1127 | msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS); | ||
1128 | int ref_cnt; | ||
1129 | #endif | ||
1130 | |||
1125 | dev_info(&pdev->dev, "shutting down"); | 1131 | dev_info(&pdev->dev, "shutting down"); |
1132 | |||
1133 | #ifdef CONFIG_PM_RUNTIME | ||
1134 | /* Prevent more requests by disabling Runtime PM */ | ||
1126 | __pm_runtime_disable(&pdev->dev, false); | 1135 | __pm_runtime_disable(&pdev->dev, false); |
1136 | |||
1137 | /* Wait until current running requests are finished */ | ||
1138 | while (time_before(jiffies, timeout)) { | ||
1139 | ref_cnt = atomic_read(&pdev->dev.power.usage_count); | ||
1140 | if (ref_cnt > 1) | ||
1141 | msleep(1); | ||
1142 | else | ||
1143 | break; | ||
1144 | } | ||
1145 | #endif | ||
1127 | } | 1146 | } |
1128 | 1147 | ||
1129 | #ifdef CONFIG_PM | 1148 | #ifdef CONFIG_PM |