From 6e0de56121a47d383e1505145ab0140dcd604896 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Wed, 7 Feb 2018 17:14:22 -0800 Subject: gpu: nvgpu: gp106: fix freq scale in debugfs nodes For better precision dramdiv4 (MCLK/4) counter is used to measure MCLK frequency. But the scaling factor of 2 must be taken into account when reporting dramdiv2_rec_clk1. The issue was not affecting other counters which use scale=1. Bug 200386061 Change-Id: Ib3891f3f2dd4206ac36aa3e3290810144f4aa339 Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/1654536 (cherry picked from commit 6a68207c90feab1caee737013ab7cd5bb3863fb6) Reviewed-on: https://git-master.nvidia.com/r/1657209 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gp106/clk_gp106.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/gp106/clk_gp106.c b/drivers/gpu/nvgpu/gp106/clk_gp106.c index b8a1ba3d..2ac2ce5a 100644 --- a/drivers/gpu/nvgpu/gp106/clk_gp106.c +++ b/drivers/gpu/nvgpu/gp106/clk_gp106.c @@ -1,7 +1,7 @@ /* * GP106 Clocks * - * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -236,7 +236,8 @@ static int gp106_get_rate_show(void *data , u64 *val) { struct namemap_cfg *c = (struct namemap_cfg *) data; struct gk20a *g = c->g; - *val = c->is_counter ? gp106_get_rate_cntr(g, c) : 0 /* TODO PLL read */; + *val = c->is_counter ? (u64)c->scale * gp106_get_rate_cntr(g, c) : + 0 /* TODO PLL read */; return 0; } DEFINE_SIMPLE_ATTRIBUTE(get_rate_fops, gp106_get_rate_show, NULL, "%llu\n"); -- cgit v1.2.2