From 7acc993cdbcc202854f188e7f53646f387573a09 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 14 Apr 2017 15:12:57 -0700 Subject: 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 Reviewed-on: http://git-master/r/1463543 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/driver_common.c | 2 ++ drivers/gpu/nvgpu/common/linux/module.c | 21 ++++++++++----------- drivers/gpu/nvgpu/common/linux/pci.c | 24 ++++++++++++------------ 3 files changed, 24 insertions(+), 23 deletions(-) (limited to 'drivers/gpu/nvgpu/common') 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) g->has_syncpoints = platform->has_syncpoints; g->ptimer_src_freq = platform->ptimer_src_freq; g->support_pmu = support_gk20a_pmu(g->dev); + g->can_railgate = platform->can_railgate_init; + g->railgate_delay = platform->railgate_delay_init; /* set default values to aelpg parameters */ 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) * If User disables rail gating, we take one more * extra refcount */ - if (platform->user_railgate_disabled) + if (g->user_railgate_disabled) target_ref_cnt = 2; else target_ref_cnt = 1; @@ -339,7 +339,7 @@ int __gk20a_do_idle(struct device *dev, bool force_reset) nvgpu_timeout_init(g, &timeout, GK20A_WAIT_FOR_IDLE_MS, NVGPU_TIMER_CPU_TIMER); - if (platform->can_railgate && !force_reset) { + if (g->can_railgate && !force_reset) { /* * Case 1 : GPU railgate is supported * @@ -349,7 +349,7 @@ int __gk20a_do_idle(struct device *dev, bool force_reset) pm_runtime_put_sync(dev); /* add sufficient delay to allow GPU to rail gate */ - nvgpu_msleep(platform->railgate_delay); + nvgpu_msleep(g->railgate_delay); /* check in loop if GPU is railgated or not */ do { @@ -757,7 +757,7 @@ static int gk20a_pm_suspend(struct device *dev) struct gk20a *g = get_gk20a(dev); int ret = 0; - if (platform->user_railgate_disabled) + if (g->user_railgate_disabled) gk20a_idle_nosuspend(dev); if (atomic_read(&dev->power.usage_count) > 1) { @@ -780,7 +780,7 @@ static int gk20a_pm_suspend(struct device *dev) return 0; fail: - if (platform->user_railgate_disabled) + if (g->user_railgate_disabled) gk20a_busy_noresume(dev); return ret; @@ -789,10 +789,9 @@ fail: static int gk20a_pm_resume(struct device *dev) { struct gk20a *g = get_gk20a(dev); - struct gk20a_platform *platform = dev_get_drvdata(dev); int ret = 0; - if (platform->user_railgate_disabled) + if (g->user_railgate_disabled) gk20a_busy_noresume(dev); if (!g->suspended) @@ -815,19 +814,19 @@ static const struct dev_pm_ops gk20a_pm_ops = { int gk20a_pm_init(struct device *dev) { - struct gk20a_platform *platform = dev_get_drvdata(dev); + struct gk20a *g = get_gk20a(dev); int err = 0; gk20a_dbg_fn(""); /* Initialise pm runtime */ - if (platform->railgate_delay) { + if (g->railgate_delay) { pm_runtime_set_autosuspend_delay(dev, - platform->railgate_delay); + g->railgate_delay); pm_runtime_use_autosuspend(dev); } - if (platform->can_railgate) { + if (g->can_railgate) { pm_runtime_enable(dev); if (!pm_runtime_enabled(dev)) 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[] = { .remove = nvgpu_pci_tegra_remove, /* power management configuration */ - .railgate_delay = 500, - .can_railgate = false, + .railgate_delay_init = 500, + .can_railgate_init = false, .can_elpg = true, .enable_elpg = true, .enable_elcg = false, @@ -98,8 +98,8 @@ static struct gk20a_platform nvgpu_pci_device[] = { .remove = nvgpu_pci_tegra_remove, /* power management configuration */ - .railgate_delay = 500, - .can_railgate = false, + .railgate_delay_init = 500, + .can_railgate_init = false, .can_elpg = true, .enable_elpg = true, .enable_elcg = false, @@ -132,8 +132,8 @@ static struct gk20a_platform nvgpu_pci_device[] = { .remove = nvgpu_pci_tegra_remove, /* power management configuration */ - .railgate_delay = 500, - .can_railgate = false, + .railgate_delay_init = 500, + .can_railgate_init = false, .can_elpg = true, .enable_elpg = true, .enable_elcg = false, @@ -166,8 +166,8 @@ static struct gk20a_platform nvgpu_pci_device[] = { .remove = nvgpu_pci_tegra_remove, /* power management configuration */ - .railgate_delay = 500, - .can_railgate = false, + .railgate_delay_init = 500, + .can_railgate_init = false, .can_elpg = true, .enable_elpg = true, .enable_elcg = false, @@ -311,14 +311,14 @@ static const struct dev_pm_ops nvgpu_pci_pm_ops = { static int nvgpu_pci_pm_init(struct device *dev) { #ifdef CONFIG_PM - struct gk20a_platform *platform = gk20a_get_platform(dev); + struct gk20a *g = get_gk20a(dev); - if (!platform->can_railgate) { + if (!g->can_railgate) { pm_runtime_disable(dev); } else { - if (platform->railgate_delay) + if (g->railgate_delay) pm_runtime_set_autosuspend_delay(dev, - platform->railgate_delay); + g->railgate_delay); /* * Runtime PM for PCI devices is disabled by default, -- cgit v1.2.2