diff options
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/module.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index ff4d9a4c..0d4cd7f1 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c | |||
@@ -766,6 +766,10 @@ static int gk20a_pm_railgate(struct device *dev) | |||
766 | int ret = 0; | 766 | int ret = 0; |
767 | struct gk20a *g = get_gk20a(dev); | 767 | struct gk20a *g = get_gk20a(dev); |
768 | 768 | ||
769 | /* return early if platform didn't implement railgate */ | ||
770 | if (!platform->railgate) | ||
771 | return 0; | ||
772 | |||
769 | /* if platform is already railgated, then just return */ | 773 | /* if platform is already railgated, then just return */ |
770 | if (platform->is_railgated && platform->is_railgated(dev)) | 774 | if (platform->is_railgated && platform->is_railgated(dev)) |
771 | return ret; | 775 | return ret; |
@@ -780,8 +784,7 @@ static int gk20a_pm_railgate(struct device *dev) | |||
780 | g->pstats.last_rail_ungate_complete); | 784 | g->pstats.last_rail_ungate_complete); |
781 | #endif | 785 | #endif |
782 | 786 | ||
783 | if (platform->railgate) | 787 | ret = platform->railgate(dev); |
784 | ret = platform->railgate(dev); | ||
785 | if (ret) { | 788 | if (ret) { |
786 | nvgpu_err(g, "failed to railgate platform, err=%d", ret); | 789 | nvgpu_err(g, "failed to railgate platform, err=%d", ret); |
787 | return ret; | 790 | return ret; |
@@ -803,6 +806,10 @@ static int gk20a_pm_unrailgate(struct device *dev) | |||
803 | int ret = 0; | 806 | int ret = 0; |
804 | struct gk20a *g = get_gk20a(dev); | 807 | struct gk20a *g = get_gk20a(dev); |
805 | 808 | ||
809 | /* return early if platform didn't implement unrailgate */ | ||
810 | if (!platform->unrailgate) | ||
811 | return 0; | ||
812 | |||
806 | ret = tegra_fuse_clock_enable(); | 813 | ret = tegra_fuse_clock_enable(); |
807 | if (ret) { | 814 | if (ret) { |
808 | nvgpu_err(g, "failed to enable tegra fuse clock, err=%d", ret); | 815 | nvgpu_err(g, "failed to enable tegra fuse clock, err=%d", ret); |
@@ -821,11 +828,9 @@ static int gk20a_pm_unrailgate(struct device *dev) | |||
821 | 828 | ||
822 | trace_gk20a_pm_unrailgate(dev_name(dev)); | 829 | trace_gk20a_pm_unrailgate(dev_name(dev)); |
823 | 830 | ||
824 | if (platform->unrailgate) { | 831 | nvgpu_mutex_acquire(&platform->railgate_lock); |
825 | nvgpu_mutex_acquire(&platform->railgate_lock); | 832 | ret = platform->unrailgate(dev); |
826 | ret = platform->unrailgate(dev); | 833 | nvgpu_mutex_release(&platform->railgate_lock); |
827 | nvgpu_mutex_release(&platform->railgate_lock); | ||
828 | } | ||
829 | 834 | ||
830 | #ifdef CONFIG_DEBUG_FS | 835 | #ifdef CONFIG_DEBUG_FS |
831 | g->pstats.last_rail_ungate_complete = jiffies; | 836 | g->pstats.last_rail_ungate_complete = jiffies; |