Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp310572imm; Fri, 21 Sep 2018 15:03:48 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaQF6dr92PMyf6+b9Hjh/R9S32IaH8/IT9xDH0agTlszKYzsRAY1ZY/Ah3mQCsU1sDDqei/ X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr45333769pla.325.1537567428478; Fri, 21 Sep 2018 15:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537567428; cv=none; d=google.com; s=arc-20160816; b=VxUkGsGO7tNHbGDGLEKbyLJIcnWYG0s2k8hOmPnh1LNLGJSM7GLgbjAnHBEQJTZAQ5 oaGZzlICGN5Dcsppsk4SJtWHSQFnbRCJM63kEcqplEzKuGctJTLC1ljA3zCS8wX5KwLg w1hgsX17COm0mIUIKKJpqSAsvyZOCgU1AeBuyjeC8pf+dP9Q/aBV10l9HmZX9e8Yn7IE 6etVQDNwqDljvq1F8wvTrKj8WcN5S0okwVG3t6ceqvxHyt+0Rllpv5g1sjhBQqu6xZVK PdxADmDwpUswf/lKiEfR54vsof4LE20RzFsP/GHOdlb6y2zr+nuuN+y7wcWD2HaDeRHV OGlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=e4d6SUz6jd2Yml7+iF79CF3Q+GxZN3hRxdA7HUKhIP4=; b=eKaGVRGYQFaJ/JN1ic0SaTk6JsIEU6TR2sov1YSBv4ZgEx7PBw5qUwA+YbFQuEfzrS T+5IQ0QAANFPjsXsTuAr/DfQT8cKwN8giBpY+fbVrGRq+kFMgp5wNKEGJsWQ/05aVsQq eMo8zCrTWvVtfU3/dW6xZsOJHHMqYBH+E1l3uxhUtw7o+D8H0rtfrEvKvolhLtKK8jCG VGfK/YpaHqZjIcaAWaeOamcMTPqYNNColZIj8Ge+zAjYHU2ptmPYinnPiunbajZmACMb /plY6R1jC1Lj8EEO6XszFFoflbFGug0gdDJj0F4pTP2yEkZkS2fUElzS9i9j/QiOq2BO NkCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="OsJ/2Ggl"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z63-v6si27986700pfi.214.2018.09.21.15.03.32; Fri, 21 Sep 2018 15:03:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="OsJ/2Ggl"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391605AbeIVDwr (ORCPT + 99 others); Fri, 21 Sep 2018 23:52:47 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:32845 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391323AbeIVDwr (ORCPT ); Fri, 21 Sep 2018 23:52:47 -0400 Received: by mail-io1-f67.google.com with SMTP id l25-v6so455156ioj.0; Fri, 21 Sep 2018 15:01:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=e4d6SUz6jd2Yml7+iF79CF3Q+GxZN3hRxdA7HUKhIP4=; b=OsJ/2Ggl+ckSFSzEKWF9T7LdkGEJLU6CpsGloK8cr1stHpIw0kryPPr5PJVuaVlmDm yfw+w1RJNTtBul51TnSnRRGLg3jF5naGrGg1oqDH6sMKeAJv1VWOce7a6BUlZ92kNGHB OeQIX7N8gyGj+OjRua3F8rD7SFqgfvdB96z9RCJP1lhUZgJEZASlrefDzfjxPWg4G+zb Xe/Ef2Dte4FeWQ5O8CY5JVIAo8mnh2yvO3UmLAZXggFW3v8jKO5GNG9r0NSq7uFsrv0C Kmjmi/PKOM+L9j8UEVPlHhdsj2IzM+NjxGnlPloetfizpoQ34FrbmpP3jouIdCbAq+NT SYtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=e4d6SUz6jd2Yml7+iF79CF3Q+GxZN3hRxdA7HUKhIP4=; b=nVOrDOArGjfDYGy3W1VKzUuIAVN6+/4pynf0VEYzv5tZZmZ6Km3ur9wm9EslvdaEaK 5J5iFmxRP+a5H1ieRBihVkP2JBCB8L/XsezWrioexJPeQb4W6UQMyiZRBqh9X0MYx5Hd jdIElaDS3eTLq6qnKTl1sbxmnbG3vfYakCfehR5ijHXTo6P5Ql9T/5/hW6ABnE+yAAYv rzhkKXeqJlkWFaj3/E1JrnMDN0ZOTW7fNt1vsRSYC7a+Sku4ThN8tfcynV5wxETQJh6z XvGsUqO7M+J+5wZ7Wq8kZgYNUoKj1gL9XJSqj9pyyvISkG3GvAFVRxsI9hLMdtRq96Fd wfSQ== X-Gm-Message-State: APzg51B+Syoq1tbBU7iu7egOGdrUQ4f/Wp9AwaKUqwwp+DcGsLJKcHDw /2fKEintF3dsay2VM+P8UzGXQ20+Jg== X-Received: by 2002:a6b:e15:: with SMTP id 21-v6mr38771075ioo.149.1537567318608; Fri, 21 Sep 2018 15:01:58 -0700 (PDT) Received: from localhost.localdomain (CPE1cabc0918a93-CM1cabc0918a90.cpe.net.cable.rogers.com. [99.229.26.117]) by smtp.gmail.com with ESMTPSA id w140-v6sm223101iof.22.2018.09.21.15.01.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 15:01:57 -0700 (PDT) From: ryang To: Peter De Schrijver Cc: Prashant Gaikwad , Michael Turquette , Stephen Boyd , Thierry Reding , Jonathan Hunter , linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, ryang Subject: [PATCH] clk: tegra: Return the exact clock rate from clk_round_rate Date: Fri, 21 Sep 2018 18:01:49 -0400 Message-Id: <20180921220149.17136-1-decatf@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current behavior is that clk_round_rate would return the same clock rate passed to it for valid PLL configurations. This change will return the exact rate the PLL will provide in accordance with clk API. Signed-off-by: ryang --- drivers/clk/tegra/clk-pll.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c index 17a058c3bbc1..36014a6ec42e 100644 --- a/drivers/clk/tegra/clk-pll.c +++ b/drivers/clk/tegra/clk-pll.c @@ -595,7 +595,12 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, return -EINVAL; } - cfg->output_rate >>= p_div; + if (cfg->m == 0) { + cfg->output_rate = 0; + } else { + cfg->output_rate = cfg->n * DIV_ROUND_UP(parent_rate, cfg->m); + cfg->output_rate >>= p_div; + } if (pll->params->pdiv_tohw) { ret = _p_div_to_hw(hw, 1 << p_div); -- 2.17.1