summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index 51336c51..e7e79949 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -869,21 +869,17 @@ static int gk20a_pm_suspend(struct device *dev)
869 struct gk20a_platform *platform = dev_get_drvdata(dev); 869 struct gk20a_platform *platform = dev_get_drvdata(dev);
870 struct gk20a *g = get_gk20a(dev); 870 struct gk20a *g = get_gk20a(dev);
871 int ret = 0; 871 int ret = 0;
872 872 int idle_usage_count = g->user_railgate_disabled ? 1 : 0;
873 if (g->user_railgate_disabled)
874 gk20a_idle_nosuspend(g);
875
876 if (atomic_read(&dev->power.usage_count) > 1) {
877 ret = -EBUSY;
878 goto fail;
879 }
880 873
881 if (!g->power_on) 874 if (!g->power_on)
882 return 0; 875 return 0;
883 876
877 if (nvgpu_atomic_read(&g->usage_count) > idle_usage_count)
878 return -EBUSY;
879
884 ret = gk20a_pm_runtime_suspend(dev); 880 ret = gk20a_pm_runtime_suspend(dev);
885 if (ret) 881 if (ret)
886 goto fail; 882 return ret;
887 883
888 if (platform->suspend) 884 if (platform->suspend)
889 platform->suspend(dev); 885 platform->suspend(dev);
@@ -891,12 +887,6 @@ static int gk20a_pm_suspend(struct device *dev)
891 g->suspended = true; 887 g->suspended = true;
892 888
893 return 0; 889 return 0;
894
895fail:
896 if (g->user_railgate_disabled)
897 gk20a_busy_noresume(g);
898
899 return ret;
900} 890}
901 891
902static int gk20a_pm_resume(struct device *dev) 892static int gk20a_pm_resume(struct device *dev)
@@ -904,9 +894,6 @@ static int gk20a_pm_resume(struct device *dev)
904 struct gk20a *g = get_gk20a(dev); 894 struct gk20a *g = get_gk20a(dev);
905 int ret = 0; 895 int ret = 0;
906 896
907 if (g->user_railgate_disabled)
908 gk20a_busy_noresume(g);
909
910 if (!g->suspended) 897 if (!g->suspended)
911 return 0; 898 return 0;
912 899