Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5313797rwl; Tue, 11 Apr 2023 03:45:49 -0700 (PDT) X-Google-Smtp-Source: AKy350aNqhqbFohQ28rVTgUqR2kd7T8tVizueMm6rBnA4NgCrv7QwFir6A4ypFmIMsVkgU840+k5 X-Received: by 2002:a17:902:f252:b0:1a6:4714:5cb2 with SMTP id j18-20020a170902f25200b001a647145cb2mr4980545plc.2.1681209949217; Tue, 11 Apr 2023 03:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681209949; cv=none; d=google.com; s=arc-20160816; b=Aah2bsLLq1muaSxliWlFoLO1yYvxxp0meRd3H3v1/YBD3FMYescreK+A7oaP4Dzl62 ORxvvngy2B/SxmBDSIZIvDrAaxYObPEL1QnyJHcM1BTIhCOyrkrJqz1Ppa+MMWkdiK93 bipR63eAbsL/q/K8GrrCJ7udmKoqRCFOYnMARzFgTT1qj4u9SFobAxYc2GETyyUlaQHW wQxukVofD6D1Lbh9LEulIrv5aQmoENgq4XAgsKh93EAAD5AQOp3Q/LAQYlSag0ADUh2S XK6W+MtcTEymefRko8NoBDXmTEka20y1d9sDJjysfc7Eu95DvGrqeUkklRqDRYIlYZM5 sApA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=v+TXeLmyznWAMQMS8gS0Vn4jjmljVmBnbvTWKb+VoA8=; b=QgSDTXLEs9s/Z5NprR6Em4o4jyRux897okf9R76lNNHSuO10NjfMUYFweTxG1kESXU 67HjR5xBIIrciJnQj5LRaiXpHMQiqrpI7Lx1SI9L6zlX/CoS3MZwxl7BBpagqgvXy2Ga p6uwZwNHjfKgB35ROvMbDVTY6+0Bmd/wld5Cz6cz0J3ynptRfRhp8SgaPRDw3hltsC/j QfYsgUdHwCTjRqgvJ/EklCDzi24IgtA+6DYDgumTLPzt5zHbQZLqkKRUhWi9Cu6TPCVL Ti4iXMYtgEpDEKOvZs0fMseHubPG9VK099nMgy7XvO4gISF9l5T2O8H0V1Ivf/c1RKLM dZoQ== ARC-Authentication-Results: i=1; mx.google.com; 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 v184-20020a6389c1000000b0051a24ba4d9fsi4871386pgd.413.2023.04.11.03.45.36; Tue, 11 Apr 2023 03:45:49 -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; 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 S229815AbjDKK2R convert rfc822-to-8bit (ORCPT + 99 others); Tue, 11 Apr 2023 06:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbjDKK2Q (ORCPT ); Tue, 11 Apr 2023 06:28:16 -0400 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C313E49; Tue, 11 Apr 2023 03:28:14 -0700 (PDT) Received: by mail-ot1-f46.google.com with SMTP id i15-20020a9d610f000000b006a11f365d13so2901392otj.0; Tue, 11 Apr 2023 03:28:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681208893; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9k4ZTujQ4vL3rn+nuolFAvnH5smJoZ+VnOtxKctHstQ=; b=y+0bH845JCNTfFSKJ0B1MNOHn231uHjFfzkjSJyaq98rD8+jejuBRzoyTS8HhnoNsO 8jQ0bd7bTqaZURCPChYQYxcPRSs7oyztbrQDGH3EQAa+rc3jkxU/hdBWk908Q1jRcEBD MRxiWJpu5gvekAKHSXCg2vGClTRugX04MBZZy4Kje2/PBxfpSq/pGiuATVcYKzGxG4p1 3urjx9jdH9H2ImVyeelhhnhTvDRI3YejMMpWCWeMZ4s+LCNLUVhFVzA17grZmnFhAGlG jbl9XUx5k4pxksCLilIFkF5uzXvqEjaBwX59XSJJnun9IBrkMSZr6cWBRu5bR8R1NM7Q FRmA== X-Gm-Message-State: AAQBX9fL7mSESR+2nvw+f/aGHSDFxg7E8T6wyWC0Q+6AyiOEoINmtg4c 9qmfuOeOiXyBbgolJirbePzAEaVVepxtJt9a X-Received: by 2002:a9d:7ac4:0:b0:69f:b541:3f6e with SMTP id m4-20020a9d7ac4000000b0069fb5413f6emr6422271otn.19.1681208893360; Tue, 11 Apr 2023 03:28:13 -0700 (PDT) Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com. [209.85.210.51]) by smtp.gmail.com with ESMTPSA id d16-20020a9d5e10000000b006a305c68617sm5237126oti.53.2023.04.11.03.28.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Apr 2023 03:28:12 -0700 (PDT) Received: by mail-ot1-f51.google.com with SMTP id cp25-20020a056830661900b00693ce5a2f3eso3621124otb.8; Tue, 11 Apr 2023 03:28:12 -0700 (PDT) X-Received: by 2002:a25:d74c:0:b0:b46:c5aa:86ef with SMTP id o73-20020a25d74c000000b00b46c5aa86efmr5126210ybg.12.1681208871324; Tue, 11 Apr 2023 03:27:51 -0700 (PDT) MIME-Version: 1.0 References: <20221018-clk-range-checks-fixes-v3-0-9a1358472d52@cerno.tech> <20221018-clk-range-checks-fixes-v3-28-9a1358472d52@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v3-28-9a1358472d52@cerno.tech> From: Geert Uytterhoeven Date: Tue, 11 Apr 2023 12:27:38 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 28/65] clk: renesas: r9a06g032: Add a determine_rate hook To: Maxime Ripard Cc: Michael Turquette , Stephen Boyd , =?UTF-8?Q?Andreas_F=C3=A4rber?= , Manivannan Sadhasivam , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Max Filippov , Charles Keepax , Richard Fitzgerald , Maxime Coquelin , Alexandre Torgue , Luca Ceresoli , David Lechner , Sekhar Nori , Abel Vesa , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Matthias Brugger , Geert Uytterhoeven , Dinh Nguyen , Peter De Schrijver , Prashant Gaikwad , Thierry Reding , Jonathan Hunter , Ulf Hansson , Linus Walleij , David Airlie , Daniel Vetter , Vinod Koul , Kishon Vijay Abraham I , Alessandro Zummo , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Paul Cercueil , Orson Zhai , Baolin Wang , Chunyan Zhang , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, AngeloGioacchino Del Regno , linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, patches@opensource.cirrus.com, linux-stm32@st-md-mailman.stormreply.com, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-phy@lists.infradead.org, linux-rtc@vger.kernel.org, linux-sunxi@lists.linux.dev, alsa-devel@alsa-project.org, linux-mips@vger.kernel.org, Gareth Williams , Herve Codina , Miquel Raynal , Ralph Siemsen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no 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 CC Gareth, Hervé, Miquel, Ralph On Tue, Apr 4, 2023 at 2:44 PM Maxime Ripard wrote: > The Renesas r9a06g032 bitselect clock 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 latter case would be equivalent to setting the flag > CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook > to __clk_mux_determine_rate(). Indeed, if no determine_rate > implementation is provided, clk_round_rate() (through > clk_core_round_rate_nolock()) will call itself on the parent if > CLK_SET_RATE_PARENT is set, and will not change the clock rate > otherwise. __clk_mux_determine_rate() has the exact same behavior when > CLK_SET_RATE_NO_REPARENT is set. > > And if it was an oversight, then we are at least explicit about our > behavior now and it can be further refined down the line. > > Signed-off-by: Maxime Ripard LGTM, so Reviewed-by: Geert Uytterhoeven But I do not have the hardware. > --- a/drivers/clk/renesas/r9a06g032-clocks.c > +++ b/drivers/clk/renesas/r9a06g032-clocks.c > @@ -1121,6 +1121,7 @@ static int r9a06g032_clk_mux_set_parent(struct clk_hw *hw, u8 index) > } > > static const struct clk_ops clk_bitselect_ops = { > + .determine_rate = __clk_mux_determine_rate, > .get_parent = r9a06g032_clk_mux_get_parent, > .set_parent = r9a06g032_clk_mux_set_parent, > }; > @@ -1145,7 +1146,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks, > > init.name = desc->name; > init.ops = &clk_bitselect_ops; > - init.flags = CLK_SET_RATE_PARENT; > + init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT; > init.parent_names = names; > init.num_parents = 2; > Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds