diff --git a/drivers/gpu/nvgpu/os/linux/driver_common.c b/drivers/gpu/nvgpu/os/linux/driver_common.c index 751cc4ce7..2608c1797 100644 --- a/drivers/gpu/nvgpu/os/linux/driver_common.c +++ b/drivers/gpu/nvgpu/os/linux/driver_common.c @@ -45,8 +45,16 @@ #include "sysfs.h" #include "ioctl.h" #include "scale.h" +#include "driver_common.h" #define EMC3D_DEFAULT_RATIO 750 +#define NVGPU_BLCG_ENABLEMENT BIT(1) +#define NVGPU_ELCG_ENABLEMENT BIT(3) +#define NVGPU_ELPG_ENABLEMENT BIT(5) +#define NVGPU_FLCG_ENABLEMENT BIT(7) +#define NVGPU_SLCG_ENABLEMENT BIT(9) +#define NVGPU_AELPG_ENABLEMENT BIT(11) +#define NVGPU_MSCG_ENABLEMENT BIT(13) void nvgpu_kernel_restart(void *cmd) { @@ -225,6 +233,35 @@ static void nvgpu_init_pm_vars(struct gk20a *g) struct device *dev = dev_from_gk20a(g); struct gk20a_platform *platform = dev_get_drvdata(dev); + /* Consider the power setting from module parameter */ + platform->enable_blcg = nvgpu_lpwr_enable & NVGPU_BLCG_ENABLEMENT ? + nvgpu_lpwr_enable & (NVGPU_BLCG_ENABLEMENT >> 1) : + platform->enable_blcg; + + platform->enable_elcg = nvgpu_lpwr_enable & NVGPU_ELCG_ENABLEMENT ? + nvgpu_lpwr_enable & (NVGPU_ELCG_ENABLEMENT >> 1) : + platform->enable_elcg; + + platform->enable_elpg = nvgpu_lpwr_enable & NVGPU_ELPG_ENABLEMENT ? + nvgpu_lpwr_enable & (NVGPU_ELPG_ENABLEMENT >> 1) : + platform->enable_elpg; + + platform->enable_flcg = nvgpu_lpwr_enable & NVGPU_FLCG_ENABLEMENT ? + nvgpu_lpwr_enable & (NVGPU_FLCG_ENABLEMENT >> 1) : + platform->enable_flcg; + + platform->enable_slcg = nvgpu_lpwr_enable & NVGPU_SLCG_ENABLEMENT ? + nvgpu_lpwr_enable & (NVGPU_SLCG_ENABLEMENT >> 1) : + platform->enable_slcg; + + platform->enable_aelpg = nvgpu_lpwr_enable & NVGPU_AELPG_ENABLEMENT ? + nvgpu_lpwr_enable & (NVGPU_AELPG_ENABLEMENT >> 1) : + platform->enable_aelpg; + + platform->enable_mscg = nvgpu_lpwr_enable & NVGPU_MSCG_ENABLEMENT ? + nvgpu_lpwr_enable & (NVGPU_MSCG_ENABLEMENT >> 1) : + platform->enable_mscg; + /* * Set up initial power settings. For non-slicon platforms, disable * power features and for silicon platforms, read from platform data diff --git a/drivers/gpu/nvgpu/os/linux/driver_common.h b/drivers/gpu/nvgpu/os/linux/driver_common.h index caf1f1ad8..c84b53305 100644 --- a/drivers/gpu/nvgpu/os/linux/driver_common.h +++ b/drivers/gpu/nvgpu/os/linux/driver_common.h @@ -17,6 +17,8 @@ #ifndef NVGPU_LINUX_DRIVER_COMMON #define NVGPU_LINUX_DRIVER_COMMON +extern int nvgpu_lpwr_enable; + struct gk20a; int nvgpu_probe(struct gk20a *g, diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index 58deeaade..c5c110fa1 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c @@ -115,6 +115,14 @@ #define CREATE_TRACE_POINTS #include +int nvgpu_lpwr_enable; +module_param_named(lpwr_enable, nvgpu_lpwr_enable, int, 0400); +MODULE_PARM_DESC(lpwr_enable, + "Enable/Disable nvgpu low power features with module parameter.\n" + "Each feature corresponds to two bits.\n" + "Odd bit indicates triggering the configuraion or not,\n" + "even bit indicates enabling/disabling a lpwr feature."); + static int nvgpu_wait_for_idle(struct gk20a *g) { int wait_length = 150; /* 3 second overall max wait. */