From 849c5317e8509b390da626bcb607e66cc5ef847f Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Fri, 21 Oct 2016 16:43:39 -0700 Subject: gpu: nvgpu: get voltage, current, power and temperature Add ioctls to retrieve voltage, current, power and temperature. Add flags in GPU characteristics to indicate if feature is supported. Jira DNVGPU-166 Change-Id: Ifaafe2efdb6b09d7b28215b641814f28e894151e Signed-off-by: David Martinez Nieto Reviewed-on: http://git-master/r/1241861 Tested-by: Thomas Fleury GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: Vijayakumar Subbu Reviewed-on: http://git-master/r/1267122 --- drivers/gpu/nvgpu/gp106/hal_gp106.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gp106/hal_gp106.c') diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index dc27cdae..ee361953 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c @@ -187,6 +187,24 @@ static int gp106_get_litter_value(struct gk20a *g, int value) return ret; } +int gp106_init_gpu_characteristics(struct gk20a *g) +{ + struct nvgpu_gpu_characteristics *gpu = &g->gpu_characteristics; + + int err; + + err = gk20a_init_gpu_characteristics(g); + if (err) + return err; + + gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_GET_VOLTAGE | + NVGPU_GPU_FLAGS_SUPPORT_GET_CURRENT | + NVGPU_GPU_FLAGS_SUPPORT_GET_POWER | + NVGPU_GPU_FLAGS_SUPPORT_GET_TEMPERATURE; + + return 0; +} + int gp106_init_hal(struct gk20a *g) { struct gpu_ops *gops = &g->ops; @@ -224,7 +242,7 @@ int gp106_init_hal(struct gk20a *g) gops->name = "gp10x"; gops->get_litter_value = gp106_get_litter_value; - gops->chip_init_gpu_characteristics = gk20a_init_gpu_characteristics; + gops->chip_init_gpu_characteristics = gp106_init_gpu_characteristics; gops->gr_ctx.use_dma_for_fw_bootstrap = true; gops->read_ptimer = gk20a_read_ptimer; -- cgit v1.2.2