From patchwork Mon Jun 30 16:56:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soren Brinkmann X-Patchwork-Id: 4453391 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3C4D0BEEAA for ; Mon, 30 Jun 2014 16:59:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 693BD20373 for ; Mon, 30 Jun 2014 16:59:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C17C20211 for ; Mon, 30 Jun 2014 16:59:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1eu3-0003k2-Bo; Mon, 30 Jun 2014 16:58:03 +0000 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1etJ-0002nS-56 for linux-arm-kernel@lists.infradead.org; Mon, 30 Jun 2014 16:57:18 +0000 Received: by mail-pd0-f175.google.com with SMTP id v10so8526318pde.20 for ; Mon, 30 Jun 2014 09:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=jIO29o2LDwjp6XUm8NsCMrsjT+A/Y4p2sYeDVG0aRes=; b=hM82ws13TUSAfzOkPBixL1k4PUJbjq5mUO9zFPJdf08+gMm41PI9kZxmMB6XIWgYxZ NzE2f1zAOol+77B0FkIa9/9J5OQo/WanDqURkzt7Qh2hF+FxiDoiHqy9nct16OnM/r+l CK1ueOq+sypnxx7IKhsbLu3qH3jXiLI47TthZTu8NeO6srMf1XHx05hpba7DJlC9TNU3 tZlIS2fr/qbiQL9CdNK2Xm/lw8of9RzgMqtB/Hg4g3ENExHyPYW+SK+IOpcbV3nJ/QrH iX8cQtMUC8QojsPNi2b193AsIIcQ5t2TNATWBuGWXmaWDPj1RdBcJpgtPbhb4fM9NqJp LL5A== X-Received: by 10.66.102.102 with SMTP id fn6mr54799953pab.6.1404147415711; Mon, 30 Jun 2014 09:56:55 -0700 (PDT) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id gg4sm28682854pbb.12.2014.06.30.09.56.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 30 Jun 2014 09:56:54 -0700 (PDT) From: Soren Brinkmann To: Mike Turquette , "Rafael J. Wysocki" , Viresh Kumar Subject: [PATCH 2/4] cpufreq: cpu0: Use clk_find_nearest_rate() Date: Mon, 30 Jun 2014 09:56:34 -0700 Message-Id: <1404147396-8041-3-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.0.1.1.gfbfc394 In-Reply-To: <1404147396-8041-1-git-send-email-soren.brinkmann@xilinx.com> References: <1404147396-8041-1-git-send-email-soren.brinkmann@xilinx.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140630_095717_251088_251AA839 X-CRM114-Status: GOOD ( 11.31 ) X-Spam-Score: -0.7 (/) Cc: Russell King , linux-pm@vger.kernel.org, Nicolas Ferre , Michal Simek , cpufreq@vger.kernel.org, linux-kernel@vger.kernel.org, Soren Brinkmann , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Round clock frequencies to the nearest possible frequency. Since the OPPs as specified in DT and the CCF use different a resolution for clock frequencies, the clk_round_rate() API may return unexpected results, due to not mandating how rounding has to happen. The clk_find_nearest_rate() API mitigates such issues and finds the appropriate frequency for an OPP. Signed-off-by: Soren Brinkmann --- drivers/cpufreq/cpufreq-cpu0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index ee1ae303a07c..1650581f85b6 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -42,7 +42,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index) long freq_Hz, freq_exact; int ret; - freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000); + freq_Hz = clk_find_nearest_rate(cpu_clk, + freq_table[index].frequency * 1000); if (freq_Hz <= 0) freq_Hz = freq_table[index].frequency * 1000;