From d0e3e668854d992f615406e461173a3cee114294 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 12 Jan 2017 21:38:10 +0530 Subject: gpu: nvgpu: compare rounded freq to last value We right now compare requested value to the last freq value. Last freq value is always a rounded value, whereas requested value need not be a rounded value Hence it is incorrect to compare requested value to last freq value Fix this by comparing rounded value to last_freq Change-Id: I7c6ea7c4e57105598c9af75efe70016b7fa8038b Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1287360 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gk20a_scale.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c index 36a47e24..edf92de6 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c @@ -1,7 +1,7 @@ /* * gk20a clock scaling profile * - * Copyright (c) 2013-2016, NVIDIA Corporation. All rights reserved. + * Copyright (c) 2013-2017, 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, @@ -181,13 +181,13 @@ static int gk20a_scale_target(struct device *dev, unsigned long *freq, if (local_freq > max_freq) local_freq = max_freq; - /* Check for duplicate request */ - if (local_freq == g->last_freq) - return 0; - /* set the final frequency */ rounded_rate = platform->clk_round_rate(dev, local_freq); + /* Check for duplicate request */ + if (rounded_rate == g->last_freq) + return 0; + if (platform->clk_get_rate(dev) == rounded_rate) *freq = rounded_rate; else { -- cgit v1.2.2