gpu: nvgpu: Call ELPG enable/disable on condition
Mahantesh Kumbar [Wed, 9 Mar 2016 07:13:55 +0000 (12:13 +0530)]
Call ELPG enable/disable if ELPG support enabled else ignore

Bug 200156347
Bug 1716764

Change-Id: I0bf4bacb23c087600b0632f806b12e94ebe090a5
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1027030
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Tested-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>

drivers/gpu/nvgpu/gk20a/gr_gk20a.h

index cb63332..9bacb71 100644 (file)
@@ -434,14 +434,15 @@ bool gk20a_gr_sm_debugger_attached(struct gk20a *g);
 #define gr_gk20a_elpg_protected_call(g, func) \
        ({ \
                int err = 0; \
-               if (support_gk20a_pmu(g->dev)) \
+               if (support_gk20a_pmu(g->dev) && g->elpg_enabled) { \
                        err = gk20a_pmu_disable_elpg(g); \
-               if (err) { \
-                       gk20a_pmu_enable_elpg(g); \
-                       return err; \
+                       if (err) { \
+                               gk20a_pmu_enable_elpg(g); \
+                               return err; \
+                       } \
                } \
                err = func; \
-               if (support_gk20a_pmu(g->dev)) \
+               if (support_gk20a_pmu(g->dev) && g->elpg_enabled) \
                        gk20a_pmu_enable_elpg(g); \
                err; \
        })