mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: add gpu_powered_on sysfs
Add sysfs to indicate if GPU has ever been powered on. This allows an application to avoid booting dGPU, when there is no need for it. For instance the fan controller can check this value, and refrain from booting the GPU, only to check the temperature. This will save power, and also avoid locking some registers which currently prevent from using VBIOS update tool. Bug 200408936 Change-Id: I6344001e91e9eee8762ff8b227ca6698d8c6786f Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1802098 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
c4ac750e98
commit
034e23c197
@@ -301,6 +301,17 @@ static DEVICE_ATTR(ptimer_src_freq,
|
||||
NULL);
|
||||
|
||||
|
||||
static ssize_t gpu_powered_on_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%u\n", g->power_on);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(gpu_powered_on, S_IRUGO, gpu_powered_on_show, NULL);
|
||||
|
||||
#if defined(CONFIG_PM)
|
||||
static ssize_t railgate_enable_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
@@ -1234,6 +1245,7 @@ void nvgpu_remove_sysfs(struct device *dev)
|
||||
device_remove_file(dev, &dev_attr_pd_max_batches);
|
||||
device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_count);
|
||||
device_remove_file(dev, &dev_attr_gfxp_wfi_timeout_unit);
|
||||
device_remove_file(dev, &dev_attr_gpu_powered_on);
|
||||
|
||||
device_remove_file(dev, &dev_attr_comptag_mem_deduct);
|
||||
|
||||
@@ -1288,6 +1300,7 @@ int nvgpu_create_sysfs(struct device *dev)
|
||||
error |= device_create_file(dev, &dev_attr_pd_max_batches);
|
||||
error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_count);
|
||||
error |= device_create_file(dev, &dev_attr_gfxp_wfi_timeout_unit);
|
||||
error |= device_create_file(dev, &dev_attr_gpu_powered_on);
|
||||
|
||||
error |= device_create_file(dev, &dev_attr_comptag_mem_deduct);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user