mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 18:16:01 +03:00
gpu: nvgpu: Add LDIV slowdown factor in INIT cmd.
PMU ucode is updated to include LDIV slowdown factor in gr_init_param command. - Defined a new version gr_init_param_v2. - Updated the PMU FW version code. - Set the LDIV slowdown factor to 0x1e by default. - Added sysfs entry to program ldiv_slowdown factor at runtime. Bug 200391931 Change-Id: Ic66049588c3b20e934faff3f29283f66c30303e4 Signed-off-by: Deepak Goyal <dgoyal@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1674208 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
a1a8ceca0c
commit
f9e55fbaf6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2011-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,
|
||||
@@ -504,6 +504,58 @@ static ssize_t elpg_enable_read(struct device *dev,
|
||||
|
||||
static DEVICE_ATTR(elpg_enable, ROOTRW, elpg_enable_read, elpg_enable_store);
|
||||
|
||||
static ssize_t ldiv_slowdown_factor_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
unsigned long val = 0;
|
||||
int err;
|
||||
|
||||
if (kstrtoul(buf, 10, &val) < 0) {
|
||||
nvgpu_err(g, "parse error for input SLOWDOWN factor\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (val >= SLOWDOWN_FACTOR_FPDIV_BYMAX) {
|
||||
nvgpu_err(g, "Invalid SLOWDOWN factor\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (val == g->ldiv_slowdown_factor)
|
||||
return count;
|
||||
|
||||
if (!g->power_on) {
|
||||
g->ldiv_slowdown_factor = val;
|
||||
} else {
|
||||
err = gk20a_busy(g);
|
||||
if (err)
|
||||
return -EAGAIN;
|
||||
|
||||
g->ldiv_slowdown_factor = val;
|
||||
|
||||
if (g->ops.pmu.pmu_pg_init_param)
|
||||
g->ops.pmu.pmu_pg_init_param(g,
|
||||
PMU_PG_ELPG_ENGINE_ID_GRAPHICS);
|
||||
|
||||
gk20a_idle(g);
|
||||
}
|
||||
|
||||
nvgpu_info(g, "ldiv_slowdown_factor is %x\n", g->ldiv_slowdown_factor);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t ldiv_slowdown_factor_read(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", g->ldiv_slowdown_factor);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(ldiv_slowdown_factor, ROOTRW,
|
||||
ldiv_slowdown_factor_read, ldiv_slowdown_factor_store);
|
||||
|
||||
static ssize_t mscg_enable_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
@@ -1114,6 +1166,7 @@ int nvgpu_create_sysfs(struct device *dev)
|
||||
error |= device_create_file(dev, &dev_attr_elpg_enable);
|
||||
error |= device_create_file(dev, &dev_attr_mscg_enable);
|
||||
error |= device_create_file(dev, &dev_attr_emc3d_ratio);
|
||||
error |= device_create_file(dev, &dev_attr_ldiv_slowdown_factor);
|
||||
#ifdef CONFIG_TEGRA_DVFS
|
||||
error |= device_create_file(dev, &dev_attr_fmax_at_vmin_safe);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user