Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp1129639rwl; Fri, 4 Nov 2022 10:05:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59+HALKT/eEiY9otxGm0yoIAEz89G0wmU+xQtJ/Zw13SvHF2BMLCyJB5zeB/OwPcQ41A5+ X-Received: by 2002:a62:1b11:0:b0:56d:568d:c293 with SMTP id b17-20020a621b11000000b0056d568dc293mr29417127pfb.41.1667581550603; Fri, 04 Nov 2022 10:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667581550; cv=none; d=google.com; s=arc-20160816; b=MRzq4+2XP7gZ3UWMKAfnVe+b78BJEJHOx6ItjYaR9HGaKyLhtStBOAUiZHxtDKq8aL uTA1nB4u7QpS1oZzaKhgMwr1uHW4bAp+geR89W0KIUorGGuFz8nj1EZ0CjM2M4JgmOaG TZx5WaqKUd+cfH7DKMhGLHjb1MH9yyG653lhUDUJrm+orrYwYpyN3taoWNzh9+qOOeh+ 1TwWvfHQB2w19ZJqjm5Lj7oj9/L23o+thGAaSR9+geRl5tRrkjoQUj8Da7gKkppp/8R2 K6FLO3iyW+LEMeE8w3+yLGCNEH9rQQO8R4ceRzgYvBGTN6yQ3DMBqwp2QFK63lF0Wr+O /6TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=/fSoTUtqLSMP2KfCqxLZIKji3GOepn9Xc93RPyjSVkg=; b=L0Ak8UIRisDK3FsUGUrYCsoBNi/r7rYQKQCxhiswYZIHC3FV4d7BekbYcdQFXlrpZ5 PQv5aS/dce+ra2MAZlOia1P/FCU1JOcH/M13EpglVjWpysnBrKuixp3chkWkBOm1GdHM fCVIsZsUW7A1BwTQT/Nw1KHBFBO2TEzLiVI18SliO/XyJVZAfJGHqpy4GXvX6oqsZk5S 7Lm2BQ3oNqfzLvK+8Obk4jJC93p1pDXBYZvS3VtqA6qYfdY9hmN5+I14knVuH1j95wXG upVl/kmP1BzogReKczTV55qvRV+hce2LtDLrGuDGoAiZo4secbr5EskQHSpobGZFlqva gd0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b="S05yN9/O"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t21-20020a170902b21500b001868d5fc27csi4421291plr.254.2022.11.04.10.05.36; Fri, 04 Nov 2022 10:05:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b="S05yN9/O"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231993AbiKDQwL (ORCPT + 96 others); Fri, 4 Nov 2022 12:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232093AbiKDQvl (ORCPT ); Fri, 4 Nov 2022 12:51:41 -0400 X-Greylist: delayed 248 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 04 Nov 2022 09:49:49 PDT Received: from vern.gendns.com (vern.gendns.com [98.142.107.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9374D42F46; Fri, 4 Nov 2022 09:49:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/fSoTUtqLSMP2KfCqxLZIKji3GOepn9Xc93RPyjSVkg=; b=S05yN9/OkId9ymzRJ4dCjcPWLQ 7kS+7hwLHIGVXlHp7W14BxEpjdI4ntV02EjHSD7RVjfxzjyZZY+kvQZZx58NMhQA3G5XgkIRxucIi 1OotghPODhkcufNUd5I3CGkJL57YrmUvR1N06/jUXH2swC2CkuimIhdic8beAfGSReYdk0zY/yiuZ yCoOy4drXYmkZQ1P6bLMxXp+heS5TEP3UnHMbT+naZWwnajVpJ4cAXNOiBZHJHsv1ZCK1dTFhnhcE kQfJJLIU0/MUGSPFRmI/cJ4R007YPo4eHbdvB68luhk9bsDRd+9PwexE0o4g4q5uI6q1mQphZaEQ8 PyW6kaVA==; Received: from ip98-183-112-30.ok.ok.cox.net ([98.183.112.30]:33812 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.95) (envelope-from ) id 1oqzsl-00Ciq9-V8; Fri, 04 Nov 2022 12:49:41 -0400 Message-ID: <6296d944-e03d-6f2b-48b1-3dad78e3c89d@lechnology.com> Date: Fri, 4 Nov 2022 11:49:34 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate Content-Language: en-US To: Maxime Ripard , Stephen Boyd , Maxime Coquelin , Chen-Yu Tsai , Daniel Vetter , Nicolas Ferre , Thierry Reding , Jaroslav Kysela , Shawn Guo , Fabio Estevam , Ulf Hansson , Claudiu Beznea , Michael Turquette , Dinh Nguyen , Paul Cercueil , Chunyan Zhang , Manivannan Sadhasivam , =?UTF-8?Q?Andreas_F=c3=a4rber?= , Jonathan Hunter , Abel Vesa , Charles Keepax , Alessandro Zummo , Peter De Schrijver , Orson Zhai , Alexandre Torgue , Prashant Gaikwad , Liam Girdwood , Alexandre Belloni , Samuel Holland , Matthias Brugger , Richard Fitzgerald , Vinod Koul , NXP Linux Team , Sekhar Nori , Kishon Vijay Abraham I , Linus Walleij , Takashi Iwai , David Airlie , Luca Ceresoli , Jernej Skrabec , Pengutronix Kernel Team , Baolin Wang , Sascha Hauer , Mark Brown , Max Filippov , Geert Uytterhoeven Cc: linux-stm32@st-md-mailman.stormreply.com, alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-mips@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-actions@lists.infradead.org, linux-clk@vger.kernel.org, AngeloGioacchino Del Regno , patches@opensource.cirrus.com, linux-tegra@vger.kernel.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> <20221018-clk-range-checks-fixes-v2-54-f6736dec138e@cerno.tech> From: David Lechner In-Reply-To: <20221018-clk-range-checks-fixes-v2-54-f6736dec138e@cerno.tech> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/4/22 8:18 AM, Maxime Ripard wrote: > The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent > hook, but doesn't provide a determine_rate implementation. > > This is a bit odd, since set_parent() is there to, as its name implies, > change the parent of a clock. However, the most likely candidate to > trigger that parent change is a call to clk_set_rate(), with > determine_rate() figuring out which parent is the best suited for a > given rate. > > The other trigger would be a call to clk_set_parent(), but it's far less > used, and it doesn't look like there's any obvious user for that clock. > > So, the set_parent hook is effectively unused, possibly because of an > oversight. However, it could also be an explicit decision by the > original author to avoid any reparenting but through an explicit call to > clk_set_parent(). > > The driver does implement round_rate() though, which means that we can > change the rate of the clock, but we will never get to change the > parent. > > However, It's hard to tell whether it's been done on purpose or not. > > Since we'll start mandating a determine_rate() implementation, let's > convert the round_rate() implementation to a determine_rate(), which > will also make the current behavior explicit. And if it was an > oversight, the clock behaviour can be adjusted later on. I think this one should be the same as the clk:davinci changes and not allow re-parenting. Since this is a USB 48MHz PHY clock, a rate change will never be requested. > > Signed-off-by: Maxime Ripard > --- > drivers/clk/davinci/da8xx-cfgchip.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c > index 4c1cc59bba53..f60c97091818 100644 > --- a/drivers/clk/davinci/da8xx-cfgchip.c > +++ b/drivers/clk/davinci/da8xx-cfgchip.c > @@ -462,10 +462,12 @@ static unsigned long da8xx_usb0_clk48_recalc_rate(struct clk_hw *hw, > return 48000000; > } > > -static long da8xx_usb0_clk48_round_rate(struct clk_hw *hw, unsigned long rate, > - unsigned long *parent_rate) > +static int da8xx_usb0_clk48_determine_rate(struct clk_hw *hw, > + struct clk_rate_request *req) > { > - return 48000000; > + req->rate = 48000000; > + > + return 0; > } > > static int da8xx_usb0_clk48_set_parent(struct clk_hw *hw, u8 index) > @@ -494,7 +496,7 @@ static const struct clk_ops da8xx_usb0_clk48_ops = { > .disable = da8xx_usb0_clk48_disable, > .is_enabled = da8xx_usb0_clk48_is_enabled, > .recalc_rate = da8xx_usb0_clk48_recalc_rate, > - .round_rate = da8xx_usb0_clk48_round_rate, > + .determine_rate = da8xx_usb0_clk48_determine_rate, > .set_parent = da8xx_usb0_clk48_set_parent, > .get_parent = da8xx_usb0_clk48_get_parent, > }; >