From 9afb084055e77622d1e3faa6099c340d00f94968 Mon Sep 17 00:00:00 2001 From: seshendra Gadagottu Date: Tue, 23 Jan 2018 13:12:04 -0800 Subject: gpu: nvgpu: enable devfreq after finalize poweron Enabling gpu scaling driver after finalize poweron, will make gpu booting happen at initially set frequency(1GHz). Also doing platform specific init scale after enabling scaling driver. Bug 2049965 Bug 2039013 Bug 200377508 Change-Id: I633f8f5a25d9de18cbb3a022913b8b725ccd87e5 Signed-off-by: seshendra Gadagottu Reviewed-on: https://git-master.nvidia.com/r/1644703 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/driver_common.c | 8 +------- drivers/gpu/nvgpu/common/linux/module.c | 7 +++++++ drivers/gpu/nvgpu/common/linux/platform_gk20a.h | 3 +++ drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c | 9 +++++---- drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c | 6 ++++-- 5 files changed, 20 insertions(+), 13 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index b90574e0..948bb69f 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -27,7 +27,6 @@ #include #include -#include "scale.h" #include "gk20a/gk20a.h" #include "platform_gk20a.h" #include "module.h" @@ -226,11 +225,6 @@ int nvgpu_probe(struct gk20a *g, if (err) return err; - - /* Initialise scaling */ - if (IS_ENABLED(CONFIG_GK20A_DEVFREQ)) - gk20a_scale_init(dev); - if (platform->late_probe) { err = platform->late_probe(dev); if (err) { diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index d22455ff..b0cad0ce 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -264,6 +264,13 @@ int gk20a_pm_finalize_poweron(struct device *dev) if (err) goto done; + /* Initialise scaling: it will initialize scaling drive only once */ + if (IS_ENABLED(CONFIG_GK20A_DEVFREQ)) { + gk20a_scale_init(dev); + if (platform->initscale) + platform->initscale(dev); + } + trace_gk20a_finalize_poweron_done(dev_name(dev)); err = nvgpu_init_os_linux_ops(l); diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a.h b/drivers/gpu/nvgpu/common/linux/platform_gk20a.h index b0c089e6..60e71a74 100644 --- a/drivers/gpu/nvgpu/common/linux/platform_gk20a.h +++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a.h @@ -177,6 +177,9 @@ struct gk20a_platform { /* Called to register GPCPLL with common clk framework */ int (*clk_register)(struct gk20a *g); + /* platform specific scale init quirks */ + void (*initscale)(struct device *dev); + /* Postscale callback is called after frequency change */ void (*postscale)(struct device *dev, unsigned long freq); diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c index c40eafe4..db30fff2 100644 --- a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c @@ -1,7 +1,7 @@ /* * GK20A Tegra Platform Interface * - * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -592,6 +592,9 @@ static void gk20a_tegra_scale_init(struct device *dev) if (!profile) return; + if (profile->private_data) + return; + emc_params = nvgpu_kzalloc(platform->g, sizeof(*emc_params)); if (!emc_params) return; @@ -850,9 +853,6 @@ static int gk20a_tegra_late_probe(struct device *dev) /* Cause early VPR resize */ gk20a_tegra_secure_page_alloc(dev); - /* Initialise tegra specific scaling quirks */ - gk20a_tegra_scale_init(dev); - return 0; } @@ -958,6 +958,7 @@ struct gk20a_platform gm20b_tegra_platform = { #endif /* frequency scaling configuration */ + .initscale = gk20a_tegra_scale_init, .prescale = gk20a_tegra_prescale, #ifdef CONFIG_TEGRA_BWMGR .postscale = gm20b_tegra_postscale, diff --git a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c index 00cbe48e..36052ee3 100644 --- a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c @@ -106,6 +106,9 @@ static void gp10b_tegra_scale_init(struct device *dev) if (!profile) return; + if ((struct tegra_bwmgr_client *)profile->private_data) + return; + bwmgr_handle = tegra_bwmgr_register(TEGRA_BWMGR_CLIENT_GPU); if (!bwmgr_handle) return; @@ -157,8 +160,6 @@ static int gp10b_tegra_late_probe(struct device *dev) /* Cause early VPR resize */ gk20a_tegra_secure_page_alloc(dev); - /* Initialise tegra specific scaling quirks */ - gp10b_tegra_scale_init(dev); return 0; } @@ -405,6 +406,7 @@ struct gk20a_platform gp10b_tegra_platform = { .get_clk_freqs = gp10b_clk_get_freqs, /* frequency scaling configuration */ + .initscale = gp10b_tegra_scale_init, .prescale = gp10b_tegra_prescale, .postscale = gp10b_tegra_postscale, .devfreq_governor = "nvhost_podgov", -- cgit v1.2.2