diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 7b0db89e..dd27ef64 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -1155,26 +1155,23 @@ static int gk20a_pm_disable_clk(struct device *dev) | |||
1155 | 1155 | ||
1156 | static void gk20a_pm_shutdown(struct platform_device *pdev) | 1156 | static void gk20a_pm_shutdown(struct platform_device *pdev) |
1157 | { | 1157 | { |
1158 | struct gk20a_platform *platform = platform_get_drvdata(pdev); | ||
1159 | |||
1160 | dev_info(&pdev->dev, "shutting down"); | ||
1161 | |||
1162 | /* If GPU is already railgated, | ||
1163 | * just prevent more requests, and return */ | ||
1164 | if (platform->is_railgated && platform->is_railgated(&pdev->dev)) { | ||
1158 | #ifdef CONFIG_PM | 1165 | #ifdef CONFIG_PM |
1159 | unsigned long timeout = jiffies + | 1166 | __pm_runtime_disable(&pdev->dev, false); |
1160 | msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS); | ||
1161 | int ref_cnt; | ||
1162 | #endif | 1167 | #endif |
1168 | return; | ||
1169 | } | ||
1163 | 1170 | ||
1164 | dev_info(&pdev->dev, "shutting down"); | ||
1165 | 1171 | ||
1166 | #ifdef CONFIG_PM | 1172 | #ifdef CONFIG_PM |
1167 | /* Prevent more requests by disabling Runtime PM */ | 1173 | /* Prevent more requests by disabling Runtime PM */ |
1168 | __pm_runtime_disable(&pdev->dev, false); | 1174 | __pm_runtime_disable(&pdev->dev, false); |
1169 | |||
1170 | /* Wait until current running requests are finished */ | ||
1171 | while (time_before(jiffies, timeout)) { | ||
1172 | ref_cnt = atomic_read(&pdev->dev.power.usage_count); | ||
1173 | if (ref_cnt > 1) | ||
1174 | msleep(1); | ||
1175 | else | ||
1176 | break; | ||
1177 | } | ||
1178 | #endif | 1175 | #endif |
1179 | 1176 | ||
1180 | /* Be ready for rail-gate after this point */ | 1177 | /* Be ready for rail-gate after this point */ |
@@ -1182,6 +1179,8 @@ static void gk20a_pm_shutdown(struct platform_device *pdev) | |||
1182 | vgpu_pm_prepare_poweroff(&pdev->dev); | 1179 | vgpu_pm_prepare_poweroff(&pdev->dev); |
1183 | else | 1180 | else |
1184 | gk20a_pm_prepare_poweroff(&pdev->dev); | 1181 | gk20a_pm_prepare_poweroff(&pdev->dev); |
1182 | |||
1183 | dev_info(&pdev->dev, "shut down complete\n"); | ||
1185 | } | 1184 | } |
1186 | 1185 | ||
1187 | #ifdef CONFIG_PM | 1186 | #ifdef CONFIG_PM |