From patchwork Thu Jun 2 09:52:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jongsung Kim X-Patchwork-Id: 9149655 X-Patchwork-Delegate: sboyd@codeaurora.org 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 11D0660751 for ; Thu, 2 Jun 2016 09:52:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03C702654B for ; Thu, 2 Jun 2016 09:52:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBDE6269DA; Thu, 2 Jun 2016 09:52:28 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C70E2654B for ; Thu, 2 Jun 2016 09:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932312AbcFBJwJ (ORCPT ); Thu, 2 Jun 2016 05:52:09 -0400 Received: from LGEAMRELO12.lge.com ([156.147.23.52]:47476 "EHLO lgeamrelo12.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753099AbcFBJwG (ORCPT ); Thu, 2 Jun 2016 05:52:06 -0400 Received: from unknown (HELO lgeamrelo04.lge.com) (156.147.1.127) by 156.147.23.52 with ESMTP; 2 Jun 2016 18:52:03 +0900 X-Original-SENDERIP: 156.147.1.127 X-Original-MAILFROM: neidhard.kim@lge.com Received: from unknown (HELO LGEAEXHB03Q.LGE.NET) (165.244.98.203) by 156.147.1.127 with ESMTP; 2 Jun 2016 18:52:03 +0900 X-Original-SENDERIP: 165.244.98.203 X-Original-MAILFROM: neidhard.kim@lge.com Received: from lgekrmhub08.lge.com (10.185.110.18) by lgeaexhb03q.lge.net (165.244.98.203) with Microsoft SMTP Server id 8.3.264.0; Thu, 2 Jun 2016 18:52:03 +0900 Received: from lgeamrelo04.lge.com ([156.147.1.127]) by lgekrmhub08.lge.com (Lotus Domino Release 8.5.3FP6) with ESMTP id 2016060218520297-50978 ; Thu, 2 Jun 2016 18:52:02 +0900 Received: from unknown (HELO localhost.localdomain) (10.178.37.74) by 156.147.1.127 with ESMTP; 2 Jun 2016 18:52:03 +0900 X-Original-SENDERIP: 10.178.37.74 X-Original-MAILFROM: neidhard.kim@lge.com From: Jongsung Kim To: Michael Turquette , Stephen Boyd CC: , , Chanho Min , Jongsung Kim Subject: [PATCH] clk: fixed-factor: set CLK_SET_RATE_PARENT Date: Thu, 2 Jun 2016 18:52:00 +0900 Message-ID: <1464861120-26209-1-git-send-email-neidhard.kim@lge.com> X-Mailer: git-send-email 2.7.4 X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB08/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2016/06/02 18:52:02, Serialize by Router on LGEKRMHUB08/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2016/06/02 18:52:03, Serialize complete at 2016/06/02 18:52:03 MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Without CLK_SET_RATE_PARENT-flag set, clk_factor_round_rate() just returns the current frequency. A fixed-factor-clock initialzed via of_fixed_factor_clk_set() (ie, by device-tree) can't have the flag set. It can be problematic when the parent of a fixed-factor-clock is rate-controllable clk, because the rounding can't be propagated to parent, the rounded target frequency is always the current, and finally the frequency can't be changed. This patch sets the flags CLK_SET_RATE_PARENT for all fixed-factor- clocks, from clk_register_fixed_factor(), and removes checking the flag from clk_factor_round_rate(). Signed-off-by: Jongsung Kim --- drivers/clk/clk-fixed-factor.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index 75cd6c7..9b5df847f 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -38,13 +38,10 @@ static long clk_factor_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) { struct clk_fixed_factor *fix = to_clk_fixed_factor(hw); + unsigned long best_parent; - if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { - unsigned long best_parent; - - best_parent = (rate / fix->mult) * fix->div; - *prate = clk_hw_round_rate(clk_hw_get_parent(hw), best_parent); - } + best_parent = (rate / fix->mult) * fix->div; + *prate = clk_hw_round_rate(clk_hw_get_parent(hw), best_parent); return (*prate / fix->div) * fix->mult; } @@ -88,7 +85,7 @@ struct clk_hw *clk_hw_register_fixed_factor(struct device *dev, init.name = name; init.ops = &clk_fixed_factor_ops; - init.flags = flags | CLK_IS_BASIC; + init.flags = flags | CLK_IS_BASIC | CLK_SET_RATE_PARENT; init.parent_names = &parent_name; init.num_parents = 1;