summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/tegra
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-05-23 13:21:14 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-30 16:24:35 -0400
commit66a2511a366113fa4d42dc500c9df9b348d9f208 (patch)
tree5d2367412887214d040d9ade1f1d48c93c434a46 /drivers/gpu/nvgpu/tegra
parentb817e9e207cca88698d28b6b4ab410f03d715171 (diff)
gpu: nvgpu: Begin removing variables in struct gk20a
Begin removing all of the myriad flag variables in struct gk20a and replace that with one API that checks for flags being enabled or disabled. The API is as follows: bool nvgpu_is_enabled(struct gk20a *g, int flag); bool __nvgpu_set_enabled(struct gk20a *g, int flag, bool state); These APIs allow many of the gk20a flags to be replaced by defines. This makes flag usage consistent and saves a small amount of memory in struct gk20a. Also it makes struct gk20a easier to read since there's less clutter scattered through out. JIRA NVGPU-84 Change-Id: I6525cecbe97c4e8379e5f53e29ef0b4dbd1a7fc2 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1488049 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/tegra')
-rw-r--r--drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c9
-rw-r--r--drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c3
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c
index a3b73cdf..96312a00 100644
--- a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c
@@ -47,6 +47,7 @@
47 47
48#include <nvgpu/kmem.h> 48#include <nvgpu/kmem.h>
49#include <nvgpu/bug.h> 49#include <nvgpu/bug.h>
50#include <nvgpu/enabled.h>
50 51
51#include <nvgpu/linux/dma.h> 52#include <nvgpu/linux/dma.h>
52 53
@@ -120,7 +121,7 @@ int gk20a_tegra_secure_page_alloc(struct device *dev)
120 dma_addr_t iova; 121 dma_addr_t iova;
121 size_t size = PAGE_SIZE; 122 size_t size = PAGE_SIZE;
122 123
123 if (g->is_fmodel) 124 if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL))
124 return -EINVAL; 125 return -EINVAL;
125 126
126 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, __DMA_ATTR(attrs)); 127 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, __DMA_ATTR(attrs));
@@ -401,7 +402,7 @@ static bool gk20a_tegra_is_railgated(struct device *dev)
401 struct gk20a_platform *platform = dev_get_drvdata(dev); 402 struct gk20a_platform *platform = dev_get_drvdata(dev);
402 bool ret = false; 403 bool ret = false;
403 404
404 if (!g->is_fmodel) 405 if (!nvgpu_is_enabled(g, NVGPU_IS_FMODEL))
405 ret = !tegra_dvfs_is_rail_up(platform->gpu_rail); 406 ret = !tegra_dvfs_is_rail_up(platform->gpu_rail);
406 407
407 return ret; 408 return ret;
@@ -419,7 +420,7 @@ static int gm20b_tegra_railgate(struct device *dev)
419 struct gk20a_platform *platform = dev_get_drvdata(dev); 420 struct gk20a_platform *platform = dev_get_drvdata(dev);
420 int ret = 0; 421 int ret = 0;
421 422
422 if (g->is_fmodel || 423 if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL) ||
423 !tegra_dvfs_is_rail_up(platform->gpu_rail)) 424 !tegra_dvfs_is_rail_up(platform->gpu_rail))
424 return 0; 425 return 0;
425 426
@@ -483,7 +484,7 @@ static int gm20b_tegra_unrailgate(struct device *dev)
483 int ret = 0; 484 int ret = 0;
484 bool first = false; 485 bool first = false;
485 486
486 if (g->is_fmodel) 487 if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL))
487 return 0; 488 return 0;
488 489
489 ret = tegra_dvfs_rail_power_up(platform->gpu_rail); 490 ret = tegra_dvfs_rail_power_up(platform->gpu_rail);
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
index 84175e98..971ef66a 100644
--- a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
@@ -28,6 +28,7 @@
28 28
29#include <nvgpu/kmem.h> 29#include <nvgpu/kmem.h>
30#include <nvgpu/bug.h> 30#include <nvgpu/bug.h>
31#include <nvgpu/enabled.h>
31#include <nvgpu/hashtable.h> 32#include <nvgpu/hashtable.h>
32 33
33#include "clk.h" 34#include "clk.h"
@@ -78,7 +79,7 @@ int gp10b_tegra_get_clocks(struct device *dev)
78 struct gk20a_platform *platform = dev_get_drvdata(dev); 79 struct gk20a_platform *platform = dev_get_drvdata(dev);
79 unsigned int i; 80 unsigned int i;
80 81
81 if (g->is_fmodel) 82 if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL))
82 return 0; 83 return 0;
83 84
84 platform->num_clks = 0; 85 platform->num_clks = 0;