diff --git a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c index 43bdc8654..0cb3dfd7e 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c @@ -20,6 +20,7 @@ #include #include #include +#include #ifdef CONFIG_TEGRA_BWMGR #include #endif @@ -28,8 +29,6 @@ #include #ifdef CONFIG_NV_TEGRA_BPMP -#include -#include #include #endif /* CONFIG_NV_TEGRA_BPMP */ @@ -261,12 +260,14 @@ static int gp10b_tegra_remove(struct device *dev) static bool gp10b_tegra_is_railgated(struct device *dev) { + struct gk20a *g = get_gk20a(dev); bool ret = false; -#ifdef TEGRA186_POWER_DOMAIN_GPU - if (tegra_bpmp_running()) - ret = !tegra_powergate_is_powered(TEGRA186_POWER_DOMAIN_GPU); -#endif + if (pm_runtime_status_suspended(dev)) { + ret = true; + } + + nvgpu_log(g, gpu_dbg_info, "railgated? %s", ret ? "yes" : "no"); return ret; } @@ -305,17 +306,10 @@ static int gp10b_tegra_railgate(struct device *dev) tegra_bwmgr_set_emc( (struct tegra_bwmgr_client *)profile->private_data, 0, TEGRA_BWMGR_SET_EMC_FLOOR); -#endif +#endif /* CONFIG_TEGRA_BWMGR */ -#ifdef TEGRA186_POWER_DOMAIN_GPU - if (tegra_bpmp_running() && - tegra_powergate_is_powered(TEGRA186_POWER_DOMAIN_GPU)) { - gp10b_tegra_clks_control(dev, false); - tegra_powergate_partition(TEGRA186_POWER_DOMAIN_GPU); - } -#else gp10b_tegra_clks_control(dev, false); -#endif + return 0; } @@ -327,14 +321,7 @@ static int gp10b_tegra_unrailgate(struct device *dev) struct gk20a_scale_profile *profile = platform->g->scale_profile; #endif -#ifdef TEGRA186_POWER_DOMAIN_GPU - if (tegra_bpmp_running()) { - ret = tegra_unpowergate_partition(TEGRA186_POWER_DOMAIN_GPU); - gp10b_tegra_clks_control(dev, true); - } -#else gp10b_tegra_clks_control(dev, true); -#endif #ifdef CONFIG_TEGRA_BWMGR /* to start with set emc frequency floor to max rate*/ diff --git a/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c index 60fe84531..4d5658a7f 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef CONFIG_TEGRA_BWMGR #include #endif @@ -32,11 +33,6 @@ #include -#ifdef CONFIG_NV_TEGRA_BPMP -#include -#include -#endif /* CONFIG_NV_TEGRA_BPMP */ - #include "platform_gk20a.h" #include "clk.h" #include "scale.h" @@ -150,19 +146,15 @@ static int gv11b_tegra_remove(struct device *dev) static bool gv11b_tegra_is_railgated(struct device *dev) { - bool ret = false; -#ifdef TEGRA194_POWER_DOMAIN_GPU struct gk20a *g = get_gk20a(dev); + bool ret = false; - if (tegra_bpmp_running()) { - nvgpu_log(g, gpu_dbg_info, "bpmp running"); - ret = !tegra_powergate_is_powered(TEGRA194_POWER_DOMAIN_GPU); - - nvgpu_log(g, gpu_dbg_info, "railgated? %s", ret ? "yes" : "no"); - } else { - nvgpu_log(g, gpu_dbg_info, "bpmp not running"); + if (pm_runtime_status_suspended(dev)) { + ret = true; } -#endif + + nvgpu_log(g, gpu_dbg_info, "railgated? %s", ret ? "yes" : "no"); + return ret; } @@ -181,24 +173,10 @@ static int gv11b_tegra_railgate(struct device *dev) tegra_bwmgr_set_emc( (struct tegra_bwmgr_client *)profile->private_data, 0, TEGRA_BWMGR_SET_EMC_FLOOR); -#endif +#endif /* CONFIG_TEGRA_BWMGR */ -#ifdef TEGRA194_POWER_DOMAIN_GPU - if (tegra_bpmp_running()) { - nvgpu_log(g, gpu_dbg_info, "bpmp running"); - if (!tegra_powergate_is_powered(TEGRA194_POWER_DOMAIN_GPU)) { - nvgpu_log(g, gpu_dbg_info, "powergate is not powered"); - return 0; - } - gp10b_tegra_clks_control(dev, false); - nvgpu_log(g, gpu_dbg_info, "powergate_partition"); - tegra_powergate_partition(TEGRA194_POWER_DOMAIN_GPU); - } else { - nvgpu_log(g, gpu_dbg_info, "bpmp not running"); - } -#else gp10b_tegra_clks_control(dev, false); -#endif + return 0; } @@ -209,24 +187,8 @@ static int gv11b_tegra_unrailgate(struct device *dev) struct gk20a_platform *platform = gk20a_get_platform(dev); struct gk20a_scale_profile *profile = platform->g->scale_profile; #endif -#ifdef TEGRA194_POWER_DOMAIN_GPU - struct gk20a *g = get_gk20a(dev); - if (tegra_bpmp_running()) { - nvgpu_log(g, gpu_dbg_info, "bpmp running"); - ret = tegra_unpowergate_partition(TEGRA194_POWER_DOMAIN_GPU); - if (ret) { - nvgpu_log(g, gpu_dbg_info, - "unpowergate partition failed"); - return ret; - } - gp10b_tegra_clks_control(dev, true); - } else { - nvgpu_log(g, gpu_dbg_info, "bpmp not running"); - } -#else gp10b_tegra_clks_control(dev, true); -#endif #ifdef CONFIG_TEGRA_BWMGR /* to start with set emc frequency floor to max rate*/