diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index d7446484..5fc57494 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -732,32 +732,60 @@ static int gk20a_pm_unrailgate(struct device *dev) | |||
732 | static void gk20a_pm_shutdown(struct platform_device *pdev) | 732 | static void gk20a_pm_shutdown(struct platform_device *pdev) |
733 | { | 733 | { |
734 | struct gk20a_platform *platform = platform_get_drvdata(pdev); | 734 | struct gk20a_platform *platform = platform_get_drvdata(pdev); |
735 | struct gk20a *g = platform->g; | ||
736 | int err; | ||
735 | 737 | ||
736 | dev_info(&pdev->dev, "shutting down"); | 738 | nvgpu_info(g, "shutting down"); |
737 | 739 | ||
738 | gk20a_driver_start_unload(platform->g); | 740 | gk20a_driver_start_unload(g); |
739 | 741 | ||
740 | /* If GPU is already railgated, | 742 | /* If GPU is already railgated, |
741 | * just prevent more requests, and return */ | 743 | * just prevent more requests, and return */ |
742 | if (platform->is_railgated && platform->is_railgated(&pdev->dev)) { | 744 | if (platform->is_railgated && platform->is_railgated(&pdev->dev)) { |
743 | __pm_runtime_disable(&pdev->dev, false); | 745 | __pm_runtime_disable(&pdev->dev, false); |
746 | nvgpu_info(g, "already railgated, shut down complete"); | ||
744 | return; | 747 | return; |
745 | } | 748 | } |
746 | 749 | ||
747 | /* Prevent more requests by disabling Runtime PM */ | 750 | /* Prevent more requests by disabling Runtime PM */ |
748 | __pm_runtime_disable(&pdev->dev, false); | 751 | __pm_runtime_disable(&pdev->dev, false); |
749 | 752 | ||
750 | gk20a_wait_for_idle(&pdev->dev); | 753 | err = gk20a_wait_for_idle(&pdev->dev); |
754 | if (err) { | ||
755 | nvgpu_err(g, "failed to idle GPU, err=%d", err); | ||
756 | goto finish; | ||
757 | } | ||
758 | |||
759 | err = gk20a_fifo_disable_all_engine_activity(g, true); | ||
760 | if (err) { | ||
761 | nvgpu_err(g, "failed to disable engine activity, err=%d", | ||
762 | err); | ||
763 | goto finish; | ||
764 | } | ||
765 | |||
766 | err = gk20a_fifo_wait_engine_idle(g); | ||
767 | if (err) { | ||
768 | nvgpu_err(g, "failed to idle engines, err=%d", | ||
769 | err); | ||
770 | goto finish; | ||
771 | } | ||
751 | 772 | ||
752 | /* Be ready for rail-gate after this point */ | ||
753 | if (gk20a_gpu_is_virtual(&pdev->dev)) | 773 | if (gk20a_gpu_is_virtual(&pdev->dev)) |
754 | vgpu_pm_prepare_poweroff(&pdev->dev); | 774 | err = vgpu_pm_prepare_poweroff(&pdev->dev); |
755 | else | 775 | else |
756 | gk20a_pm_prepare_poweroff(&pdev->dev); | 776 | err = gk20a_pm_prepare_poweroff(&pdev->dev); |
777 | if (err) { | ||
778 | nvgpu_err(g, "failed to prepare for poweroff, err=%d", | ||
779 | err); | ||
780 | goto finish; | ||
781 | } | ||
757 | 782 | ||
758 | gk20a_pm_railgate(&pdev->dev); | 783 | err = gk20a_pm_railgate(&pdev->dev); |
784 | if (err) | ||
785 | nvgpu_err(g, "failed to railgate, err=%d", err); | ||
759 | 786 | ||
760 | dev_info(&pdev->dev, "shut down complete\n"); | 787 | finish: |
788 | nvgpu_info(g, "shut down complete\n"); | ||
761 | } | 789 | } |
762 | 790 | ||
763 | #ifdef CONFIG_PM | 791 | #ifdef CONFIG_PM |