From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24698C4332F for ; Wed, 9 Nov 2022 17:23:43 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 443C216B0; Wed, 9 Nov 2022 18:22:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 443C216B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668014621; bh=8GTSROHAD2BWx2mUMAHVpfmFyuKA37Xxl2wWLsi+Q28=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EiYjdew1pttbopd03IX3wQv6WCkqZLzavOG8Ts276BSXdTDB3ZgINflqWTR1GKDuO ThbF4QG6IIbPZmyJ1OFW4qddSA1eFyYOsnJj85iF1ofuxkMcC1mgW43GYB2xj9IoI/ P6Z07mNK/3ROubSVfvDZz++tpR+fnPZjQ0xMlCvc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B7130F805FC; Wed, 9 Nov 2022 18:16:15 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 68C46F800EC; Mon, 7 Nov 2022 11:58:37 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 29489F800EC for ; Mon, 7 Nov 2022 11:58:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 29489F800EC Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="MlOb16fr" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2A78o4vV010393; Mon, 7 Nov 2022 04:58:27 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=7lexxXZ3I3hljvfG/MXh5XgWwfTCj6K6EGi2gwpMgRA=; b=MlOb16frReJltGone9fs4amjkqovcdEamnVC3FlFeoZZd6zluUCjkGf0ihnUMsqujkaA H8I/V07ZcrCtj3Me8MCnu1HzAT6c7SRFW+Hh/FVPBKLTBK0lkpQcAFdVVvECWHTUpo/L d/dE/5urYwZVfafPQWAGGipJxVMewDDaKcb60xAi4A8h4kLf4cmEFO87PvkJnkW7tfL0 mbQIqr5S1dRUOd8T1/4MBzSMJ4Q4RIhkv/R5+HYlOfm7QbUPuCEQIfOD3fVC8gn6g8Oz NCISdICUUpF19kLQlfICj24QVNW5fiPzst1JOV1+w7Md+3AcASEfckm6g8vj5m1MRnhx Bg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3knn81j3vw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Nov 2022 04:58:26 -0600 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.15; Mon, 7 Nov 2022 04:58:24 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.15 via Frontend Transport; Mon, 7 Nov 2022 04:58:23 -0600 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id D68F1468; Mon, 7 Nov 2022 10:58:23 +0000 (UTC) Date: Mon, 7 Nov 2022 10:58:23 +0000 From: Charles Keepax To: Maxime Ripard Subject: Re: [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook Message-ID: <20221107105823.GF10437@ediswmail.ad.cirrus.com> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> <20221018-clk-range-checks-fixes-v2-20-f6736dec138e@cerno.tech> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20221018-clk-range-checks-fixes-v2-20-f6736dec138e@cerno.tech> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-ORIG-GUID: q89X8q3_8G1HVgVOlyA9kAC4F9KyM1s_ X-Proofpoint-GUID: q89X8q3_8G1HVgVOlyA9kAC4F9KyM1s_ X-Proofpoint-Spam-Reason: safe X-Mailman-Approved-At: Wed, 09 Nov 2022 18:15:50 +0100 Cc: Ulf Hansson , Prashant Gaikwad , Alexandre Belloni , Liam Girdwood , Michael Turquette , Sekhar Nori , Alexandre Torgue , dri-devel@lists.freedesktop.org, Paul Cercueil , Max Filippov , Thierry Reding , linux-phy@lists.infradead.org, David Airlie , Fabio Estevam , linux-stm32@st-md-mailman.stormreply.com, Abel Vesa , Kishon Vijay Abraham I , Geert Uytterhoeven , Samuel Holland , Chunyan Zhang , Takashi Iwai , Jernej Skrabec , Jonathan Hunter , Chen-Yu Tsai , NXP Linux Team , Orson Zhai , linux-mips@vger.kernel.org, Luca Ceresoli , Linus Walleij , linux-rtc@vger.kernel.org, linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, Daniel Vetter , alsa-devel@alsa-project.org, Manivannan Sadhasivam , linux-kernel@vger.kernel.org, Sascha Hauer , linux-actions@lists.infradead.org, Richard Fitzgerald , Mark Brown , linux-mediatek@lists.infradead.org, Baolin Wang , Matthias Brugger , Pengutronix Kernel Team , linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno , Alessandro Zummo , linux-sunxi@lists.linux.dev, Stephen Boyd , patches@opensource.cirrus.com, Peter De Schrijver , Nicolas Ferre , Andreas =?iso-8859-1?Q?F=E4rber?= , linux-renesas-soc@vger.kernel.org, Dinh Nguyen , Vinod Koul , Maxime Coquelin , David Lechner , Shawn Guo , Claudiu Beznea X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Fri, Nov 04, 2022 at 02:17:37PM +0100, Maxime Ripard wrote: > The WM381x "clkout" 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. > Yeah I don't think there would be anything wrong with this clock changing parents on a rate change, but as you say this can be refined down the line if someone needs the behaviour. It's an older part so probably better to stick roughly to the current behaviour for now. Acked-by: Charles Keepax Thanks, Charles From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBC0FC4332F for ; Mon, 7 Nov 2022 10:59:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231286AbiKGK7K (ORCPT ); Mon, 7 Nov 2022 05:59:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231836AbiKGK6m (ORCPT ); Mon, 7 Nov 2022 05:58:42 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28BE119C03; Mon, 7 Nov 2022 02:58:42 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2A78o4vU010393; Mon, 7 Nov 2022 04:58:26 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=7lexxXZ3I3hljvfG/MXh5XgWwfTCj6K6EGi2gwpMgRA=; b=MlOb16frReJltGone9fs4amjkqovcdEamnVC3FlFeoZZd6zluUCjkGf0ihnUMsqujkaA H8I/V07ZcrCtj3Me8MCnu1HzAT6c7SRFW+Hh/FVPBKLTBK0lkpQcAFdVVvECWHTUpo/L d/dE/5urYwZVfafPQWAGGipJxVMewDDaKcb60xAi4A8h4kLf4cmEFO87PvkJnkW7tfL0 mbQIqr5S1dRUOd8T1/4MBzSMJ4Q4RIhkv/R5+HYlOfm7QbUPuCEQIfOD3fVC8gn6g8Oz NCISdICUUpF19kLQlfICj24QVNW5fiPzst1JOV1+w7Md+3AcASEfckm6g8vj5m1MRnhx Bg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3knn81j3vw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Nov 2022 04:58:26 -0600 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.15; Mon, 7 Nov 2022 04:58:23 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.15 via Frontend Transport; Mon, 7 Nov 2022 04:58:23 -0600 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id D68F1468; Mon, 7 Nov 2022 10:58:23 +0000 (UTC) Date: Mon, 7 Nov 2022 10:58:23 +0000 From: Charles Keepax To: Maxime Ripard CC: 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 , Andreas =?iso-8859-1?Q?F=E4rber?= , Jonathan Hunter , Abel Vesa , 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 , David Lechner , Sascha Hauer , Mark Brown , Max Filippov , Geert Uytterhoeven , , , , , , , , , AngeloGioacchino Del Regno , , , , , , , Subject: Re: [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook Message-ID: <20221107105823.GF10437@ediswmail.ad.cirrus.com> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> <20221018-clk-range-checks-fixes-v2-20-f6736dec138e@cerno.tech> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20221018-clk-range-checks-fixes-v2-20-f6736dec138e@cerno.tech> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-ORIG-GUID: BS92jlzbqC_0WCEemxbjcbgSY_UegXLF X-Proofpoint-GUID: BS92jlzbqC_0WCEemxbjcbgSY_UegXLF X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org On Fri, Nov 04, 2022 at 02:17:37PM +0100, Maxime Ripard wrote: > The WM381x "clkout" 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. > Yeah I don't think there would be anything wrong with this clock changing parents on a rate change, but as you say this can be refined down the line if someone needs the behaviour. It's an older part so probably better to stick roughly to the current behaviour for now. Acked-by: Charles Keepax Thanks, Charles From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C7A2C433FE for ; Mon, 7 Nov 2022 10:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YpXpwYiKO5BA08S9Uz1ilNArbQtRWYLlDFTA268ri6U=; b=qV4LwyZoz+BLQ8 Rc2WB0cBIxtkOVJAw3d+tVq/ATHsd0OargF12wrL7AJJVZqDz5Kerev3oK+M/DbLwa6SLdyiFqxks ICK2Ck5PqvRCMgiNgkmiQO8vz6N9kf0QqElmSLsCz6DBTcu0RZGFbYpKAfQXoEUB65fq+cqHRldG+ I+BTdTf7L6n7rSNEr6DhX90l5TiaeDoJM/kNSKQ3AxeWKaLKBOZkgaYgc2hDk2TIe5YesYNMsJgS6 ln2PvpiMBLgLMW22WVO3G5e+vPfevgm3Aklv01vd61DdWaVQ9fjff6HObH2q5ZhK9h2JgTfJcjDR0 oAw5ioEcuK8zhdIKQUOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1orzr1-00Dw34-N1; Mon, 07 Nov 2022 10:59:47 +0000 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25] helo=mx0b-001ae601.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1orzqy-00Dvq0-SQ; Mon, 07 Nov 2022 10:59:46 +0000 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2A78o4vV010393; Mon, 7 Nov 2022 04:58:27 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=7lexxXZ3I3hljvfG/MXh5XgWwfTCj6K6EGi2gwpMgRA=; b=MlOb16frReJltGone9fs4amjkqovcdEamnVC3FlFeoZZd6zluUCjkGf0ihnUMsqujkaA H8I/V07ZcrCtj3Me8MCnu1HzAT6c7SRFW+Hh/FVPBKLTBK0lkpQcAFdVVvECWHTUpo/L d/dE/5urYwZVfafPQWAGGipJxVMewDDaKcb60xAi4A8h4kLf4cmEFO87PvkJnkW7tfL0 mbQIqr5S1dRUOd8T1/4MBzSMJ4Q4RIhkv/R5+HYlOfm7QbUPuCEQIfOD3fVC8gn6g8Oz NCISdICUUpF19kLQlfICj24QVNW5fiPzst1JOV1+w7Md+3AcASEfckm6g8vj5m1MRnhx Bg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3knn81j3vw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Nov 2022 04:58:26 -0600 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.15; Mon, 7 Nov 2022 04:58:24 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.15 via Frontend Transport; Mon, 7 Nov 2022 04:58:23 -0600 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id D68F1468; Mon, 7 Nov 2022 10:58:23 +0000 (UTC) Date: Mon, 7 Nov 2022 10:58:23 +0000 From: Charles Keepax To: Maxime Ripard CC: 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 , Andreas =?iso-8859-1?Q?F=E4rber?= , Jonathan Hunter , Abel Vesa , 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 , David Lechner , Sascha Hauer , Mark Brown , Max Filippov , Geert Uytterhoeven , , , , , , , , , AngeloGioacchino Del Regno , , , , , , , Subject: Re: [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook Message-ID: <20221107105823.GF10437@ediswmail.ad.cirrus.com> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> <20221018-clk-range-checks-fixes-v2-20-f6736dec138e@cerno.tech> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221018-clk-range-checks-fixes-v2-20-f6736dec138e@cerno.tech> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-ORIG-GUID: q89X8q3_8G1HVgVOlyA9kAC4F9KyM1s_ X-Proofpoint-GUID: q89X8q3_8G1HVgVOlyA9kAC4F9KyM1s_ X-Proofpoint-Spam-Reason: safe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221107_025944_948999_CEBA76B5 X-CRM114-Status: GOOD ( 28.58 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org On Fri, Nov 04, 2022 at 02:17:37PM +0100, Maxime Ripard wrote: > The WM381x "clkout" 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. > Yeah I don't think there would be anything wrong with this clock changing parents on a rate change, but as you say this can be refined down the line if someone needs the behaviour. It's an older part so probably better to stick roughly to the current behaviour for now. Acked-by: Charles Keepax Thanks, Charles -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6E84DC4332F for ; Mon, 7 Nov 2022 11:08:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C6B7510E141; Mon, 7 Nov 2022 11:08:25 +0000 (UTC) X-Greylist: delayed 518 seconds by postgrey-1.36 at gabe; Mon, 07 Nov 2022 11:08:20 UTC Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC96510E141 for ; Mon, 7 Nov 2022 11:08:20 +0000 (UTC) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2A78o4vV010393; Mon, 7 Nov 2022 04:58:27 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=7lexxXZ3I3hljvfG/MXh5XgWwfTCj6K6EGi2gwpMgRA=; b=MlOb16frReJltGone9fs4amjkqovcdEamnVC3FlFeoZZd6zluUCjkGf0ihnUMsqujkaA H8I/V07ZcrCtj3Me8MCnu1HzAT6c7SRFW+Hh/FVPBKLTBK0lkpQcAFdVVvECWHTUpo/L d/dE/5urYwZVfafPQWAGGipJxVMewDDaKcb60xAi4A8h4kLf4cmEFO87PvkJnkW7tfL0 mbQIqr5S1dRUOd8T1/4MBzSMJ4Q4RIhkv/R5+HYlOfm7QbUPuCEQIfOD3fVC8gn6g8Oz NCISdICUUpF19kLQlfICj24QVNW5fiPzst1JOV1+w7Md+3AcASEfckm6g8vj5m1MRnhx Bg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3knn81j3vw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Nov 2022 04:58:26 -0600 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.15; Mon, 7 Nov 2022 04:58:24 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.15 via Frontend Transport; Mon, 7 Nov 2022 04:58:23 -0600 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id D68F1468; Mon, 7 Nov 2022 10:58:23 +0000 (UTC) Date: Mon, 7 Nov 2022 10:58:23 +0000 From: Charles Keepax To: Maxime Ripard Subject: Re: [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook Message-ID: <20221107105823.GF10437@ediswmail.ad.cirrus.com> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> <20221018-clk-range-checks-fixes-v2-20-f6736dec138e@cerno.tech> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20221018-clk-range-checks-fixes-v2-20-f6736dec138e@cerno.tech> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-ORIG-GUID: q89X8q3_8G1HVgVOlyA9kAC4F9KyM1s_ X-Proofpoint-GUID: q89X8q3_8G1HVgVOlyA9kAC4F9KyM1s_ X-Proofpoint-Spam-Reason: safe X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Prashant Gaikwad , Alexandre Belloni , Liam Girdwood , Michael Turquette , Sekhar Nori , Alexandre Torgue , dri-devel@lists.freedesktop.org, Jaroslav Kysela , Paul Cercueil , Max Filippov , Thierry Reding , linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Abel Vesa , Kishon Vijay Abraham I , Geert Uytterhoeven , Samuel Holland , Chunyan Zhang , Takashi Iwai , Jernej Skrabec , Jonathan Hunter , Chen-Yu Tsai , NXP Linux Team , Orson Zhai , linux-mips@vger.kernel.org, Luca Ceresoli , linux-rtc@vger.kernel.org, linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, Manivannan Sadhasivam , linux-kernel@vger.kernel.org, Sascha Hauer , linux-actions@lists.infradead.org, Richard Fitzgerald , Mark Brown , linux-mediatek@lists.infradead.org, Baolin Wang , Matthias Brugger , Pengutronix Kernel Team , linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno , Alessandro Zummo , linux-sunxi@lists.linux.dev, Stephen Boyd , patches@opensource.cirrus.com, Peter De Schrijver , Nicolas Ferre , Andreas =?iso-8859-1?Q?F=E4rber?= , linux-renesas-soc@vger.kernel.org, Dinh Nguyen , Vinod Koul , Maxime Coquelin , David Lechner , Shawn Guo , Claudiu Beznea Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Nov 04, 2022 at 02:17:37PM +0100, Maxime Ripard wrote: > The WM381x "clkout" 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. > Yeah I don't think there would be anything wrong with this clock changing parents on a rate change, but as you say this can be refined down the line if someone needs the behaviour. It's an older part so probably better to stick roughly to the current behaviour for now. Acked-by: Charles Keepax Thanks, Charles