summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-04-14 18:12:57 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-14 03:05:12 -0400
commit7acc993cdbcc202854f188e7f53646f387573a09 (patch)
tree61d213424ed8985973fa7ee3e4580c7b1b95bd3b /drivers/gpu/nvgpu/common
parentab22d66386e3a23e0dfe897bca25e01623f6d61c (diff)
gpu: nvgpu: Move can_railgate & railgate_delay to gk20a
Copy can_railgate and railgate_delay to struct gk20a at probe time, and access them from gk20a instead of platform_gk20a. JIRA NVGPU-16 Change-Id: I63d4f4aff7eb17a167775fd7982a1b548bbca3a5 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1463543 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/driver_common.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c21
-rw-r--r--drivers/gpu/nvgpu/common/linux/pci.c24
3 files changed, 24 insertions, 23 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c
index 7d6acf91..c2f31afc 100644
--- a/drivers/gpu/nvgpu/common/linux/driver_common.c
+++ b/drivers/gpu/nvgpu/common/linux/driver_common.c
@@ -113,6 +113,8 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
113 g->has_syncpoints = platform->has_syncpoints; 113 g->has_syncpoints = platform->has_syncpoints;
114 g->ptimer_src_freq = platform->ptimer_src_freq; 114 g->ptimer_src_freq = platform->ptimer_src_freq;
115 g->support_pmu = support_gk20a_pmu(g->dev); 115 g->support_pmu = support_gk20a_pmu(g->dev);
116 g->can_railgate = platform->can_railgate_init;
117 g->railgate_delay = platform->railgate_delay_init;
116 118
117 /* set default values to aelpg parameters */ 119 /* set default values to aelpg parameters */
118 g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US; 120 g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US;
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index ebc25a26..708190f2 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -312,7 +312,7 @@ int __gk20a_do_idle(struct device *dev, bool force_reset)
312 * If User disables rail gating, we take one more 312 * If User disables rail gating, we take one more
313 * extra refcount 313 * extra refcount
314 */ 314 */
315 if (platform->user_railgate_disabled) 315 if (g->user_railgate_disabled)
316 target_ref_cnt = 2; 316 target_ref_cnt = 2;
317 else 317 else
318 target_ref_cnt = 1; 318 target_ref_cnt = 1;
@@ -339,7 +339,7 @@ int __gk20a_do_idle(struct device *dev, bool force_reset)
339 nvgpu_timeout_init(g, &timeout, GK20A_WAIT_FOR_IDLE_MS, 339 nvgpu_timeout_init(g, &timeout, GK20A_WAIT_FOR_IDLE_MS,
340 NVGPU_TIMER_CPU_TIMER); 340 NVGPU_TIMER_CPU_TIMER);
341 341
342 if (platform->can_railgate && !force_reset) { 342 if (g->can_railgate && !force_reset) {
343 /* 343 /*
344 * Case 1 : GPU railgate is supported 344 * Case 1 : GPU railgate is supported
345 * 345 *
@@ -349,7 +349,7 @@ int __gk20a_do_idle(struct device *dev, bool force_reset)
349 pm_runtime_put_sync(dev); 349 pm_runtime_put_sync(dev);
350 350
351 /* add sufficient delay to allow GPU to rail gate */ 351 /* add sufficient delay to allow GPU to rail gate */
352 nvgpu_msleep(platform->railgate_delay); 352 nvgpu_msleep(g->railgate_delay);
353 353
354 /* check in loop if GPU is railgated or not */ 354 /* check in loop if GPU is railgated or not */
355 do { 355 do {
@@ -757,7 +757,7 @@ static int gk20a_pm_suspend(struct device *dev)
757 struct gk20a *g = get_gk20a(dev); 757 struct gk20a *g = get_gk20a(dev);
758 int ret = 0; 758 int ret = 0;
759 759
760 if (platform->user_railgate_disabled) 760 if (g->user_railgate_disabled)
761 gk20a_idle_nosuspend(dev); 761 gk20a_idle_nosuspend(dev);
762 762
763 if (atomic_read(&dev->power.usage_count) > 1) { 763 if (atomic_read(&dev->power.usage_count) > 1) {
@@ -780,7 +780,7 @@ static int gk20a_pm_suspend(struct device *dev)
780 return 0; 780 return 0;
781 781
782fail: 782fail:
783 if (platform->user_railgate_disabled) 783 if (g->user_railgate_disabled)
784 gk20a_busy_noresume(dev); 784 gk20a_busy_noresume(dev);
785 785
786 return ret; 786 return ret;
@@ -789,10 +789,9 @@ fail:
789static int gk20a_pm_resume(struct device *dev) 789static int gk20a_pm_resume(struct device *dev)
790{ 790{
791 struct gk20a *g = get_gk20a(dev); 791 struct gk20a *g = get_gk20a(dev);
792 struct gk20a_platform *platform = dev_get_drvdata(dev);
793 int ret = 0; 792 int ret = 0;
794 793
795 if (platform->user_railgate_disabled) 794 if (g->user_railgate_disabled)
796 gk20a_busy_noresume(dev); 795 gk20a_busy_noresume(dev);
797 796
798 if (!g->suspended) 797 if (!g->suspended)
@@ -815,19 +814,19 @@ static const struct dev_pm_ops gk20a_pm_ops = {
815 814
816int gk20a_pm_init(struct device *dev) 815int gk20a_pm_init(struct device *dev)
817{ 816{
818 struct gk20a_platform *platform = dev_get_drvdata(dev); 817 struct gk20a *g = get_gk20a(dev);
819 int err = 0; 818 int err = 0;
820 819
821 gk20a_dbg_fn(""); 820 gk20a_dbg_fn("");
822 821
823 /* Initialise pm runtime */ 822 /* Initialise pm runtime */
824 if (platform->railgate_delay) { 823 if (g->railgate_delay) {
825 pm_runtime_set_autosuspend_delay(dev, 824 pm_runtime_set_autosuspend_delay(dev,
826 platform->railgate_delay); 825 g->railgate_delay);
827 pm_runtime_use_autosuspend(dev); 826 pm_runtime_use_autosuspend(dev);
828 } 827 }
829 828
830 if (platform->can_railgate) { 829 if (g->can_railgate) {
831 pm_runtime_enable(dev); 830 pm_runtime_enable(dev);
832 if (!pm_runtime_enabled(dev)) 831 if (!pm_runtime_enabled(dev))
833 gk20a_pm_unrailgate(dev); 832 gk20a_pm_unrailgate(dev);
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c
index b4e6cb7c..a603135f 100644
--- a/drivers/gpu/nvgpu/common/linux/pci.c
+++ b/drivers/gpu/nvgpu/common/linux/pci.c
@@ -64,8 +64,8 @@ static struct gk20a_platform nvgpu_pci_device[] = {
64 .remove = nvgpu_pci_tegra_remove, 64 .remove = nvgpu_pci_tegra_remove,
65 65
66 /* power management configuration */ 66 /* power management configuration */
67 .railgate_delay = 500, 67 .railgate_delay_init = 500,
68 .can_railgate = false, 68 .can_railgate_init = false,
69 .can_elpg = true, 69 .can_elpg = true,
70 .enable_elpg = true, 70 .enable_elpg = true,
71 .enable_elcg = false, 71 .enable_elcg = false,
@@ -98,8 +98,8 @@ static struct gk20a_platform nvgpu_pci_device[] = {
98 .remove = nvgpu_pci_tegra_remove, 98 .remove = nvgpu_pci_tegra_remove,
99 99
100 /* power management configuration */ 100 /* power management configuration */
101 .railgate_delay = 500, 101 .railgate_delay_init = 500,
102 .can_railgate = false, 102 .can_railgate_init = false,
103 .can_elpg = true, 103 .can_elpg = true,
104 .enable_elpg = true, 104 .enable_elpg = true,
105 .enable_elcg = false, 105 .enable_elcg = false,
@@ -132,8 +132,8 @@ static struct gk20a_platform nvgpu_pci_device[] = {
132 .remove = nvgpu_pci_tegra_remove, 132 .remove = nvgpu_pci_tegra_remove,
133 133
134 /* power management configuration */ 134 /* power management configuration */
135 .railgate_delay = 500, 135 .railgate_delay_init = 500,
136 .can_railgate = false, 136 .can_railgate_init = false,
137 .can_elpg = true, 137 .can_elpg = true,
138 .enable_elpg = true, 138 .enable_elpg = true,
139 .enable_elcg = false, 139 .enable_elcg = false,
@@ -166,8 +166,8 @@ static struct gk20a_platform nvgpu_pci_device[] = {
166 .remove = nvgpu_pci_tegra_remove, 166 .remove = nvgpu_pci_tegra_remove,
167 167
168 /* power management configuration */ 168 /* power management configuration */
169 .railgate_delay = 500, 169 .railgate_delay_init = 500,
170 .can_railgate = false, 170 .can_railgate_init = false,
171 .can_elpg = true, 171 .can_elpg = true,
172 .enable_elpg = true, 172 .enable_elpg = true,
173 .enable_elcg = false, 173 .enable_elcg = false,
@@ -311,14 +311,14 @@ static const struct dev_pm_ops nvgpu_pci_pm_ops = {
311static int nvgpu_pci_pm_init(struct device *dev) 311static int nvgpu_pci_pm_init(struct device *dev)
312{ 312{
313#ifdef CONFIG_PM 313#ifdef CONFIG_PM
314 struct gk20a_platform *platform = gk20a_get_platform(dev); 314 struct gk20a *g = get_gk20a(dev);
315 315
316 if (!platform->can_railgate) { 316 if (!g->can_railgate) {
317 pm_runtime_disable(dev); 317 pm_runtime_disable(dev);
318 } else { 318 } else {
319 if (platform->railgate_delay) 319 if (g->railgate_delay)
320 pm_runtime_set_autosuspend_delay(dev, 320 pm_runtime_set_autosuspend_delay(dev,
321 platform->railgate_delay); 321 g->railgate_delay);
322 322
323 /* 323 /*
324 * Runtime PM for PCI devices is disabled by default, 324 * Runtime PM for PCI devices is disabled by default,