From patchwork Thu Dec 21 16:04:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kochetkov X-Patchwork-Id: 10127949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2531E6019C for ; Thu, 21 Dec 2017 16:07:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 174B829897 for ; Thu, 21 Dec 2017 16:07:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BD9929D39; Thu, 21 Dec 2017 16:07:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BA65B29897 for ; Thu, 21 Dec 2017 16:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qP0PGuBjVxbGJM9PVTyQ8pd6OCMw2wSWqoCdPXoq0n8=; b=DNIgct4IrhmY2zHbqF4vzQKWFC 3Thn9+JHMwVMfp2vU820GSWgfR/i3xCBSpHlf2eZFik83AnX8wVP7wkA0P7tfbDKnfJ7GqFOsv964 UEkeFQvEnTKiX7OC4R9KGjz/lmHbkDOSGB5IURdi2fbi+mG4FjPCy25zrCVqUyoTmJv9w1GK0koTN R2tJb6Iwv0wHNzrlBsLRLRA3jjwHL7o6ld8xyfB7/4ajnKJ+WKjlJBPQ2qxpWWgXAeoY3MNy6f05C OBAKBvvsYZ1KG+ghSwXzyFvFgJc1k0p0oi8UFct2h2bxCt2e92NPV5fY8xZHgErZSX+aURViTZH7c txTr+8zg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eS3N1-0006jx-SN; Thu, 21 Dec 2017 16:06:55 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eS3L9-0004VM-Ek; Thu, 21 Dec 2017 16:05:06 +0000 Received: by mail-lf0-x244.google.com with SMTP id w196so10546694lff.5; Thu, 21 Dec 2017 08:04:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tFy88ZHY48JYmDZXtR6x7LgfIPt1sr2j4cX+9MXPE4g=; b=AubyCoXukbAFx7z6F6oMXjn6ojrEQXhMu5/U6mIsg2xtiAq1JwABkRBs1L1jIchynz BdPKIQs5rDkQUpzGRqBl4fwQ2gTu4QKwf8DZichdCon/sMZ0bWXBrczsOGNxeY6Xhbzs peupEVouo5hVfbySrlOL+JQXvs8izw6AXShuR1cliYgF/JZHNtPNFROXM4v1KCb4XTX6 k4Ac6PMHHFL+1XVw8CIU5Yyeo3SRq9UUXZaLv4wjMWC+fJNPTKu6FmkHZ8AGKldtVnzL a8ELm4XYp2NTsXFgp2OlCAkPqRCrbKX7c4r40THDH6+1GP+/OF4W8+nA0ltoafQ4Hioi 3ImQ== 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:in-reply-to :references; bh=tFy88ZHY48JYmDZXtR6x7LgfIPt1sr2j4cX+9MXPE4g=; b=jVAu72a0q68BvFnIJYyEsuTPTsjbOPdXD8FDWV2cHLZjJ01+mCmpFIIfOSlUksJC5U +LlmGzLbYZVwOupYjaFFotVhqHlwXnWBr1swALDKDEJJ+vmSD39DLmSyzVhf0USboerO zlUfYuoZ5c08rAX1maYy9wk8QozI/nuaKZ5P1o35mlkWrhRBd9uCkwdzO8GGi6uikS8E Gi5T6UW//T8bb8HoX75yJiGJjkpYlYpWtVVqK/fcFKsDcEsy3MClNg72o2KCNAGUm9Gz WkhgOCV3PAzrimNl9Y7TmhOpyhPhITq7Ij+NeF57bkMo+mnAHUs89tTE/jVlrGBvCi77 MpDA== X-Gm-Message-State: AKGB3mIp4+zNnetpJ/tozdLBeFqkzGAj9N8DkHnNmVfiGIsgxUPi7Dtl JvF8YNsLEud7i/AsfeXTXMA= X-Google-Smtp-Source: ACJfBovkq6IIJEZkr++y8ANjYYx92kwygq4w1fTxZFyDlO6sFrDaLFTDwaP4JZm8YHPMFWVI3683gQ== X-Received: by 10.46.1.18 with SMTP id 18mr65682ljb.51.1513872287330; Thu, 21 Dec 2017 08:04:47 -0800 (PST) Received: from ubuntu.lintech.local ([185.35.119.87]) by smtp.gmail.com with ESMTPSA id y1sm4091581lja.4.2017.12.21.08.04.46 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Dec 2017 08:04:46 -0800 (PST) From: Alexander Kochetkov To: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH 1/2] clk: rename clk_core_get_boundaries() to clk_hw_get_boundaries() and expose Date: Thu, 21 Dec 2017 19:04:41 +0300 Message-Id: <1513872282-5370-2-git-send-email-al.kochet@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1513872282-5370-1-git-send-email-al.kochet@gmail.com> References: <1513872282-5370-1-git-send-email-al.kochet@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171221_080459_517287_B4C817FA X-CRM114-Status: UNSURE ( 9.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Turquette , Elaine Zhang , Stephen Boyd , Heiko Stuebner , Alexander Kochetkov MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In order to provide a way to know clock limits to clock providers. The patch is needed for fixing commit 5d890c2df900 ("clk: rockchip: add special approximation to fix up fractional clk's jitter"). Custom approximation function introduced by the patch, can select frequency rate larger than one configured using clk_set_max_rate(). Signed-off-by: Alexander Kochetkov --- drivers/clk/clk.c | 14 ++++++++------ include/linux/clk-provider.h | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index c8d83ac..8943aac 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -421,10 +421,11 @@ struct clk *__clk_lookup(const char *name) return !core ? NULL : core->hw->clk; } -static void clk_core_get_boundaries(struct clk_core *core, - unsigned long *min_rate, - unsigned long *max_rate) +void clk_hw_get_boundaries(struct clk_hw *hw, + unsigned long *min_rate, + unsigned long *max_rate) { + struct clk_core *core = hw->core; struct clk *clk_user; *min_rate = core->min_rate; @@ -436,6 +437,7 @@ static void clk_core_get_boundaries(struct clk_core *core, hlist_for_each_entry(clk_user, &core->clks, clks_node) *max_rate = min(*max_rate, clk_user->max_rate); } +EXPORT_SYMBOL_GPL(clk_hw_get_boundaries); void clk_hw_set_rate_range(struct clk_hw *hw, unsigned long min_rate, unsigned long max_rate) @@ -894,7 +896,7 @@ unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate) int ret; struct clk_rate_request req; - clk_core_get_boundaries(hw->core, &req.min_rate, &req.max_rate); + clk_hw_get_boundaries(hw, &req.min_rate, &req.max_rate); req.rate = rate; ret = clk_core_round_rate_nolock(hw->core, &req); @@ -924,7 +926,7 @@ long clk_round_rate(struct clk *clk, unsigned long rate) clk_prepare_lock(); - clk_core_get_boundaries(clk->core, &req.min_rate, &req.max_rate); + clk_hw_get_boundaries(clk->core->hw, &req.min_rate, &req.max_rate); req.rate = rate; ret = clk_core_round_rate_nolock(clk->core, &req); @@ -1353,7 +1355,7 @@ static struct clk_core *clk_calc_new_rates(struct clk_core *core, if (parent) best_parent_rate = parent->rate; - clk_core_get_boundaries(core, &min_rate, &max_rate); + clk_hw_get_boundaries(core->hw, &min_rate, &max_rate); /* find the closest rate and parent clk/rate */ if (core->ops->determine_rate) { diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 5100ec1..2f10999 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -755,6 +755,8 @@ int __clk_mux_determine_rate_closest(struct clk_hw *hw, void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent); void clk_hw_set_rate_range(struct clk_hw *hw, unsigned long min_rate, unsigned long max_rate); +void clk_hw_get_boundaries(struct clk_hw *hw, unsigned long *min_rate, + unsigned long *max_rate); static inline void __clk_hw_set_clk(struct clk_hw *dst, struct clk_hw *src) {