From 26265b997447c8c1fddac6a904ac4b6ef2b2f3b5 Mon Sep 17 00:00:00 2001 From: David Nieto Date: Thu, 10 Nov 2016 22:50:20 -0800 Subject: gpu: nvgpu: arb: fix rounding in effective clocks Current code cast casting the frequency to 16 bit before division, giving out incorrect data JIRA DNVGPU-164 Change-Id: I4eb1fa73fb9e8963f550d3d853db39b49b990fa4 Signed-off-by: David Nieto Reviewed-on: http://git-master/r/1251663 (cherry picked from commit c0d91a054f8278af9a2383bb3f837465779132a9) Reviewed-on: http://git-master/r/1274546 Reviewed-by: Automatic_Commit_Validation_User Tested-by: Thomas Fleury Reviewed-by: Vijayakumar Subbu GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gp106/clk_gp106.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gp106/clk_gp106.c') diff --git a/drivers/gpu/nvgpu/gp106/clk_gp106.c b/drivers/gpu/nvgpu/gp106/clk_gp106.c index 0e9f8d3a..4c9bc782 100644 --- a/drivers/gpu/nvgpu/gp106/clk_gp106.c +++ b/drivers/gpu/nvgpu/gp106/clk_gp106.c @@ -67,7 +67,8 @@ static u16 gp106_clk_get_rate(struct gk20a *g, u32 api_domain) freq_khz = c->is_counter ? c->scale * gp106_get_rate_cntr(g, c) : 0; /* TODO: PLL read */ - return (u16) freq_khz/1000; + /* Convert to MHZ */ + return (u16) (freq_khz/1000); } static int gp106_init_clk_support(struct gk20a *g) { -- cgit v1.2.2