From patchwork Fri Nov 4 13:17:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031754 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 E4EBBC43219 for ; Fri, 4 Nov 2022 13:18:05 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9U3Mq1voqWEbZVQQ2g4kwY3qx+SYjD3N2lBFUFZQyrs=; b=qohQ+C5jtazTGt O7jvMpQdo4Afmf2+s8d7KyQvVSSXJBDKTQaDi282uZDkaKAzX+C70nisNhtRYAYA+bmmuq02WyKpd /w3s3t2KBL9+iaR3a8Ieky+Mn9Rgae++Sr5mTu4anfu17mzUXhgac6ZHl1Am2Zt5b4EM/Y2Nr/WrW cKkUA8hcjRrx584TOcdm4nRHfplQjKC0BWtqlS8nDtmSF8lCy7ihP3dnBob9zifVm/q5JE/uMllON uhVwmZpkFb/IFVsopneLqntpqxUT3qD6T1cfmtr5KLa83iZ0GBfQPhgfvSj3sGO8IzlQXYOnl6F9r LVvsbfZjwvzu4841WeVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaD-003cVU-2g; Fri, 04 Nov 2022 13:18:05 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwa2-003cNn-Iz; Fri, 04 Nov 2022 13:17:56 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 4980458024E; Fri, 4 Nov 2022 09:17:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:17:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567870; x= 1667575070; bh=G6roTlQI+WbfuJBVMerfpRGcIgbu8Jj1z+yrfkH1e+4=; b=n 305Fx+jcKbMsgUN7v1krJxUbv7vaOfIMbnWEiBcRYzX0RmgLNUo6ZQkQ041POXIZ dxIzQjfl8zV82UiM8+VLMQJwrb6pLRYX7gCMb+XBMWuH1E/0jDHRJlvJ/Lpuin95 ZDW+gl9GhhcANj/Hsh5IWBqmfuv3jIxxLX8EstOLGKg7VuSm1kTHzuqYRVBMDUhB +JjAc8H/cro+i7N4tOFy91tFBOszwsetF5RzSoAbn6n4jqLKw+oDrzkPQt1uAiRO 0tL7+W8Sv5otfhI+TTUQ693kejDfv6p3gxSaz+ybZkiMhJ3htwMZwenAoc/Uz60+ iTbTLunO1rfdpWZpT6mSw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567870; x= 1667575070; bh=G6roTlQI+WbfuJBVMerfpRGcIgbu8Jj1z+yrfkH1e+4=; b=I Z9JokDAMRMmEs198kcOyI8byre7eSOmpJS/5iXjULqjY+mM1ez554uEE5P/Dmq9n Y2phF2Ulr43HOi7KVl59kOM2ZXOb2atqD2mg8M/epW+1ArP9EmdYUAJlZliMFOVD o12Xx38r37wZLzYpfU+rJPcvqSDRpLY/FCYqk6k3WDWHqAoayvxVtE5/iP9xO5Ej yWXKogQGxCteQLxh7SqLZ6FP2k0sBEskWmK/5LsDTWMImCxvmptKYJUVpH2wCBV6 CsD67r2Fk67TjOH07maYbYHROh63LTNDVT8baKk+pXZhP5+x0ZDzT30G2pMfBFWv GuflU3e1PeXPYUL41JYFw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:17:49 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:18 +0100 Subject: [PATCH v2 01/65] clk: Export clk_hw_forward_rate_request() MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-1-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=818; i=maxime@cerno.tech; h=from:subject:message-id; bh=pHSkDqlAWAoctG0mTmKyzVsJsENtdafsCZJ4udDXPgk=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp9aPz1sP7s2/Xn5a/ErU6beWJjGX1Lh2zWb89/fOWUJ BsmFHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZjIRS5GhqnPGtbbXKwz4D9Z52Fi92 u/dNpMd35p+Z1zHPNui+1TEWVk2F9WoVG819j57F3279o6Mm83xyUl/TrE/K164Z5ff2asZgEA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061755_256080_2A44E862 X-CRM114-Status: UNSURE ( 9.42 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Commit 262ca38f4b6e ("clk: Stop forwarding clk_rate_requests to the parent") introduced the public clk_hw_forward_rate_request() function, but didn't export the symbol. Make sure it's the case. Fixes: 262ca38f4b6e ("clk: Stop forwarding clk_rate_requests to the parent") Signed-off-by: Maxime Ripard --- drivers/clk/clk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 57b83665e5c3..d4a74759fe29 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1525,6 +1525,7 @@ void clk_hw_forward_rate_request(const struct clk_hw *hw, parent->core, req, parent_rate); } +EXPORT_SYMBOL_GPL(clk_hw_forward_rate_request); static bool clk_core_can_round(struct clk_core * const core) { From patchwork Fri Nov 4 13:17:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031753 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 8DE5DC4332F for ; Fri, 4 Nov 2022 13:18:05 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BAqqCPntvbGMeoYP5dIXtcNoveqsXZNIM0uoaNeR/QA=; b=4cD9kNNh9pz4g/ sUO7WQ0aqwr2shDy6Fc1tBNuPOPBv1i8BeAPawhMRZWEodcOkAKpKN8PMwL7zDYeL1Ww7HKpOXP5H NszbW8H6BLlBUsiq1N2magzjS0PXimTKj8aEcqQ8BRKgHc3clk6QwcWJEbgpSlvW7LgnC4IEv711W LcUdN9ncrwjN9wYM18YtPfFHbgOKJ3w/LkW+4gpVrqY6C8h+LLU0cjDc2OYmJUvKzTaEVo3EB+6Ir n7WtaKv9J92iuMLjm9otUdTWAleL7i8H49kc3gSLGA6pbBMXL7pddhv5r7+vEjyelDyiZlGoDmEip xrL5bitgToffApliCmNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaC-003cVF-P4; Fri, 04 Nov 2022 13:18:04 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwa2-003cOC-V1; Fri, 04 Nov 2022 13:17:56 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 61D9858044C; Fri, 4 Nov 2022 09:17:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:17:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567872; x= 1667575072; bh=06erX3Kj2Cpg1UoaP6NUgmKg6CRYa/Sd79GEp9CTLUk=; b=e 1ZeoTljhCPkZpz2rIoVn4PYG9rZGAspv5rnLPPk41E3S9iCP+0nCwdQvSyVEpKlr Z5Jiu8Mbec/PKLsbqcILj3878dmHzqvG+e9pk3gXVjxy+FUYgJbQqCZIE0NxHDJ6 FOf6Ez+WuBz85DACVSv1TfoY2uCWu6oSxx0yLC8K8Wkq+wRK8MlPV4X0RXDQwiGK qQ59Dzpv2S5quPC/rxmIxn5jsKMIDI1Z5NpVGGAmUrQwdS6AtSzTQiXeahLbpbv1 fyZ2iR/6sHpVBP7gQk9WjuiA5ucOSZfWC37s3dYrDDB3LWJ7SUC5/SptcCEcvd1J fIQccRyog/25GtPWrg8wA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567872; x= 1667575072; bh=06erX3Kj2Cpg1UoaP6NUgmKg6CRYa/Sd79GEp9CTLUk=; b=O 1TqjhPO0LY4RXuxO29Nix1PCYvo1wCARUQeGv3LyVWVwqLlizWkmKCf4ONBaxIyX y0c3rBl6+5IohCEpE3AmLurPhH1TpSY422cJaHmD6fA9H45dkj74X7c2SBob5UMJ atcHQwp7sU33ZPzAvoDn7SIoHBxNcgkPrjZ9AP5+yi08cxEKT7IgaLG+n6h4CVbx 9kBAd0rWUHqYq4S7rwT6hwzy2RhFl1Fve1/j8L7h3peV+9hRZjRjvwfI+3aPpdie 9kgkIqVYCR+GZOzR01+RuVCjS/l8gYgWMyVDgh8E6W1fuLMpv/7PvvqbwoGytXWZ mdscHkxnn0JPA9QiFdt8Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:17:51 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:19 +0100 Subject: [PATCH v2 02/65] clk: lan966x: Remove unused round_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-2-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=1566; i=maxime@cerno.tech; h=from:subject:message-id; bh=UUWQAfB4LjFBOSGFZ6uyIELdMsnaIf0eeBGtwWhM+3Y=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp80QlY2nviyod257eWMD6xV2dMP2fspWXFExnhWBFwp NQruKGVhEONikBVTZIkRNl8Sd2rW6042vnkwc1iZQIYwcHEKwEQ+vGX4p7RFJ8c9ym9KRP3i+j9yG9 f4pdRXfxHeFsm382TzioAPEowMM/46eBx3YEqvMhJnNg0UUA3Yslxced5S2+ZZYt2ZL9qZAQ== X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061755_253136_DEDC5A86 X-CRM114-Status: GOOD ( 11.26 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The lan966x driver registers a gck clock with both a determine_rate and a round_rate implementation. Both are equivalent, and are only called by clk_core_determine_round_nolock() which favors determine_rate. Thus, lan966x_gck_round_rate() is never called, so we can just remove it. Signed-off-by: Maxime Ripard --- drivers/clk/clk-lan966x.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/clk/clk-lan966x.c b/drivers/clk/clk-lan966x.c index 460e7216bfa1..870fd7df50c1 100644 --- a/drivers/clk/clk-lan966x.c +++ b/drivers/clk/clk-lan966x.c @@ -103,22 +103,6 @@ static int lan966x_gck_set_rate(struct clk_hw *hw, return 0; } -static long lan966x_gck_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) -{ - unsigned int div; - - if (rate == 0 || *parent_rate == 0) - return -EINVAL; - - if (rate >= *parent_rate) - return *parent_rate; - - div = DIV_ROUND_CLOSEST(*parent_rate, rate); - - return *parent_rate / div; -} - static unsigned long lan966x_gck_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -177,7 +161,6 @@ static const struct clk_ops lan966x_gck_ops = { .enable = lan966x_gck_enable, .disable = lan966x_gck_disable, .set_rate = lan966x_gck_set_rate, - .round_rate = lan966x_gck_round_rate, .recalc_rate = lan966x_gck_recalc_rate, .determine_rate = lan966x_gck_determine_rate, .set_parent = lan966x_gck_set_parent, From patchwork Fri Nov 4 13:17:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031755 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 3AAC2C4332F for ; Fri, 4 Nov 2022 13:18:11 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=L/VJmtCYM+3y+qDBd3Ue3t6Fbg7TmA8WjvgMJ8vJMBo=; b=cGfOBmTM2M5OLU i6iLmyMNLAX6ztNAuHbHJ54D5NhlrPFV1ksOUBq+ZDeGDl80V2DWLbNIOusGUD2pueAFU2pTJ+zib Wpv6AfCCwjwiemvJr6zLwUMVx66+FDqRqkbOduqylYsTF3RqKT3zL5nwPrJ7oKmKCVIImDO+O075W M1VFRp/E2zoMgMYC1kQwVnPAns9a1+lkc4+1xZdtXPMZibQyAybht6PGgItR3/uenwzuV8HIyqV3+ j5xAr12xftHhlZLZGLo2VTsLYXld+ncLRHSJirT9MMhPqMb2eLE6+zBqj+Wt5RrlLnupEDGWM7ncZ 6+xVTdlMBO2Eh7KZ56RQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaI-003cZJ-6P; Fri, 04 Nov 2022 13:18:10 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwa3-003cOn-1Y; Fri, 04 Nov 2022 13:17:58 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 695D7580452; Fri, 4 Nov 2022 09:17:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:17:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567874; x= 1667575074; bh=gulfUfzWxrSqI04EuTpJI31rPi0/dfB3rbjvrNMKjxY=; b=j xHzL7Cnzjfiw0PGk2c3HMN+PyHDbxOM2uEnKzwVGPtCzb8g3bu3Eiz3Xyexsc//I eS6k5W3Op9rsyni8gj3FUiKo46O6VmY+Yn+cedj2E5AkZw35yhxickPQS1dFkcwS 7EpQk9j3L3hPZdNPSx2Tp4hp1NrDRw/6EuAzr0GkUDXHnkg+KVB8+VHBCa3OIeN6 HiG97KbdXWEXAER1UyuUfycgukhpXo9yKoP4RlJMZkyD8CQ3w5MF2ZyHA9/+4DMz tNwzP+OTA1J8obKlrIJe1slYiwet0dc569CunTXqgx0e27uXxEHFKpAWFs/jJsjT skp6xRiKzC6uH3PY8iMdg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567874; x= 1667575074; bh=gulfUfzWxrSqI04EuTpJI31rPi0/dfB3rbjvrNMKjxY=; b=N cXu9Kys9Bj+Vx2D3rQoRZS89rl6OSuwEoxKU2uDggMYLKsUEucWr/xdkTEuyTfLe 4Gbh55NY0v1hs1/44EUfw0UXk/dmYaTUr4AgQB8nwcW6SVUYRVot0WUnfS4goOf6 VLMYeVNlx/xsVsQTya7UMOgN8U7yPZ13sQh8oyV+CzIThamJ2BSErys5KdaqJ5aK Z6wLTHi0EDHZhcvFRVjlKGLtSQjeAkuLiDNUpGh5C9l00gV62N43kkIAZ1LfEjmf B1xjczzbpL8i7prAlCCeW0o1e+X40do+K4XyW4DrEjJGhG/mTUtfvXbjWdq3i6uR +UPBng6rPnYVVYBl25z0g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:17:53 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:20 +0100 Subject: [PATCH v2 03/65] clk: nodrv: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-3-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=1157; i=maxime@cerno.tech; h=from:subject:message-id; bh=cTvG3Ny7vbFY5Q42sItsaJ9Su6ls/B3daI8QtRhhdSg=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp8+C5Y88qpojMj6IcW27fC9ExOEC2IMTjbY8smt4mCY VtvVUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIns+sLIsOpSyRUbDrOeLQs+e1bEvz CNs3t1tfW627PaiTti9lwrsWf4Z9VzwsL9v+szkaxnq5uC5LtaWAyKmXWOvb6a9Ex7+88TXAA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061755_290803_A340A9D3 X-CRM114-Status: GOOD ( 11.17 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The nodrv clock implements a mux with a set_parent hook, but doesn't provide a determine_rate implementation. Even though it's a mock clock and the missing function is harmless, we'll start to require a determine_rate implementation when set_parent is set, so let's fill it. Signed-off-by: Maxime Ripard --- drivers/clk/clk.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index d4a74759fe29..495d7497cc43 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -4257,11 +4257,18 @@ static int clk_nodrv_set_parent(struct clk_hw *hw, u8 index) return -ENXIO; } +static int clk_nodrv_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + return -ENXIO; +} + static const struct clk_ops clk_nodrv_ops = { .enable = clk_nodrv_prepare_enable, .disable = clk_nodrv_disable_unprepare, .prepare = clk_nodrv_prepare_enable, .unprepare = clk_nodrv_disable_unprepare, + .determine_rate = clk_nodrv_determine_rate, .set_rate = clk_nodrv_set_rate, .set_parent = clk_nodrv_set_parent, }; From patchwork Fri Nov 4 13:17:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031756 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 05F4EC43219 for ; Fri, 4 Nov 2022 13:18:32 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BzJBGdlX3is9dus2giKqOC3FsqeuCc/gKu1VXLy0KIQ=; b=Lva1XFVkkAu9Rh +A4CmaKjoLOgWsb/z5uBK6Ftzzv/rLCKgCqqUkRESWxQHGV4v1mennPBDpM7bAtwC7c37XIVOS/zS QCaSpLE1jPp70Y7AdbRDlzHeIJ5+GATc9k1WHHTW61PTCiQhjR8YX2nKcFMdYWZGNW4BO/wxz0raM oEXvwZFN3fj+IXwuUkrIepxwkF6bSJbAh3iDZnKH/u+mHChffzG6ObuHs3poCyidja9Yl/nvnVgvl aGT5GzWcg2ZoNrZn0iNdEBBaF/YtVnpyOdDuXztSa3LKn/1DcggDpokcR5RaRklMMB8lH/lul5NoZ OwbVRYFUCAPiF64+IwJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwac-003cmu-Mi; Fri, 04 Nov 2022 13:18:30 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwa5-003cQG-BH; Fri, 04 Nov 2022 13:17:58 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id A346A58046C; Fri, 4 Nov 2022 09:17:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:17:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567876; x= 1667575076; bh=L5wASX54u8n/djj/NOTWyB5h74dOMSF40gyr8Izx+PM=; b=w o5yf59DJo2lg0er1Ihv4bUCkkCfOZSysHpM8j2KZUudIcSQKLit35/EwhGHwdpdE UnJmQM+37JVpRwPEDUq/c69V5MDtv5XI2+G4OVxRUDPDTJ0rJcr7Qsrl5W86JuZb WnzxjA+YljMtA0dz6vqeN60gRwMONWlSh0LlE65S2OpOzY1Z1ae/o8DSM6AFkQMJ Lm2zKKruwETpA3kpDcni4FnoUKm2/9I/OpXz3mInbnL3LuqJ2bOVqyoyeBVdkSsw 5FUonyqajbV6lSZn79XWdQSnvtyXwdnSXkv80volJQHqxSB+cDStSyPQHgpRFHB6 DMKvprVXIy93Gof051BpA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567876; x= 1667575076; bh=L5wASX54u8n/djj/NOTWyB5h74dOMSF40gyr8Izx+PM=; b=H LdzmdsPkObzjGsUJbpUqtcESSs8NEzMQB4dUyHGMXou0SMkfu96aHNECIKTlqiK9 /a3jqGVCXucOVjwkAMMcLC/akaa/13DWw8Cy5iYfswpi6jIACTKexUZ5oCkoi6GC PyENG9cD4J2tfGg+GKRrPH0WcI5ah2Fo3QlADO3E19UYD0KTtaD/3j++PkJJ/3+4 AsaWsAcv5G9vDnjwo4RsXSnsgb9mpTRZtXh0GczXU7ymQgtPIscMACZhJ+u9+MNo uDrtp1AvIOcwx0om7MNe4gwv3yMdCFwZyVlGNudQXysuymEj5Cxa4W9fgn/7CgwJ Fb+YSBhTRo8MsswXZOQew== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:17:55 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:21 +0100 Subject: [PATCH v2 04/65] clk: test: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-4-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=1244; i=maxime@cerno.tech; h=from:subject:message-id; bh=VkPVOrruF5FqCt4has6Fte3flpq+DUum5sJ0HsbRupA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp/yll1seLXoFEeiavmPhY805evWH5ladNrqys2tTy9H uMm86ShlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBEJgUzMvxzbEzhdPe6VW79r632Ye yFOX5dESsKb6d3bDa8HTWn4wojw6ub9XclXhZxubQ2pbZPaV78dwnHM6l7cZqynTJaRwXmcwIA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061757_487090_1A8C0A08 X-CRM114-Status: GOOD ( 12.86 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The single parent clock in our kunit tests implements a mux with a set_parent hook, but doesn't provide a determine_rate implementation. This is not entirely unexpected, since its whole purpose it to have a single parent. When determine_rate is missing, and since CLK_SET_RATE_PARENT is set for all its instances, the default behaviour of the framework will be to forward it to the current parent. This is totally fine as far as the tests are concerned, but we'll start to mandate a determine_rate implementation when set_parent is set, so let's fill it with __clk_mux_determine_rate() which will have the same behavior. Signed-off-by: Maxime Ripard --- drivers/clk/clk_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c index f9a5c2964c65..b4f37fbd180b 100644 --- a/drivers/clk/clk_test.c +++ b/drivers/clk/clk_test.c @@ -104,6 +104,7 @@ static const struct clk_ops clk_dummy_minimize_rate_ops = { }; static const struct clk_ops clk_dummy_single_parent_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = clk_dummy_single_set_parent, .get_parent = clk_dummy_single_get_parent, }; From patchwork Fri Nov 4 13:17:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031758 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 D93C4C43217 for ; Fri, 4 Nov 2022 13:18:47 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XEjBUPFYX+R7Mc4CAStfJsyawPdMTehTwbRdsQcq+Qo=; b=0HZDwVX0v1EgoR 3yaHogsKCZlOVioHjIqOCrpIC2Ed5Raq2bwyqid+xR/Zx8yXnC9qnU+/1RLOzzALkOLbmKAKvinyn sDgkqWnZzGHMHGjJ99FK5jQMpOmwNqZTj4i0l1SNZWXLM6sNwiCsxiQ3JWkzPjxlnvCx8+1/lbk+l 8zh2uDPM05OG27SwUwqCen2U5rMH8IokdxiZSp8jNej7a3d7yzct9GjkESCJsoehQ+ppnTeVrql5l BZTern2ryxA1mOB667jy3u4lBG/PIQCFjLoc+N/sSOR/YutDrgucmjBHxx9hHH9R/U/XXq6T4+wsD UGgSpN+hF6L3J919BYQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwat-003cyq-2A; Fri, 04 Nov 2022 13:18:47 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwa7-003cRP-BX; Fri, 04 Nov 2022 13:18:01 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id AE6EF5804A4; Fri, 4 Nov 2022 09:17:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:17:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567878; x= 1667575078; bh=ZwtWu0JKDLR1Byh5NP92pAZeUFp7QBOGOLGADdMx8VY=; b=G JGUxPP4wXZDut4uwJK2L26Gtsc/nPU/dLypnvFRtKBwgHKJVUqZ6iqdzA0NfdTi3 8GKVe24HnLDN3ZL8po6yZUxv2292nCU7FFMzxuO6JO0WFNR+Wkc1XLwgCrOAEepO CiLfGF28RdkDzDxWsGfjNuIHSqJRvoC0TRCqjiKzY/SxPmPisPiGx/zk8+YFay4f HrtWYqldqbcV5Ob2tMRuxYTkpD7rsCdW920sd5FOJIj8rib1Tpy6PqUTzrFy+KTO 1tCfUKqMyJ/oRVP5HISbwHUGlNINpnE0Ez9tYRPNSSJZSlXJj+Z0/Tj7KUkNERQR EddKNTWkTSx4NFDzivo4A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567878; x= 1667575078; bh=ZwtWu0JKDLR1Byh5NP92pAZeUFp7QBOGOLGADdMx8VY=; b=F UiIdWG1COOLexRKazWOWcN+/vAxMoXjvhvzzsiOU1Tr4hKE65IUxi4brSFaU2SM8 /aNdZ+unXJE2QUSbfi+hqwC0oUmSQcZ/JyRm5K+Z44fsOQSN3nZNqRhbqBYHbShy PaY2Pe3Pqz9qtM3PEFsL4uXiCUQ8JSOuVXEDieTyUdrforRxjBPt9thi/wcsyibz MQFavmVgtPbkMAIEplLD4rz0rsz+MFrpZqF8aF4+Stwq8DYGmiLmRgJ3TMKeZixN pzVWcfQKB52nA0tYBU7SLughSHuM/CZllJQf/v4V1q1ysaSxYBajEfo1qUvFE3XO KWoZNrz/jlaKV00CJvraQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:17:57 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:22 +0100 Subject: [PATCH v2 05/65] clk: actions: composite: Add a determine_rate hook for pass clk MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-5-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2565; i=maxime@cerno.tech; h=from:subject:message-id; bh=ldQa1y5iEWAiQ5ZhkDsR48TuBb6c9j4eafc8yAmK7Ws=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp/4Z5memNzjdjrghcLmL/MW8JUum3egX+BUTfL5Kc/e C15M6ihlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBEkowY/ldd8hX6+FeOL/vs8ZYpDb nsV9/kc7CEcPtfifM9b+Cu+5Hhf+KPn2W5MpMCjIMfel1RefXT8+4+g4godesVTMveyzK08AIA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061759_494550_A96BC001 X-CRM114-Status: GOOD ( 19.93 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Actions "Pass" 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 --- drivers/clk/actions/owl-composite.c | 1 + drivers/clk/actions/owl-composite.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c index 101706e0c66f..4c844a5613e4 100644 --- a/drivers/clk/actions/owl-composite.c +++ b/drivers/clk/actions/owl-composite.c @@ -189,6 +189,7 @@ const struct clk_ops owl_comp_fix_fact_ops = { const struct clk_ops owl_comp_pass_ops = { /* mux_ops */ + .determine_rate = __clk_mux_determine_rate, .get_parent = owl_comp_get_parent, .set_parent = owl_comp_set_parent, diff --git a/drivers/clk/actions/owl-composite.h b/drivers/clk/actions/owl-composite.h index bca38bf8f218..0a0eecc78344 100644 --- a/drivers/clk/actions/owl-composite.h +++ b/drivers/clk/actions/owl-composite.h @@ -104,7 +104,7 @@ struct owl_composite { .hw.init = CLK_HW_INIT_PARENTS(_name, \ _parent, \ &owl_comp_pass_ops,\ - _flags), \ + _flags | CLK_SET_RATE_NO_REPARENT), \ }, \ } From patchwork Fri Nov 4 13:17:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031759 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 81C8CC433FE for ; Fri, 4 Nov 2022 13:18:52 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cuFgM5QNeRqIwyUGlov5/T3iZoU+sRPqJ8wnSrsvBGc=; b=4LYN6YYgsYk+Zv I3uHpDCA1ojXyoIQQNFoJUHN7ysK79Gk0W5GQtNA4+gCkxIwhRFNeNhfaVUCIsKCep3doOW8d6MaV YvxBk/+r8QB6WXLMxeFR9tbRHJbxurKIaxSASlLNLPGZg5ZUdr9KxGSxElxrPKSTeqxmcNdFkX0A5 Bo9slsZSVP9JHXDoJ41ZymkDJkdr8dJ45desGH9hRYX3ueFcgEpDskao4dMOhzs4PeRAhopoZ3Ikp MhPZYFOZbhLb+rnaAiNxfhFeZwfCgtwNbwQqV8bRZELN3kFSMaeB/J64FoZnDFVMihnhkLyFVCiG0 zwsd+6W6o2p0X/PiTf0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwax-003d1c-Hf; Fri, 04 Nov 2022 13:18:51 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwa9-003cTF-HU; Fri, 04 Nov 2022 13:18:03 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id D3AC35804A7; Fri, 4 Nov 2022 09:18:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:18:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567880; x= 1667575080; bh=Khf7mx3VrFaYsjTSuZhwXgkGSrwmuaHnXNS9meURKw8=; b=Y HkHSc1p2aLPXfTG6LmeIqok4B49pM7AILQsdRN8j9tlv5wRVbrqNwYNIcUuiRoNt 8B69Co6a3EOhkwzhitZD0LU/ankShNbsKNsZIn6ZY9pjPOk+ZO3HA5PBug7PjNY9 iXON89R2995YFxbwAKHnWYbWo3WbI3uJcYfJr/4FSbam3kUOdzLVlEPWZF/WQcCR 828gnmlw8RLe3NvowY42Qv0lrHM75i1zyIl/mF6enfFjriPf7Y4gFsdin6mkfn24 B7q/+63nkF7c+kWsDe/fPe664f/K4oFucm4o8MsQl7GeJ0JauL1or4fvASTEP4G/ JswsqJo+xpiIRDm18yHiQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567880; x= 1667575080; bh=Khf7mx3VrFaYsjTSuZhwXgkGSrwmuaHnXNS9meURKw8=; b=R pHVIwOu/tgwO3+gxphdNT3OC6Dsa4VidwFO0CiBKA6ee+B1MRpf9pQ9/zyBmxI59 iSRXvbd+6TCMoDmPF7cToqlUFJfIPiZUC1sFNndXD32jBU5PhC4P1Kdw3fH1Xx2f tYpom22TUfKklcQVENP0UClSJTbgT0NTUy9wW5INI3+fh9dhZB2nVFLebC6IwWR7 b7em+zKc5OuBYxvLg9VQ64LNsW4fHUoNPBalvFgoewPu+W2KRkmroaxhzOnTHujs 2gH+m//17U2OoO9ZrHMDzvggqcxNNuWZgR9moBHd7r36vlGwEHImCxtsk9sf3ApL JcvyZ++57IpbSvDTH+Sxw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:17:59 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:23 +0100 Subject: [PATCH v2 06/65] clk: at91: main: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-6-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2485; i=maxime@cerno.tech; h=from:subject:message-id; bh=7EZ9zueUqfHZhXa1z3kMjzKNmVy6wrATuX9Z7Uo/274=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp8cAmzfqz9Itj1VbV0l9eDlzieHvskkvq9Okfocx7np sMqFjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEwkdTnDP8PvDnzcL1iqjyp6LVje+3 pNddXpP1LGDP/OxR0oOmrPaczIsFX0bOnagAsZ1u5H2Do9sk3dCj/5Bp0tvSz5RffIa4Fl/AA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061801_804469_62B62166 X-CRM114-Status: GOOD ( 18.04 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The SAM9x5 main 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 --- drivers/clk/at91/clk-main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c index 8601b27c1ae0..e04e72394632 100644 --- a/drivers/clk/at91/clk-main.c +++ b/drivers/clk/at91/clk-main.c @@ -533,6 +533,7 @@ static const struct clk_ops sam9x5_main_ops = { .prepare = clk_sam9x5_main_prepare, .is_prepared = clk_sam9x5_main_is_prepared, .recalc_rate = clk_sam9x5_main_recalc_rate, + .determine_rate = __clk_mux_determine_rate, .set_parent = clk_sam9x5_main_set_parent, .get_parent = clk_sam9x5_main_get_parent, .save_context = clk_sam9x5_main_save_context, @@ -565,7 +566,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap, init.ops = &sam9x5_main_ops; init.parent_names = parent_names; init.num_parents = num_parents; - init.flags = CLK_SET_PARENT_GATE; + init.flags = CLK_SET_PARENT_GATE | CLK_SET_RATE_NO_REPARENT; clkmain->hw.init = &init; clkmain->regmap = regmap; From patchwork Fri Nov 4 13:17:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031760 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 7FF04C433FE for ; Fri, 4 Nov 2022 13:19:02 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s1KPKPnPb5QQ/OyhAtMclos1usAsGUH3GgTs4zP4k8c=; b=OvfqUnZBfblwId Ng+9kVurH15GcLXgrlsNdb+O8r2LEtK02iGDmlPI5JCVzIpBTAXUM9HtxP1PInN3HXqEQ4D++/GcJ dZbV6xdsHqQPdwLeqAUotgDN9P7QNVnNn3GBjCGN+xPK9AYbjp+XPatzcJ1RLGNR2O9eIoJLNjAJC oP4o3Nf9Oh6kCTt2mcSSRVBDgq/Z+FdCrQrQXy4GAOPmhjfuU+PuKJ9xtqdpjR2xgTJOfNLVAIEHZ Y3yzRgV3CWhMsPT+Mk1oO9JUyRJXuMw9SAFDl57nuNznQbK+7OYcxJIn/CQKN/4ANNACGKE781otK zD/HREPrmQ82w40eff7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwb6-003d7m-NP; Fri, 04 Nov 2022 13:19:01 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaB-003cUF-HB; Fri, 04 Nov 2022 13:18:05 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id DEBCE5804A6; Fri, 4 Nov 2022 09:18:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:18:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567882; x= 1667575082; bh=+sGsriMY9gumtulyD6+ryWkyisaCZqEROGKJ28jHBsM=; b=R L3QSnBx+wOPF79j3Cpe8bMgpmaUP0S6erjJbqjLOJ9Ho0FrknPrCNp084KHHuqaY JoscoysehO3PNpkfIkzpimOGEWun8DIfg9KVSE6e0Qz2u0DQgWUdNxIANUCURI+i M0xWpmefH2qRTi2X+v4cTAAaJavV1jJ4gD21yaHaPuHXpa8E2UHToeRId8xLQdNM WXQLHwx537xr9BzNuAnVATKq2gLYAb5ux/Ue1d99PVGPod5aHxTl9mm6GsIyumv5 ZoU3uYR5MxLJgNsHvDaIK2Ynu39CqLFJbNtnmxEgF2FC1Bs1BhOLg9nLBwLLxqS3 0pD2s4HXDz55YawdflZIA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567882; x= 1667575082; bh=+sGsriMY9gumtulyD6+ryWkyisaCZqEROGKJ28jHBsM=; b=h VS7UTxOlqO2nT9CGDsz7XTecQdQ2WsmWmLs5Z2mxyfmZEnW9Itlgw8c5vHMgklwn KJC372oVOT8UaKVwu5MpsvVplaPGKk5VVcnPwjWnN/+JxjZlVHly5jB6NMOIWBHs 7Gp4PcrIASOHN3j4il+PkQmjwVlItzdxEo4D8TE6kU9dWQvoeUyfl/lhLh6JmKRB duz8t2faQNR3y/wcdExkXF7AaCT9SctUt2arpCml1/aW6f1AVIE6m8HzkoCEUJsj 9q3dMRIvdPeJGsh95Jw0QkWM4Z0pCOHWlRfhFbE6ZYSkzkGRVOkz/oDvpm0VVmVd 318psvDVqeWb31K7fwIkg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:01 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:24 +0100 Subject: [PATCH v2 07/65] clk: at91: sckc: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-7-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2307; i=maxime@cerno.tech; h=from:subject:message-id; bh=GMav8u9gHBIjeuouIjRsu7I6ApdOcNs7sXTeIwxStJs=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp8Xrk2fs77P+JC/4UmRXX0fxHdu5Z4iIr325LR5d58l 7Cln7ShlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBE9ncxMtzjEkm0q7X/tFfHqUX4Ks vzPROc09SMfh2Xbk2IOOgb08/wi8lNpshbdl6ppAvjh30mys3N2bsy5xjW/r2nsql32wRtdgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061803_787483_AFF01D42 X-CRM114-Status: GOOD ( 18.21 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The SAM9x5 slow 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 --- drivers/clk/at91/sckc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/at91/sckc.c b/drivers/clk/at91/sckc.c index fdc9b669f8a7..9c42961a8a2f 100644 --- a/drivers/clk/at91/sckc.c +++ b/drivers/clk/at91/sckc.c @@ -310,6 +310,7 @@ static u8 clk_sam9x5_slow_get_parent(struct clk_hw *hw) } static const struct clk_ops sam9x5_slow_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = clk_sam9x5_slow_set_parent, .get_parent = clk_sam9x5_slow_get_parent, }; @@ -337,7 +338,7 @@ at91_clk_register_sam9x5_slow(void __iomem *sckcr, init.ops = &sam9x5_slow_ops; init.parent_names = parent_names; init.num_parents = num_parents; - init.flags = 0; + init.flags = CLK_SET_RATE_NO_REPARENT; slowck->hw.init = &init; slowck->sckcr = sckcr; From patchwork Fri Nov 4 13:17:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031761 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 594A8C4332F for ; Fri, 4 Nov 2022 13:19:12 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MEaJrdpX25Fpk2XHpioHHNcgTtSw9YBuiWE4qA3B2UI=; b=e5UiolbaNV69es lj0VdP9qtZrUcGgtt4zWNjWDn1CZJX5L3CImLSHtidGBnMDwLB4M07tFTFD3i+znDnINODrk7C6Rh mnRyMBAfEt75Z+xakPns1x8JDunysOsM5i1b60rIGK8ruxi8u3arTgLhNt9orIJl91aYBKshtenvA e0Y/2MnxaBxNPhHJCYPI+gSBAtdzWDwVKkoXxBhsS9Jka625Ize1ImnPblje3i+JRcPNE2WhJHUFJ BxgbdbWJ8UMqSrefrGMFlHS80tKIt4pCVFkSTca+fpXDy/6whY8nk+g5t4hi50ls9lj4hxystRi3v DryFJdktVVTSZIi01peQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwbG-003dEn-RA; Fri, 04 Nov 2022 13:19:10 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaD-003cVS-HD; Fri, 04 Nov 2022 13:18:07 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id D61615804AA; Fri, 4 Nov 2022 09:18:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:18:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567884; x= 1667575084; bh=WxUAaKixVvU/205sBMrlyzx56UfytsEBEtr4Q2Zomhg=; b=A dsj3xE0kRj3BbcNyKVge1IOecqubO9Lu74IyIBvoEBmmD+WjwW6wEaE5Zdjc6s3r BnFpPbe787na/KqzJ7VKnE6F8I/7m9VDbItyVSDhPCwWFnFojHaIMx/7eqhX/7Vo 9MvNOQPdaByn9uTLmddFofcBrqOvEwioZ4RxP9LgDXzJYdp5sRAjtBF744sYOKOP KQWjxO1SLbDZFmPypzXSa1YpHtPmLMsCBjnBxmgXL6Gq3lAEwD2Jeqtj1VBxm0r1 1wxGw76xYXFfg5GPPKm3fILP6kNjLGi3NyiON/ZqljxO012Odh9wyLByi9tRC5Zx RE5+d09VBNTx0kMUqNPRg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567884; x= 1667575084; bh=WxUAaKixVvU/205sBMrlyzx56UfytsEBEtr4Q2Zomhg=; b=n NsOX9jfuAjCOEfj3YDAQTjDigFd2psVcv50r05YnkeX9t0N6ocDWz8CJIMj7PGWT +gpiQfYeMsYr4SqMt+uizIVU0yx3bIvN41PKUeU0fdTebw+iuPJEApEYp7RxNbxn kJ6upjcX1wkTtVUj2RXskoSn04uNpB5h8L6Q3ASwAW1Z0Oq6eq5HAQLPyGT0723g g6UcEPmuCxcqZhwWvQ1valCrCZs6r8Rsl0YSgtgfFPN6bx7E99baBXDXrtcz6kQw ppDnXut97vSUNxuyM13jsw6/fMDIKniGqCL6mBOroh4SRZa5+F0wU0hZqpBZxmPc I1xU25KNw3gEiA57WDTBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:04 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:25 +0100 Subject: [PATCH v2 08/65] clk: berlin: div: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-8-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2348; i=maxime@cerno.tech; h=from:subject:message-id; bh=rPWuoAJpzdfQjtzAAQ45iaax8gcc52kLdIvyFXY8Ndk=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp+5jIPaZv4qnvTtXzNrQ4G+4brPp6pnquw9W9wekrP2 59k5HaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZjIvUSGf/Yvq87//SK+XIz1AscJL4 GTMYpXX5TYbThVMv3klIpla84zMjQtd82892qpl1BS8f9HiYvWzJ5a+t+eI2IBa59DSI3ZSiYA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061805_756167_4A4CAB0E X-CRM114-Status: GOOD ( 18.33 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Berlin2 divider 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 --- drivers/clk/berlin/berlin2-div.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/berlin/berlin2-div.c b/drivers/clk/berlin/berlin2-div.c index eb14a5bc0507..d3856ec93c12 100644 --- a/drivers/clk/berlin/berlin2-div.c +++ b/drivers/clk/berlin/berlin2-div.c @@ -210,6 +210,7 @@ static unsigned long berlin2_div_recalc_rate(struct clk_hw *hw, } static const struct clk_ops berlin2_div_rate_ops = { + .determine_rate = __clk_mux_determine_rate, .recalc_rate = berlin2_div_recalc_rate, }; @@ -251,5 +252,5 @@ berlin2_div_register(const struct berlin2_div_map *map, return clk_hw_register_composite(NULL, name, parent_names, num_parents, &div->hw, mux_ops, &div->hw, rate_ops, - &div->hw, gate_ops, flags); + &div->hw, gate_ops, flags | CLK_SET_RATE_NO_REPARENT); } From patchwork Fri Nov 4 13:17:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031762 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 60EA2C4332F for ; Fri, 4 Nov 2022 13:19:22 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oBbq11A/y43HSSEszok2Pa7Ti7hbuSzVSmncwOtE0hQ=; b=GCZp9gSBmTP+QW ziu/L//laY5gjiFY2gLCahS96IPxph5jtVqsw/5GXE91yqX4wLv7uOnNc7mDzCTIStPfzk7WKkuQr DswuTNMO2YYMHJ17wFBQWxnTchG/ktYVrl0DEqvdOF+3iNNwwTPnnwm85qAY+L3SuI4jXqWuOj5nG 1YGXc3xY1MXf9RKm/ETm+dDdoBTD9NS911RKnr46t2Co7QBBVt7w9GeyyGK9CVbwLV0DFBk5zR0hx as8zu1iStMQU/42LOZA6flzhSvtad1+uqkd4BZO5KQMZVatJY4Fl7lXBjTMqEsYuQTi6sLkBjaAMb LVZ8NAs+QNla1BxLpZTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwbR-003dNs-KN; Fri, 04 Nov 2022 13:19:21 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaF-003cWr-Pm; Fri, 04 Nov 2022 13:18:09 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 28BBB5804AF; Fri, 4 Nov 2022 09:18:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 09:18:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567887; x= 1667575087; bh=y4Ya3eCzhqjyISke/moSgSMqf6z0p+qPeXmjWCndzHU=; b=j q8NTiN392q0nST1yAbBFObAp1UEDc/ojmFpT0iAPE5z/r4PMGaC4fId3iQeGptm6 FWLjFpinVP93MH6AtfhuG3R3SoLLFoy7Ke5YHAUs5NRsjZu0uQiMbysmoY1dkwTI lTPsfhAswZIEIeb70VN4e87W9T4f8G4VyeMeXaeOv6bmzBQIpPd9z9kbLQfZ92eL bHvrTVVTbn+vidqn4F/HCflk5PGgsXO0XEkqcbhSnkYzLL9weGO7sbtL2Qt30r0J Z7hcYluTfJwRlSPiZ1Mra5i6LDqTr38lVNjwtzJyTfCYz51+AMQG7mX7Mp5QCgar he1KgE1rQuT2sC3gXmQtA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567887; x= 1667575087; bh=y4Ya3eCzhqjyISke/moSgSMqf6z0p+qPeXmjWCndzHU=; b=p 77m4SJ3Yda84OApgc/2qiMXwwvw1g0Qrf9oHhpsFVO3hYKyr+84+1KOk2sCQa2Jh q777cbTvERCsGgx1dba3rYSROY0hi7SxlApSXhYI3lFK9HGEkfPedFNZuyxYrHxw 1oOHLGEjEAcefv26az2D8veoJZKUNWIZnPj0zGHecB6CKh6L8ZU3hl1WOyOHsoB1 RhDTJ51i6qk4wJvkuy+rNcYpaZjfZ7lA+PBJsSij1mrE9eMQx2cBkyZGDE034VmJ UfFeOdokhtBfnWgXL+VG+yaishbaZs8oKmpAbK35L59OWDQYoc70pZYgkYI2WBDn GbEgAFpWL5qEDZZeobzVQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:06 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:26 +0100 Subject: [PATCH v2 09/65] clk: cdce706: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-9-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2293; i=maxime@cerno.tech; h=from:subject:message-id; bh=RUSlZTA1lXUfioH9cYv2z56GCip4AdcMS3Tt/tJ571A=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp/jdjHF5kS81ErfGnJ/s7xM08HQ1+oJQneeR1y7+6uY sVuuo5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABMpY2BkmFSmsjvlVeVlaZa4NRe/nv zyx8zcvL/+lyTP7IvzfvxtWMzI0Dzj1CtrpoUC6teYVa2tEqWbK4x17u/d/tZoddbvpVWbOQA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061807_951975_8F7DC067 X-CRM114-Status: GOOD ( 17.75 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The cdce706 "clkin" 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 --- drivers/clk/clk-cdce706.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c index 1449d0537674..dc046bbf83a1 100644 --- a/drivers/clk/clk-cdce706.c +++ b/drivers/clk/clk-cdce706.c @@ -155,6 +155,7 @@ static u8 cdce706_clkin_get_parent(struct clk_hw *hw) } static const struct clk_ops cdce706_clkin_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = cdce706_clkin_set_parent, .get_parent = cdce706_clkin_get_parent, }; @@ -471,6 +472,7 @@ static int cdce706_register_clkin(struct cdce706_dev_data *cdce) { struct clk_init_data init = { .ops = &cdce706_clkin_ops, + .flags = CLK_SET_RATE_NO_REPARENT, .parent_names = cdce->clkin_name, .num_parents = ARRAY_SIZE(cdce->clkin_name), }; From patchwork Fri Nov 4 13:17:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031763 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 8D319C43219 for ; Fri, 4 Nov 2022 13:19:24 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KFqstWeH4m8q6SdKqco8t0Hj6ICfe1o96zUxOxNdA0Q=; b=J5UAS48fOKdrU6 a0oi1V9a9YfftB56CoUxEtQdYMWMvHoXOp2M8cA/Hg/S8F699WTeEDSRvKk+d3Vyo1oAjK32+Ko37 dQuKrdG/ztUVRVgFdVoPwEG9s+vOE5Yc9/34D9gp9Ah1Wh2XrW1eFLHV1V3RW5W4UZHB1lkyCZoTG cEewEBVi+MNqTATeBybNjpjGjSdGKmaaw8a9DzsjpKW7crpPJz/bwIpYrJEulXMdZ4/xmM9BCncDS n8dUgtR/uRh7rtjRY35kj5us7GaEEZlpqA9nCHZQ4d5MBlImdnLx2r+zqwgp3pQfHJO78EqBVu3ZD epxrprJjgLsBtoKMVu9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwbT-003dPS-Hx; Fri, 04 Nov 2022 13:19:23 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaI-003cYe-45; Fri, 04 Nov 2022 13:18:11 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 5FD305804B2; Fri, 4 Nov 2022 09:18:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:18:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567889; x= 1667575089; bh=HSdFwQ3aW19zofmGUIyzD52AzOA8mMIUukqySVU5Fxw=; b=g exMH46JBY4nrfTxtsAVPMinzBNkX+8+g6BdrM/jCohcU7TfjvqLP0pv8xrPVI573 L32KLdvZgWspf84qIDSefyC55ognb8gtlpa4gyenbzihCDx9B+aeBh75uAKsuPc/ OMePI4Ukr7zyZf8TAWbbpTjlf1tGfjlMB5KhJq2OWRwSrsvReua9KUhfdINkY1HI 5+00U+dfoHwTRfbfqfqRWy+6Y2D5LQc3aw1yaF3AXQuMQMTXHPG90kHp+DvsjSbL 3f51o4E9huiwauUyMwg7M9+PCvOrGMJfpm+q7BjlKokD5jSnl0kEapRyCSSE36OC WUzsSr9BxIAmcSlZUqCnQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567889; x= 1667575089; bh=HSdFwQ3aW19zofmGUIyzD52AzOA8mMIUukqySVU5Fxw=; b=A biPP7HxWRM2nrGMfQZiT/vH7QrSVae2oXaq6/ibwrHHKDCL8eWdvnqH6TDSIqHgs Go01KRYa0XITm7jMTwJMfXDd/WrKe89YEtVhP4yR1OT2LIdtwWt8QaWfNHqzJBoY jSBDzq9m03pjrd/48dAPSa0BBuBEEPs1gZdyU+4mhnixFcoDGW7wSj5K9nklAuFv xM/kbaGWkC+f74B/lfSyGa9GU4qTj/iEIksYt1WPLs9pXrqNh4LV+6VyazMtGFS5 6qE3P4anbi0F2a9f7Ezp2HsTB1zsC/BAfWFhjNeONJz3wnYcsyyz5WZVeJkD5S8u kfLnT33QBGCbvRnT1HgWA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:08 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:27 +0100 Subject: [PATCH v2 10/65] clk: k210: pll: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-10-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3687; i=maxime@cerno.tech; h=from:subject:message-id; bh=6IusAj9w3/tB8c67BjbXsxFLlirYjqevo85MFxaRu+Q=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp9nzthWO/9t0mWP8nM3/zoJhbxUmy21Sfoov+JM69Pr Dvfqd5SyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAi07sYGVoy354y73h5YENih8nUsr g9MW+nWu4+9+yQcnpXSND8d0cYGf6tkbWT0VozTcysrrua6ZDO77JVH8/Or98hHfVx9uLcRcwA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061810_387706_59DFA2E1 X-CRM114-Status: GOOD ( 19.48 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The K210 PLL 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 --- drivers/clk/clk-k210.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c index 67a7cb3503c3..279931a38127 100644 --- a/drivers/clk/clk-k210.c +++ b/drivers/clk/clk-k210.c @@ -537,6 +537,7 @@ static const struct clk_ops k210_pll2_ops = { .disable = k210_pll_disable, .is_enabled = k210_pll_is_enabled, .recalc_rate = k210_pll_get_rate, + .determine_rate = __clk_mux_determine_rate, .set_parent = k210_pll2_set_parent, .get_parent = k210_pll2_get_parent, }; @@ -544,7 +545,8 @@ static const struct clk_ops k210_pll2_ops = { static int __init k210_register_pll(struct device_node *np, struct k210_sysclk *ksc, enum k210_pll_id pllid, const char *name, - int num_parents, const struct clk_ops *ops) + int num_parents, const struct clk_ops *ops, + unsigned long flags) { struct k210_pll *pll = &ksc->plls[pllid]; struct clk_init_data init = {}; @@ -558,6 +560,7 @@ static int __init k210_register_pll(struct device_node *np, init.parent_data = parent_data; init.num_parents = num_parents; init.ops = ops; + init.flags = flags; pll->hw.init = &init; pll->ksc = ksc; @@ -574,19 +577,20 @@ static int __init k210_register_plls(struct device_node *np, k210_init_pll(ksc->regs, i, &ksc->plls[i]); /* PLL0 and PLL1 only have IN0 as parent */ - ret = k210_register_pll(np, ksc, K210_PLL0, "pll0", 1, &k210_pll_ops); + ret = k210_register_pll(np, ksc, K210_PLL0, "pll0", 1, &k210_pll_ops, 0); if (ret) { pr_err("%pOFP: register PLL0 failed\n", np); return ret; } - ret = k210_register_pll(np, ksc, K210_PLL1, "pll1", 1, &k210_pll_ops); + ret = k210_register_pll(np, ksc, K210_PLL1, "pll1", 1, &k210_pll_ops, 0); if (ret) { pr_err("%pOFP: register PLL1 failed\n", np); return ret; } /* PLL2 has IN0, PLL0 and PLL1 as parents */ - ret = k210_register_pll(np, ksc, K210_PLL2, "pll2", 3, &k210_pll2_ops); + ret = k210_register_pll(np, ksc, K210_PLL2, "pll2", 3, &k210_pll2_ops, + CLK_SET_RATE_NO_REPARENT); if (ret) { pr_err("%pOFP: register PLL2 failed\n", np); return ret; From patchwork Fri Nov 4 13:17:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031764 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 CF3C0C433FE for ; Fri, 4 Nov 2022 13:19:27 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2Nb/LTB6ekDFM0an13CRtbKfjAID+K2c9520gmaexH8=; b=g01DYDzXkoql5z JIfbCmJW9+ioFFjDNPygUoOhl6HoIuI2/IG8zfA8LrhE5mEUrr9f70cRQ//g8HeTplImjOCx88JJI GyI31Fj38dgCNKWDmZLGHJOElTCmJpkeWk25MVFLrF5xc7B2HYI7bzYzYMXdZcJyHNkdfcqVjx4VR sFSqpWAe/InCLib58uB85ePyNU0BpCoY5RnXZMn4Y7GJnqSrccs7e3v9cKHnsBZclHmAiqUpil+2j Kt4h6V40fnWYhwusSuqSmuGeQyfzffuFNPAFju41gA860JeMNM7T78Pgxn5RMXDnHzt0oTAS/sMKk ONNvWwcYfkgNLy0LCFcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwbX-003dT4-43; Fri, 04 Nov 2022 13:19:27 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaK-003caj-6d; Fri, 04 Nov 2022 13:18:13 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 836E25804B1; Fri, 4 Nov 2022 09:18:11 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:18:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567891; x= 1667575091; bh=fmnbd20vnai0Isz1Na1SFvb6jzXJYKrz2269y3tcZXo=; b=C oupMYwVAU4WGUwrdylKXOPlxhygxfcRGnWp6IwpQkm4YYtTHyAKoct293YeCWZXZ 8rfr1ME2p/GyrfDv8oDDxmf2e4yG5bUatgwp430EnNSCsXFsHzqGJiz8Ww0BqR0k j7jNiHqCoC/cowwZb7ACLnQf3HhNeBlRsc2An1cZvKrtbpjITe1RAlgcmY1A8wZe hNSLfcAMlRgiOKr8M0NErhYhxQK+vcfs3B92SPekPW7+/QlHz8w9TK08eKhNDWdW Vnbjxs2GgTjwJ9he/DdVCwnTKcI1ezMt88jjRC8r5z3qnZLuh32+95TFtPv4r08G K1DJikoMzpK18M3jUuUxw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567891; x= 1667575091; bh=fmnbd20vnai0Isz1Na1SFvb6jzXJYKrz2269y3tcZXo=; b=g UjzDA9JjkPwIuc39XA9n1T6FwrGwA++nqNr6afztTE8pmRMap/DnqYopuHU5e+lV 8Qw3bqJerP7ZAonKJs1UoP7P0I71j+JxkATz3ErQl6hkfSo+t8ekXisNL/h7pMMK vmYq/LO/yIvqy4MCkKySajNaji4AVcSyAeDndK+y3SHfZrr4pvrK/WcRzFhvtAgq K1zbe/XTx3o/HJIzSh7eVb8lfVjm4pRHtSSrC/yp/X3JBz63DZb/YDR34WR8wR/Z yOZ62d4C4IBMmbsEUKk+U4yuiJAGxhQdXn7f8uv75RtQtwF5q4z6YBbCMWPDHWF/ ImxbV4kvYVXO3DZ/OpKSg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:10 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:28 +0100 Subject: [PATCH v2 11/65] clk: k210: aclk: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-11-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2301; i=maxime@cerno.tech; h=from:subject:message-id; bh=9Rjc30gdQbiTU5mY+5IHrTTpT8oxx4VPce37OsseMFE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp/F1z66cCJxStfCZub3C97tWJWyoZLbwXV5wvX/zVUM ihavO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjAR6VmMDEtyuXNYNMO2b9lc8V7Ucs fCtUJu/bY9FZdfP/2z7wGzzgmGfzZ3xP66uU+wLN7h8NTnpPO1tNdq6n/maezsluS61LbpFCcA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061812_363377_7093E7FA X-CRM114-Status: GOOD ( 17.97 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The K210 ACLK 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 --- drivers/clk/clk-k210.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c index 279931a38127..5b9fd00d14e1 100644 --- a/drivers/clk/clk-k210.c +++ b/drivers/clk/clk-k210.c @@ -639,6 +639,7 @@ static unsigned long k210_aclk_get_rate(struct clk_hw *hw, } static const struct clk_ops k210_aclk_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = k210_aclk_set_parent, .get_parent = k210_aclk_get_parent, .recalc_rate = k210_aclk_get_rate, @@ -661,6 +662,7 @@ static int __init k210_register_aclk(struct device_node *np, init.parent_data = parent_data; init.num_parents = 2; init.ops = &k210_aclk_ops; + init.flags = CLK_SET_RATE_NO_REPARENT; ksc->aclk.init = &init; ret = of_clk_hw_register(np, &ksc->aclk); From patchwork Fri Nov 4 13:17:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031765 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 4F97DC433FE for ; Fri, 4 Nov 2022 13:19:36 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PkuTBt6pCgE4D3vc1sMbD4itYuvq3mmFypPpgc7LwnQ=; b=gqnEgSlkNS0blt HRRE6sY4JJUGa6q4QtwILXhXhvR5mbMRqUI5y7J37a+nUYotLHUysbZqfVfytvdLsg+HhIUpK6+S1 HD2rgNQUV9stWRnhoDi6z5XI7bdEYgeBGpCdOnU6YwrknV+SEfIcInSpSCAa8bkbxrKhTR5AHLvHW 6hncBTGWCjX8iUavgSisrHS/AUHkWpScdKoRoYVK50JHltaegRxoZzS+VUjPhBQKJqgFRu+wqAtTY nQyfiJlYPLiCkhLgkckhMHfZfgrVquQEseteo37IaKjQ55F7UkrclPv5EyolGFQ63HtJz2Potj/NJ SasYk9STxIH8XhhXR4Gg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwbf-003day-EJ; Fri, 04 Nov 2022 13:19:35 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaN-003cca-1z; Fri, 04 Nov 2022 13:18:18 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id E82ED5804B8; Fri, 4 Nov 2022 09:18:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:18:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567893; x= 1667575093; bh=OsqVSaB4puHg3xKhCHX6duSiOM6c63DJuikQrynCI44=; b=J UdmX+9OKT2Rm/H4Zvu4K4UuKBkK1sMcCKQaVisqCi96xyOcKWhfAdPkpBvu/d8i7 DTe+qV1+RoQExQZN9ZLePj0t/mZ6Pr+SFY0av3sKpTtyl361UjVFrLjGoTPGhT7r YXLC3MMFT4Q+GdO8dJ44D02tJE6Or/dutXkttpYCJFAMMXW8rx/AybLqjyBZ70V3 c41Sx627XrxI7RjWbmiAIdedoPMQEc3jzrazkJeOSooGhCH5KqObWRFY6YhCjQho TshI9BVXpGzfsX3I7mSnW5WSeIGYqPtOW2mMmmJUxaCoBY+qL+3erKEkaSMhBICT igJ28mS7cTnY9F2hP8Djw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567893; x= 1667575093; bh=OsqVSaB4puHg3xKhCHX6duSiOM6c63DJuikQrynCI44=; b=Y IkzRWpABgj7fwxnSUL/qucvfBI/d69CQlduw7Tc+W7f3sIzFPGpGrdNHrD6Clu5v g77nMrZ60/YwKP31G6cUe1HdtRGN9OCh4xkNWc61Rx2dVkAPyrsajDY7a6Vs1X3I dsQVEyjSu2cbZo8x05vEGY0TRkdf2GMEByECJhpO3Dc0Z+PGHOjMmYflqFuMpulZ KaESgglUPSCMhHcnVAJ4tp/Rs6sl+wDzp2tB6mKq7jV4vtY0AIPfhnDm1FkeozI0 6MdJxNTZ1zIqha32nI5F4U5msMpYAjgGzOKYuWFD42w9K8q/pB1aElL0b7/wA5FU +BceI7UF5yfnUV2g5H+gQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:12 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:29 +0100 Subject: [PATCH v2 12/65] clk: k210: mux: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-12-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2437; i=maxime@cerno.tech; h=from:subject:message-id; bh=Gej66EsLQRO3ewM0fRnTAOk0KO3GEvBFH3z5OOVIT6U=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp8dNxo9c8+bwh8eeYrv+62PPtM/1YozJZderJgWpfWJ uVe3o5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABMpP8DwkzF56zNRqdWf0o6Gxx0J3X 37ivsXY6+mzc9zF5bLvzRjZWBk2JeW/O9TzQcx6T/TGS+Jv/e7wzB5qYDD8d3nJ1fwf7LoZQcA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061815_434370_CB22587E X-CRM114-Status: GOOD ( 18.37 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The K210 mux 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 --- drivers/clk/clk-k210.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c index 5b9fd00d14e1..cdd7230f8f66 100644 --- a/drivers/clk/clk-k210.c +++ b/drivers/clk/clk-k210.c @@ -780,6 +780,7 @@ static unsigned long k210_clk_get_rate(struct clk_hw *hw, static const struct clk_ops k210_clk_mux_ops = { .enable = k210_clk_enable, .disable = k210_clk_disable, + .determine_rate = __clk_mux_determine_rate, .set_parent = k210_clk_set_parent, .get_parent = k210_clk_get_parent, .recalc_rate = k210_clk_get_rate, @@ -832,7 +833,7 @@ static inline void __init k210_register_mux_clk(struct device_node *np, { .hw = &ksc->plls[K210_PLL0].hw } }; - k210_register_clk(np, ksc, id, parent_data, 2, 0); + k210_register_clk(np, ksc, id, parent_data, 2, CLK_SET_RATE_NO_REPARENT); } static inline void __init k210_register_in0_child(struct device_node *np, From patchwork Fri Nov 4 13:17:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031766 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 15CA5C43219 for ; Fri, 4 Nov 2022 13:19:37 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FyQJi7pCrLMeSFbpUz3+KBGlJcjY2lmwrNZZmoLqdJM=; b=IaSqONMMkv520L vh/Vagf+g9/8H8oYp4TqkVXjRP9jnlbNUwm3NOD5WRWtKcHwxK7vUQMiA5D2prIQWa5Fh1FZKNqDy MtCPx5IITT55ZyxjeE8ZeGdvtM3UsnbFEfYOVhP7NtGi3/3TMOQIRuUkbc5iFD3FaeKIrxgq+6Tk8 4ruDBkQz8P26VuSfYn4qCu8BQ8XPhDOHCvvCvHkK38hzHD1n9X2ncEqIxIRhVvaxQrWplUzm+4wWW sSgCjHJ1FZyCcP6+1hnErJzQ965/NpTp6dtpBSwJAnojNT58d+0Gr8q9JHz3cWpCrxnbogbykKylP MC4XdxJlmXd07QxfBQ0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwbg-003dbQ-1s; Fri, 04 Nov 2022 13:19:36 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaO-003ceQ-Sq; Fri, 04 Nov 2022 13:18:20 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 2559C5804B7; Fri, 4 Nov 2022 09:18:16 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:18:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567896; x= 1667575096; bh=IZ9UQ4DbVzbIJsLd1t+7sQBLMSQknh79wDggweQ8Tfw=; b=H E9+GFigRxmJ0btH19cuEF1I+Q7oSyo2VB5yjUzcKpwPw6+hgNZssum7qye/gfJXD oI1LVsmfkuX1QxODfaM6D/fBolvl2JJZE3GG2YY4120499IyiZhQ/zZHEeyzql+G EHFEX0WSOgf83/dH4VWUEcPcdoEQWJPYaN1ZO/u7cKqHYraZnfidoD6VyixptwRl oRECi31IwUGxrMoGE6yxPw+n9SsBdtMG0eSB6/KYQQz1dO6cnsRK0BpmdDMit3f/ puOZmH4v7PuvPJRmPPVQhSNbiguZ4IEUuG6c0tZv339equzgA3yLprb/2vQVNQH6 uYstgbrwCZzIZNR6dJnzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567896; x= 1667575096; bh=IZ9UQ4DbVzbIJsLd1t+7sQBLMSQknh79wDggweQ8Tfw=; b=h 8f/i8gyuyu426UDXEklkTY33MOqF0cm6Q2e3NUACnLO/Gvy1hKqFyetHdmpF+mJR kwlIqEBI9vvMrZZ07BA8CYO4l/+jWb281w0FmNHoulubbktqTtoiWBHc+aG9yO2R vzfvfU24V7E/IRWWy7cbkyNJJr48uX6w+wzFByTpGUzrF+JydvMncB9v5Tzg7jiL PaOym40VVFsCRmcxXt6C2VrNRll49V+3Ju1+pnOsDYt+3Zbk43td+kekTjG3OypV DEUAVaU/Tqww/rI6GuIKA64x9g7nI9guZGNtuV0aGi48kMUJpTJu0AiovAeZ0Qgy xy6lSlyu7kGVVeiDfp9wA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:15 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:30 +0100 Subject: [PATCH v2 13/65] clk: lmk04832: clkout: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-13-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2171; i=maxime@cerno.tech; h=from:subject:message-id; bh=Qcdipb0o2ae/N8jSEKXNaEcjkI/bera5lXalhrYMenQ=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp91ojkiNA5wfu7ViHnF/fB8QWK6wK6jDjnn/55cf5Nt Rc/XjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEwkSJjhn2GvrJd9wuOtbOyub4KEai 3/bmF26akq352iUJadl1BixMhwfa7Pj9S2Fya3301mOn58f8HWXxOWGCh3Ln5xR8xn0RI3TgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061817_148023_630E6DB8 X-CRM114-Status: GOOD ( 17.12 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The LKM04832 "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. Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems unlikely. Signed-off-by: Maxime Ripard Reviewed-by: Liam Beguin --- drivers/clk/clk-lmk04832.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c index f416f8bc2898..f68bb0affdad 100644 --- a/drivers/clk/clk-lmk04832.c +++ b/drivers/clk/clk-lmk04832.c @@ -1281,6 +1281,7 @@ static const struct clk_ops lmk04832_clkout_ops = { .is_enabled = lmk04832_clkout_is_enabled, .prepare = lmk04832_clkout_prepare, .unprepare = lmk04832_clkout_unprepare, + .determine_rate = __clk_mux_determine_rate, .set_parent = lmk04832_clkout_set_parent, .get_parent = lmk04832_clkout_get_parent, }; From patchwork Fri Nov 4 13:17:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031767 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 4FA61C433FE for ; Fri, 4 Nov 2022 13:19:55 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=daeRQjAQ59ZoBH1+lrZAzWt6UU7FGOm9yV0uJwLJpSU=; b=YEAuMjNHMATtMn t0nc3eL1iu7khqsxSG8FgygfqPnydsfaosOo5wnHXZR/muRjZOSRMHiQQZpZYgnkATrMrD8O9Z6+O QESpSZwEmlAkN+7oGE761H0w62jo9EcRPlxeA+FVDofS6ysTnFdF5uzY7e2I0P+odhbuIFrhrBWGG jHDNR5yJT0aj4w2ohGv5cRy8zoFdKdwk1B0LVonR0ceXeENlAq3ddNnIcMhMmgG9SYc4Yh4sHo0GX QnAov4UUdaMRR3NDM2XQfhFXHyxI9JSDvM1m+czSd2h6YTkfFIn6Z9aqKHLakb5wEeQqGIhVawexk l/Mnqaut6AUslyA9PY2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwby-003doY-CJ; Fri, 04 Nov 2022 13:19:54 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaR-003cfb-2x; Fri, 04 Nov 2022 13:18:23 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 3AE285804BC; Fri, 4 Nov 2022 09:18:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 09:18:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567898; x= 1667575098; bh=RuuyV6S71+mujxNJX0cGId978o4gpdLcxFzG55JMY70=; b=A frxmKpQz5PIfmG0qLjdZSqW7AoZsGjSfzZKtxxaOPp1kCJidyD8f0bOAfSPYnMMy d5fXveH+dxeLatQ3ssR98LN/49pHk5siScG7lCq9P7obrbgidkGqjy8+Kcz4rQeT spRw37VS299Ze1T+zzAkeOqzwv2DxGV8ouBO081Lhv82Lwa7ZZlbCpA9hkv4GTBH 4p573/B+5MPB8YjWPPZO5FTjnbdn4EQhbtXd2gO5CV953lnj/WhKe5Nv9gfKMkvd NX8nfhp81j9phHvZWCufzWVP5iw+3Mdq/FJFZXnXssygtlg8D5lipZxkp/2P9OsX u9g9zR8yq0KACsUwDH/GA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567898; x= 1667575098; bh=RuuyV6S71+mujxNJX0cGId978o4gpdLcxFzG55JMY70=; b=V 07rfJmHapq4vYXjHv+1IqqohB3jLzWPXwfte5tQarX/htpZ0ctKOFH3ZmzGOLLH+ 74vH1raGIyp153k6YdlEqwvVf4GxPDLHaWjDhxNPAln/z9P8y/08fCaKnfyHr0a1 oZWqNTZ/hpBe2HdX1+K1nHUm7jW6CZam9DoLZpkuzS+bHBnFLPzqFLF4FnSvf8qP sn71Y/co+S47rd5dX0HsitGkcldcQSiTvWWhxuNcnFuoT7XVI3zmMFvltoQOgJnW swqRWB4Worsu1UJ2oofemnGEvLXVVgp21pqPfrhkckPV2e13+Gaf6Nst4UGyrF+G RsVXvXRaKvXW1wL+Qw26Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:17 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:31 +0100 Subject: [PATCH v2 14/65] clk: lochnagar: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-14-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2353; i=maxime@cerno.tech; h=from:subject:message-id; bh=JCLc4VWVJIPdfsNjAzEAtfaos/KVBZzKQohFfHFKU9w=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp+XL+XhXHGidRP/w0rpAvW1x2redm5d+XXxIvOOClW7 G6eiO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCR5mWMDH1VR5Lqoi+1iH3VcdpefX DftnVGM/mUGTg+bbz98Nv1qKuMDMe7tCrS7dYuWie0du3LUHOLRIMVGv8K910NsTjJo5/KzgYA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061819_362007_BD681FC5 X-CRM114-Status: GOOD ( 18.67 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The lochnagar clocks implement 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 --- drivers/clk/clk-lochnagar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/clk-lochnagar.c b/drivers/clk/clk-lochnagar.c index 80944bf482e9..820c05732ac7 100644 --- a/drivers/clk/clk-lochnagar.c +++ b/drivers/clk/clk-lochnagar.c @@ -209,6 +209,7 @@ static u8 lochnagar_clk_get_parent(struct clk_hw *hw) static const struct clk_ops lochnagar_clk_ops = { .prepare = lochnagar_clk_prepare, .unprepare = lochnagar_clk_unprepare, + .determine_rate = __clk_mux_determine_rate, .set_parent = lochnagar_clk_set_parent, .get_parent = lochnagar_clk_get_parent, }; @@ -238,6 +239,7 @@ static int lochnagar_clk_probe(struct platform_device *pdev) { struct clk_init_data clk_init = { .ops = &lochnagar_clk_ops, + .flags = CLK_SET_RATE_NO_REPARENT, }; struct device *dev = &pdev->dev; struct lochnagar_clk_priv *priv; From patchwork Fri Nov 4 13:17:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031768 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 02224C43217 for ; Fri, 4 Nov 2022 13:19:55 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Iiq0nfxiBGDLmBGU77unRJzRLRGZaS7flj+3zZ4P9g0=; b=NfTyLIRJxlTavJ gmI2Dw/zlzuwP/sT7NbM3xw922nGn7h0ZbVKGHvF77qLxgj1SR6djbbbtcZ4EBcu16v2clNBqJ7Yt kQtgdlXKgaWtaPm2+Kpzf1/LoVcS+H4PJRT/EgAxrGK7N/rNCZv7e3oJ5/iTEbPsjP7s37EurgWUh JrWHgI8u5808MrqA8Z+zceGt4Hhv6u1mbVE/71PO0++uXnhLXrnLDLohoGU4NekLEaynjdmn+txXT 1ZdkJXPjR0DwB2JXVDBsQYaeYf+n9Vw8tRg1Za2aQLAMhl4I/RJ+Cg5yhmah/QuNWIUb8LWe1m1vJ b6DqXmbzN298Gp2hYE2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwby-003dov-Or; Fri, 04 Nov 2022 13:19:54 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaT-003cga-6d; Fri, 04 Nov 2022 13:18:26 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 5B8EC5804C2; Fri, 4 Nov 2022 09:18:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:18:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567900; x= 1667575100; bh=ZCwzbCeVZB2Z2ZsOYNmFLEHLHlieS5RCP9CrLVnrDto=; b=p c2Q5C0moCtna7UVj3FhJIKcS3uaQpR1TZpMr72LICx8oqkdiNcSekX6/onZeEiGy sRgyK/t8JOGAfqyn9wd+OKG5V8uZiadXkX4lQ6gVlkpj6Eyx36Dn39lw93G4JQK6 k86WunS42LQH42TyuEKqHgkEDijTjTMFUVePqESJD1xnHtFRRZNMauwuk4dH5rxu bGrRcpzuifgwbtD0Vl5edz+I73xW30/3aYT0N7Bigfx0rjqI6EwwuU4Fy3fXB8Ql IafJWPL+JgiTcTWpvP3h9MdXizLuA38oJzBzKrtQkpkXhH+9xVXmvyVDhKEQk74D OSyzdKmcKZ2T0tCf5lLqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567900; x= 1667575100; bh=ZCwzbCeVZB2Z2ZsOYNmFLEHLHlieS5RCP9CrLVnrDto=; b=V 0h10qHvmMLmXBIw3VozyS6ppDm9KJWguva10hoozqItb97jLvKdnYCPzaU96TDob Yggc98OSi9Zx4TIXtFwDZwHYuHsQPxeuf0s90yF1Nbc/Z26VOeLw4SSeg/xor9KH fpBUHC6kvPrKkRE/kfl0H6vgE0s/EZKOif+BYE2gCYE6facPJayXDYgXp/JxVl9m y0v3sl+hBy6ZiiFQ/2wbQMXZ8+sYMtZoOBvb/hIHSwe/+SI3+RkporpvigU9H54B cbLX3DRDf2fV/wt7DnqRFvkWqFQSRt7NUzhzZa8lH3cwfKqfIjgbMd29H8pempPQ 3WWUgQSbqZOvg4TqI8p6w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:19 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:32 +0100 Subject: [PATCH v2 15/65] clk: qoriq: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-15-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3449; i=maxime@cerno.tech; h=from:subject:message-id; bh=1/qQmnkaLnLq5c4J9u4KwVo54amMRuIrpmMOv9UfOro=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp+n77x3kfen/fO8TvnL5zs7qyq42ffq/L6x9F6ShUzd hgsLOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRa48ZGQ5HePQydxW3Pqx9GtI706 cvcUHkZlvJaMPQdUe1YrZdCGP4Kxv0qvHEcrZeJaVjqn9fv35UIrnQdlqc71rNHmXlH3uXcAAA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061821_384229_68274898 X-CRM114-Status: GOOD ( 19.07 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Qoriq mux clocks implement 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 --- drivers/clk/clk-qoriq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index 5eddb9f0d6bd..6f51a2cfaace 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -878,6 +878,7 @@ static u8 mux_get_parent(struct clk_hw *hw) } static const struct clk_ops cmux_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = mux_get_parent, .set_parent = mux_set_parent, }; @@ -908,6 +909,7 @@ static const struct clockgen_pll_div *get_pll_div(struct clockgen *cg, static struct clk * __init create_mux_common(struct clockgen *cg, struct mux_hwclock *hwc, const struct clk_ops *ops, + unsigned long flags, unsigned long min_rate, unsigned long max_rate, unsigned long pct80_rate, @@ -951,7 +953,7 @@ static struct clk * __init create_mux_common(struct clockgen *cg, init.ops = ops; init.parent_names = parent_names; init.num_parents = hwc->num_parents = j; - init.flags = 0; + init.flags = flags; hwc->hw.init = &init; hwc->cg = cg; @@ -1010,8 +1012,8 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx) else min_rate = plat_rate / 2; - return create_mux_common(cg, hwc, &cmux_ops, min_rate, max_rate, - pct80_rate, "cg-cmux%d", idx); + return create_mux_common(cg, hwc, &cmux_ops, CLK_SET_RATE_NO_REPARENT, + min_rate, max_rate, pct80_rate, "cg-cmux%d", idx); } static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx) @@ -1025,7 +1027,7 @@ static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx) hwc->reg = cg->regs + 0x20 * idx + 0x10; hwc->info = cg->info.hwaccel[idx]; - return create_mux_common(cg, hwc, &hwaccel_ops, 0, ULONG_MAX, 0, + return create_mux_common(cg, hwc, &hwaccel_ops, 0, 0, ULONG_MAX, 0, "cg-hwaccel%d", idx); } From patchwork Fri Nov 4 13:17:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031769 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 660C5C433FE for ; Fri, 4 Nov 2022 13:20:00 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NnDfzssFYj1Rc65xXNjbtMjAcc9fUEmSP9IstS71Ma0=; b=Hi1b5xHd7SHTt1 Cps8Kh9NvLHuSYbJuEY+hrtfnEqcmFMy9fmjsis209VcAlzwzYzblalyzymEz+by2x6IG61mUK6cL vL/9mUQFxvIcfRkB0VORczFF/PweI/Eb1ZnHZA5c+MM9ciXTJRA6ZNdHFDIS9BOedU2D/elBv3PS2 PrxB/80dilUvbDrQ1p8Z4vmwMk2sMxoHtjsR1mrstdpLIWIC639CIqQRy+kJ9WXD7OQpUk403CcO3 zLTCW9UclreEsx97kuSMJW7djbRsowqK7ENh6S8hMx+Q3ZmEfeAWEDq2a68XkWtu6VNE6RBmQH/gX nslVsfqmd7Z9Tq4Nqruw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwc3-003dsG-Iv; Fri, 04 Nov 2022 13:19:59 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaV-003cie-Cv; Fri, 04 Nov 2022 13:18:26 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 9337C5804C4; Fri, 4 Nov 2022 09:18:22 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:18:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567902; x= 1667575102; bh=AiZw4g5HOn4xy/Rxk0RktvHjkdLEPlfvrWYEfqyclqU=; b=F RCpPtO0Z+oJjRMEMPtc3UUoQLtiu+IOQf2+QP2jstGTxC498emPhjWTBn4B+Ssr2 iaNhYgUYqJ5UWQ6EytcbC+mC8M7K4W1bsSqWJclY/T37yJbj5v5kM3wHPNGvEHha Dgx88U6pfG0fBsUebGShI3nB8b7o+X0YBaI+BGIQWLuK9lCUHVMqx8ZIHXUEo6Cb ZXnRDP06x2bGlyQ6Kxjxn/f8WyRERTt1XIy8CNy5hwUE0tq20JqBAwzcHS/bxas9 fkN0jGYRxT4ZQnXuGAfSK398yB4rVORbEW3LmzlbSe89/sKfx2HAQydh3PvF099s Q2Y8XxdummTB7aZJcL1Pw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567902; x= 1667575102; bh=AiZw4g5HOn4xy/Rxk0RktvHjkdLEPlfvrWYEfqyclqU=; b=k h6GSq1IWf33v2fE78JAHvMeI/9Pr+h63pPDiUUc8//2Cg7ZFGOj9vnzp5k9FAQ/s 7EV1hTql9ooJ0GMlONsk8IkK/M4qFtZE37S1L5BaFO9cWsNC/Z85YzHzB/kb4le5 AsAtQqScCVse57/SYSRid/QwIlRgZgW8R3bmVw8LkM36hU0eXwOUVHbHcz8fZ3IB 5P2UOkx/w4ANXCAfFKf1uv7Mln+kXm9VMQrWlnHd7ScLcapohBC9G+Vc+44yU1Hc tf9wejuWuW+iJjzBQzWOsUe/Zp1sEMXxW/cwsFeAxUsM0AdTXvc1QjDBnG0ZM/9k 3Mv0/6R7hL2q+9xQdZo1g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:21 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:33 +0100 Subject: [PATCH v2 16/65] clk: si5341: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-16-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2382; i=maxime@cerno.tech; h=from:subject:message-id; bh=8SGQf3kkT7UEwm20SsvxRlrkz2by+8b35E6hVUuixM4=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp8N5/l16Ki33Ag99eGbJRfrehb2cJ/Fc2YaGfyREu6+ 4NjQUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIkUH2JkWKt1Z8re8GWPzjclzTs8TT J5lvTM9k/zz5v8YGaamHyD9zfD//w0v/SC7FS5r1Mm/m85IPjjmswuqVlt2hOYpsi/tnrLzwkA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061823_598256_1E9F73D0 X-CRM114-Status: GOOD ( 18.53 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The SI5341 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 --- drivers/clk/clk-si5341.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c index 0e528d7ba656..259861aa2e2f 100644 --- a/drivers/clk/clk-si5341.c +++ b/drivers/clk/clk-si5341.c @@ -551,6 +551,7 @@ static int si5341_clk_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops si5341_clk_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = si5341_clk_set_parent, .get_parent = si5341_clk_get_parent, .recalc_rate = si5341_clk_recalc_rate, @@ -1682,7 +1683,7 @@ static int si5341_probe(struct i2c_client *client) init.parent_names = data->input_clk_name; init.num_parents = SI5341_NUM_INPUTS; init.ops = &si5341_clk_ops; - init.flags = 0; + init.flags = CLK_SET_RATE_NO_REPARENT; data->hw.init = &init; err = devm_clk_hw_register(&client->dev, &data->hw); From patchwork Fri Nov 4 13:17:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031770 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 C6893C433FE for ; Fri, 4 Nov 2022 13:20:04 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=o4gBnCNLPPb4U+PoR6Aq4mfsID+AbRVnnZixALROH74=; b=KpzrjhNU2/NGv3 3bKOSEgHmZs5x6YBBPYlJCNTLyFw7RJ1KQ2ExRUnDjQMvaYjyoEl2xInxW+qKvBurzGBJJ+o/F9Ar Hzld5DF5Zvz36/xKp0P1euNE8XhoMx52lwktaqXQwGVzMtLGl5Ap4RgAEjwkvEzT/M0MP/1PGRz2h rnSHkZj5c6erP5uS2gD7EB0MRKBGU86nssAlHQFcgzzG5mMweyvbud5UBcIxA/iGcas60G8SQ82sa NQbLszLfvCC4nf8loIa6I18MkG1MdgWJ5nArYVp6WLJqF//t/aAOtXc7F52qbbeh74btMzM5CKWEN 1BXqva0xRAJzOoVIOdWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwc7-003dvX-Sy; Fri, 04 Nov 2022 13:20:03 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaX-003cjg-Dn; Fri, 04 Nov 2022 13:18:28 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id B73D85804C5; Fri, 4 Nov 2022 09:18:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:18:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567904; x= 1667575104; bh=ZQiHGlhcCi/k+//rpfo4vhoISVvHuB3yO5HEIA4xQ/A=; b=j kjCQWX9xab52+XF4Z4xv6+Hy6ru0SOALA2TqaDZBZa8itukdy/3e0tVRuE7Xr9fN 7xnWTNcH2DCFNFhQFQP1mhnyN2KQFj9ug8I5/KOxEByRCFSvvqYjKAMESSVcRGnF oodTz3OeKFV0GrKO3zu9TxAcgRyBEiZ9gFZIXK/ztiUNRLZBlPw0p0eP97ZMK0DT iPaJr0iURFasa4CVqgLmCkHRGMiBXPlKQE3NhOWGLd391l82tjtn4wpi+MJ50FAT +a2VJqaI3s/VpMSOoEJtbbyQkToEnZL97jKftlsYqqvs9wGOCBIM4nwZEyBnrkWe eoRuceLKDWPI2+4rPt2Rw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567904; x= 1667575104; bh=ZQiHGlhcCi/k+//rpfo4vhoISVvHuB3yO5HEIA4xQ/A=; b=L 1cZChDsIlqnNhfr4CVP5rKXrSD5DW1LijYfMxZ9VXawJ8ziZx/4xFfU41e+31wuE hIgLPBjO57MfuIn/XSAiPfIbYZZTDTCRRk5pFiXP3PlNZkTQM58vjnbrE3J4sD1C OaJ3lsejqzHPNLP6dGcjefRUBNEfe1SflT7Z1zyVYXT+ENhedOINZQNFhwH6gMxM 2rub/yqEri8Tf298kiQPgIkHF/P9idZS3I2NajfOZQEFaDpYki8jvDQtWoOND+Fi pvhlzxI451q5XDFVj+TfhNfflSelKvSwJ85d3NPdJd/UHjP7o1NXE3QiyduHDdKb W8IO+r3QniIB6rgPrFOZA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:23 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:34 +0100 Subject: [PATCH v2 17/65] clk: stm32f4: mux: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-17-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2288; i=maxime@cerno.tech; h=from:subject:message-id; bh=lgJkEvSNRDAnm37cdjNLF/t0qBUSxsL3dduicg+ovzY=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp8ZevqTgufkWbXs+uPr9ttBxXD6Dcv/D/okDKbUJR2b kZ7aUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQ3h4hSAicxlZGR4MU3xztwAM43PwhkiArm7tH wuLVK90l0tk97ttnlfiPJxRoaGo2EJBt+W3pjD8ONq/yv+k7bF+gF5XCWNLK/zd4rNXcYCAA== X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061825_661861_0D65F6D9 X-CRM114-Status: GOOD ( 18.60 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The STM32F4 mux 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 --- drivers/clk/clk-stm32f4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c index 473dfe632cc5..01046437a48c 100644 --- a/drivers/clk/clk-stm32f4.c +++ b/drivers/clk/clk-stm32f4.c @@ -1045,6 +1045,7 @@ static int cclk_mux_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops cclk_mux_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = cclk_mux_get_parent, .set_parent = cclk_mux_set_parent, }; @@ -1085,7 +1086,7 @@ static struct clk_hw *stm32_register_cclk(struct device *dev, const char *name, &mux->hw, &cclk_mux_ops, NULL, NULL, &gate->hw, &cclk_gate_ops, - flags); + flags | CLK_SET_RATE_NO_REPARENT); if (IS_ERR(hw)) { kfree(gate); From patchwork Fri Nov 4 13:17:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031771 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 8E439C4332F for ; Fri, 4 Nov 2022 13:20:16 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w2mUChfGco6aYWk3+Dtkw7kGPzq5lJrk8rEbZ/qkOyk=; b=qtxKPQ9MbZPUB5 rsZsjYkebxl9StI805m8QrrnZ9jrNRyYvPs+wYjxxHoq8tlymZufO9gMAKT323JMH4cpcTX8uJJYU WeKpT4/Pw2vXVtOK9pgeDt1UU7ZAHts0PUP7681n2yHDEXOySj85JwM4KE4OtLgEVW+NQdks2V1sc SERewPVUim16tP0Thwa4etcGUqKuYZ4muOXWnEDtVB+ZEDcDfmdPqFWk8dpL/ihBEuknWbY0yVyNj NLStOFjgz7cJai6RMb+dqgPG05z5L+jLFyAviMgdBGKyQb5yN+VjrDenym0rfqIe5ObI4XNtPtJTT gABKccIpozxNEqylLLeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwcJ-003e20-Iu; Fri, 04 Nov 2022 13:20:15 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwaZ-003cky-NT; Fri, 04 Nov 2022 13:18:30 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id E62CC5804CA; Fri, 4 Nov 2022 09:18:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:18:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567906; x= 1667575106; bh=5y94lcdciHGnxsIUF611rAjwiEbDzI+GRIM63DhjQ2I=; b=p 7sG0etQ4w8VvMurS5E1x1s8e34HA6/ESjrqf2T8/oeYUUhUqvbDeYEilHTpDdrcl eUEbHNH5PaABl7QXw9OsszdG8/qFDVeOeThYm1sy+8h5RbiqMZzSr/IXQ2bX5QLw Gk9h1W7ipwKgyE/WsJyalfoZO4gvfSl41MIz92t68zpO6Z5B9GHoI/ys9xlavqTY 1Vcydo0FgD1lpX3TX5Gb9n6okBBQosmJgpZZkkVI+MwP1J+4icDBAnbHl2Cybakr yd7bSjW+akk7pTM9ZaaW3UJ0Q0eli7WksxVNduf4EyoQvdHGEpdwkcFS4uGHIwVp 4+wonm7WOaSllsNgqILeg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567906; x= 1667575106; bh=5y94lcdciHGnxsIUF611rAjwiEbDzI+GRIM63DhjQ2I=; b=F Sc+SC644Dsuq/yPQ860pRaogIUkMlcIWla5PN4pdESBgqRdWEMOf19tKAkS94O/9 r0eJsSALXG01dxVdBqMp6fsLA/2s0Mxo/zMRXUdW3IEh4F/Aldvb4BbETlDGYl/y wlYs4idlaSh4/fHCWrtoObeycW9S32M6w4I+1BuwP00SvDHCohJ/eWk3gvB1052a GkX8zvGMJw9UfCQsFB5JsJDceoOhs2/ff++dXGVwzpVVmHAf/bMsOHXSuj8wrRpj 0fk94/SD1yg/ObTyngY+DzFk2kWmF6WDSGZBNBK/IEIcc7h0YiDuQbSkbBH46jF7 uUHBPYRAzbOu9QdbE3lFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:25 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:35 +0100 Subject: [PATCH v2 18/65] clk: vc5: mux: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-18-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2392; i=maxime@cerno.tech; h=from:subject:message-id; bh=UHYzA/6Th38vKXuoTjYzk35rG9CoA3kN/ZZ7xjHnj08=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp9DBZ4qWZ1h2GCy9+jC9UcZFWRu/amQalW+8cMkxFVm wjHBjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEzkKx/D/9yGTQLmDDVFd4O2JO7f1y 3en7P0/bwPBfbf9x96/nLRvOWMDM/uvkj8t3DN4hKGvKCzvVoCm8vXxDTdV7q/guX02V11OiwA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061828_155645_8FBE8065 X-CRM114-Status: GOOD ( 18.33 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Versaclock5 mux 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 --- drivers/clk/clk-versaclock5.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c index 88689415aff9..e858066c2c3f 100644 --- a/drivers/clk/clk-versaclock5.c +++ b/drivers/clk/clk-versaclock5.c @@ -281,6 +281,7 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops vc5_mux_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = vc5_mux_set_parent, .get_parent = vc5_mux_get_parent, }; @@ -1031,7 +1032,7 @@ static int vc5_probe(struct i2c_client *client) init.name = kasprintf(GFP_KERNEL, "%pOFn.mux", client->dev.of_node); init.ops = &vc5_mux_ops; - init.flags = 0; + init.flags = CLK_SET_RATE_NO_REPARENT; init.parent_names = parent_names; vc5->clk_mux.init = &init; ret = devm_clk_hw_register(&client->dev, &vc5->clk_mux); From patchwork Fri Nov 4 13:17:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031772 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 A5B4DC4332F for ; Fri, 4 Nov 2022 13:20:22 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0+oY8Cl8ZpC3TrblIZv5xUA8f5jMpr+jcHZZXilWeHI=; b=LGrEk/yMU5GPpc 8lUKk+iiSDTq7RyjNyZn9UOqDwgfgZgE6Hu4uJPhE+imSbVH0/MDDM5+vyMYtNBUaHuvt1aLnLTdk O17ji/vDFUBF+Y1Aq7giN8iLjVAWI+WzTQD0LI/cI3mjBuLmzOEh5E3WA2zG+AUcYvVA/9W7llzs8 eGjJz+2ItLjV0CIp9QuWdIlU6XeuQoe8asy7Z9XL4Gar632Ce4X5vH54cOIDlOaMqUOPntmMs/4aq ADmOMmyvrEzdvzQDSaYsqh03iP8LGnqgwci9l0jxeu6+TBFY6fCC324YE29kFecYHyN8CI5Yssge3 A0CdaLCnhQfxce1ZXTcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwcP-003e6m-V2; Fri, 04 Nov 2022 13:20:21 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwab-003cmP-QY; Fri, 04 Nov 2022 13:18:32 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 090795804F5; Fri, 4 Nov 2022 09:18:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 09:18:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567909; x= 1667575109; bh=luagwsSex2THKzX/CP22BYGQdlBn413TABDvuAp6fwQ=; b=K EsFXPNGj99Bf0Ygoq6pEKFBZqzxTFQ58Xowuql0miB+VgiLCs6WlsfrQmJ+n1vnC EsM7+KwJgItMNf/R4jBypbhDaH+lE0JEjLRGfNlBEmIBFQLLk4e5+YJrQFgozEtL 6iKrn4RK4MzrVX0Y7eZtCO9T/MDr148y5hdFOtxwCFB0H/6ld6JRzq/72ul9cyja XRv8dlnAZoVWTgoseMeLQibVivVmeg8GkgPN2RrAgq2216t9cQ9hwPoGM3iOpzU3 533auOaN4AMUFriqLe0UASdaIujgVpKmFlEGqwl25N3HXRIDDdvlVhnmhMv42lrp lxYcYu1ZynHwb+njql4gQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567909; x= 1667575109; bh=luagwsSex2THKzX/CP22BYGQdlBn413TABDvuAp6fwQ=; b=c KjJHMiLbInvMzOadRkNJBSe7i4mYeLZErYacU1nqsZD+xK+FiRzmvYFiP6l8UXX0 UUN0twglI+QtR3Q8jTo0/PCkKQwootlRB2oI6tQn85TrF+ox6n2VXcDR34RVz1Wf ti03a1IJS6ZJs7O3Kfo9iWsiynbrFcZyFLpfQLAVKv0iQ3izxTHzAirUDn01HWUv akeTzvRVBk2rFCIyL2jaXN6PomXEDfbCoWXWRSTurB3UbWPCL//vDZJvotoMolF1 tXzSLRKRGHxboiG0UyVuh0EpoCCZzLMJCxco0PF/GNCQof0Zsr8uWIh24tZec8jx eH9RkYTyl75cHw+7bWsmA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:28 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:36 +0100 Subject: [PATCH v2 19/65] clk: vc5: clkout: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-19-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2931; i=maxime@cerno.tech; h=from:subject:message-id; bh=JEUZtb9tXOof5sAOCA5zwNzO7GBHkJSDJOl0Zd1+YdE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp+TbuhP93XRl9+0dOEe7Rm33CbPlOu4JRPSc7rkw4L1 Biy1HaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZjIrDSGf6azgqLsvy1gX1v01eEkYz /HFrsYFZmVN68fPGbAJqjavIyR4db843pKvvmpMbZBE1itOVL2ezbJBJ0UOb1Z5qDq6z+yLAA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061830_126308_BA142322 X-CRM114-Status: GOOD ( 18.77 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Versaclock5 "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. Signed-off-by: Maxime Ripard --- drivers/clk/clk-versaclock5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c index e858066c2c3f..661ab1ca3d83 100644 --- a/drivers/clk/clk-versaclock5.c +++ b/drivers/clk/clk-versaclock5.c @@ -728,6 +728,7 @@ static int vc5_clk_out_set_parent(struct clk_hw *hw, u8 index) static const struct clk_ops vc5_clk_out_ops = { .prepare = vc5_clk_out_prepare, .unprepare = vc5_clk_out_unprepare, + .determine_rate = __clk_mux_determine_rate, .set_parent = vc5_clk_out_set_parent, .get_parent = vc5_clk_out_get_parent, }; @@ -1115,7 +1116,7 @@ static int vc5_probe(struct i2c_client *client) init.name = kasprintf(GFP_KERNEL, "%pOFn.out0_sel_i2cb", client->dev.of_node); init.ops = &vc5_clk_out_ops; - init.flags = CLK_SET_RATE_PARENT; + init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT; init.parent_names = parent_names; parent_names[0] = clk_hw_get_name(&vc5->clk_mux); init.num_parents = 1; @@ -1141,7 +1142,7 @@ static int vc5_probe(struct i2c_client *client) init.name = kasprintf(GFP_KERNEL, "%pOFn.out%d", client->dev.of_node, idx + 1); init.ops = &vc5_clk_out_ops; - init.flags = CLK_SET_RATE_PARENT; + init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT; init.parent_names = parent_names; init.num_parents = 2; vc5->clk_out[n].num = idx; From patchwork Fri Nov 4 13:17:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031774 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 E3585C43217 for ; Fri, 4 Nov 2022 13:20:23 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9uaPG2FemHTWKAOOPC5+0xtPoKNUPzBNenGcDOyI0cM=; b=2EJ6mdrRvf5Mtq T+k2/jI9PN56SlS8C3JLDjmvmlT4MM4hP5kaQyFmF9rDIW7QV2kltHMH2+1sQ7Pvv6uyfV8tI9Lbc HRr2AVzSg0cn0uCNf3pzG7Ma1Q+8P5FjPWOfUbC/BfgygnFnc9NQlqvkz1rxopcUZtKmTdGT4MN/S LBj53X4b3wPMJnVmWtuGzaoKJU+rqivsq7MPH3AvqHiHX0HZ6De7lyy2GHFrPmNP7CRJ3DziIVNAl LkclCZj6ghKpGYC+NF5yjnF2muxSH9CJIm9BeIOHN8NYCRY3cTnGFt3UIYfAOoTtDtSMmbBn/bQRN H99RCJSBC1xhI+lSde2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwcQ-003e7i-Ry; Fri, 04 Nov 2022 13:20:22 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwad-003cnO-Pi; Fri, 04 Nov 2022 13:18:34 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 0DCE258050C; Fri, 4 Nov 2022 09:18:31 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 09:18:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567911; x= 1667575111; bh=fD5QkUGTVXjqsPP/sK/neTD9XbByTp5xchKTtVPLBts=; b=s C6kD/hbUSh1Ha/l2HFiNzWscphfRg7OoztB6W57Jod+o6eFTHn2AIwUp5zWvjCyi IDE9YiogefGA7DMn69kujuGcAyAGXLk9PmNIOmh2Byxkn2xT6/BkIa2P0agO+Wz0 jcgtAaBRuCdCuNZRR1nLYdEV0ckkzIWTX3ald30OfUjSDOzQ3pPGgeAdoOJFW9oK v6p965Cb0A2//fb5FVQJXEsqNdYkyBHRPcVkXhjgx/z45ZLexgQ5/w4DUDEY4jk/ dJy6eGxxO0dHcp5gP0HdAGCoUYqWPrNz7nYVuSaoRlpSPru/S2mWztyX9G/PAqHO SH74dXFTzQFdM626XUwUg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567911; x= 1667575111; bh=fD5QkUGTVXjqsPP/sK/neTD9XbByTp5xchKTtVPLBts=; b=g vrxgbNPvtfCBcIsbxJzut77zSpOraJdxEAdprjmwGPebtseQelwtr+K4ke8gQ4ge 8FPWxIx26ao9VLwyTyBXD1aHaNSRh4vaPVAirAJ2Vf8cZB/7ehJCtvuWwtvOv9H7 AOjCAHR/cvcZaUS6e/NObKc1mHvloR1SrDILXCG0DbyuAi5Ip2JMKl/24DMt++Rr QXtNzORFflJN33dr/fsLA5ttlqEVN+aqvGBx30uUhl/+NAXv6M/T3aYutc+HuuR/ tOtPanS2DoYMO/Otj8NMe08TVTNVgN3B47WwsmGVJoacyVFqqjKlU7X10VLclH7O s4o/NHbfUDk+OZ6RYpvBw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:30 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:37 +0100 Subject: [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-20-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2442; i=maxime@cerno.tech; h=from:subject:message-id; bh=4BlYqq5UPfFYo3niNZoafiUX8HiY7gooJ3ho6JQRT2Y=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp9/cZbYiNgFSp1Uslx4bUtC1n6H9On2a8PqVoa2VFyR +XOwo5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABM518DI0FjC4Lh+0eWkr7tsFh/pjX A1yvy6fNLR61GGswsra5arLmNkeMsXfG5/8JoXPs17T4ZP5Kw6PuuJv71QRv1P36j0xpXibAA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061832_088688_CD61C737 X-CRM114-Status: GOOD ( 18.65 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org 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. Signed-off-by: Maxime Ripard Acked-by: Charles Keepax --- drivers/clk/clk-wm831x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-wm831x.c b/drivers/clk/clk-wm831x.c index ae6dd38ec053..be3a9c1f3610 100644 --- a/drivers/clk/clk-wm831x.c +++ b/drivers/clk/clk-wm831x.c @@ -329,6 +329,7 @@ static const struct clk_ops wm831x_clkout_ops = { .is_prepared = wm831x_clkout_is_prepared, .prepare = wm831x_clkout_prepare, .unprepare = wm831x_clkout_unprepare, + .determine_rate = __clk_mux_determine_rate, .get_parent = wm831x_clkout_get_parent, .set_parent = wm831x_clkout_set_parent, }; @@ -338,7 +339,7 @@ static const struct clk_init_data wm831x_clkout_init = { .ops = &wm831x_clkout_ops, .parent_names = wm831x_clkout_parents, .num_parents = ARRAY_SIZE(wm831x_clkout_parents), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, }; static int wm831x_clk_probe(struct platform_device *pdev) From patchwork Fri Nov 4 13:17:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031773 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 82AD0C433FE for ; Fri, 4 Nov 2022 13:20:23 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Gs/NhYAD3J/7i6p7gQWTEgkpyBLuHHZARZ70kkreQ6I=; b=anUPP+JAJ8ehdg tLBQ2UyUwQYHgPUg0j9+jmqkYVTen1MzRKKvS2w62+LW4jhNL3IhlUW/2UgWWN/TlZxUy+dqyXDCb LiRILIKyH9hBGvG/ftHLo0f8cEvcJfF15N6amTUKd+U5afJZM15/Nl7Bw0RyrDK/gC+Q0xePg6tmP RhOuWI/2QBZlZMobxr1vZht/eG3xnxPgDZEzeSDABnqLhqi69Pe/0vlO6fwCAdZbZ929wahOHXK/x TcmJF3HUOsaghZLxNgLrqpMce+Os//8bGmyZfAGOpnPg5sicKb3D0lh3RVqKLytmg8eWUxEQiyx2W AlzB91YDp0Jo5IDM6dWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwcQ-003e7M-Fy; Fri, 04 Nov 2022 13:20:22 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwag-003cpA-0i; Fri, 04 Nov 2022 13:18:36 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 3AFE4580528; Fri, 4 Nov 2022 09:18:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:18:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567913; x= 1667575113; bh=ltd//1Xth5WBrP6OwPj3yHhAh3ddasBVKeA7pncTY2o=; b=n 7/pCpZlVGBlVeQx9hWRN+IFie+Kpa/n5SHJS2J+nkDaQ72jtkGv9ez/N8fI5BMWR ybCSnODhjhrusKK1TLIa9tetXw/QHCpgZWctKs6wlo0UeqKIJpz2eKdpdBrS9UsD 3lra8gGQXgYSIJzlAjRUXVoUEQK+qR5P+N460W7KIXuPUerya10sKgd5nvYDGfAl rZepp5CgR+VFgPugV2WXW+qxmklWRSGNXYSIboFfvqTikSQ6dAnfMF7pWw2eSJxE p1ftRUW+W54Vs97YemWlDYBZO8wet9Q6DdlrCHtfeJiNHvgg1QEfF7lLlvYu1/sd lV6RUfkNHcQ5lWs1TWNhw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567913; x= 1667575113; bh=ltd//1Xth5WBrP6OwPj3yHhAh3ddasBVKeA7pncTY2o=; b=e zmMgQj22P/jrfLWyWilGcuWzd5gJXrz33cEBBtR20fEqVwQrfBzVKVzpryOF8sEd /PmZeTRhOtZH4zJbNOrAeko52XyP6WE/mhi6aZ2yqysRPW3pE9JvNgWgGjguqILT qSi0gzgu+68aKqutz/XoVw3rvuZ9O1KJyaFzVELOW7Tjoqw8zGHrOQp0uVPMwgKB vl/inuwlxUUDOZ93DOycxK+aJhrZh7XV3/ooYVqdeuCfaboyaATypaVj9I05KrDs d9VKgFpoqm6gjbigj9pTgKb3GPdTA9MgBb2Ma0Xtp0lgtHQPFo+lxo8Gm2VXQVuL P6HvZRns9nVqHesRbSv8Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:32 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:38 +0100 Subject: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-21-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2406; i=maxime@cerno.tech; h=from:subject:message-id; bh=ntiJZSBCLXNOskq1dVAg3rLcHe7W9HnbDfbVT52VioM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAp9XaDxexdTGkDvz75qOHe8S5UTNfp51znnd99Tj0t5P Fwy3dZSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAicWKMDDs2rTctz5eeM7UwOpHv0v bU8q+LWd822v158WHyybWCn6Yw/NOXWP39yexZp4Kn1Z9dG+35wexAxko+oQOZba6SbPInL/ADAA== X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061834_370189_5011D625 X-CRM114-Status: GOOD ( 18.11 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Davinci DA8xxx cfgchip mux 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 Acked-by: David Lechner --- drivers/clk/davinci/da8xx-cfgchip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c index 4103d605e804..c04276bc4051 100644 --- a/drivers/clk/davinci/da8xx-cfgchip.c +++ b/drivers/clk/davinci/da8xx-cfgchip.c @@ -229,6 +229,7 @@ static u8 da8xx_cfgchip_mux_clk_get_parent(struct clk_hw *hw) } static const struct clk_ops da8xx_cfgchip_mux_clk_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = da8xx_cfgchip_mux_clk_set_parent, .get_parent = da8xx_cfgchip_mux_clk_get_parent, }; @@ -251,7 +252,7 @@ da8xx_cfgchip_mux_clk_register(struct device *dev, init.ops = &da8xx_cfgchip_mux_clk_ops; init.parent_names = parent_names; init.num_parents = 2; - init.flags = 0; + init.flags = CLK_SET_RATE_NO_REPARENT; mux->hw.init = &init; mux->regmap = regmap; From patchwork Fri Nov 4 13:17:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031775 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 3A2B4C4332F for ; Fri, 4 Nov 2022 13:20:30 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=d/9u7Bx76NezN8QQ5j7Yr/kxGPyinq4px5K7TN5K0WI=; b=jiaq3v8toudBXu 1wCq2624QOeS6D9SUYpp7kvZiYH/dEu90FIWGyXOKkkK2iR+CF0Knx+XUJtm8h1k9WO0yYqTUXlFE Jzuyp8fdF9uve0hukTiXX64oTmhrr9MwcBcQkEtxOppxm6BxX+7sjj8/gPOLfNR945M1VngwJ+zCu vnGWQbxJ/mYyphreNqXjRoSC70USgieaEoZO0E7QQDvhf113U4lP/wrXiGL/5FVtWjbzXElErTcWS DfFua7Ngi5cYoes8VNfbfj32CCfF2TiG2e9f5A2t2ykQVeo/pUHWrdPFrdg7LbDD0sf2as6DCrA3Y yyHgtvLis/0xjilw6Ltg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwcX-003eD3-H3; Fri, 04 Nov 2022 13:20:29 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwai-003cqe-5Q; Fri, 04 Nov 2022 13:18:37 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 75B2758052E; Fri, 4 Nov 2022 09:18:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:18:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567915; x= 1667575115; bh=hysVo4u8nbCgGA3oHny22G9EjvddeG5nBELtR5H+f1I=; b=i VjK6BPo7bB2mroEWqSFauGJ5VvTBJIqYMUOgtXu4tOgDrMbCNRDAWwixILFIJF8h 5c7xFpit5f11ZaXvRbvnmxLQHhSdFy51mCcyLgMQt5GUXh8evVQAVNPYQ2nFQvch USK7f+DLuQ1iLGL3s5HsOHeTY7HbUqzckqcZJ8PRtxNSIaOkzmoKEzk98uHj37kP hP6rNpdX2+BF9JFpNwM3mpzlY26vkYl69OJ7RhbupuKv1n4V4Px4Eu6O29qRbcIX jiz5krjVbkok1knpt/bWZMpLKVqhyZMYhuPcLQkmdDkLDYlZ2aNsCfa9hXUWT2J0 6KelJbifZ1FJtPlfWUtHQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567915; x= 1667575115; bh=hysVo4u8nbCgGA3oHny22G9EjvddeG5nBELtR5H+f1I=; b=t tR/dRmghjH1wm+Sy4i5cdtFySAIqnUc6rF0OkMpAKNrADFwLXeaCGTGxLmp4Vqwo Mj9MSyK8/Nqc975GE1OpdKmXjD7OE6q5NHbw2IgP/zSYqILKu8k5SrSvJ1Qsw1ia 9p4cYf3w8Zcav2yGOa8vpva5bcepb1q+KMPH86IRHlj9aa/whJ15BV42KeDo9/Y6 sApHSd3j0fV+Ulho+mAEfYJAqKwTGe8EMJ2749XWpIMnMC857tErQNco7/Y+u9j/ 6Ku9wjCuJPazXA41KWr/2CXZCKO8ALnIOz02O67VfmZb4ZrDvnDbUi1aKRfpcbrr sVldLVzzSDMMtfRIpQOSw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:34 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:39 +0100 Subject: [PATCH v2 22/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-22-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2335; i=maxime@cerno.tech; h=from:subject:message-id; bh=UGe0lSsyawHFRBIzcLkMuGL594L6jEEp+ALykYgzBK0=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl/cL2buPvW/+OumRZPuCHB6Hvr1NlVPza7eojh3s8e2 0yvaOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRLGOG/xni35OFHhxziJ7XerNz1T NJPtsThmd/n44SCSpluWBhfZKRYbF++3uVqtPFq4+fXmadntzTIr1/x7pynttvDt3JvdUoyw8A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061836_388932_C6EB6430 X-CRM114-Status: GOOD ( 17.14 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Davinci DA8xxx cfgchip "clk48" 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 --- drivers/clk/davinci/da8xx-cfgchip.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c index c04276bc4051..4c1cc59bba53 100644 --- a/drivers/clk/davinci/da8xx-cfgchip.c +++ b/drivers/clk/davinci/da8xx-cfgchip.c @@ -565,6 +565,7 @@ static u8 da8xx_usb1_clk48_get_parent(struct clk_hw *hw) } static const struct clk_ops da8xx_usb1_clk48_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = da8xx_usb1_clk48_set_parent, .get_parent = da8xx_usb1_clk48_get_parent, }; @@ -589,6 +590,7 @@ da8xx_cfgchip_register_usb1_clk48(struct device *dev, init.name = "usb1_clk48"; init.ops = &da8xx_usb1_clk48_ops; + init.flags = CLK_SET_RATE_NO_REPARENT; init.parent_names = parent_names; init.num_parents = 2; From patchwork Fri Nov 4 13:17:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031776 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 DA212C433FE for ; Fri, 4 Nov 2022 13:20:35 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IhvWQH1z/WlAJQwQJ4OhFLx0p+uTlsj3+tgGsAZ/9x4=; b=mXYjBiV8/ltp2V rK+lQjxTludj/xRH0Lob9dFQN2j21FfZqeGpTZ42Jqvjoje66qmWZrKkl1taNdLm+M3ba3LhEJogn h/C3wwCYwAcVZQmZlikUje0ZmUtr1HBmUz7ZWOXOVRtTob9eHecVaJt9iiUUB4xyVdzPcLZ1QUYtw ToMjDXG2zaJPdt01+llYmHeAIYayMc//OqDxSy2kEn5x/ilul1duSm6cfAn+FzfPnDc6iT7IrfyHW hAxNrGt6GviX4DqJIDlN01j4YWOgwNuffvaeIShrNshUn0mSGkd53Zptt2mtjhC39nc/I5ShPls/V zT2YzN8iNNyvX/73/FEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwcd-003eGx-26; Fri, 04 Nov 2022 13:20:35 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwak-003csS-Bq; Fri, 04 Nov 2022 13:18:40 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 93220580556; Fri, 4 Nov 2022 09:18:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:18:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567917; x= 1667575117; bh=g/tCYGEB7G/tpibSy/Nw5qee275ckprCb70mVjEL8Dw=; b=n uK84mbQtP1Gv0owSEWECFoSWPSRKPZRrLnP53mBmR1JXIrC9oBSbtfFRk93gDFw3 DwQJgARuU0gEgD3BNNI6yWQBVbXqoCTTJuwcbTFW2PG9mX3ZrNLvN+xeoFrfoaDd enkShSkp+9wUTT8FBq4gwSfcTcFEocdCYqZKd8dh4G+zxB80VjnjbtLYMdJ/5NP2 pnnM2PEjgcHC5x8XG4RTMhrL4/Xek7ENXFrGMno7el9POJBYZyNkWeBpGxGYPiRp dZk8RpAF6LoeRI7gkypVpTGu6xkL4e1RVZ2AOXxGHximqw38nMtsokKzNiCWh3D1 x/jhvyg1YQhfDdUxauT9g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567917; x= 1667575117; bh=g/tCYGEB7G/tpibSy/Nw5qee275ckprCb70mVjEL8Dw=; b=t SZBNPYfman7zBwm0Ls4+r79aIJA+y3tZDGCbDnQadnQxPG05IFt6+0cL60/NiKzf kTmPwyY/DlBMqt77YchRedr+9grtO+kkZ7Yil2LvznyOCw7/tVdp1IWP+SFt3vzM AZ/b8zkiATE2h56fmitY9CSm4RoxDHofXKs58DKPyQy99pWLP5lb3aXGsT4mra5I iO9son4wj05e/qjTZcYeRGaC1IzAcE+wsPjp+wAZF6uz7zSDD2ECuYLY60xm5+gw 8MUY7olA/7BlOwACvDDdrrjQN/G1d+IvgbQ/bFSOe3OZOgHT3NPgRYp5xRNEy3xV qgv+UgkaOhajfwQWjHuoQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdeglecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:36 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:40 +0100 Subject: [PATCH v2 23/65] clk: imx: busy: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-23-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2355; i=maxime@cerno.tech; h=from:subject:message-id; bh=LtN3afqB1IeTGDIUKVpccoxSm7ihgsjecZ9M4RPxq2g=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl8mXlmy4NrvfO5Xk5cF36uSirvU9ji1JPZF3xbLzWxm E9+c6ShlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBEDmsy/A847WgyPYxnl+63DX+mu/ 30Cr3T/2mNG/tT/bbtmannjCsYGe5ryHx5mWUszfsq3jJcUEBGR+ZwT52lr7baUvnzKzrdmAA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061838_626611_4CB22872 X-CRM114-Status: GOOD ( 18.97 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The iMX busy 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 --- drivers/clk/imx/clk-busy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-busy.c b/drivers/clk/imx/clk-busy.c index 6f17311647f3..2df81862782a 100644 --- a/drivers/clk/imx/clk-busy.c +++ b/drivers/clk/imx/clk-busy.c @@ -148,6 +148,7 @@ static int clk_busy_mux_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops clk_busy_mux_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = clk_busy_mux_get_parent, .set_parent = clk_busy_mux_set_parent, }; @@ -176,7 +177,7 @@ struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift init.name = name; init.ops = &clk_busy_mux_ops; - init.flags = CLK_IS_CRITICAL; + init.flags = CLK_IS_CRITICAL | CLK_SET_RATE_NO_REPARENT; init.parent_names = parent_names; init.num_parents = num_parents; From patchwork Fri Nov 4 13:17:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031777 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 5875FC433FE for ; Fri, 4 Nov 2022 13:20:44 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3thSOpwi9RUMZrjSo/a9FWYtcocooNzkI76t+xHfkhk=; b=xYOSUwLTdtyGQb 0z84b8e6qEqsKOeZqIrCRLRpwJDdWDprnDhZvXuV6PP7XQgHJtP55xM0v2O3eFxOV45sOAaS12vlx o4J4rqx9sBetw7HWJzPjgOXnTmHCIUm06IWrldgYTBbzZ4P6GSMWyN59JSVgnqT87iF4Yl0OlAid5 cErL91IZNwz3Gu6Ecyu9stvgymuhVgSYNecDUPE+WeIUI9zkDsEZELxbVcOHBLlj/TIdZrl1r7V2i kRZ3wtJRzlTDn/zmYE6AvNTeyIzak2ljMLOe+0QoRv9AR3x4tMP8IFpBHUrg5X8Wr2YzRL9t/4QLb NJ21E5ybDrB6st6PuUXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwcl-003eMu-D2; Fri, 04 Nov 2022 13:20:43 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwam-003cto-HD; Fri, 04 Nov 2022 13:18:42 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id B9D1658046C; Fri, 4 Nov 2022 09:18:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 09:18:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567919; x= 1667575119; bh=YPE8ExSs4d4LTvnXSYBVZkXRbapPJ6obpuAeld6klEU=; b=P tmveYw5nLXiJ+/zabi31GiaQcHOpM7y1cK7cVDgxmbINAy4odu4apdyVIY0h9QrU nHGp5w3KxZGu7BLLECSXCccBwpvZSPCBtCHJe8aKTkRa2/RXxvtTlsuDv/zLWeO2 bTE9yx8jgoKtSGxqyubIW67sP+raBQg2no0B2nf/ijORhIhwOsNhXKpfJvXb5/rH U5HKs966WPLfjH1Fz3M564IMKA4aOHTCia6NSjORQauJ9KIj/cwzhEaUdi6JGx1h LWqXk08w39Gn6nkeSdG2DlT8qttZjbHVNEARtBKJjIyp1Iv4OYUJWcCsmPkfzgs0 bcbsEwjeeDMujPdwjUBpw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567919; x= 1667575119; bh=YPE8ExSs4d4LTvnXSYBVZkXRbapPJ6obpuAeld6klEU=; b=s tB2czEvX4BDMfxM9zlNk5k8xasvbCujl9jiJp6K3KnHPNgDJvw7PFnUzfnsPCfMH onK11uy4ITiU6uLdq5K0KSC9QzuYLGYxmdEM4RagFMXUv4K0PAipQBIhep8vT4TS XdtU+vXo00gVDf+uVGDeqaVLNWEiM56TbShVGNmCSoXj0TQZUd/LOfHGEzKl456G ilwNzS+O3NuzGebEBmIXBzPlg9MFPR7X4RzkW31wxpH57FEzvcB36JVEmhk0AcU8 0nX/RMYyB+7BBYF074CcwJ8KMHwu+vIyphC1kT8cs++MlzvVch5kYpMgD+GYLknp VmqyApPJHL9oDGSTQXl5w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:38 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:41 +0100 Subject: [PATCH v2 24/65] clk: imx: fixup-mux: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-24-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2379; i=maxime@cerno.tech; h=from:subject:message-id; bh=Y1EX8G8pftDxQw1Ys52sH8o9+GAhW5bf3l3YFzowBDA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl8Kz2/bolLusfHUS28mXpaWw6ePtX+OPm7LUjL3p6fc WZagjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAExE7SQjw6R5H7qu8Ka9sXod0MMvcc r/7OGs1zknzlTPbKpxkWXx8GX4ZxW4dMKRjSLZsmbFQfzGNfeMlGrvpRx4oHwz+01b28Fl3AA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061840_762987_B13D47CD X-CRM114-Status: GOOD ( 19.03 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The iMX fixup mux 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 --- drivers/clk/imx/clk-fixup-mux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-fixup-mux.c b/drivers/clk/imx/clk-fixup-mux.c index c82401570c84..e32c3b22ff05 100644 --- a/drivers/clk/imx/clk-fixup-mux.c +++ b/drivers/clk/imx/clk-fixup-mux.c @@ -60,6 +60,7 @@ static int clk_fixup_mux_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops clk_fixup_mux_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = clk_fixup_mux_get_parent, .set_parent = clk_fixup_mux_set_parent, }; @@ -84,7 +85,7 @@ struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg, init.ops = &clk_fixup_mux_ops; init.parent_names = parents; init.num_parents = num_parents; - init.flags = 0; + init.flags = CLK_SET_RATE_NO_REPARENT; fixup_mux->mux.reg = reg; fixup_mux->mux.shift = shift; From patchwork Fri Nov 4 13:17:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031778 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 094A8C4332F for ; Fri, 4 Nov 2022 13:20:45 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9j5o1Ei4tF34RN9+NaZuMr8MwTB6JzQTSwDYZOw4W70=; b=rhDRJ+7N+RjnqD bAFlzBjH+EqK/cO1bdcdDvSZV2gCh12Y7C8BTAyrtmnrDYlDDtJtjbHujHGXKhLXBF28IagLovMlx EOMr/QTZ/LBqJgE1mNvYsbZYMnvpCx+yp6EEa3i1+ckZ61sV5WNmFwBrGh0Qz2nIZAh9R+aApAWQI nDZg/7IW3mL2erxHGuDFpKaK55Wp31D9mbKnh82QBpSUuiJw9hevEoNVJms9kFJRTlox5a0x8G5Mu VGVKO7k7Mt0JFlWN/C9Yi6zQAL61J/pe9xOHZ5lg3UyIuOb801IqHSFloLqseJMAk5qfNpyJcfkU+ G0oYePZAfIAwbdDRyfOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwcl-003eNI-QI; Fri, 04 Nov 2022 13:20:43 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwao-003cvB-MC; Fri, 04 Nov 2022 13:18:45 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id E1D0E580558; Fri, 4 Nov 2022 09:18:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:18:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567921; x= 1667575121; bh=ryNmbFJM4diOGk8okA5Tqnn27dGfir9PKyxk50XOcPc=; b=y ZOTQaSkMUBYQeuVZ/i7oVURymR8TVy1qgr7EHudwMPs9CxjDy9m08iDZTRUkxNCz 9vMcquerZa6C0uV9+MeKoSupX+AqG9uc/rteuxg7LiGHfimpYr4SqpkhFYrSzhyX k75O5SnT1b19L33C7oHAdWp+smugMk83Iat4NZH/ObwTHzTEXis3NYyj6kKq5oJq LvJme0ZPRwcNI+B6aHhVWX26I87RCVF/2p+8Cq33aI/LZxKrHlK6JrOLLgGui8D3 eEGO6wCi1BzFUQoW7io4hVzDdXhuD0I0eZ87xCfWgoob3YN7aDQLY4RwfXXpYlMj ynr8iUuiIHd8rhIfLIV/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567921; x= 1667575121; bh=ryNmbFJM4diOGk8okA5Tqnn27dGfir9PKyxk50XOcPc=; b=k ocjtyoBv6Gxm60Vv2ETo2pxrQE6Aj8LnWrNWs5GoUeGj+0GREUMHKWCNWn0Yy0k3 ap+YhXB1RJBQmpRbV3LMu8Ww8iMiRv20ZWzC6QqWa8W4DI97+g+RbqUAKwHV0wRd 0V2EcOkNFtLvkFSTTjvoT7ZuNbaNc/GrXkJ5rzSA0yiq7YRX0RNVs84eI629ujUu Kr4nvY6rCnxA2xiP3GKX0w+XTpfwLCpbfOEVjlcbET2iez0M8JoWgS7h7ilA7EmM Q7+ZL7aAu8uhqU45D1CHMTrz1MxWDyi+yzE/IxWd1kRpLtgriLz+gQKJX2QYdpGQ N5Kf/qsx6/n6jxhtcIS8Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:40 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:42 +0100 Subject: [PATCH v2 25/65] clk: imx: scu: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-25-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2828; i=maxime@cerno.tech; h=from:subject:message-id; bh=FUptvuI3F63mAIhxBYRO2PMltn/Yw3CvkS3mja0KFvM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl/09/PK679nObU2X/T2a32roICJZXu8t7YaNbvOYtlR JbO0o5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABMJDmZk6H0T9btj78RNW+6x53x66M 182f3B+fMGBU92zO6TDIrdsZXhf/BJ/XBTpYs/pfR+r/e4ru9ie9mvN3o/O4PAGbkT3R03mAE= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061842_894965_D66FED50 X-CRM114-Status: GOOD ( 19.92 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The iMX SCU mux 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 --- drivers/clk/imx/clk-scu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index 1e6870f3671f..66e49fea5f8a 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -785,6 +785,7 @@ static int clk_gpr_mux_scu_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops clk_gpr_mux_scu_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = clk_gpr_mux_scu_get_parent, .set_parent = clk_gpr_mux_scu_set_parent, }; @@ -836,7 +837,7 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na struct imx_scu_clk_node *clk_node; struct clk_gpr_scu *clk; struct clk_hw *hw; - struct clk_init_data init; + struct clk_init_data init = {}; int ret; if (rsrc_id >= IMX_SC_R_LAST || gpr_id >= IMX_SC_C_LAST) @@ -868,10 +869,11 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na if (flags & IMX_SCU_GPR_CLK_DIV) init.ops = &clk_gpr_div_scu_ops; - if (flags & IMX_SCU_GPR_CLK_MUX) + if (flags & IMX_SCU_GPR_CLK_MUX) { init.ops = &clk_gpr_mux_scu_ops; + init.flags |= CLK_SET_RATE_NO_REPARENT; + } - init.flags = 0; init.name = name; init.parent_names = parent_name; init.num_parents = num_parents; From patchwork Fri Nov 4 13:17:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031780 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 A4C09C433FE for ; Fri, 4 Nov 2022 13:20:57 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lr0njV1AGOawTMXDQjE+oHtI2PCTV9abqfmvSNBxbVY=; b=HDHj9X06hWjN2R dDQXvw4Y9sCTiNt0uhiy5Aj2weSixFZBgWmrVJYKPWJUc4xIKEOCmvIo8qi4vpWCdalJXhyF3+cei tmUnZczIFSUv0doS6Tu9BFLxwl45nRc18cFxefxmBOcDGPTzFP0k41xzvGr4ftMqvPQKgRkONRWXc VqHZgMSKuGj06zhe6wfsnmgQBhSPQGFSWQA7VIQj0jVQk65sMIamNRBSKWhn5SoSsUWzS4jd98fBd OfAzofB4XF/0Hr7eRHHr79mARNYEAD65P2n8zPwYeWaz7ksNyUts/lL6RNNnht4wn+NpL4mlOTF+S kY6iMrECLNMGRMO6XhPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwcy-003eXE-Uz; Fri, 04 Nov 2022 13:20:56 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwb1-003d3b-6z; Fri, 04 Nov 2022 13:18:57 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 3C52258055B; Fri, 4 Nov 2022 09:18:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:18:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567934; x= 1667575134; bh=cUYVzFMeWj7msgaW+CWX20V7PRaLLDctOWBEFEelebg=; b=R PvSXf8qmSCp/W1ZoDh3c3/tZZhN+u7CQRVwhZEb4zXz2jS3Jy+B/ACMjx43CPGv4 47I2U2h3rKJaP6kFCDrZG4MOegiXoY6JFxMfTbzrIFV6iFUvxL3OPhysJvdIlxWQ 7Tu8YepQ2lA2i23jY0UJu8TBG6NIi9uM9I05B4WasPrbmWwv0RUv3u0VDY1471ZD ZiEKrhHclv0UJ2/Xnlr/0s3aDafHuysTDfrKKE/pXIRYE1K+PSZ9tE6f2il/PUjh I5CWIQ2Btiyt7eUsAdfX7cz9GuxVi9z0f/buF5YvbuJeAbjSz26d9RUx8RztaMYI HISIHnaQOYUfsg0Uvr/5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567934; x= 1667575134; bh=cUYVzFMeWj7msgaW+CWX20V7PRaLLDctOWBEFEelebg=; b=g nlm2rPOAv4Q/ADkU5nOABCfYBubNb6EPUuu++fOj7mvVr5T7f04jqYD4RWlEP57f BB+oU9mAVYnLB/EFafXYyTcqDNqAaaJiLlsCtPMMdY0ok5JZzY3vNIpn0g1jZ0tl l2JKwLnHW/5TjV4qGbCwh8TRLAeRJe3Df2DkOQ0j0KAYYbSfaq6gyTfLhhFDa1EZ b9dYxUAIaCPmOLVBciPTqoaCRdS/1LTKwtfxCOK0t/I/M7zZW+zCq+wfP1oTY88D Z/5MY0HFuZ3+kwWHl8eMkdlVsu6Tme6bChRrIV8Q43pJzgV1Ek2KASHM1cnWB1h9 fKuLDzlldiGvt+ZyA3eCg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdeglecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:52 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:43 +0100 Subject: [PATCH v2 26/65] clk: mediatek: cpumux: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-26-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2401; i=maxime@cerno.tech; h=from:subject:message-id; bh=+MX66eVw5hOCcS4y+VNPZpuNpw6WMytsI19v9YzpKxo=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl9eMfEfu9pa+HnulUtJl7i4v24wTQ/hYpZ2nmsx59Gk 4+02HaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZjIX2GG/65sfU6xas8/yzhvk0n7EW aVOP/Ck896BfeK/+z02OX2fyPD/3x+1pYD8ikivmahXr8WJit7edhOt+H74/fjav4Bi8nfGQE= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061855_497255_8E348F25 X-CRM114-Status: GOOD ( 18.61 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Mediatek cpumux 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 --- drivers/clk/mediatek/clk-cpumux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-cpumux.c b/drivers/clk/mediatek/clk-cpumux.c index 25618eff6f2a..514807ae4903 100644 --- a/drivers/clk/mediatek/clk-cpumux.c +++ b/drivers/clk/mediatek/clk-cpumux.c @@ -53,6 +53,7 @@ static int clk_cpumux_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops clk_cpumux_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = clk_cpumux_get_parent, .set_parent = clk_cpumux_set_parent, }; @@ -73,7 +74,7 @@ mtk_clk_register_cpumux(const struct mtk_composite *mux, init.ops = &clk_cpumux_ops; init.parent_names = mux->parent_names; init.num_parents = mux->num_parents; - init.flags = mux->flags; + init.flags = mux->flags | CLK_SET_RATE_NO_REPARENT; cpumux->reg = mux->mux_reg; cpumux->shift = mux->mux_shift; From patchwork Fri Nov 4 13:17:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031781 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 BFE2DC433FE for ; Fri, 4 Nov 2022 13:21:03 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NgYaYU94fb/PKw0oZysuabIzXgPiuD/HNQ0tlrC/XLo=; b=jbwe7hyFgm/YbG 9F5BDBwsFh5Cz6LnhzIijlDdHZjxBKQAgxMoGvWHAZLRrXGsMyQf3WepFC+xClVRfpCNKx5Y5SyRl fbbsdFuLsNZILnh5OY3rfuk3qOtFvHd29QgT3mHPIMNuylEftDwvIpdwqLLph6gAjIUeVtFiz6Til nvhOME8D83oX3GFEGTEacelsOz9j9A4Ba0TFWAAUv5iVu8bO3G1RchBzuQ/xF5/I4tiwK2I7MLNhX i8IDo3fVx9/pSRmHDfeVOdbJIef7cHpku+YoenaHlSUwzWPqoXRXhxkPRzEnRjymkSsVNQP0kDCva osX4Rx+EI49/0upKgMqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwd4-003ebL-Rg; Fri, 04 Nov 2022 13:21:02 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwb4-003d5X-4m; Fri, 04 Nov 2022 13:19:00 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 04D49580562; Fri, 4 Nov 2022 09:18:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:18:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567937; x= 1667575137; bh=EM4fniunJodZCkTlf4r6iLT6zTeW+tqDl1NJl7aK34U=; b=t SwYiPPu+OA/c2nxlVNCm5WTc+N7Y/Cn9TYuHpaUlT+K63DsZ0rPGBhodqKgxgDfZ XIy2NLh85n2Tq+omcbXQ/VKcKcpAKSFBKJAWeTXCl1WqzdJGKNqmteA5NOfqVC4M snBAV4gNpM1iAsO1Dga1AfjZ87BBB9MhjgVJzH+3lha43nMqS1mgcjM9YvcbbhSV CeHswLxx7REHAXhyDD/YLbvZi9ytRnVVX6ryqh13UCBu84ogEn+f/H3Hxzy0BNDe JRdmir8rph3Vwcb89Hx4iewm4O0/hTyzAOw4ij3dFreRvOGmZ0W7630AWuxIv2CS c2DI4+rhNIM7koIP/zExg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567937; x= 1667575137; bh=EM4fniunJodZCkTlf4r6iLT6zTeW+tqDl1NJl7aK34U=; b=Z upueXuS2m1jh+ldAn8XMjTyfHLR//dPEUpWQNGoSPX0jjrYHoejVWyKL8tOjUVVz LO0RgnaIsZlHJtlLwr2uaSNn2DJC5rX5OTtqh3GLMPDPc1Lug/b77rV6AIl0neIC A9asE0U8lPC9U0uJUwhR1Eb5egJRvLuFnC7xLzYgI4oX/wGVrJRzu3c6zfi6fyPT 2OmdwVRZobBkrTSqgOTYsBAxlM3/b6J1mzaFBja8XFEhe5/ni9+BtfQwvJr09dhJ HjWJ9fo31CfRxtqcYqUh1azOv9bmOiyz/9RABeT2iiGPQHIxXCCJXI7+G9PgPBU+ gpEsspX6KRghDaMkEaoXw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:55 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:44 +0100 Subject: [PATCH v2 27/65] clk: pxa: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-27-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2451; i=maxime@cerno.tech; h=from:subject:message-id; bh=gkm/+o6ixqMj8B1WnYL7qpChrixnNV+DZWxwRDHCQVo=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl823gjtiSyuvCg27WGHTV+3p0fIjr8+s3btzDvoc9lM MLylo5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABPJ9mFkWPnjw5/jq5fz/s7ZFtWxVb b/sbTug6a7odvns07d8/KX0x+G/1kqLpX8SbpZ5fV/8r76XpZYz3SdK1ZXOcct7+WOn5O12QA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061858_346623_0C080494 X-CRM114-Status: GOOD ( 18.47 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The PXA "CKEN" 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. Since the set_parent implementation is a nop though, it seems unlikely. Signed-off-by: Maxime Ripard --- drivers/clk/pxa/clk-pxa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/pxa/clk-pxa.c b/drivers/clk/pxa/clk-pxa.c index 374098ebbf2b..47bc60c2854c 100644 --- a/drivers/clk/pxa/clk-pxa.c +++ b/drivers/clk/pxa/clk-pxa.c @@ -82,6 +82,7 @@ static u8 cken_get_parent(struct clk_hw *hw) } static const struct clk_ops cken_mux_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = cken_get_parent, .set_parent = dummy_clk_set_parent, }; @@ -117,7 +118,7 @@ int __init clk_pxa_cken_init(const struct desc_clk_cken *clks, &pxa_clk->hw, &cken_mux_ops, &pxa_clk->hw, &cken_rate_ops, &pxa_clk->gate.hw, &clk_gate_ops, - clks[i].flags); + clks[i].flags | CLK_SET_RATE_NO_REPARENT); clkdev_pxa_register(clks[i].ckid, clks[i].con_id, clks[i].dev_id, clk); } From patchwork Fri Nov 4 13:17:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031779 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 85854C4332F for ; Fri, 4 Nov 2022 13:20:54 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lANBmfHxMyfyeeQbVVmqJ598tJZVclprLiWKkPB3eHg=; b=phkew9jQaGbPZc Fc2hguN5VwtN7g6GMccjMUt9BYTq9rbs2SGEzso7fNfSAQ1f3UHY4qPQJHynha0XsYxr1G8/q0Pkq 8ZzRG0+IAGiTCBtN8st0X7zmqe1r88RPD21bDneFtQX+myuuZUPC63Omzr+j0U4qUMipBgprP7oKo +cpyZa/QC+UVhqlS/Z8lNQqQZWpRh5JhcMjaZkCSE6TxDfdklICl5L1d9abatX6undplWO+5Cfc1p fQMyGpaX8donfKtQSCCa8PebvuVpGQQiLWHDce6Z/yQ3pRfZ1oEH0N1z+Q+KNZyIJa3HqbeC2/w4o XmGlQ/RkhPVKw6vlde5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwcv-003eUv-Om; Fri, 04 Nov 2022 13:20:53 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqway-003d28-JA; Fri, 04 Nov 2022 13:18:55 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id BD83F580559; Fri, 4 Nov 2022 09:18:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:18:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567931; x= 1667575131; bh=x/RnpdCq8+l4EBCIw1+peBD+1x1bRnGWgIjtgh7TZMo=; b=h X2tpSuUgsYz8JHnokK5gCBSla06jpKoxkkj6fjH9JIZwX+IZM5OJ3TE5o+wU8L8U 1SC07858vt3iW3/1xK/5+CZvZ0bko5yAzjN6RhHMQAOvVZEC1l7AqjIXYQqSpHiS 88IwCYd30Vp/m4a87X7S86R35utHVTwrFlhsOcw64CkcUsGDdX6MBQ+pu8oEYEqo zHC+ChzMxXJi0UahYgSLGyWqAfifSm5A2O3QFwW6GlognSOIYB5h+i6fSb9DArLl lgye938EblJpIS2GDNiktjCBdfjA3hHcuSKWydmgW5QIQ6dwyKqdOYYQKnIVGrrA SyB4Vs9Soco3SgQx5knzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567931; x= 1667575131; bh=x/RnpdCq8+l4EBCIw1+peBD+1x1bRnGWgIjtgh7TZMo=; b=J gP9Nyqw4uJNzPp1bH8YqEDeesONVVGHerTPniEFT9S7UHs08JZpB94wh03wTExsB Cqg870pHDbkWZ6y7+7Tb16JcR0OttUdSqGZ1Ohzyow34ToXA17hB2nVqNCy3cWJp X5piRIe40AofkW46w0rsPgDLwIN7V+Fe5cEaFPDzEyZMT6oPidaUQ3nBF9Pd41uy zetM+3ClJ03fTlQ8fJii1uwoi4uv8CkMXSlnvBWTe7hU/WIhXQ7vJIfggniZk2ov /DVviPFHuuJcb7UnC+Q0Xn7sF6DWOKVsXCuL35S8H2Q7Z7YGlaqYiAhMYea/ciN6 3iDK9xY0lq76GRvE7T6bw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeeinecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:50 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:45 +0100 Subject: [PATCH v2 28/65] clk: renesas: r9a06g032: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-28-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2424; i=maxime@cerno.tech; h=from:subject:message-id; bh=qtN8YmaUvPGpHcy8Dy+enw7ZsB7uxefygNx/9UP+R2Y=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl8YryTd5Eg5oODvGn3v6Q/XhmnHGms6tv7idpbgWb1k ygn9jlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAExkTRYjw83aXKOQbSeesfRYnS40/X rv8I7MmQKXPRQTyjpM5hzIsGf477fh/Dzt9IdLl+lF6/866rTl76rP0/i/O+W9lP1txHuwmR0A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061852_854115_A16E2A12 X-CRM114-Status: GOOD ( 18.31 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org 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 --- drivers/clk/renesas/r9a06g032-clocks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c index 983faa5707b9..70c37097ca6e 100644 --- a/drivers/clk/renesas/r9a06g032-clocks.c +++ b/drivers/clk/renesas/r9a06g032-clocks.c @@ -773,6 +773,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, }; @@ -797,7 +798,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; From patchwork Fri Nov 4 13:17:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031782 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 246E9C433FE for ; Fri, 4 Nov 2022 13:21:12 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zAn5vHivudnclNg14GyEGbtP197bHfnUO70Nx4VrIME=; b=U6TIVRPgIzyBJu lVg2CzcwNSw7n+uPB3u8IxpxUd8NVnA7I1HXolPTLUJFzaeyA/YF3vPuGfc0EqMSftXEzyF3OI7jT GalCKAk2bW/9eX9YNvxwVoU3SldZsfPWPQisOZXjiL+G4/BI3ikgXVWfoaxQ92mus3aWP4XRElX0f 6PTr8FR7kipbF4VsvNVg4VNprhluCIbVTc+kFqLN1RB5W5QW6oT0BDMnMewAppOBUfFHMEtaLkvB3 dDhTwrDTHLP4Mr+YABhZeeqRtbOvCB/I6oeUQK3XAIfqv+w/h+HzhERdqI3qCZjCmJVO0Wi817hv8 tAWPi06s+5x8ew8YarhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwdD-003eiB-8O; Fri, 04 Nov 2022 13:21:11 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwb6-003d7I-I0; Fri, 04 Nov 2022 13:19:02 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id B9CF7580563; Fri, 4 Nov 2022 09:18:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:18:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567939; x= 1667575139; bh=lA5WUlP+m15yaMMsRS2hRLYRwFFZ/W3FM5CuZu5dZ9g=; b=D GupQqrPMYH0MsOjDofyJ4Cwhhr8V5BN6i5uOoYZlfo9ldp8iTLw8ZRNCmwcQ9TmV rrUmX1mMbGHca24HZ3T4OyyYg+kv4B2KaRHUj3AJeifhqljLI3GOhby/iOiFWkvk iqfaMOKXPDn6eeimRAFDiF24OGHZx6+Pi3FirbB3LBfzmw2YGHXi84fmtVVn1Ub6 alMaWIvXKYCqenOCrJhHLAeeeJkgD1yT2w0Afcuy+29DlT3KokZ/mhQXmHkqxnwR MxCN6cf3i9g88iTQ3XYtIejPHu8jOeuqEQVXBjEbQD8gPShcDJtY1I/ILnmaKD7d a5c/QnkFOvH/5QBsN4hww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567939; x= 1667575139; bh=lA5WUlP+m15yaMMsRS2hRLYRwFFZ/W3FM5CuZu5dZ9g=; b=H 4Zd4lIyAAkMozOsbJcGXnv3u58DX8bHBozkjs1fY+hKCtVZMrmCD3ba6wgfj3nz0 /7uod78c1pqNKPjXKY8McVqqI5j4nj1Y7E/RvUcg+lZlItZpOAU5MmrfQDb9BWwg 9M4o8KTFVUXYizYqRnxbtYW+jDDR2qSaxccwLuf/Hl1Asomp5E7AfKD3ZqrcPqVT TppPkqyNdZLUnOpE30qoYlk8DDC/oQ5J/eeRLH5dFUPOnM5hmaYMTdo88usuYGOy 3xKyM94BmzmS6CRifUIRCAHMPwY4DHWgy0npvi/N+rHFaKQ3Z7lHohjaFqjvoHxh wsUqYgWZ83oVTg2SbrXXw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdeglecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:18:58 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:46 +0100 Subject: [PATCH v2 29/65] clk: socfpga: gate: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-29-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2400; i=maxime@cerno.tech; h=from:subject:message-id; bh=TfjTLbLF9K86/ClXD5L3Glk0XF37HwX6ba50fpUMuXM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl+aU07IsNZUTFHpkLn8b0Zma8OZAwKpH68vfMA5Ufrv 7prajlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEzk6SWGv5IuH1Xj1nXPWyj51k3j8a yiN60Fqyd9nlyRPkXLeLunOiPDf5+nAunhk/157zkZnb8onG5+PEGoZcnbOw87tm8vmi9xkw8A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061900_720128_7AD2C6C9 X-CRM114-Status: GOOD ( 19.04 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The SoCFGPA gate 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 --- drivers/clk/socfpga/clk-gate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c index 53d6e3ec4309..261fe2fac982 100644 --- a/drivers/clk/socfpga/clk-gate.c +++ b/drivers/clk/socfpga/clk-gate.c @@ -164,6 +164,7 @@ static int socfpga_clk_prepare(struct clk_hw *hwclk) static struct clk_ops gateclk_ops = { .prepare = socfpga_clk_prepare, .recalc_rate = socfpga_clk_recalc_rate, + .determine_rate = __clk_mux_determine_rate, .get_parent = socfpga_clk_get_parent, .set_parent = socfpga_clk_set_parent, }; @@ -228,7 +229,7 @@ void __init socfpga_gate_init(struct device_node *node) init.name = clk_name; init.ops = ops; - init.flags = 0; + init.flags = CLK_SET_RATE_NO_REPARENT; init.num_parents = of_clk_parent_fill(node, parent_name, SOCFPGA_MAX_PARENTS); if (init.num_parents < 2) { From patchwork Fri Nov 4 13:17:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031783 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 59A57C433FE for ; Fri, 4 Nov 2022 13:21:17 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1GkMBpM7exWPkma9/Q4SXlceY7LFvTQeSDs4qXhlxsM=; b=t0RsrrOX57OIm/ OjBBKNNWwtm5P2svvXJ4vOUh2mxqqqV0dmL2f1cUm9I97rwqnUIP+hNJUa2+N2zKWCHlIunKBqZqe NawnQHmwYDBh8OvA/5NAc3B/sdB4jJnE6MBf5FjUD09RPot10NkIcP8VZvf4l/WOApntNUYJDUwvg s+YxiNEhibx8qNt2Uu32VwjcEN02w4SAyta9qYPGW6m1ufzQ/B0D/SqeHUFvgCYbUp8fruca4y6Hl slQ7zNCIrZnb0hD8+v1o0vKn5ecBsmNo/CkAbBqVWfiM9grtH3Lf01M9YnPoB0qDbdV6WGZSIZz2b YPEVKmA/IwZl09609hdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwdI-003emS-Ih; Fri, 04 Nov 2022 13:21:16 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwb9-003d9r-83; Fri, 04 Nov 2022 13:19:05 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 8E6E1580564; Fri, 4 Nov 2022 09:19:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:19:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667567942; x= 1667575142; bh=hhP29jEeBfRvzuLV/5grZHmqUXnMc+kegKMNYrrgAHI=; b=V jvcfM9nj9GzEUwML8i0RWhLmpPgguA4VVeDPo3mpJMAwqKY2gUGf0ZNET1MmeJ8w axhLXzSnlwbck0udyyDdRT3wOfZMZck8s1lsego0su8vyK8Q9/jUqyIXDAYoI7xR NiVGnZaXvuTfgKKihUia4Vee8cMxaYFXjabKdjGTJoUoLV1gNYzMEahJcIJZcrfO U7qQW7mn9BAH5gRN+LMpWwt5+kEe4NAI77BtBBYRShU219E7XseOfb9BA0N6HArz spo3xuJUu9v77jfn8/6Z6JxH1zummUH8caTVrALB5PABEJTQie8WJSM1fdnVSOzS 2kWN6fOnd2iq7iOxD7cDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667567942; x= 1667575142; bh=hhP29jEeBfRvzuLV/5grZHmqUXnMc+kegKMNYrrgAHI=; b=R uGgbqTxzTUoc6LjVuqwzn1P7/NClCKa8APdk664rYH79Ggc3G0K8RwtjzAcun7q4 4EPE8IjUb5Y06cBowmzaV9zRYCbTRsAsHBLbtyGCs65w//CPgR76uPY5dNiOEpYC 9+MBBlFcC1x76g4fFx04EEbXn2TQqjdWiOus5zIlnx3TmT+eZ4tolYp+OhREZSN5 RUgwss73bjI0fkfMHpoVKbfy5C81bsV8SEicV9V3a7XNNKrmUkTVsvug93J3UjCJ RVK/wiK3c3OT+aALghXK1e2ZtsHI6yIwZ+UYeCwIzVX6XQyVbiVQIfeZLh8q4xmr iTLDy1wgba5+abYj+Scxg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:19:00 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:47 +0100 Subject: [PATCH v2 30/65] clk: stm32: core: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-30-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2135; i=maxime@cerno.tech; h=from:subject:message-id; bh=Eu7Y9hu9fu4KEW6frLW2ZrjpgTapsHsdiRdYuhVIur8=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl+mGnq9vZuX01usJ/UqulT/gX36ycL9uR7ypy7fvCCf vMG5o5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABcpZPjDo94ypz/949U1O9Z/KY7OEd vtHdTUaVXSIuzyp8yLv6mW4Q9nvmvE15hoJX1L/q9F6wr67x3fn8Uida2z6Dp76WPnVSwA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_061903_453733_371E74F0 X-CRM114-Status: GOOD ( 17.29 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The STM32 mux 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. Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems unlikely. Signed-off-by: Maxime Ripard --- drivers/clk/stm32/clk-stm32-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c index 45a279e73779..3247539683c9 100644 --- a/drivers/clk/stm32/clk-stm32-core.c +++ b/drivers/clk/stm32/clk-stm32-core.c @@ -275,6 +275,7 @@ static int clk_stm32_mux_set_parent(struct clk_hw *hw, u8 index) } const struct clk_ops clk_stm32_mux_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = clk_stm32_mux_get_parent, .set_parent = clk_stm32_mux_set_parent, }; From patchwork Fri Nov 4 13:17:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031877 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 10F45C4332F for ; Fri, 4 Nov 2022 13:32:54 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dEJpOo9njR+ZWkiJopGxyN+tnL0NhcFxhXDb3q4Bz5k=; b=gyLQowN/F37su2 Up7KFOKtE1DdbUeTSlIYLEcIfNJlg0zHLLWlYDCLfQ/X/5ZDjfPmwAsT6algj9ovAnj/w95ZQP6WI xEiJmb6m6b2HOESuuUyg6HH0N2/eO+jX1eF186YCe9vKOLRG7X9arkPKs4A5OYRQzTjATT46RI9eX DN0QGxWqEG9nr8WXdPU1usH4QyFz0O6QyKZ4BxtkTj2PXxtWUyUPSqqHcEZDW1epRjhpjeet5Xb4g /lUlxu7dc+kyqXBXixc8FXkE9YKA+EdSbEouKuyc3hZG3YqR39DVBvIYNPN4S/yBNqAb3ibJNp5I/ 8xiaN3ForUjuM2IWp36Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwoX-003hl2-EY; Fri, 04 Nov 2022 13:32:53 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwoQ-003him-L4; Fri, 04 Nov 2022 13:32:48 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id A42735800E8; Fri, 4 Nov 2022 09:32:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:32:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568765; x= 1667575965; bh=OP12R/HSwnTWUiyniRxMemi0pLCGiBDAP9oM26nYGNs=; b=b gAoZ0r0P8dMEne5SzNzLIJAe3UgRjLWN9bCUPBHvCCH4eCQnR+QyrHBmvrbbTLE1 +7fy8nnZ7nZePtSZgN+yAdudz0peNsQ7IvXEMzywxSGKMXCDY01yRLg1S1sLMqan CdmOfRJnmnbz3lB8jX81cmwZMSukLNJpcdaYN4ub4roKS3mcXdM3yhK5MbkPDl9O 6KuLcNyGnI3U9Q2dyrQN0qKfcFG4rqV2GNa7g4gCRBu7n7OSteja1wDrUR5Bx2N4 AHWbAgHJ8t4YdpC3Ti39gE7KCzssfZnyc047bBssNcd0aQAoQ4BmGMJZ/R87RUsp 2bSijGIJnkZocDBohoOcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568765; x= 1667575965; bh=OP12R/HSwnTWUiyniRxMemi0pLCGiBDAP9oM26nYGNs=; b=r SkeD2o6ZAAo+4q0OjI4d65U5pnJx1CYHxmUBzzZTJ2VQPck7LDDg5vZ59AKlZn6G s/1uPKi6JibjWI+JLAEzr+0vypI0rTLlOyvBpEX3L3/4TWgrpCTy9f7hY4T8fgoh mdnLqfjodVnyy1VF/bQYN6mP4BnC4MXeK5Q6lDjASmNh44TrIZJqqkKmBQRRLyTo h7di6xl4TiBPFU6a7ZCev+sVPuNeE3n1XfYdG+O6bpzRYNjhmBqQVNzKP45mcc4G +NLZOyKVwjN9c9IFwOObE539NDfDI3Mx3n9UdGttpghBCbOLOoBQZtYANtVzPoO6 5RKhVWFHnfrO3Rt2tQSpA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:32:42 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:48 +0100 Subject: [PATCH v2 31/65] clk: tegra: bpmp: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-31-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2636; i=maxime@cerno.tech; h=from:subject:message-id; bh=TtnVJku8LpgyWhA8mU3ohncryBqbkle8GPJNf4SxgVU=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl9eTHlylc3QsPZpwdbVvj17exleFBruNQk1PGPRt5Xr UJVQRykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACYir8fw311P4dbJgnmqy2/ufpXSdO 2U0JN5zd4Fs5veOvxVV3zD5cvIsK6mVMTlyI1Ji/juLzhWfzT23c79x3g2RB9LuRXzycIukQUA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063246_782596_661213F4 X-CRM114-Status: GOOD ( 19.30 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Tegra BPMP mux 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 --- drivers/clk/tegra/clk-bpmp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c index d82a71f10c2c..6aea1cefbb80 100644 --- a/drivers/clk/tegra/clk-bpmp.c +++ b/drivers/clk/tegra/clk-bpmp.c @@ -286,6 +286,7 @@ static const struct clk_ops tegra_bpmp_clk_mux_ops = { .unprepare = tegra_bpmp_clk_unprepare, .is_prepared = tegra_bpmp_clk_is_prepared, .recalc_rate = tegra_bpmp_clk_recalc_rate, + .determine_rate = __clk_mux_determine_rate, .set_parent = tegra_bpmp_clk_set_parent, .get_parent = tegra_bpmp_clk_get_parent, }; @@ -512,10 +513,12 @@ tegra_bpmp_clk_register(struct tegra_bpmp *bpmp, clk->hw.init = &init; if (info->flags & TEGRA_BPMP_CLK_HAS_MUX) { - if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE) + if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE) { init.ops = &tegra_bpmp_clk_mux_rate_ops; - else + } else { init.ops = &tegra_bpmp_clk_mux_ops; + init.flags |= CLK_SET_RATE_NO_REPARENT; + } } else { if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE) init.ops = &tegra_bpmp_clk_rate_ops; From patchwork Fri Nov 4 13:17:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031879 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 35ACEC4332F for ; Fri, 4 Nov 2022 13:33:04 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eKaNJS1c6ightJOpNQuygUEC0crPG0tNZ4Pg2sK/tlI=; b=WgwJ9tUbSM62iy MDkUfKdS+QRyMZ1dcHqZJmBo4rAb/6/lyJXRI60BJxUyYzo4mkfl5AKRwkZoj+OCgHBe+uE1KzUw5 8t6SE8SEIaFQ0K7GqXkreWGYETOVh9t6G7LWeD7BQ4KXkOImdbHapI3SMU+PnOlbZyaGN0v7PvHFl HGyx9ZHI7MvIwwYlH0+HieRHv2bXxJORp3pzsYsmqCwyTKr8I2q6zzf6dfoGnCLBUzXt4pVRQ++uf VN4uUYUgd61dE+72zwUpslmJ/Rvd1octFVna5HpNylogxpiQMKgIZASSWZCDxW30KzT/1J21wuQFL Q4Z5AXVpINO7G/wOSSpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwoh-003hrZ-Ii; Fri, 04 Nov 2022 13:33:03 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwoV-003hk9-U9; Fri, 04 Nov 2022 13:32:58 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 4C4EA58025D; Fri, 4 Nov 2022 09:32:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:32:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568771; x= 1667575971; bh=PgJT+O60Tl+oRyfYM0RNB96qJJd/6g/qeRlw0csOt/Y=; b=B SYd4lT7Dwqp6d//jYgIZ15ci2iAlGhIOk3Dcev6OQMfz58/D4PKVGfzqOt1IfNwp T0WtlfkqNUz1bd0iQrpUISWSok1PTGWQDd+XLls9ZEJjOGnyqPZ7lJ/ZEszDcWRR KVM+kb6Xo6j9VHtuBsD8SJR4Owf2sTRIrsGSmUype9yUof/7zGhyxdtKP1AC8agj nFlFZKpPN1OF32+7Y1yP6OqZAoO5iDAHQiwcraxEEfYXgSAmyUYH4d0DLhC4ohID Upm0eZig/ClN0MXMAJx88o9L9U7CTykeVuCTLqGSZBhHVswbljjemh6LmCBG49Qm Vc0WFKiq/0MvdhP/Y/B5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568771; x= 1667575971; bh=PgJT+O60Tl+oRyfYM0RNB96qJJd/6g/qeRlw0csOt/Y=; b=C MAgrYXElIO8zBRaqNEbyQKCF0ZtCID/htl4bMWqYcpIThpa7KGryM9BzCisr0013 ts9XN4+2W8q1YXqTY2vmHbLiZT2KfspGu+2U3n0JgS5BaBjTOmOGB9E0kaF0LaH2 bUmTCGIv/tOODWUuQbKMCyc6qfWvqgjy3LYKY5yGnMYI0p7F1Lwp6tMgK/izMx1C ZLlscC4g3nns9evUsAioFXed2pf/RkxZBzDepN5Vc27v20Ax3Tdy2ptVELPBGgXb XQBx5mUMYsaARiOLysEIIDLXJvp4JXpoA3c8hV0494PBHqlbtqLjKWL2vFeB0Tjo 3AyJJpSayrT/D9F78Eb2w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:32:47 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:49 +0100 Subject: [PATCH v2 32/65] clk: tegra: super: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-32-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2388; i=maxime@cerno.tech; h=from:subject:message-id; bh=Nh/LYk+ARxOMHgn002rtxIDsEB03sDrV7scjXxRbF3M=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl8Sp/vO4jqUnV7OwXhWfPt7/gOBOlHyqb9Nzqb8ESyR /hTZUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIn0dTIynP+Usu6qykJjZo63wSd51l x13rT5lFjckj13XhTI7srqVGH4H75MREFsieVHngQDPlueCzwJUpc9/GL++jA9flIbXpjHDwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063252_655457_C2F62F14 X-CRM114-Status: GOOD ( 18.89 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Tegra super mux 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 --- drivers/clk/tegra/clk-super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c index a98a420398fa..8ad62e04fd8b 100644 --- a/drivers/clk/tegra/clk-super.c +++ b/drivers/clk/tegra/clk-super.c @@ -136,6 +136,7 @@ static void clk_super_mux_restore_context(struct clk_hw *hw) } static const struct clk_ops tegra_clk_super_mux_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = clk_super_get_parent, .set_parent = clk_super_set_parent, .restore_context = clk_super_mux_restore_context, @@ -212,7 +213,7 @@ struct clk *tegra_clk_register_super_mux(const char *name, init.name = name; init.ops = &tegra_clk_super_mux_ops; - init.flags = flags; + init.flags = flags | CLK_SET_RATE_NO_REPARENT; init.parent_names = parent_names; init.num_parents = num_parents; From patchwork Fri Nov 4 13:17:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031878 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 DF38CC433FE for ; Fri, 4 Nov 2022 13:33:01 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dsx3VXLGOOegEX0AZJiiJkvLEIevpfm/Tjn3vmgvA+Y=; b=MWoGoN1LPfpfD+ oFDtC1qQBIVkBLG3lxFiFYJrR1VUhGnOGHniJzxgnBLBVXyZ3pzx/CSCQsuXfR0I92tjlWdWUFfYS P40etSxcT6F7pxFkL3srZ/ZomoXpTQv3/qXBf2swTuylDZhNkA4AW3VS583aFtT35b+ey0VtpegLj lN6gJUP3g/7TFCFyX2+h/jQrc2MZulrxt1xmdNKrxpsn9exqsuIz1xeixLm++9d4jGiHq6SbL1NSv PRMD0TkHy1RPl03hzUk/kkyP/HOCQnarscWR0Y961tVxpdbtEAokqu8PkUawYqhB/jbJBT7CTkv0/ trU47/W9O+M7bxGvKZYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwof-003hpw-8g; Fri, 04 Nov 2022 13:33:01 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwoY-003hlg-VI; Fri, 04 Nov 2022 13:32:56 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 5C485580260; Fri, 4 Nov 2022 09:32:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:32:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568774; x= 1667575974; bh=tGBydtCUDCk73jqHi1ms+PUwXaWw+MD85xxvyrgKLGo=; b=H zZSaVpusazNg/YVT2NLu/+9aFuPRyZqkFeM3Xvax2JTezgPb71HKKAmjNt9OL6LQ BRoCWn7bkdaceum4BsnyjBxsWjAOgX7hUuyXGFN7VnHNs7ea0D81T/uCym3Lkaic tS6dCr9stjiI+BvSE1W9cHogLQrZKAU6fydmTfrZ1I2IwgKv0uIjjdpcvBiREZNO RXLEvlYObHoq9AVZe7OJ3Z37GXxVQFAQyL5ER7T8OONYI4texbIxZfoMV6He0i8+ ynhmvP+z72lzSAAL98VCo8V5qb/hvDwgieUxz2cUNQHYTDloXGthdUmfq0XB3+Gh 0j4WOPoUF+RVUm51g7JTg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568774; x= 1667575974; bh=tGBydtCUDCk73jqHi1ms+PUwXaWw+MD85xxvyrgKLGo=; b=M 7Tf4/qXEEA34xah9HeEwuKKmhlpnc+11ekAUOmw3BuNFjlUhAFTCURkfMRHZVvDy o4DzyRL44cP0hsbvuG7EjtK6ucV1beBEkcKQuNR2nhUGTNfTi1P0NVe9l8SOlRqE 9i8zRRuFS9TQHU2fwX+Crtqexrn06Rc3G5I64bzwQrRGkRpotaOt1okiUiaTFcq/ FLdsCWYVP+gzoASKY++2x5y/39Pq8A24vno/WVF9lxb94gsbxH9Rb/7jbkiXVmy+ gynmUWLDlJAW321uqM6oPkwPEr32WWCAxLJXkWwC1RFivj5ubkkoQHTEQbOliAA9 cn0fDNZcwl13jyoCkwDJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:32:53 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:50 +0100 Subject: [PATCH v2 33/65] clk: tegra: periph: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-33-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2522; i=maxime@cerno.tech; h=from:subject:message-id; bh=TVWzazISCOex614FUIKSWVgATQ2K3qNuwmBeNxoZHAM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl9Wim3aHRGfvVZQ0iX9wS0dq3aNxKwnv58HPNecriXL t+d1RykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACbyYSojw6TIBX69GamNv7n3nJZjfj /7WX75c+aVkQ8MONsOJTi+lWD4K8MpteRrxtFfP8u2nry3X7fc/vGy7Ngb12ys1tT6TJkQygcA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063255_103027_6AE61FDE X-CRM114-Status: GOOD ( 19.19 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Tegra periph nodiv 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 --- drivers/clk/tegra/clk-periph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c index 79ca3aa072b7..367396c62259 100644 --- a/drivers/clk/tegra/clk-periph.c +++ b/drivers/clk/tegra/clk-periph.c @@ -140,6 +140,7 @@ const struct clk_ops tegra_clk_periph_ops = { }; static const struct clk_ops tegra_clk_periph_nodiv_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = clk_periph_get_parent, .set_parent = clk_periph_set_parent, .is_enabled = clk_periph_is_enabled, @@ -170,7 +171,7 @@ static struct clk *_tegra_clk_register_periph(const char *name, bool div = !(periph->gate.flags & TEGRA_PERIPH_NO_DIV); if (periph->gate.flags & TEGRA_PERIPH_NO_DIV) { - flags |= CLK_SET_RATE_PARENT; + flags |= CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT; init.ops = &tegra_clk_periph_nodiv_ops; } else if (periph->gate.flags & TEGRA_PERIPH_NO_GATE) init.ops = &tegra_clk_periph_no_gate_ops; From patchwork Fri Nov 4 13:17:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031880 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 57538C4332F for ; Fri, 4 Nov 2022 13:33:07 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kFPQ3BKrrqHGtUK7BcxBoNhniJiFE4dDh4tZUiFCHrk=; b=QyeBKfPCK4M7MM 0W6QOQz90cz4kFXXOKuggaBwemh/FS/SGcp8AVlE/JbfkJ8cL7g0j5rtoSkbBKw1ZskR3jvgUObVT et+lXXE9bhTiYK0mx9oA32EjhI0c0OnGczXhiOfQt4vmLkk7M4/fV0VirbomOfsmdq+34OoW+Tzff 31rX1GTYjKmf2oaVf0Q+P3GFOkqv/b8gpLf+JvrZtdRP7d20/x4N3R3ke+63TX58n4YW1mHm2xmbT wJ2C/yqdtXWTWEhC9y+6DRE+1tMUJU+7aHvkCCEsCvQAldd7XK09eeAdPcsRLo7ZY7pygsP5tCmyS 43/L24PTCQh7WWEEfF0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwok-003hty-Hf; Fri, 04 Nov 2022 13:33:06 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwob-003hnE-Az; Fri, 04 Nov 2022 13:32:59 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 9FFAB58026B; Fri, 4 Nov 2022 09:32:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:32:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568776; x= 1667575976; bh=JahQgmjhiDg/dtEsjzZBdwNyHKdprmfv0l41QTxopUI=; b=f CffqvzExcaqkaPOwU1INp5n0Hnp3Sdly+hKW/geeljXPLf6Y85vhg5GmdGVOjgo4 zHKhr0mcGEbcISnaL8yfXyuJTQjf/HXnJEqTppFah/gzLo4m+8TteYAfbxn5FuZv v4a99+i9g1pz0RCbWfsbabCTn/9dc2VChVlYCfSlPugjcwDAOOE0Qc5uKAyw7Hcw 9R4hm6ylAM6IBsGbkokkG2ve2my9yKiPBcKD/37OwB6QZOXk6R6Pnq0U5Qn9cY2t AXdITmtpHAUhmPNm+LNdSEv93MzJ6Xy/gnbSV7oW99kblmwo2LaSsa04yZsMvz4j tQby7qez/LxIzBj9ARRnA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568776; x= 1667575976; bh=JahQgmjhiDg/dtEsjzZBdwNyHKdprmfv0l41QTxopUI=; b=P iu42wvKkMiPL14eg0JaYgR9GyCm0prjRlMVmt5D0LT5sHR9iTHVVa1VPUoALgPbI z2ZdObMyhbSqy9wBoJCbkhj0SoO2/tGXO1PEnKObUn+fJBRaTRIzQZWHGtW3c/Cv rPwtJG8jA7uvFkx2+6AFUUIkRRoha0/VZ0Si0/mezKWKcE9u+PhE6kW0TUJX/cyG s+lMcon99ffZQUJO/1P2yff2wrdRTZdwC67GOtyPLD26jlG538iPSidJMsq4oaNJ ONlIIOu706fopChL4ke4WoZSpfdcaJn7XvMhlH/kRdV6cmp5bhpm0+VZzODQbp+5 TQp5sicepd/k9iF7Z2+cQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:32:55 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:51 +0100 Subject: [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-34-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2581; i=maxime@cerno.tech; h=from:subject:message-id; bh=uxb5qeg43H3RnTF2Tkp9QnzMwccoi3/lBLvTmEuDxLQ=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl8UvmusUUp3X/9SdW/j6pm/p1irupXITGu/85evfBJT /a+lHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZjIARNGhvWCWe3ir74anCy8d6iV43 xw1Lb2q/yKHo0LnDVEC3v45zH8s29+8uepzZWXLEwXhdZkcNtf+5dYvP9gYdP7sieCh7W42AE= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063257_481781_5D9FC430 X-CRM114-Status: GOOD ( 18.55 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The UX500 PRCMU "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. Signed-off-by: Maxime Ripard Acked-by: Linus Walleij --- drivers/clk/ux500/clk-prcmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c index 4deb37f19a7c..7118991f3731 100644 --- a/drivers/clk/ux500/clk-prcmu.c +++ b/drivers/clk/ux500/clk-prcmu.c @@ -344,6 +344,7 @@ static const struct clk_ops clk_prcmu_clkout_ops = { .prepare = clk_prcmu_clkout_prepare, .unprepare = clk_prcmu_clkout_unprepare, .recalc_rate = clk_prcmu_clkout_recalc_rate, + .determine_rate = __clk_mux_determine_rate, .get_parent = clk_prcmu_clkout_get_parent, .set_parent = clk_prcmu_clkout_set_parent, }; @@ -383,7 +384,7 @@ struct clk_hw *clk_reg_prcmu_clkout(const char *name, clk_prcmu_clkout_init.name = name; clk_prcmu_clkout_init.ops = &clk_prcmu_clkout_ops; - clk_prcmu_clkout_init.flags = CLK_GET_RATE_NOCACHE; + clk_prcmu_clkout_init.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_NO_REPARENT; clk_prcmu_clkout_init.parent_names = parent_names; clk_prcmu_clkout_init.num_parents = num_parents; clk->hw.init = &clk_prcmu_clkout_init; From patchwork Fri Nov 4 13:17:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031881 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 8288DC4332F for ; Fri, 4 Nov 2022 13:33:10 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B8Bv7Be7mKd6J17QpiDHKk2cS7oh0g+wbfzFo3ztZ8s=; b=i1cvZJVMegsMmK eezFD5OcYQ+y7yJMosO9rLWLyqXHdrDENwwiHf96TKOQPGIKItFVfSE/0ciLXDXd81fdSQbeY2mzZ 38lQXw4lukCSH4gyQssBO5fAQiWVAegFw6BzfZ8NmTkr5MbjbX+z3O2Tm7vMUFGY2SpKAxUNsmQaL aFa4MNQRmQSuRxy+Y0W2PWBVOFxYZnXrTbr3cnpF5Fca+90D8TjzLQAt0T71p6glC2gZDYpu5Mamx iGwxiv7+G3YNehGAP1MzEcs3xdP7/GOm70SDROGXZqI6Jd++0ObDmFmjezmDrIs4xYgEli+Iy76T0 gCasAzZ4x0Wpru69I4og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwon-003hx5-HW; Fri, 04 Nov 2022 13:33:09 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwod-003hoj-Hl; Fri, 04 Nov 2022 13:33:01 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id E30EA580269; Fri, 4 Nov 2022 09:32:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:32:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568778; x= 1667575978; bh=vSt6U+MbOQyFoX22fbJ16ApKXjMQPIV6036d5Sbu8lg=; b=u zIfcgd0fzhiYhcqk3REFdxwgWHkKnqTvwBsZTvWnHmexsiJ8y9/bbXTIEyco9KLl dWHaCg+7OlUGn8lZzn/4w+0Vr8abhUkXoDneXyvOgpXOAcK6vNJv3e45a0Zs6V/M ZTQo3cfUHaKlg+13XDi1vr9PTy9DIke3y1wWX5mpGDqJrN72W0okbNGbKpN9PrSe Sby5FtnSNzQmDs54Ku/DnwgwvuvgU+6/FhGJlMUL1Od3I67H550ViBp0wBRfXSYG OAuXM0cQypqS7Iw3vkzUWVlOS5s7/smzZi+dQtftMKKLo1sGsuVg3IpxA3nxPkbK 5E2LzVgiNZeF7Rz3W2/nQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568778; x= 1667575978; bh=vSt6U+MbOQyFoX22fbJ16ApKXjMQPIV6036d5Sbu8lg=; b=X Bp5wfpirXnmQpMGy6daSSL4kepWjvYrRGVyW85Hqpnm2iQZ/1rBJFFxyAur8KUma 6T82p2cEawZ1p9/R/YrscBbEZElvvhvrl3aq2FXxXEORsesUzkw0FuBtNzE1OckX 28sc5gF/p51JOg4tanlOlJP62+YRULv8z/48FpcQDt1kity4p05K3YrBIw1yq/VD cazm4jKBZX+MiyoZ5CgE2r3TBleOM4ke3OZhYgoSikmsDV6P6rERQx62dB3buoLr F8NjAFyh93tp6NdzkjDAJDHCRGcMEStpzcDpa/j4bnWZDgQx0W2tAjD6IFCvza3B I8JNy4tE8avG3L6wdQiWw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:32:57 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:52 +0100 Subject: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-35-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2421; i=maxime@cerno.tech; h=from:subject:message-id; bh=oLcWV9CzQns4W0opoCZuOaa+qIVFiYRAK6VcYTSKxa0=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl9u/twoslN+xUUWw/RpwdYuB9RXfH5z6mKmksaf4+eO iW9b2VHKwiDGxSArpsgSI2y+JO7UrNedbHzzYOawMoEMYeDiFICJ7ElhZFj6jDUjUvFb2RarA5y5ve umhvY4qRqFvfgmc/Xs0RcTDacxMhyfE8b685fv4zchh+c/yLVn6FO9m7cg2TDIrV9gosnmH3wA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063259_762136_28F8309C X-CRM114-Status: GOOD ( 19.23 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The UX500 sysctrl "set_parent" clocks implement 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 Acked-by: Linus Walleij Reviewed-by: Ulf Hansson --- drivers/clk/ux500/clk-sysctrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c index 702f2f8b43fa..d36336665b6d 100644 --- a/drivers/clk/ux500/clk-sysctrl.c +++ b/drivers/clk/ux500/clk-sysctrl.c @@ -110,6 +110,7 @@ static const struct clk_ops clk_sysctrl_gate_fixed_rate_ops = { }; static const struct clk_ops clk_sysctrl_set_parent_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = clk_sysctrl_set_parent, .get_parent = clk_sysctrl_get_parent, }; @@ -220,6 +221,7 @@ struct clk *clk_reg_sysctrl_set_parent(struct device *dev, unsigned long flags) { return clk_reg_sysctrl(dev, name, parent_names, num_parents, - reg_sel, reg_mask, reg_bits, 0, 0, flags, + reg_sel, reg_mask, reg_bits, 0, 0, + flags | CLK_SET_RATE_NO_REPARENT, &clk_sysctrl_set_parent_ops); } From patchwork Fri Nov 4 13:17:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031882 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 E30DCC4332F for ; Fri, 4 Nov 2022 13:33:15 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J/tH/beH0P/UkwSxcYU+31q0e/g+jekGFhzYbNCs8x4=; b=wjycZ8yI93j4ng /+RehxyDUCHpXmzYJE3+LOWsZvR8MhkkKS7XDKh/vTosx5b2JxY+mb5JF/QbKnqpeqJRx4vJqD3hb 8OrbEiEVw2Q4x5VR8DtxX8zRakYBJXPz0w+snfbHzsqEzUWM+v1vCyLDZ/GsqI1V+YyBbeEbLsXH1 pKYCTrUsaqc3RXxOCBKfsQGgYLy7DboxmzWqU58LvUHyx3hPu4webCct7c6UDOgTkXQy8pxhGHBJJ +im/RJACkASZyeSMxu1/y9Woalt/voUQSf4axrWR0FhpA+XCKu/L3epSMIAHEfzaNkEzM6hnTY3Nj I8MyIJJauKRQk74EFW7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwot-003i2D-6m; Fri, 04 Nov 2022 13:33:15 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwof-003hps-Pc; Fri, 04 Nov 2022 13:33:03 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 120CE58026C; Fri, 4 Nov 2022 09:33:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:33:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568781; x= 1667575981; bh=FXqlLXY3AQe0JhPBQDYJIXVUIjFJbhMJ2RtbAJhAFMk=; b=C HZIa4EET3aSql06mqcmzzkEGPykUUEEHs9hEwk4FakVtht6tTdl7Aw4XI8k7fCeu cWUzx7mUxTF8EOBYelPTU/hKRyvYK2pccIVXKBTOkbCuIgPcCxOVLJcK1l5zSL1W w9pc8f3oBeem4PFri8Mil8IvquI9T7yOhMyHOSu4vU1E1aYt3xlZ+jgWHd7wFCH1 5Uzt3focgVnzc3ZYNsREKJx86cjcL/JHWZpk/U/XSeI6NLHb9GemJEDUW+2BFwZa Tmdx1V/U4C5KysC3oBzZO0OpNlx4BN4yOlgNo0BCTCt8mR4mBHPvA0Bv3VMei05b rQebRQMmMiStiogFdJZ+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568781; x= 1667575981; bh=FXqlLXY3AQe0JhPBQDYJIXVUIjFJbhMJ2RtbAJhAFMk=; b=F H3oaqmQdM9q0TdfeO7VliMe4RhTADODhaJS6cBZ9dPwJRHNUqj/9R+74MGU5h8gP 4+SbVziMAfzg5Xq0UG1mda5036YqTymwhJmyGr/GojaAaA9wXxz2mafU13eycOdM 7KNURDIGoy/W7gAVPrtiWer0L3YywiwztsnDaDlopec4Cf63MdOGWGNeXAQeOtN2 PdRLgt5cTyOCPo6cfXFvMTljeVjaGjWCOgLlMJI2RnpqYIreAq5wx+GdmsHDgMfw Sp7JHzERIdeJo22vpzWmVZ+c2qT+sbmjRzId/HBN92Zwn0O5u8YyeFbj1F/RgZLU xbTKT04ZG80c3pIfanEkA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:00 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:53 +0100 Subject: [PATCH v2 36/65] clk: versatile: sp810: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-36-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2391; i=maxime@cerno.tech; h=from:subject:message-id; bh=eAcY5g46V2wRTxnzJPXQmmI04+Lvot43DqmK7cibQQ8=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl/ci/SWFTm7lOuKnLsatD5GoTsygf8W/6HVT3YXrD90 bV9ZRykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACayvJaRYXLzYbtrp1J+FnmEfji3b8 lSKzvdJzufPdz24IWm6ssolZ+MDDcyJRgmGO6dn2s2KSf7g/6cnMltRttswlhevN2x/appLg8A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063302_048117_7D857066 X-CRM114-Status: GOOD ( 19.05 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Versatile sp810 "timerclken" 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 --- drivers/clk/versatile/clk-sp810.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c index caf0cd2fb5b6..a45b1b7b7d49 100644 --- a/drivers/clk/versatile/clk-sp810.c +++ b/drivers/clk/versatile/clk-sp810.c @@ -63,6 +63,7 @@ static int clk_sp810_timerclken_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops clk_sp810_timerclken_ops = { + .determine_rate = __clk_mux_determine_rate, .get_parent = clk_sp810_timerclken_get_parent, .set_parent = clk_sp810_timerclken_set_parent, }; @@ -105,7 +106,7 @@ static void __init clk_sp810_of_setup(struct device_node *node) init.name = name; init.ops = &clk_sp810_timerclken_ops; - init.flags = 0; + init.flags = CLK_SET_RATE_NO_REPARENT; init.parent_names = parent_names; init.num_parents = num; From patchwork Fri Nov 4 13:17:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031883 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 A79BEC433FE for ; Fri, 4 Nov 2022 13:33:29 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X/pUVEsCueUzLDOeeRDvmedCfVwl+y+YGZ/MnNO31Ms=; b=TGGHIcNa1DJX+q 9CYrI6lN5XuOhzAnUT70l+ICZIxQMlgCNz0yMA5AwQAhIe1XPvTyovw+JkH6l7INtGp7P7z8XuSnQ YkYNtkW8MT3F+X+TYuWXTe1U9ipGcxQtoSF3DE9YAZ6xsa4Y6kxTJOFaMLrpmbc02VqX2z5hnHQPw TfmTC+mEfPwhmnpDORK/f88vEuzIXAekkSVdiuZqb24t8vyhD8AD+mmQ+okWeBHBtmWvNjUxAFW2l 1vl/VgOmRZK/qmm6bR4GhbpDMGq53iVG5EP+dC56nzuL42RD7y8EbSiSjS2RCNN96Or4mxxu5tRNH uIwB1Dphciy+JOzpn3qA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwp6-003iA7-LZ; Fri, 04 Nov 2022 13:33:28 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwoi-003hsJ-Pk; Fri, 04 Nov 2022 13:33:07 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 2959C580271; Fri, 4 Nov 2022 09:33:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 09:33:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568784; x= 1667575984; bh=fpvChMV7gduAS/j/O9KuAGwGonXURVFj8t9hZ+51w88=; b=E /8S7N+PBkpOwH7yDGV/cFLKmPQgWXSkHka1GgnMe2kAzfb/3csu8WkTR7jVsGsft TWD1DkOX4/doZ3S/8CTBJZjq4JVtE9fDOOFCfPLa1NEL2+d01VsyTRA1ogRbVnpJ 60woen3gbxz9iYrSrlFHYAf8R2hirO+Ji/MeJcvexEH61PfKaglvPR1uqOUXrC0Q d0ZpkrtXSdBhicsdu5EsPaa7dgQO77EEBXznUVbhq5ZtezN1O+q6B0NuPq1a+UPn rO2w+mKVBS/kcJcjJ3bUb6yIjunFIdwmwWXQAi6/U/yTKggAwbQVUZHDsx/0zX6S huM9mEzXZTuw7vsq4/4Ww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568784; x= 1667575984; bh=fpvChMV7gduAS/j/O9KuAGwGonXURVFj8t9hZ+51w88=; b=A NPf8pC1rTQsNkkgFwsJ/dexEtm8HSyMo8dXM+5f1p77+ZVScZrpf3wFg4Vsdskpb fd7DOGo2LEOi6geKHHk98SgfCCPSgHCBDrI2tuZhpcrit8QmO11EEDAk7uWKLyf7 KdAf82YsBJ72Kfe06MRjG1Rcr4e3OarPCVn2rPM9d8u/KNvywhhVXtgJjVyo8AQN 3I/w1QtN78+zpT4E0tOtpp8HYINoya/gA2dDpnV2o59G1BEOomj8GIwVwcrIbmoQ WIuVfEB3o+2RfBQb10RLgc+9WpyzFgj1RWwTjqTfkJco3XZ1QTS597eD7+oSqMFH VJErVDXT0e2Jf4eayxIRg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:02 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:54 +0100 Subject: [PATCH v2 37/65] drm/tegra: sor: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-37-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2414; i=maxime@cerno.tech; h=from:subject:message-id; bh=PtNDgy5KlIotUjfA8c+WS3NHqugiidPN0vYRGszjepI=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl9OSjKLX8/iiZHYVn5Wr9JOSPd0rpOajW3SCxaRs/uC TKw7SlkYxLgYZMUUWWKEzZfEnZr1upONbx7MHFYmkCEMXJwCMJFEH0aGGTvLG1vj2Yyv8rSxb1A8uk 1j5WsH7XqbtcE9W7zuz2OyB6oo2SO1c0uvzEqlVWWiuy/5PTzwXftN8wPWoyExlr0cdUwA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063304_928377_700C6C67 X-CRM114-Status: GOOD ( 18.32 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Tegra sor pad 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 --- drivers/gpu/drm/tegra/sor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 8af632740673..92084a9a67c5 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -586,6 +586,7 @@ static u8 tegra_clk_sor_pad_get_parent(struct clk_hw *hw) } static const struct clk_ops tegra_clk_sor_pad_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = tegra_clk_sor_pad_set_parent, .get_parent = tegra_clk_sor_pad_get_parent, }; @@ -604,7 +605,7 @@ static struct clk *tegra_clk_sor_pad_register(struct tegra_sor *sor, pad->sor = sor; init.name = name; - init.flags = 0; + init.flags = CLK_SET_RATE_NO_REPARENT; init.parent_names = tegra_clk_sor_pad_parents[sor->index]; init.num_parents = ARRAY_SIZE(tegra_clk_sor_pad_parents[sor->index]); init.ops = &tegra_clk_sor_pad_ops; From patchwork Fri Nov 4 13:17:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031884 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 4C873C43217 for ; Fri, 4 Nov 2022 13:33:39 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=A9uVUSScDGTPTe04A6lcmxdnENLlvgB7kv/woD4LV0U=; b=Rt69IFy6E7VTk0 gBpy73qrwm+VzH33ZF6D4YKJqgLIq03RRjxH9gSTdOeE/zWZ9VCzTEqWjnFVM50OpigAvxH/LyEvY UdxXJbbV77OF8mtfYCEKsws14t4W/Vjv5LAnnJmpMCrpKMKkckHOc5rN4sp+tmc3lqmlT3JSCyJ3K BZRkSpiIE0z1qiL7bssO+P9MFKfo0mHu4HJo/AsA8k1D4FQ/H2HzURU2dG4N/NS6qeRKW1OoTguX6 BEjBHp9e8Nw3Mjc9V7SYrYXfe6oicq/7HMwthN/wqAqS3vc8qkYdlx6J9YhAOERUGLIK0pe7xTgML Kent3WRFxnX/n15RW2gg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpG-003iI9-6B; Fri, 04 Nov 2022 13:33:38 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwok-003htj-Q1; Fri, 04 Nov 2022 13:33:09 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 2E52C580282; Fri, 4 Nov 2022 09:33:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:33:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568786; x= 1667575986; bh=5BxMZxfClzfTLGk/1DtBwDoYyZCRr1onRqUwaNh1ye8=; b=g NiiUyxBwXfVIT33r4UTtbXDl+b/ju/cUbHgDv0t3rN2QlWH8E9pNWtfB8I6PY/SF LTVQQs+dnrhDM2WHbQ823rxaqR7KsVF2Mx6OIHbnBdT/udSgIWdj0nDHG37D0FRx hsxBT3gMG1xgGo2FoF+KbYcDPVwTZUbtck0rN8pDId6E6xFU9fGr+y4HDm344VSP ypUlZBqz+/Hh5g16aeQ6N2WvCdPo312X447x2zVjH1EVTteCMui/M3orSzDlrcrW bHyFd7r6IYCIupTO7VBOkh/PEbuj7v5iq3gHTudBZqzkKVUuheV/zhGbX9/xX2s/ 02hApmUHxYUcRDLFp2+mg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568786; x= 1667575986; bh=5BxMZxfClzfTLGk/1DtBwDoYyZCRr1onRqUwaNh1ye8=; b=A m9SAIB2X/3FNr5Am9A0wSTzyVfDNSl/PdYmDbGnUK/tb4PQqDZSLVmj1Y3cqJJgS wLxpIMTGd1xMRLjlitrxzz4nIs+KEtCML4sU6vdX6z1DoaiMAv6jUajXorJeBg1A Ad+CY6UJ9AD2LeemQKctXBQpuZgZB+c8CYIwi/luebTWWQEHLM6cnmPM18CQXqGB HReaChN1v3j4rzYI66FLQ3SJ5Nrkh7GGcDUt4lFkgbE9inGDSn3BDq3oG6h/HxoP 46ETbDzsAt6z2EhICVK7LcfeHhbfET0D/3qTs+umr8qA/keHxEiIIiLW2AfkT0Ci jYN/ekxROY7GVwx/gh00g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:05 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:55 +0100 Subject: [PATCH v2 38/65] phy: cadence: sierra: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-38-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2205; i=maxime@cerno.tech; h=from:subject:message-id; bh=zntdB40frzZthx9wXTpp5pjWLOP9hS5dwLBzuFNQA28=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl9Fjna+EY8xqTol8nrNq76l6o6CrrV5DFp35Y/ymOws L5TpKGVhEONikBVTZIkRNl8Sd2rW6042vnkwc1iZQIYwcHEKwER+ejL8rznRuGyVIeM8ozUcxp8Ufm Rf9XRPX12p+/X05yypqp0sEYwMi17+M5PSX5KifkRV6M2scqETvxZfdvly823oovz3b7NucgAA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063307_033237_043CBA22 X-CRM114-Status: GOOD ( 17.10 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Cadence Sierra PLL 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. Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems unlikely. Signed-off-by: Maxime Ripard --- drivers/phy/cadence/phy-cadence-sierra.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 6e86a6517f37..403f8eba9fe5 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -709,6 +709,7 @@ static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops cdns_sierra_pll_mux_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = cdns_sierra_pll_mux_set_parent, .get_parent = cdns_sierra_pll_mux_get_parent, }; From patchwork Fri Nov 4 13:17:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031885 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 641AAC4332F for ; Fri, 4 Nov 2022 13:33:52 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WPjOyaOvR5IbiYBcWDkofDmUyAuylDT8A5lf/PGE6Bk=; b=WlYP/iHINs1Zrm 9nqPFePXriIdMMx19XB7pPwFnx09J6uT+SWW+o6Vo3n6ttBNbypDQGkoDJOzg3KgyKQv0VXSccpxL ANZ7Wanw0OGif00mtBFTvlSW5oUpqdWuE1iTaWzddFPULfweGEuYtqzy+XIOxHJbzfFSew1+3abgV ZDluKf50EGvMCBkUCgRFfdASkcPKNBPA99/QdqNy+2IRGO2DQIqe6JxrXi84iNpcFyaK3RMn1VigD 0vqMujS2DgjWcyl5GvXpDIlUdV+2CtXHwRtJfZEwo3hiQVZghnXcM6S2v7E0ivIYObE1gdOCLO1R8 fS7Hh4VxL01pj1edyfTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpT-003iSC-CU; Fri, 04 Nov 2022 13:33:51 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwon-003hvn-2B; Fri, 04 Nov 2022 13:33:11 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 598C25803E8; Fri, 4 Nov 2022 09:33:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:33:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568788; x= 1667575988; bh=iEX+qgPsoF8AZsDDEpGRO0Wv9ERhTtchVN/nTDUON28=; b=p bh88bViNuCnAY+nmezxhzQpPXqiXrtmZpZiMkvubC9dpF8obJXOSLuuzZhS3rLgG UNoBuG6FtQNH2Pu6u1ZA2P56/SfSgSfBpCxlJA7HoAfJiGGau3vvmYVV4kMiUXQN iDob0KEqR3h87kQ/tH34fQUUIyi3RqBmQHWntR3rUqkW2Y6HrJjd3HrX/GBUeyR5 tKkE5EIIasldJVph9XLiyIzgFtUAeFdMTvR3lkFtqE6Pz9pIQ32BeXKY9WHgsp3S XbWQcaL1a/wkyUEoBDMMsqwDjBhPPXrtlJDddW/sQJwX98B1/9ijpWnJzCxpFntA MB4cBpKxzlUfqe1Y85DjA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568788; x= 1667575988; bh=iEX+qgPsoF8AZsDDEpGRO0Wv9ERhTtchVN/nTDUON28=; b=L ewE/QBQgU3MZQAh9A9Cf/STXRR3E7fe10weMiaH73G5oQa9jy0na3YB8a6Se49nk z83FWVW+n4XeT5jhGj9RmFUbicXPcWvHumlRQVEEdVz9s8WpSiPHDdj4kbcuVKVx jogcoXz8wYBonpUghI6rEgF5y4owqrXjLQ8YgWrWjQ5tIKmTutoNNvGR2W/js7uK lbA36m42G0qhhhlxc0sG+GUY+bnZ/9L2dVvfujzxOIhDvZSt5WVaGhmWYYB4Nb6d MKO00/n1xcO7x75QynAov+Eqjuyf57SaNF9/qgMwiBMNlZjCyyEaoHx1VQcRe7mU BhL+gJ1qbk5kiJLgFSZgA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:07 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:56 +0100 Subject: [PATCH v2 39/65] phy: cadence: torrent: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-39-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2311; i=maxime@cerno.tech; h=from:subject:message-id; bh=1VwDsLraUz0q8iU1PEKJyQs/2PSjnm1eIS8AcyBHtRY=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl87c1dxa/EFusWqntjO+z/23rUyKadSo0dx/sfyiiNj 9mzuKGVhEONikBVTZIkRNl8Sd2rW6042vnkwc1iZQIYwcHEKwES6ORgZfr0y2vCOo2Fm4vzsy5On+F ZPVe/3e5C/4+/DO222Qf99lBkZ+rVLg1hZTwrx6u6XKOz+331IVc+4d5rBJdvajwYPL1gwAgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063309_221303_CEC53453 X-CRM114-Status: GOOD ( 16.76 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Cadence Torrent refclk 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. Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems unlikely. Signed-off-by: Maxime Ripard --- drivers/phy/cadence/phy-cadence-torrent.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index f099053c583c..be65b05ec41d 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -1861,6 +1861,7 @@ static const struct clk_ops cdns_torrent_refclk_driver_ops = { .enable = cdns_torrent_refclk_driver_enable, .disable = cdns_torrent_refclk_driver_disable, .is_enabled = cdns_torrent_refclk_driver_is_enabled, + .determine_rate = __clk_mux_determine_rate, .set_parent = cdns_torrent_refclk_driver_set_parent, .get_parent = cdns_torrent_refclk_driver_get_parent, }; From patchwork Fri Nov 4 13:17:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031886 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 90C79C433FE for ; Fri, 4 Nov 2022 13:33:59 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VInb8DQbqWhbM2b9ASf3hoejwYRj7k0qHVHyfUQRXk8=; b=y/oKpFI7M8b4OH tPJ48ATYIMH5AyYRNygU4u0O4cANgly1NYc0+KNlqjsZzjfqLsP8q+VWganadjiyjy4uDrXqu9Lad aK9hRV7BeNSKx4eEshs9Lx3wA8eF1Mx24zvteYejLfmiaGo8GyUL55PaqlzF5yk0BIPMViQ/26Cev pwnM7iaf4U6bcnOiSfzrnoA1sgDfX6GxYzWVUuqo4zATc7Bs8ROViJloIvl9U1HseKQrqKC5SOEBD NaTBw0F3KR/CUWSAS+9/b88VeTtQSKBYQMeCK3WsZKcIUxsYqsACtfOwTsg/64y86kPToO1IJe96V 4VHPdcnKjiE4o+Pu5JGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpa-003iXb-IG; Fri, 04 Nov 2022 13:33:58 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwop-003hyc-9t; Fri, 04 Nov 2022 13:33:13 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 9B72B580456; Fri, 4 Nov 2022 09:33:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:33:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568790; x= 1667575990; bh=n64sOLiagnviVv3HjsxkegJ5AjY5p57YrMPjGj42NiQ=; b=N DUApnRs/rAKtCZmBe2Wm6s30ujm0TpOYHX4pXaMBY6oJ9Fb3M4PNfv1EWMi4aEgx v1jvaYP8prDSIxQzIkR3b+H+GuKo5hcFx7TyPX/mYkd21gPm2hY5xEal3ao/t+51 hCstWdcMea+COQCxhXldDKpP76bcUq3zQgLpYpvDGFZhYWCJ59GndmH1X/kU1MRT YLiJJzuMq09leXG1USYF6I44I+Si2yhd6KYPLpohQeX1PKFqfX8uehsd7RQJPOkS ws/T2vLKKOYxmd0vSmw7ZwaRYh4Xi1X31qCa01FCbgmOQVLXxaBUjx0bsinMFIBu 3c6d7+hvyKuSbWfOaQzDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568790; x= 1667575990; bh=n64sOLiagnviVv3HjsxkegJ5AjY5p57YrMPjGj42NiQ=; b=R QChmzzAm/9yfSs0GvKAwp/hkTgAo2XndsU9uHr2S32CNmGLfr8Cre3PuxKQMPM2r x2igjFHMSbfW/WinY/LFXIAaHMRE8dX+WEv5KUDyb9RnmvMoNQpbggd4Xk78hRg7 RcH8R1NW00WK5wCnamrztGDax90UWXoz81LmQmDXa11jViIFqeRkRyzf0vrC63Fi M/DoQWRBKKUOLs6gggemUcXAKrK5J8NZP+PwAs7yy0iLzzjY5xBqs9HZpYPQ0see F42tua2NFt+XyO0HY0tNgVofHinjSjJCHdIq+ZW28cVYMOfwVTramQE8Gmi7Yekl /Q93eTbVjnxDgeSipQiqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:09 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:57 +0100 Subject: [PATCH v2 40/65] phy: ti: am654-serdes: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-40-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2171; i=maxime@cerno.tech; h=from:subject:message-id; bh=Iy1qQJ0znBUKLYMmx1qyBFpOyf2xzBCZjv3Ms6vHOyQ=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl8bvL0V1bnzAmZ4XbSQXOei+LKj9v2TL6tdfZauPuP5 iF2so5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABP5x8DwP+OfmohMW56dbvv+FWpmTl paQix/H7EFeXRlGHMU6QfdY/in6K/HzcC92EBr6ZG/22O/buxrUOc8skp2D1+8xkT1zazcAA== X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063311_599134_1D08C4D4 X-CRM114-Status: GOOD ( 17.10 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The TI AM654 SerDes 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. Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems unlikely. Signed-off-by: Maxime Ripard --- drivers/phy/ti/phy-am654-serdes.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/phy/ti/phy-am654-serdes.c b/drivers/phy/ti/phy-am654-serdes.c index 0be727bb9f79..f2061ce4e62d 100644 --- a/drivers/phy/ti/phy-am654-serdes.c +++ b/drivers/phy/ti/phy-am654-serdes.c @@ -634,6 +634,7 @@ static int serdes_am654_clk_mux_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops serdes_am654_clk_mux_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = serdes_am654_clk_mux_set_parent, .get_parent = serdes_am654_clk_mux_get_parent, }; From patchwork Fri Nov 4 13:17:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031887 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 49E3DC4332F for ; Fri, 4 Nov 2022 13:34:07 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m58SaN9nNUhPlgiXgiSdElyPC3Paq9mksALz1SY+jPE=; b=g6N4Bw7JLyskaq IyHgt38jl9645bjEC8KnaYy6PPG7vjAst6uZcwX3yHhpLMDTAL2yzVv6W/7rVdiBWBGRTmzAfoRVa LoIgMGRTIUwb4PNecrRKfh41jqNso9ct9zDL9uf6i/nCLMfHJel0zE9r7BSUnlRGgptar7cfOto8w SyJq2dG2TiM9GBKr8P93zotXOoZRmfUvZgzVaUhjeBiDrC99ZZo8DyOI5GgEEtKSa18/ujVBlNxKa TW+wfCPUk7GQ72GvL8Ifsu67yZ8g4Dk9o084DYVQ5d6SdoXDUPtoqe8vCbzpNziaF8TiI6hCf6j3S gCiknmAlLez37ZuZIgkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpi-003idz-C8; Fri, 04 Nov 2022 13:34:06 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwor-003i0l-Hz; Fri, 04 Nov 2022 13:33:15 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id D5DFA580272; Fri, 4 Nov 2022 09:33:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:33:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568792; x= 1667575992; bh=M1Idicxec/SjsVbngLWtURd6yauqH0OPCkHzY+mm2fk=; b=T I/kFokFdLJrFTpdeHySAOi9asq+6S/Yhv/SuovPeXSRXrEHGTfat2muVNXrOGwF1 b/HmX4erdMDkOPHYaS7eg4nOyVl9d4anAlDtYRXkeA5ilNKHMnqcbiMmOvP3ikU5 PX7aYeFZuxsZ+OICHGX5eOqs5uF5BJx+fJQ5hG+1FuGdqv3voIDKixibPc1HxYFx Wq6zm3RSHupADOkFl5fiE8B6PyGdGw0u5UdG+3SDr/lWI0oURJT50Gc+IKXOlXBM D3j9Sr4PsHMxN63LlY19rt8wHqcbppEGyWnAOkGJcQ+oUJslNiiWqUYD1CYRgWGq MwB7Mm7VlwaKsKb23Q7zg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568792; x= 1667575992; bh=M1Idicxec/SjsVbngLWtURd6yauqH0OPCkHzY+mm2fk=; b=p ZIJwbyfBMa3i9+2YI02nMxsGb2L06OItCgy92XFtfKT8AdbV37yfPraGmXoMdJtE 5Zn2RNNZQGyBIfOs4DxlUpv9y/W8Qyt6sW2NZGCkWJl+SzpL6elXO0aIQ5dzmLNL v2LpN3R5TlX36pL622dO5/G4xgsXvzV8h3XEmEKOj7rJyj37iVrArFvoq0NnMYV+ MLVleTazeU9arh32Graxcl8hKk0Fy9A22bZRYMRrRwzagMUDWmxcGNywHPevMB74 eyYARkqcCrcfC73RgpX8lZaZ6EC2i1M7UcAdrZYb1b9goGm1vOvqZn1pJ5kE7aMV khzMg1Fi1f31iqz6Qztig== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:11 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:58 +0100 Subject: [PATCH v2 41/65] phy: ti: j721e-wiz: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-41-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2117; i=maxime@cerno.tech; h=from:subject:message-id; bh=afkbyj6qSgUvTXcAti18h6pkdtwmG8YUcM+gKscM/p0=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl97jY/NC4n+c4Vtz7cprTo9U/35pwQf3PtA0MPH7Wi2 X0F8RykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACbixsXwV+DDte6+ih8Ffye5yD66xm Ca/XNezczs4FfFM3xvdjoKqzH8d+dY6JAlxDbV64drmyjTlt2sn12kCtPZrFO3cj/t/1LOAwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063313_740475_2481A457 X-CRM114-Status: GOOD ( 17.01 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The TI J721e Wiz 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. Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems unlikely. Signed-off-by: Maxime Ripard --- drivers/phy/ti/phy-j721e-wiz.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c index 141b51af4427..bd0691e5de47 100644 --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -781,6 +781,7 @@ static int wiz_clk_mux_set_parent(struct clk_hw *hw, u8 index) } static const struct clk_ops wiz_clk_mux_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = wiz_clk_mux_set_parent, .get_parent = wiz_clk_mux_get_parent, }; From patchwork Fri Nov 4 13:17:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031889 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 35CD9C43219 for ; Fri, 4 Nov 2022 13:34:16 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EP4NhNB+kQ0zJnoLeNX2lJolR31VSSdVQZjwOH145Kw=; b=mTk9nbNrETfGaI 7KmY8qTLBIdz9xUC2ihSwvtfGzu8qFiGaMeA0GHZTcRbPl6w4LA1MIWE8+uktYnAiOIS5syU/g4NT RjMW57L5vcnodgxwUJ68SdKhfEFGl6YvORZUFmVhYg68jGXelZECp2xsmfRv8/aeFMRb0Lgnnb6iw Gc335tvroy6dNcBkFpM9kH3dSWEYX2zObCh0RpBU3VUGMsqfyaB2tPupXianw98IrbT9cWhfDi9nI NzoXBGyLFlpSsW0MDDUOMlzjRykOd/XPcmeuEwWCQYcBNilzJjTpHcmxgrDVcRUF9VBjzgxnD/Ivn J15RnFW8GNAXWafVdGOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpr-003ikL-J6; Fri, 04 Nov 2022 13:34:15 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwot-003i2B-Jr; Fri, 04 Nov 2022 13:33:18 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id EE0F258051B; Fri, 4 Nov 2022 09:33:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 09:33:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568794; x= 1667575994; bh=i/mdM6EBYqXU9owm3d69sSy2Pa3hzJ15q/3x138bZyE=; b=J 9nWs5By63qyldGfoZmgNazEVWBlEeNGjsA0SN8tbirUuxog9s4i0zrfw5GGBLya9 Evo+SqmEgs93b2kr2vmSc+dxzwGTU12hU+xqej8aG1Ii4CjRlwXwRqlXAC1rEtBW 5mylbxY1ynlVmY2o+SS3NqAc0yIVon/cllx3aVeXbjp4dS8KTUP2kaNNhI+uv1Ap nJVf5zY5D3qy8c/HsZidhxweByt/JXBLNyenLxzvzG8dnUH88rmcwaXntuXwsmOP tYZQWdbmKDNSOBYVMnFElBDqj+JK6CrOy6z+tBFRcEvBC6dq26BG39LyyC4sdGCg jxOCP8/hqj7H9UoYrsu8g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568794; x= 1667575994; bh=i/mdM6EBYqXU9owm3d69sSy2Pa3hzJ15q/3x138bZyE=; b=e dHY5hm1zWpU0YGASfdRoL44xxdxjBrGMnPUcihMgN4pXSWsooezkVeoqd+P0FZ8C u9RJTf22oaCo2WRQIakhyozIElT/ubuZrquA4JOHHwfr2CNsjuWuVA7vbf3BPr+n abUqLUh2j/S+nFfOhkdbrATHOjoquPEfJFNG8Nt4f71BMni1+OR7tHJUUndtrYjn +89vHPfffaliFdW+P/QTiR7Ij3L2ZyqFO0pJ+LvEBcCCqvfiHtNH8GV2lww8O/b2 ocXR9Oergoyr7M2aMg+RsoMZZAHCHwCIl3n3eQsheu1ZPLIIhrpwUvBgULAdPbgk lncx0aAmOJt8aEsKbhG5Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:13 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:17:59 +0100 Subject: [PATCH v2 42/65] rtc: sun6i: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-42-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2353; i=maxime@cerno.tech; h=from:subject:message-id; bh=i8NV7IjuD9Yk1Zqq8ZAa7SMelcQ7FkoI783UQL/koLU=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl/1/VZaF0+xO3nvzpLUj0Lhj9ZM94pYvE+Ry81ombm7 +4vVHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZiInTUjQ9MpMxvNpTFH+ji1p8+I/m 4cZKbL/NZdzCf1qne564+6fwz/o5bve5501XEa677Dto4WJcfWtbLdlZLwiq++IZqxpMybGwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063315_800402_FBC68505 X-CRM114-Status: GOOD ( 18.37 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Allwinner sun6i RTC 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 --- drivers/rtc/rtc-sun6i.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index ed5516089e9a..a2781502c244 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -215,6 +215,7 @@ static int sun6i_rtc_osc_set_parent(struct clk_hw *hw, u8 index) static const struct clk_ops sun6i_rtc_osc_ops = { .recalc_rate = sun6i_rtc_osc_recalc_rate, + .determine_rate = __clk_mux_determine_rate, .get_parent = sun6i_rtc_osc_get_parent, .set_parent = sun6i_rtc_osc_set_parent, @@ -228,6 +229,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node, struct clk_init_data init = { .ops = &sun6i_rtc_osc_ops, .name = "losc", + .flags = CLK_SET_RATE_NO_REPARENT, }; const char *iosc_name = "rtc-int-osc"; const char *clkout_name = "osc32k-out"; From patchwork Fri Nov 4 13:18:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031888 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 19108C4332F for ; Fri, 4 Nov 2022 13:34:16 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vU5uWrVP0vzUs2oT3Zcz9yN5I0ceoduuXt6AeHDkQ4A=; b=ee/nX4azjLvIDX /l3S+w8Y6EaO/igFQhdVtxxnmmLCR1sOdWSz00ibT1jocLuHlNjYR+U8ySql0BCzgy7MQtERaNkHc +Ho2SVFhcfcTOA38zCY1Pq+fiC0d0aSVDVv53CGo90ZaLAtRn2bWDeKsODnom8iecB8KeWY/GrY/6 LRr8B/LSkOegDTo0f0Wl78QJUk6RjAEG3ypYwq5yG2YDbwssHwznOhDNkwdtOdkSm+SgKEm/XktW0 wQXw/5+fHl/6ZpFhcIJRDmG5QmDv2tH+E3p8IuFr9ZDqGsk0wlHA4qTPPzz8p8Nn0g0HVbb3sRtXh H4dHJh7OiPDsFbY2Ro+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpr-003ik8-CG; Fri, 04 Nov 2022 13:34:15 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwov-003i4W-TG; Fri, 04 Nov 2022 13:33:25 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 2AC4458051F; Fri, 4 Nov 2022 09:33:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:33:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568797; x= 1667575997; bh=fg3LbFdK7oLGU8pw7P/uSBq6ZwZOI0plHppEE1bDmBA=; b=A qJ1DnE6s8H0RfNn0cMAfNSXP+8hRWRgiEiqxW48NVYReq5PQW6EsSmQSH0MMXAHx Qt+vbpnztBC+FyFDx80peqkwBjjFe7WwaPmod83ha7JkIVcqdO/Oj1ysromqKl4J xPRhPe6s4tsEUja1b0o1AquAIQ++MBsA0ALZebCV1YnPkHbTXShWBHZrYxSeuO1f H60dQRVBzPGqNor//n1V3qvAHOFLhLcnEkFMzNOoPaeWNNYzcfTim+7tmvTMVGDW nLCKHyBZkQGDCGWTetSdCaakqwoa1+YCxsDoIwkgWephABVcoEMR3MKxklCCUZBn b5TsJVun68u2KJD9rHcQA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568797; x= 1667575997; bh=fg3LbFdK7oLGU8pw7P/uSBq6ZwZOI0plHppEE1bDmBA=; b=k +nKPRSTeXucW0Gnio9dQ6tkf7RiM62cQ+GAXafT/Xqq3PycqfRsTG75dYM7Q5TYD SGx98jI8ELxX76btqIY3zR2Gz2tz3FoK1ISCBq5GPtzxJ5Zp+t+ptmxp3DxuxUzq eDwJ6xubHKYOxFeD1Q5hs1pzW6kjpNq7j3cXUkSvhDdbg2adQSYki5DCdf23oUSh BmjJkMYkyd/omQ9B6J9mAcqoxYMoJD7gE5x3dfR15KIvMzx4I4zDLPxIl1htULBt e9GmzBOfhrbuwGFj9TmOK0lWu5PkTdBwfOXW1gqESdwEqBkPUfhgkz7Jqkoe8mQd PEKK9ev7LgmhgJ2m65nzQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:16 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:00 +0100 Subject: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-43-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2905; i=maxime@cerno.tech; h=from:subject:message-id; bh=41F/tkON2gmE4Z0te8zgw432YM1WhJCHxFnSDsKUDDo=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl/X2T6ZIhebfdb1m5jXhgkF8qXysyvtj8t9VZzvdO7Q zuWXOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCR2fYM/0O6nlo38K4VfjH96rdpHd +NLatl4v3/n7azvBbv/ndDWTMjw97T6Ut4eSKtlGf+dHtz8eEUVQP15XVT7i9Zw33p+T3rU5wA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063318_344604_80B4E409 X-CRM114-Status: GOOD ( 20.67 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The tlv320aic32x4 clkin 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 --- sound/soc/codecs/tlv320aic32x4-clk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c index 2f78e6820c75..65b72373cb95 100644 --- a/sound/soc/codecs/tlv320aic32x4-clk.c +++ b/sound/soc/codecs/tlv320aic32x4-clk.c @@ -41,6 +41,7 @@ struct aic32x4_clkdesc { const char * const *parent_names; unsigned int num_parents; const struct clk_ops *ops; + unsigned long flags; unsigned int reg; }; @@ -292,6 +293,7 @@ static u8 clk_aic32x4_codec_clkin_get_parent(struct clk_hw *hw) } static const struct clk_ops aic32x4_codec_clkin_ops = { + .determine_rate = __clk_mux_determine_rate, .set_parent = clk_aic32x4_codec_clkin_set_parent, .get_parent = clk_aic32x4_codec_clkin_get_parent, }; @@ -401,6 +403,7 @@ static struct aic32x4_clkdesc aic32x4_clkdesc_array[] = { (const char *[]) { "mclk", "bclk", "gpio", "pll" }, .num_parents = 4, .ops = &aic32x4_codec_clkin_ops, + .flags = CLK_SET_RATE_NO_REPARENT, .reg = 0, }, { @@ -452,7 +455,7 @@ static struct clk *aic32x4_register_clk(struct device *dev, init.name = desc->name; init.parent_names = desc->parent_names; init.num_parents = desc->num_parents; - init.flags = 0; + init.flags = desc->flags; priv = devm_kzalloc(dev, sizeof(struct clk_aic32x4), GFP_KERNEL); if (priv == NULL) From patchwork Fri Nov 4 13:18:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031890 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 0CA16C4321E for ; Fri, 4 Nov 2022 13:34:22 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NJHFpGVl4RGhvdW3B/3bZFPjthc86jUpmbDwYpwpD/Q=; b=BGlj/i/JZimC80 kee7sNdPXw2sVm7z97EDS4OiZzfln4dZ22t6KAQVk4ETNIPhv0oBrm037/HB2fZC9nGqXGufN94f0 +fCyucLpVBqGqdUnu5bTfvP9P+yw76Ks+lsIrFrsXkHZSJMt3N7wQ41wsIzJ9PlMJ2YJlFRxSygH7 l4qG1mgqEy3/dRsbXVzIcDfrGFiyzwIqfT6bPYLtxEaGVAViUZdM7UOOEgEdMpCSpbBKY8Y7OuDAK 0dCkzQUupas0VPFwzcCci3Fg+6RWojQA3OlSPD3VCdnbSzC4p+SiXqQf12Ofnmt6EHKWjKInLmWui SFP7I+0xxxWoCLDCGJYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpx-003ipH-1g; Fri, 04 Nov 2022 13:34:21 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwoy-003i6R-Ay; Fri, 04 Nov 2022 13:33:25 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 7314958052E; Fri, 4 Nov 2022 09:33:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:33:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568799; x= 1667575999; bh=HRYqZuPrTxR5ocoXQl58H79LzXrTK4oe+XLQKgDqwow=; b=n YbfPD+YOONVImaVJW6okA+Ho8OWhjFirvYIkpf0xTJaiGhVQsUda3N1lFlEkumFp t0kmgGTmNMLB6PSpBBcrS4uX7lfIxkZVjCzDyQxrDvOKR/itCqSigvJAilAJV7an 9h7xSGRnhjGBVM//FChVggcsrWpiqDOgpkOo6+FmtnYcZQ4x2KvSCfZQRmu0OONw zVDDxIkJtaaVrNlpdfCCg60bttz2E9kDKrk8U9hxB9EwTlXr6r5YbXSrY+Zy1q5T OItYukj8nHhe7X//1OAM7x8U7SlAjg4lbl/JBQFwB0jOFNs1CicyJ/l5iEHsSyVr DctsKBlEWFf9rvoxNhVSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568799; x= 1667575999; bh=HRYqZuPrTxR5ocoXQl58H79LzXrTK4oe+XLQKgDqwow=; b=E n2m9L128afacmzm12GvhmuldgE/VzDJfYvnOaFGiWBIyK+sPY3YSYDwUHLnRJsjK 5tygCdoN/FihFV2m52kks7hLr0vPDYa1Hf1DZJvQop2/rocbvLsbP1yxQdDRJMrB BlrjHz6S+DP41pU1Sb2JcHK45EK8OyzV9q8o66kcHQeFO1/qHgjHirQggrvUZ1ea f2ydufWuTyWX5Bsc430VCmQf9xUzBjqs8Fu2M6oI12hO04MBZXxqOnPdM+NXwRc9 j6C1J5RjvnLh5RyZAC+8MtacAm2EFTun+r3JpQYVRJL90l436Pqgs1Z+JD8g8ld2 4kmmcKF4Dyfbbeholc8bg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:18 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:01 +0100 Subject: [PATCH v2 44/65] clk: actions: composite: div: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-44-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2795; i=maxime@cerno.tech; h=from:subject:message-id; bh=aQqMQVxKATvqDxq+DQ+zQmlJOI9IGNizwFw3mXLyv8I=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl89WM6nlJ/6XNTDuPyJPVNdnoGWxTE3To55q+w2qSSx zbjdUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgImYcDIy7P9qydHNZPtl5uqqp+67A5 6liTo93q3ge+nutJwVufH/LzP84VnpWrRB6ajXp+tByy73Ls/9ascwf6GbKMseZsaqguJwBgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063320_545805_DA01D8BD X-CRM114-Status: GOOD ( 21.72 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Actions composite divider 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. Signed-off-by: Maxime Ripard --- drivers/clk/actions/owl-composite.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c index 4c844a5613e4..d66b268563d0 100644 --- a/drivers/clk/actions/owl-composite.c +++ b/drivers/clk/actions/owl-composite.c @@ -53,13 +53,19 @@ static int owl_comp_is_enabled(struct clk_hw *hw) return owl_gate_clk_is_enabled(common, &comp->gate_hw); } -static long owl_comp_div_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int owl_comp_div_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct owl_composite *comp = hw_to_owl_comp(hw); + long rate; - return owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw, - rate, parent_rate); + rate = owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw, + req->rate, &req->best_parent_rate); + if (rate < 0) + return rate; + + req->rate = rate; + return 0; } static unsigned long owl_comp_div_recalc_rate(struct clk_hw *hw, @@ -152,7 +158,7 @@ const struct clk_ops owl_comp_div_ops = { .is_enabled = owl_comp_is_enabled, /* div_ops */ - .round_rate = owl_comp_div_round_rate, + .determine_rate = owl_comp_div_determine_rate, .recalc_rate = owl_comp_div_recalc_rate, .set_rate = owl_comp_div_set_rate, }; From patchwork Fri Nov 4 13:18:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031891 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 F1CC6C433FE for ; Fri, 4 Nov 2022 13:34:22 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OeQd4Je9sfrtXEcyTnGr9sEV0uX9qtUBr8Uz1FWfi2Y=; b=LgpdDhad6rhIUF UYo/0Heoaa8aDbRUoHgKN2EKD7/s6EHnEK9PiznuaMkw7q2h4QzkwtmcoUPIVAH2HmQkRvuXsLJcJ 7PNj6YFIX6ap5LaobD64qRZ9rdyt5mmDtyu6f8nty6JJ3enUlN5iiipB6xiAi3Yv8aUV/1g7lma3K mb/jgChdcZiDXeNnDKIPJG65YROHj68xG0aLartd28RqThY/56FxzPV4vvXm+Nmt9/16IMRO7oS5g zxI/6gBvkcIa3JZctlmKeMWheWFdl0EbT4N2XmWBN8MQFuDfEXoLIWLKJqtfnQ5aP2UT+9wIvZqpE 6Fr8ufy8yQ3397h2gtQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpx-003iqG-Ri; Fri, 04 Nov 2022 13:34:21 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwp1-003i7F-Ux; Fri, 04 Nov 2022 13:33:30 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 5913A580534; Fri, 4 Nov 2022 09:33:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:33:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568803; x= 1667576003; bh=MQ0Ld/P4Fy4XpBFmWEgr3+5rbjeMq0KitSHa5XxIhpc=; b=Z KRF+MknNb830w12aSXmHDDa3Nolp7oCfQuaQzH+ApgFX4DeQ5sbxWjRZOukHIIJk wZ018WzJifVhMTqlg6pc+NmplKOviBbIpGOmKtxcJxIJkT+8r8oILdTmALrwLDyj Wc5zbECyiu8nzTye2xQ19BFZZvIPmME8iVrj0DXvDRJ+bLZKu8dEzmDlgF5cIowC UCpue0lnx8K/n9l9SrvjY5veHnXJfzccPZDQmpvzE7K1wFOyWLOkTpJFVUOGBDPO 1pAvc9mlE0Q7DkhPbucW2TMMyo1Cbo4lR7LRUR0Jex6qarxlNTnUvlyr0FbEudMr sVvWE2W5MlsMgvYTWN5+g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568803; x= 1667576003; bh=MQ0Ld/P4Fy4XpBFmWEgr3+5rbjeMq0KitSHa5XxIhpc=; b=i WCFpBx8gbLxyphG0n1UE/RPKJVHlYo/aLO4cqMwWEnNBYFGVjX687uwWEFXZyd/R WbIEIIlaJsPDggwoJZ/afBUYuUGGY5x5iXXyUSublk9uIZL/kSGBcUc9vGjem2Pn hqjJBcE2ajjY+MVObLPii16lMZlMzy6CqSb3NL4ghitxzRNOhtHtcw5gcKMlQMOz AfHBJD2JORs3nTIMGvVnf5aYZc9waAekXVLQUBXimKkXgjp9XCu+s2EAveJxmLIu Mt3Yl1bfF099cNpOSzAZVqaN9msPP+XiDHPvZRscVOgzMDf0gSKVBRI6DPiYsSbF 8RughNLGc407OKBwO4pXQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:20 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:02 +0100 Subject: [PATCH v2 45/65] clk: actions: composite: fact: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-45-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2809; i=maxime@cerno.tech; h=from:subject:message-id; bh=sj/foC147At0N/C0Kf5KGLnIttWxDPKpX8zy5b2f4zk=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl+npn597pxcbLKJZd97YeFTHzaGs930q3GtTGq6caAo hkOno5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABO5eIPhr7DLyZQXTE+MM0/8P6LAYy G4kJN77Y/SZxUqRo4npPK0KhgZ9sltjQxjUXa3zhLL36B9JsF/c03d7ejvaxamzbb8xZbFBwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063327_760697_F9C5F6C5 X-CRM114-Status: GOOD ( 21.44 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Actions composite factor 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. Signed-off-by: Maxime Ripard --- drivers/clk/actions/owl-composite.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c index d66b268563d0..3cac8f0a80dc 100644 --- a/drivers/clk/actions/owl-composite.c +++ b/drivers/clk/actions/owl-composite.c @@ -86,14 +86,20 @@ static int owl_comp_div_set_rate(struct clk_hw *hw, unsigned long rate, rate, parent_rate); } -static long owl_comp_fact_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int owl_comp_fact_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct owl_composite *comp = hw_to_owl_comp(hw); + long rate; - return owl_factor_helper_round_rate(&comp->common, - &comp->rate.factor_hw, - rate, parent_rate); + rate = owl_factor_helper_round_rate(&comp->common, + &comp->rate.factor_hw, + req->rate, &req->best_parent_rate); + if (rate < 0) + return rate; + + req->rate = rate; + return 0; } static unsigned long owl_comp_fact_recalc_rate(struct clk_hw *hw, @@ -175,7 +181,7 @@ const struct clk_ops owl_comp_fact_ops = { .is_enabled = owl_comp_is_enabled, /* fact_ops */ - .round_rate = owl_comp_fact_round_rate, + .determine_rate = owl_comp_fact_determine_rate, .recalc_rate = owl_comp_fact_recalc_rate, .set_rate = owl_comp_fact_set_rate, }; From patchwork Fri Nov 4 13:18:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031892 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 5923CC43217 for ; Fri, 4 Nov 2022 13:34:27 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VtZmDykgVZjoOuBR2GkQ2f7Uoxl3mnMeobQKuCHfFa4=; b=NSkhIvVDcGXvRt ZH36A0Sns7dqfcdkO7OuJ2h13WoN5otmGiIoO+P8VysZVqOAuGuSjqE4QD4TBPIuViKbdbb8uMrUu CfuvmsU5oDcaHiW2VjDcL52XpwBZ1eR/EpKKrguPM7NICpYO14iKw+FEWxG4w3imkXGiMFW2bqYJg fvmvGkI+kcF/btfzTPDzkPoZ2h7xMuWoUGcMoEsSlaGYg978C3yItH6drrPXoCpfKMNiLwqIwib2Y 5h3+Nfk9q26VxK4MORqjVMb4Mv0nHPxRCkGzHfTGvuKMmO4p1AzRxzikUapszvtnXtwFpGqFox/1T b8/D6QRTYltbrTSXomqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwq2-003iuI-Ex; Fri, 04 Nov 2022 13:34:26 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwp4-003i7I-6q; Fri, 04 Nov 2022 13:33:33 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 971B858054E; Fri, 4 Nov 2022 09:33:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:33:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568805; x= 1667576005; bh=IylGEyJTRPMvT8znDqNL1T0V9+HlmisR/0Tt/8pDDS8=; b=W BpDa0xz0UgeA2M2gUTMFCVVbp+BZl4goID59uvjfUACGG7XuBpUieF8ctaHia78L OApudN1sUygyjkP5bS3uMoL/tAw9a2Kzm2t+/2YYQZG3dixkEzEJe7QLjtvEL4LD +FNoKxavMYBJ2Z3GW1EeLLj6V+f7MmBcupP2LV33uKWxEQ697Q5PcY/DbmlZ7e7B fI0TdNVxJK5GE3Nyh0MVcK+Vtjts9DHWsmwf+tejk3yqnfDyfCy+KOa0e0KCO7BL edSKAqm/VEggHY8wahQxCf/cIkpF9ll++rP2zcbrmwrYvJz3FFIwI4KG7q2DoRJI bDG5lJ5anDu62v0V5+ISg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568805; x= 1667576005; bh=IylGEyJTRPMvT8znDqNL1T0V9+HlmisR/0Tt/8pDDS8=; b=W juI7T3YWHMoa00g+k2ccSQlseVZm563421NKUS0hszpO7WrLBe+xK8iONRyKqmQD c7kJ41/6N6zgAOJJZKCJpN7hdN1wDXRaNi+LI07xrtO0sGBsfmnTCV8kFz0cQCc6 OSam8j4bezwmEc1zx/tHNwRgBtvHhjVnBaopDd3LBrto5X0f9QjjTqSaZUZcRuZM jvMKjobMpnN2Wi0aKkH0nk4cLwRpCDK0e2dD3QhUk41Nc/gucrnXzuf54fHaROtp 2tzCPa1MA6ge5iLD6RCAmJUjyNcYuYDD9VRjNQKxZPwYckmYTzfwEOP3irABtLE4 UPhOdBqkOWgto/XGIPDNw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:24 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:03 +0100 Subject: [PATCH v2 46/65] clk: at91: smd: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-46-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3366; i=maxime@cerno.tech; h=from:subject:message-id; bh=gzcyRDG/OIMJFYi0N/cpVcR4UVw51AqrYck0s0PpWsk=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl8Vlpw/VfXKJr5lyeqiJQ/O/t7scaOweumsbEm7s79a zq/j7ShlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBETicyMnxiOCAeeF4sdZdDyommx6 meywI3VD25FB2v5K90kFE4yZ+RYaJR0aKsNze2p64/53LJguOGVKUt34cFX86ear3Vu/rGGnYA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063327_829211_76191239 X-CRM114-Status: GOOD ( 21.42 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Atmel SAM9x5 SMD 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. Signed-off-by: Maxime Ripard --- drivers/clk/at91/clk-smd.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c index 160378438f1b..09c649c8598e 100644 --- a/drivers/clk/at91/clk-smd.c +++ b/drivers/clk/at91/clk-smd.c @@ -36,26 +36,31 @@ static unsigned long at91sam9x5_clk_smd_recalc_rate(struct clk_hw *hw, return parent_rate / (smddiv + 1); } -static long at91sam9x5_clk_smd_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int at91sam9x5_clk_smd_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { unsigned long div; unsigned long bestrate; unsigned long tmp; - if (rate >= *parent_rate) - return *parent_rate; + if (req->rate >= req->best_parent_rate) { + req->rate = req->best_parent_rate; + return 0; + } - div = *parent_rate / rate; - if (div > SMD_MAX_DIV) - return *parent_rate / (SMD_MAX_DIV + 1); + div = req->best_parent_rate / req->rate; + if (div > SMD_MAX_DIV) { + req->rate = req->best_parent_rate / (SMD_MAX_DIV + 1); + return 0; + } - bestrate = *parent_rate / div; - tmp = *parent_rate / (div + 1); - if (bestrate - rate > rate - tmp) + bestrate = req->best_parent_rate / div; + tmp = req->best_parent_rate / (div + 1); + if (bestrate - req->rate > req->rate - tmp) bestrate = tmp; - return bestrate; + req->rate = bestrate; + return 0; } static int at91sam9x5_clk_smd_set_parent(struct clk_hw *hw, u8 index) @@ -98,7 +103,7 @@ static int at91sam9x5_clk_smd_set_rate(struct clk_hw *hw, unsigned long rate, static const struct clk_ops at91sam9x5_smd_ops = { .recalc_rate = at91sam9x5_clk_smd_recalc_rate, - .round_rate = at91sam9x5_clk_smd_round_rate, + .determine_rate = at91sam9x5_clk_smd_determine_rate, .get_parent = at91sam9x5_clk_smd_get_parent, .set_parent = at91sam9x5_clk_smd_set_parent, .set_rate = at91sam9x5_clk_smd_set_rate, From patchwork Fri Nov 4 13:18:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031895 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 4EA40C433FE for ; Fri, 4 Nov 2022 13:34:44 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9bzlk26GXfycRANTOwQ19y/z3pnq9WSBm/2bnEIRcwU=; b=lx22zWeArcwIvP nSAovKTZETqykc2wW7twChV7fCNbeCdlzoow3/dZkDC1XnY1YFJPSOu37DgqkhwMyQI2RlGsbripQ /HFXx9jYkKKZ5wp7Q6CQ546X2jJ6mvka6bSHN8aY2EWrlWLN09oo6gTwpVjlt+oNWbYXS73LdRiYI /rsxtORb50nHP6PqoJG/KotWjkQbVgptLWloUYSQGvBIZ1rUBZjXvvY/fP4+FWhB5igh3uM3wqYZB 9sfumMtv4YjsMCp7NHmSjow17xsdatgRGNMnrcaKgtJXeXNtwlGvyGbmX6Wp71CxEj0uhlAYGWuOB 7q8zKlurV2fScq8BmmtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqJ-003j6s-Bq; Fri, 04 Nov 2022 13:34:43 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwp6-003i9S-PF; Fri, 04 Nov 2022 13:33:34 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id D4E975800E8; Fri, 4 Nov 2022 09:33:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:33:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568807; x= 1667576007; bh=rVH2PD16J89pUbo+adGHsM7w2einVSfRdsLqyotZWAE=; b=g 5TTazSlIlWKFbRnHRB/+/mY92G2q0kqgIqVq9M2pgF6I8aGf5bS3+lf1sdo3xLR2 EWkm3LzGS3Lyx8ykwQR8xTNFHRckfOPxZdlfCTYP/7SzurGYe1HxdrqktKO8535J IrxjmwDAPUuV1+wUPh/aeNy2tdGoEk/7a0qQ9BW/WpTEs3ogf/+tcyH2fmCSl5ZE Aj68bfYUDXxiBvrXnF1pjG00T1UkKvfiCs9nmP6dnyHultVqCCTSaaNIKVyL8zX7 U6etlqWywcFebp1yY97KsblEHi8yUEhQm6RapCR4dEgTW4/ByrV6beQmykBr/DTp iGvp2xm9BiryyoP+s8mtA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568807; x= 1667576007; bh=rVH2PD16J89pUbo+adGHsM7w2einVSfRdsLqyotZWAE=; b=M 4aNb9dXiJrfl9FG92wI4U6hDmvMvuH2ETozSFBDbgT4d5c/nmF59MkwsSDFM5qJ/ 250WfCb8DvX0Y2Wcj9i7ud++6lA4+9UHHaNxttyD4llkUclO+OUzTHEJReAI3QHA XfVQUfVmOHdBQcfURJbPn4DrJHylpl98SSblKH1qzbFyFlyEVjRZDBWl33XjCdY2 rImtXGsEIxfV035TQff85NoJxP0RyH8i9xuCHFkzdtN+dXEocXIBQe8TMUGEgSUL Mg66DSilTLHOQL+ntJ7752QCXrfwllo7SFSebnsd5p7w5piU0ZNLg0uBrnPgTuWJ w+Ss1WnPd2Xsv6Y7Ntt5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:26 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:04 +0100 Subject: [PATCH v2 47/65] clk: axi-clkgen: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-47-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3082; i=maxime@cerno.tech; h=from:subject:message-id; bh=gNQ86CL4FqR99S49w2gKPWneizqFQDUvKieZeJxKmIg=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl/vmMtdyV/KWqnt9iiAV6z0pY/3n78B/CLCHbadm2f1 /b3aUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgInUzWP4H9tofMNx5YXVfyJ/tH5Tzn R+ZbikcrNpe8XmlT2Mm6tvZDIyLOidsXppTpdNZG/4E31Dlu7s9QvEFr4xzUo6rhDyO6CMEwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063328_947729_D80CD5E7 X-CRM114-Status: GOOD ( 21.04 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The AXI clkgen 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. Signed-off-by: Maxime Ripard --- drivers/clk/clk-axi-clkgen.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c index ac6ff736ac8f..6b2a44ef4d73 100644 --- a/drivers/clk/clk-axi-clkgen.c +++ b/drivers/clk/clk-axi-clkgen.c @@ -384,23 +384,25 @@ static int axi_clkgen_set_rate(struct clk_hw *clk_hw, return 0; } -static long axi_clkgen_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int axi_clkgen_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(hw); const struct axi_clkgen_limits *limits = &axi_clkgen->limits; unsigned int d, m, dout; unsigned long long tmp; - axi_clkgen_calc_params(limits, *parent_rate, rate, &d, &m, &dout); + axi_clkgen_calc_params(limits, req->best_parent_rate, req->rate, + &d, &m, &dout); if (d == 0 || dout == 0 || m == 0) return -EINVAL; - tmp = (unsigned long long)*parent_rate * m; + tmp = (unsigned long long)req->best_parent_rate * m; tmp = DIV_ROUND_CLOSEST_ULL(tmp, dout * d); - return min_t(unsigned long long, tmp, LONG_MAX); + req->rate = min_t(unsigned long long, tmp, LONG_MAX); + return 0; } static unsigned int axi_clkgen_get_div(struct axi_clkgen *axi_clkgen, @@ -495,7 +497,7 @@ static u8 axi_clkgen_get_parent(struct clk_hw *clk_hw) static const struct clk_ops axi_clkgen_ops = { .recalc_rate = axi_clkgen_recalc_rate, - .round_rate = axi_clkgen_round_rate, + .determine_rate = axi_clkgen_determine_rate, .set_rate = axi_clkgen_set_rate, .enable = axi_clkgen_enable, .disable = axi_clkgen_disable, From patchwork Fri Nov 4 13:18:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031894 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 68916C43219 for ; Fri, 4 Nov 2022 13:34:43 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WblYyGSB8P5fLdrGNY+/TfcfPnfX/jgCy1LorkiaAPU=; b=JehaZkLeIDpBKE D3gHoSyPGkxLFBRVIVZYCTH0k7yWYHK7eXUmp8RnqW4EPSooq2SOwCdgpXML8fVezcZJsD1oM/Zqa Woc74DaILQ9/2M/7kMlp0lR6y9h3lFALSwRHyenBo/XWMIHCbWcnHKa6gQiqetJUyAKLRhVvSpZCP T3i/B/Z4OtLtpYhgcWgKAcAm+UbMuSx3SgkQ0dfMS9g1HnAuK8PJRHR1TaiwXOrgPCJz6KS9LFryb wYOYcWBhW+krh1LamKy88zl/XSm8tFSkVsTU4H7y3bKkkP4KktYQSS60+3Q0lLPYFHLFn6aIQxX2d 7Ssp/udr1O8yEOFo4z8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqI-003j6C-9t; Fri, 04 Nov 2022 13:34:42 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwp8-003iBW-Pn; Fri, 04 Nov 2022 13:33:36 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id E2886580557; Fri, 4 Nov 2022 09:33:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:33:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568809; x= 1667576009; bh=Ca8uceC6XTgaL0T6vfBE+x1DidRhuhT7oHwTsk34l0s=; b=C Vv33buHEaurk2brJFzaAzWWywkiilE/o2dWsnExRu2al4YAMFnjqJh6z+T5k1mYs LliIxGh4PRUY1BSQIKoqibutiB0PtZilhORBmRs7STO/XrlEw7lMt/1DuQaB+bYF WEIiTZMxPwjCbgP3F79Brux14UxSk1AchfPA2YHR0QLXUlAcgVWKsFtRpH7ThgpP 7Yt0F3HLCwApHqN6LBjQaAYLN8wrKsj9nq8Alk2KQMUbiEhFe8xfhZt52GsuzYK5 qmF7eGyfvlgAF6K8ReDFn0x5FDIoOVeUo1NISk8hbgDBvivX1t392/oNNvBC2oV+ +O5Oqm3XCgDRC5G7LIfBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568809; x= 1667576009; bh=Ca8uceC6XTgaL0T6vfBE+x1DidRhuhT7oHwTsk34l0s=; b=j MwMp/AuACxzpIn7x9Y6I74itNwvzGh5Mo6H8Occw5HJAf1n4oLlRNCKLi/8NTH2h M8HgUs87Hw300yyv5wleImX4mwd1gGCFC6W9miz7aEFFcHPmdc/P7g72swWh5Icy 6VxculxJ5Bl+zLxOU7IBGrPhjFdR7CEE4lf/6ZLqxnaUd2qTvN/65AX1CR3auWWH 3faBT0YQvxk/lIegVI0SGS2bqP8j2ui+0XQ8BExJAefn+KuGuvsAoU7uJLIVFLAS +UKqOUmoioZQf1ZF6Ux0WmZZldBVEIj5nIX+psZo/xmldj8gbxYRcSluoabm5twi sQ/xiUhDS0UHsgMXfvg/A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:29 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:05 +0100 Subject: [PATCH v2 48/65] clk: cdce706: divider: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-48-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3573; i=maxime@cerno.tech; h=from:subject:message-id; bh=Q8gBzirmJeZ33RW5LvDEEWpimdL9veoEzpYNfMu3wJ4=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl8T7+n4HI+aJe2o9urg/uqEc/M0N8w6qHPz5BpjgT5h cZ/2jlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEzEQZeRYcZ265vfpOz1U3ktvSICr+ wLeHl96+73V1xuX/ES0QnzMGdkaG5/N3tDZ/JFTuFLR3+sePOOV3hv2J1L4jHHP76Rf3x7CysA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063331_035495_46AD9F24 X-CRM114-Status: GOOD ( 19.85 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The cdce706 divider 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. Signed-off-by: Maxime Ripard --- drivers/clk/clk-cdce706.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c index dc046bbf83a1..a53769d239a9 100644 --- a/drivers/clk/clk-cdce706.c +++ b/drivers/clk/clk-cdce706.c @@ -288,18 +288,19 @@ static unsigned long cdce706_divider_recalc_rate(struct clk_hw *hw, return 0; } -static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int cdce706_divider_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct cdce706_hw_data *hwd = to_hw_data(hw); struct cdce706_dev_data *cdce = hwd->dev_data; + unsigned long rate = req->rate; unsigned long mul, div; dev_dbg(&hwd->dev_data->client->dev, "%s, rate: %lu, parent_rate: %lu\n", - __func__, rate, *parent_rate); + __func__, rate, req->best_parent_rate); - rational_best_approximation(rate, *parent_rate, + rational_best_approximation(rate, req->best_parent_rate, 1, CDCE706_DIVIDER_DIVIDER_MAX, &mul, &div); if (!mul) @@ -344,8 +345,8 @@ static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate, dev_dbg(&hwd->dev_data->client->dev, "%s, altering parent rate: %lu -> %lu\n", - __func__, *parent_rate, rate * div); - *parent_rate = rate * div; + __func__, req->best_parent_rate, rate * div); + req->best_parent_rate = rate * div; } hwd->div = div; @@ -353,7 +354,8 @@ static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate, "%s, divider: %d, div: %lu\n", __func__, hwd->idx, div); - return *parent_rate / div; + req->rate = req->best_parent_rate / div; + return 0; } static int cdce706_divider_set_rate(struct clk_hw *hw, unsigned long rate, @@ -375,7 +377,7 @@ static const struct clk_ops cdce706_divider_ops = { .set_parent = cdce706_divider_set_parent, .get_parent = cdce706_divider_get_parent, .recalc_rate = cdce706_divider_recalc_rate, - .round_rate = cdce706_divider_round_rate, + .determine_rate = cdce706_divider_determine_rate, .set_rate = cdce706_divider_set_rate, }; From patchwork Fri Nov 4 13:18:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031893 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 CA57DC4332F for ; Fri, 4 Nov 2022 13:34:41 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gIR4K38WvKDrfZygIpYqkoGbYL1ylbUKHPP9Ldu7ztk=; b=U8m5t6xaUFlbIZ hMig56NUI2ghjaCeuwXBnu3S5WiESfFsxFpG/Gbbtt5OcnjpmTdfpjrXCAChCU/lT829K7XSU71DS 35Mp6xD05r43SsB7P/LevMVygb6S705DojwdcCxHnKKjxnytGbJSGEbJWPPLdfc5jpf+ftkL8HLCJ yB13Luo9S7XINC1QvY22AmMoydWmTe/IHrHLoh+9RuTaQRd93jQ68/enCic10+N1uJaij47z/sese y/duKSv07rMKTTU9ZYBB98a4ccS2fE0pbBrgzCbOiFKhfQURpFBzqKcFALcl7yYiZbPfsFXA/Xn9+ uYOogyyL49SmLAeXP52A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqH-003j54-2w; Fri, 04 Nov 2022 13:34:41 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpA-003iD9-SB; Fri, 04 Nov 2022 13:33:34 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 28DAC580559; Fri, 4 Nov 2022 09:33:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:33:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568812; x= 1667576012; bh=hLZAHotGbvX5RCXUVHAH7bvNpGr04f++TPN1ala9Hwk=; b=y avmSF21AqBq2otaD9WpEPbsopcxp7067eucqG0A/J5D0qgh3C7nhhQkuxa/UBDeM zGsRsBtv//2zvo1LAeaS86hlrLNLZye7tOsLnvYO2w8Wmh8INPPZN0VI4dGcDs8a Jv30In4FPtUatIgm8BsX6E6NmJcn1Hcovrsq1QdrNixbR8scF/TmZ28kvu+d+hqR tVgBXonGqTZoytTaDa56ngd21clkTWuMOBmV7KiQxQue89LKoFmEgHkM1sA4Dz2A DecNxM6P4eO1hrvU6MfOo/hm/n15EqBNxObP3SF3UbUfnzS+y3c9ko4B2uEJNIVE NNN2ePJcaGIxOvUcFeqiQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568812; x= 1667576012; bh=hLZAHotGbvX5RCXUVHAH7bvNpGr04f++TPN1ala9Hwk=; b=u e3G+wWDcY1Mo8Jt9Trr95g7TEadmjVfWiFRo/eUCALy5vyJhy35+VsUeclRxM7X2 aHs6IdN11wGptGVg1pnrQj1WMlMNf8sYkg+3I7u/PCFUPNU/cmyCOibtn99h8SSL jP8cCPM0T290AYJm0ZJKurkEMuG12zjH3HXjkWU+8Fg0OfzqhfMbOt27AdkZRuw+ ixQJvGUujEe/sj/uv+Zs3ku+W9ug2l0wjuGQyNatfxqiGeCUUefghnakBPIGTm2p +ULUu6tYyxGiAVE0REV4APfXiMxhButinhuBFdnPHn35ebNeuFGBf3GB4bIVjWIj 5nuDZbZwKMlumDMYlw84A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:31 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:06 +0100 Subject: [PATCH v2 49/65] clk: cdce706: clkout: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-49-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2504; i=maxime@cerno.tech; h=from:subject:message-id; bh=LBRgLD6ule1i9P91PA8GWOAFBI/bOqx0LkhzNbQyeKM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl8PzX4rKXRKI8OwcvX/MzsWHP38O+5UMcf7mEddJy45 rRd36ChlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBEUv8w/A/+73n09cFz5rK1mgIPT9 7jcJlw2F49WuHdrlNiuxflcf1nZGh0qhP5KH/AaMpB/6sql+RCX1xq22kS2iG66eWzZaH50fwA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063333_128228_52DE3EC6 X-CRM114-Status: GOOD ( 20.09 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The cdce706 clkout 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. Signed-off-by: Maxime Ripard --- drivers/clk/clk-cdce706.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c index a53769d239a9..0a560b4d295e 100644 --- a/drivers/clk/clk-cdce706.c +++ b/drivers/clk/clk-cdce706.c @@ -423,11 +423,12 @@ static unsigned long cdce706_clkout_recalc_rate(struct clk_hw *hw, return parent_rate; } -static long cdce706_clkout_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int cdce706_clkout_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { - *parent_rate = rate; - return rate; + req->best_parent_rate = req->rate; + + return 0; } static int cdce706_clkout_set_rate(struct clk_hw *hw, unsigned long rate, @@ -442,7 +443,7 @@ static const struct clk_ops cdce706_clkout_ops = { .set_parent = cdce706_clkout_set_parent, .get_parent = cdce706_clkout_get_parent, .recalc_rate = cdce706_clkout_recalc_rate, - .round_rate = cdce706_clkout_round_rate, + .determine_rate = cdce706_clkout_determine_rate, .set_rate = cdce706_clkout_set_rate, }; From patchwork Fri Nov 4 13:18:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031896 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 8B385C433FE for ; Fri, 4 Nov 2022 13:34:51 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ap6kKccM1Q4T7Elxot+GL4jYwcOEXIB7yJc2Z95w+z4=; b=Nw/79aDAVpM1y3 +zg25EWoIsdMe19owwXkCxlmMZ6scw+XsHjeBA7dBFCvomeVuEvt54LoIxvKsxeEk9AUjy+01SCK1 u+yJIPUUPO1eEX4+J47dmjZrthWB53UgoHvkGLFeAUQop75OQ9KKQQzZYadAeW2yDI0fV05lvGYfD fSI6lJJMWv8e8phYUZle9L/eL+n8al4kUKXU0XQ3bQY/4gZlpD6EZ9lQwODAYLxHcC/j0EnOrOPOt 8VAPJSLn5RR2pOvv20dOM3gsRLD4bAxIwcJ7S8FKTy/+RPA13W8YJEu4Oy85dUfIBFWE13lkUx+G/ YtT31YlHNQTADkiqCM5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqQ-003jDz-Ps; Fri, 04 Nov 2022 13:34:50 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpD-003iEu-92; Fri, 04 Nov 2022 13:33:37 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 6EDE658055A; Fri, 4 Nov 2022 09:33:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 09:33:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568814; x= 1667576014; bh=7qelYozWRBeNQ18eAF0ig9Rqs1/Vy7erIZoCj5CRlF8=; b=W 2hgwuQhCuDzZFqOL74G8eMJopYbe3WVWO1tOSfbjm7rGs545/RqMe4YpsXPSSJ7e Os78ELU0McLCwosmkahg4x6agO8j9BlK7zqjZWeq1NAKTr+22H1xF4pNVV+dG/92 6+IFxJWnelWdQJK0BqxDVgwiGbq4mar6ITkvuE33C7BFKmuhNmy9YuWTzH8xalPK 55Foi6jiR2swY9GoXwqCB19fO/gZF7rpP1eUPqaCxM3/jNqwumDgXhuy01FMauaK duYoqgzgpQ0ogkpgCizxFqDzEHh+vX+zw8j7HtZt2PIxIsdlqkASHdyxKSSJMel7 7RgLlgMWwG5WHpeb7Jb7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568814; x= 1667576014; bh=7qelYozWRBeNQ18eAF0ig9Rqs1/Vy7erIZoCj5CRlF8=; b=s cdVS0cAOV4KaEJ63gsAkZSZ+3h2gOTwQ7j5sA5jB8i4P1C6hAwEn/z6Ow9dunnEw KDNUSU2rJ1UoFaCR1zh+jrFGtvl+7FxtLxA2agByj9oGkH/HCQR7h77UmyFIMrc4 +J9oZtbA5Qcr3+AYCDgGAhDwAX/Gk5IStqng7crrG3Px/ip/VaCf8kleJ91TsAkG DolRmD69h4AKlsLj9LQrU0CUvBxsYqyN3X7ghK43mMUBK71xjQnpaHznnJpN/UTl LFxWHa+OEPE0tfuQbcyRaafljr7S7dsmmNOcqe4EHW5ou8eL5L8Rx9octy2FMBLO CVHMXR7SuTApHmu45a0fg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:33 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:07 +0100 Subject: [PATCH v2 50/65] clk: si5341: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-50-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3381; i=maxime@cerno.tech; h=from:subject:message-id; bh=utUH6EMI1InTg240nlK+dQXZPyYHpDtciqK334scBKM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl+VlwTvXiWkbioeP5m7/okWr+Mh5S9zg2wFEkTUwrW/ KXl0lLIwiHExyIopssQImy+JOzXrdScb3zyYOaxMIEMYuDgFYCK1WowMyxwUXnWH5ThZ7b4b/dGOdW 5utUDZ1SJu1S8fF2q1dttxMjI0rDw+14KBaeZJi8gJzr1P/LjNxe6Vei3bzOgjFJt+7TEbAA== X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063335_495837_DB611E09 X-CRM114-Status: GOOD ( 22.91 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The SI5341 output 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. Signed-off-by: Maxime Ripard --- drivers/clk/clk-si5341.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c index 259861aa2e2f..14792d5ffb4f 100644 --- a/drivers/clk/clk-si5341.c +++ b/drivers/clk/clk-si5341.c @@ -828,19 +828,20 @@ static unsigned long si5341_output_clk_recalc_rate(struct clk_hw *hw, return parent_rate / r_divider; } -static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int si5341_output_clk_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { + unsigned long rate = req->rate; unsigned long r; if (!rate) return 0; - r = *parent_rate >> 1; + r = req->best_parent_rate >> 1; /* If rate is an even divisor, no changes to parent required */ if (r && !(r % rate)) - return (long)rate; + return 0; if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { if (rate > 200000000) { @@ -850,14 +851,15 @@ static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate, /* Take a parent frequency near 400 MHz */ r = (400000000u / rate) & ~1; } - *parent_rate = r * rate; + req->best_parent_rate = r * rate; } else { /* We cannot change our parent's rate, report what we can do */ r /= rate; - rate = *parent_rate / (r << 1); + rate = req->best_parent_rate / (r << 1); } - return rate; + req->rate = rate; + return 0; } static int si5341_output_clk_set_rate(struct clk_hw *hw, unsigned long rate, @@ -930,7 +932,7 @@ static const struct clk_ops si5341_output_clk_ops = { .prepare = si5341_output_clk_prepare, .unprepare = si5341_output_clk_unprepare, .recalc_rate = si5341_output_clk_recalc_rate, - .round_rate = si5341_output_clk_round_rate, + .determine_rate = si5341_output_clk_determine_rate, .set_rate = si5341_output_clk_set_rate, .set_parent = si5341_output_set_parent, .get_parent = si5341_output_get_parent, From patchwork Fri Nov 4 13:18:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031897 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 50757C43219 for ; Fri, 4 Nov 2022 13:34:52 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TpgZT52a/Fz7uV4PrYYfcEOeweJY3p7PmDU7AZr9dDQ=; b=FBS2zp2Duqy1FG v5iRe58+ZI8/ntCmXlm8+epR6d9zsX/c4tBxy2+sPbis6wm+1VCo3Jj4iY98Cm937ypRJHOCaFO7U UVnZq45nxAlfoiZtCf3T4TUAVt1N47TflzaSjCEf7CQuFkWjxIrpHk9MKOS5OfEjo95FY4alCKiFp u5J+d0lP7ls7vvEtkbRKo4kG7UhQZ832xhxhWGW72g55SNnzA1CjWOoTVadH0sA3ufIOozwD+BFVD TaLF0Nd/9sBJgyuNKYS3neLPU1obB27m+gaGVWyKHkOlBDxJAhcS0JUhJNleAUIZVZoZ8AeZknR04 ypvpm3l1CC3Ae2NyoX6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqR-003jEg-CS; Fri, 04 Nov 2022 13:34:51 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpF-003iGb-92; Fri, 04 Nov 2022 13:33:39 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 95A5E580260; Fri, 4 Nov 2022 09:33:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:33:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568816; x= 1667576016; bh=+AiYlQRmsw0uLRfb7MwzL/XTfZ5Fxn4mSWP4u38OBc0=; b=Q MKZH4rOQfBAUFPl2kU8N+az8xxxzqHwnfoagnSqHE4Z4x/I66CzikPa9khpog+TK mX5CiOHHyetOrtj5B5H3oIai0cVqAz7dsmhKFDWMDsTaflteAVnw5lplRRRmLh2M AwISHUMsvI6qMf3oyCHUzrW2nWnzxDhB+dLoQUwjMTZyQSS+7khRSHzVzcEcVxM2 YKRWdcWPqrs4G1C5tx7f1ZP8ishZc1U0mjkL6kw6P/cKmGfBySebzcoWlL4YC0hD qBonwLy3SAxv6/yCeqViGDywUyfo88TjitYF+NT3aBFKZT/+J2+h9egozrqnvV+C 0ketKOn02usfgtAXomy+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568816; x= 1667576016; bh=+AiYlQRmsw0uLRfb7MwzL/XTfZ5Fxn4mSWP4u38OBc0=; b=u m35+KlRBkM503Uuc8W388SCArOUQTpzxXyG0lJs2th/3sKr+hh5s1H795WNFZ2E4 RzXoCzo3P804NnZRfL4cqR+NuGicK8/MPhJQ6B47tqh4tBFEREUyQal/H2Qna6pW PvW7w9AY6XTnG9PIma4faNayN9B8YAjDkKdryWnWPx/qtCTKAo3hzCGEh1+UXPiI 6WICivcddpyfdPgqG8rMzRFrY7vqHpG7G3tD6paTJ/iFjGpRGJrQDCpaLEizkpk1 vbEgKqSaOEczPSmpqPpZs9Jp/goRDfBD41UfLRtPXxrVMHtgZcjPVT+9+cGYzLcU Egtp1AK7+MLlRuhE5n/Mg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:35 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:08 +0100 Subject: [PATCH v2 51/65] clk: si5351: pll: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-51-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=4022; i=maxime@cerno.tech; h=from:subject:message-id; bh=Qbffwobc2f4qG6KNVK9kakvzDTd3L35C5TOO/CHBHR4=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl/rPYvbg/V0k9JrtXWTEhtePJyVwTpD7du9IEn5uUcO /uruKGVhEONikBVTZIkRNl8Sd2rW6042vnkwc1iZQIYwcHEKwERaDjEyzLps/b5q/Y0muQOrVQwX/6 s5ydSl9tDnhXDV0qWrE1MrLzP8039RZxmyy+q9ZeHk3GVbpaT3esd/K34Sf9dHnHXSve53/AA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063337_426652_16CB3179 X-CRM114-Status: GOOD ( 21.40 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The SI5351 PLL 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. Signed-off-by: Maxime Ripard --- drivers/clk/clk-si5351.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c index 9e939c98a455..fcf5785ba4ce 100644 --- a/drivers/clk/clk-si5351.c +++ b/drivers/clk/clk-si5351.c @@ -442,11 +442,12 @@ static unsigned long si5351_pll_recalc_rate(struct clk_hw *hw, return (unsigned long)rate; } -static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int si5351_pll_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct si5351_hw_data *hwdata = container_of(hw, struct si5351_hw_data, hw); + unsigned long rate = req->rate; unsigned long rfrac, denom, a, b, c; unsigned long long lltmp; @@ -456,18 +457,18 @@ static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate, rate = SI5351_PLL_VCO_MAX; /* determine integer part of feedback equation */ - a = rate / *parent_rate; + a = rate / req->best_parent_rate; if (a < SI5351_PLL_A_MIN) - rate = *parent_rate * SI5351_PLL_A_MIN; + rate = req->best_parent_rate * SI5351_PLL_A_MIN; if (a > SI5351_PLL_A_MAX) - rate = *parent_rate * SI5351_PLL_A_MAX; + rate = req->best_parent_rate * SI5351_PLL_A_MAX; /* find best approximation for b/c = fVCO mod fIN */ denom = 1000 * 1000; - lltmp = rate % (*parent_rate); + lltmp = rate % (req->best_parent_rate); lltmp *= denom; - do_div(lltmp, *parent_rate); + do_div(lltmp, req->best_parent_rate); rfrac = (unsigned long)lltmp; b = 0; @@ -484,19 +485,20 @@ static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate, hwdata->params.p1 -= 512; /* recalculate rate by fIN * (a + b/c) */ - lltmp = *parent_rate; + lltmp = req->best_parent_rate; lltmp *= b; do_div(lltmp, c); rate = (unsigned long)lltmp; - rate += *parent_rate * a; + rate += req->best_parent_rate * a; dev_dbg(&hwdata->drvdata->client->dev, "%s - %s: a = %lu, b = %lu, c = %lu, parent_rate = %lu, rate = %lu\n", __func__, clk_hw_get_name(hw), a, b, c, - *parent_rate, rate); + req->best_parent_rate, rate); - return rate; + req->rate = rate; + return 0; } static int si5351_pll_set_rate(struct clk_hw *hw, unsigned long rate, @@ -533,7 +535,7 @@ static const struct clk_ops si5351_pll_ops = { .set_parent = si5351_pll_set_parent, .get_parent = si5351_pll_get_parent, .recalc_rate = si5351_pll_recalc_rate, - .round_rate = si5351_pll_round_rate, + .determine_rate = si5351_pll_determine_rate, .set_rate = si5351_pll_set_rate, }; From patchwork Fri Nov 4 13:18:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031898 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 904E0C433FE for ; Fri, 4 Nov 2022 13:35:05 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2IhND+fqmcroMOWqx42TdXV1iEXnU7urgwZuExx1dcM=; b=Nr6rR1km/lY1Qi F/QRtIfMM4y0FVeNwRgD2asH4rZQECOUCdidaKNvmMWyZmdUI1Bg6opbEBxmHIx9db8rc/0GXXeRD 3di0sQd9PGCUvhIgwdgvIRa8YchAKxYRdkMHtdqbZ+u/ZeA0qcux70vL3hAoiLfRrDHXtrxaIkPkS 2Re/UohG3vLxms0LWX5lMuLQ5k+WsztlLFdo3SnvbcQyQ2iK+84C2SCinRmCc4HxwRsS1dQ7f7mAf lkxIBtoY37YEc8Kdwl7w38kqyNv2CCp3zKQW/R4aM+I7YO4x1VP58BJ7cjOh3Ya4EICShKV0YjbO3 D+R3XdgnoVuZNQniixrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqe-003jPh-Qk; Fri, 04 Nov 2022 13:35:04 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpH-003iJ1-QD; Fri, 04 Nov 2022 13:33:42 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id C3CD358026B; Fri, 4 Nov 2022 09:33:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:33:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568818; x= 1667576018; bh=TfSsPz+MZn+lbcea/YJJoyg5y0xdpCmmfuBpFmSlgEw=; b=B 0geBDBkA3tn1Q2efyciGYColZLp6fIWPADf5flf/2kFvggjNddH5Wb9g4FZ4Sqht CjtLGnWHVjPpfwRkEDGwdSmWrrl69JlHoViMOXi+lGSsSz1KmmqwmxcDm/omnSXG noepxP9BiRgRifCArtHRcLR+0Dp4e9HZ+ltUktlvWVXZbUS6DypPEheNSUwYUyMu ekmW9wOg3a6XV59goybMYI2X7Mu/3sF54SaBI2ZQA329AKeLmcvk90TV24mwMKZO 5GijmiTTQ8sWmYzBXuNIC1EyoDuNRCT8ejeOhsx2/uIJCgpJ6u3VxJh4M1s7VVPa 7QI1ZUSOtQhrUA6jZIBGw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568818; x= 1667576018; bh=TfSsPz+MZn+lbcea/YJJoyg5y0xdpCmmfuBpFmSlgEw=; b=H DWcS+z3HqcXSaW5dzAvn/Yx23G/9kcwBJPfBwb0tE/LKCkRRehJDNbW3GzEpZUsK O1Rv0MFy0kDrj457Wae8j/muKIHpq2ZLzdt2BcZ5V5zTwAbny5lPAlqji1r66s96 HRa/g/PxVi0i7V5o2lyF8DNFwFiHZ+997fs0HiwEVf5TIjf0IATxvCBNoYqCj2wb 2pmtYogCgLLFoHSr44YtUTly154Qu+mmhR+o4FpxVU7Uq1VEbl8C0u4gZNu+4dmd Q80AXUI8vBxGrQSdgj7KvJmvboQMrT7mg8sKSwuJEA0ZNuWm8C6taUijrAcTD84Z wnjqnY44D9uhV6VgWeuHQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:37 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:09 +0100 Subject: [PATCH v2 52/65] clk: si5351: msynth: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-52-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=4451; i=maxime@cerno.tech; h=from:subject:message-id; bh=5ogQpKqiR/Y99yWhmkgF+w2Os3xi0Hh0gjEz2wUXMoE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl8f/tDn2VDyKGuvB+s6Tr4Me/lUuz3VG3/fqNjzS2bF tRkdHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZjIyn8M/wynCl60qVkUViNhc/fw7S 9BqeqRf6uslgd3HK66ZJqXmsDIMFnv+Omc8nf8zirCilf0eHX75I8+W7tMbI+h28H6sMoAbgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063340_080156_297FB0A4 X-CRM114-Status: GOOD ( 22.42 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The SI5351 msynth 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. Signed-off-by: Maxime Ripard --- drivers/clk/clk-si5351.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c index fcf5785ba4ce..bfab05f4fe28 100644 --- a/drivers/clk/clk-si5351.c +++ b/drivers/clk/clk-si5351.c @@ -642,11 +642,12 @@ static unsigned long si5351_msynth_recalc_rate(struct clk_hw *hw, return (unsigned long)rate; } -static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int si5351_msynth_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct si5351_hw_data *hwdata = container_of(hw, struct si5351_hw_data, hw); + unsigned long rate = req->rate; unsigned long long lltmp; unsigned long a, b, c; int divby4; @@ -681,10 +682,10 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate, b = 0; c = 1; - *parent_rate = a * rate; + req->best_parent_rate = a * rate; } else if (hwdata->num >= 6) { /* determine the closest integer divider */ - a = DIV_ROUND_CLOSEST(*parent_rate, rate); + a = DIV_ROUND_CLOSEST(req->best_parent_rate, rate); if (a < SI5351_MULTISYNTH_A_MIN) a = SI5351_MULTISYNTH_A_MIN; if (a > SI5351_MULTISYNTH67_A_MAX) @@ -702,7 +703,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate, } /* determine integer part of divider equation */ - a = *parent_rate / rate; + a = req->best_parent_rate / rate; if (a < SI5351_MULTISYNTH_A_MIN) a = SI5351_MULTISYNTH_A_MIN; if (a > SI5351_MULTISYNTH_A_MAX) @@ -710,7 +711,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate, /* find best approximation for b/c = fVCO mod fOUT */ denom = 1000 * 1000; - lltmp = (*parent_rate) % rate; + lltmp = req->best_parent_rate % rate; lltmp *= denom; do_div(lltmp, rate); rfrac = (unsigned long)lltmp; @@ -724,7 +725,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate, } /* recalculate rate by fOUT = fIN / (a + b/c) */ - lltmp = *parent_rate; + lltmp = req->best_parent_rate; lltmp *= c; do_div(lltmp, a * c + b); rate = (unsigned long)lltmp; @@ -749,9 +750,11 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate, dev_dbg(&hwdata->drvdata->client->dev, "%s - %s: a = %lu, b = %lu, c = %lu, divby4 = %d, parent_rate = %lu, rate = %lu\n", __func__, clk_hw_get_name(hw), a, b, c, divby4, - *parent_rate, rate); + req->best_parent_rate, rate); - return rate; + req->rate = rate; + + return 0; } static int si5351_msynth_set_rate(struct clk_hw *hw, unsigned long rate, @@ -791,7 +794,7 @@ static const struct clk_ops si5351_msynth_ops = { .set_parent = si5351_msynth_set_parent, .get_parent = si5351_msynth_get_parent, .recalc_rate = si5351_msynth_recalc_rate, - .round_rate = si5351_msynth_round_rate, + .determine_rate = si5351_msynth_determine_rate, .set_rate = si5351_msynth_set_rate, }; From patchwork Fri Nov 4 13:18:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031899 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 0C155C43219 for ; Fri, 4 Nov 2022 13:35:10 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6CnIR3e9Alkz71/Xl5EKS1QvP8CoADxAlQxBPKiFiTU=; b=XaVwkpJeLweLzA 2suMOmr+zvBztw0Fxnyt2PlmgTQX5SsrlL2macPlJmMp7CgYffxO3O+sgf0zIrqbL+lI433Zw052j 3NXMk62rs/BLrabTQVZ2NPpiB+zHMrXmy8L3R2sv5mYJupgGdc+tmZhX2U7DTihOwMxG9YNniGpDr XLB1p4EVBmps1nvEsLmVDzbUHWh7SyeJcrbmmjaprW/f/mqFuGAuqTLEmtrcIjuB4gvZmvjkjDSzP CLF5YWIw/ebjnFRhk9fusWS0uP2v9rcOjbtGlokp2/9zI6v2FOYChZoj7uEH7YAwoGmP9bG5BbpgX 4w4Iv+b9NXrtNNFr90CA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqj-003jT9-36; Fri, 04 Nov 2022 13:35:09 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpJ-003iKf-Lc; Fri, 04 Nov 2022 13:33:44 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id D9ED0580269; Fri, 4 Nov 2022 09:33:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:33:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568820; x= 1667576020; bh=3Pt3v/H0yw0dXfcmwyxC7Cglg777DQnqTx8XySYty5Y=; b=v bq650g4m1kc+mTssR8G3hUHWtmzk6HWmzmDYxWET2WeAIT5RacoCfReO3QJFRAew O7kevyKk3h+BJegvfYuhZeeJjz+0bPp2k8LJdftjMu5S1vJ3iyUdV6kTPnD1nBC1 ckk64G6dLPZVYZp1pm6PFALjMW5+3lNnnUK+l7u7QhKz04l5Oq2Op2eCEhsbtJyu bmIRDR55HPXmKpY/BX3IO2A6+WJQobSWATuWkCDouEMrkuVp/FibVxjvf2GeX77N qihlSTm7kSSeMEW/1AnFCGJMiq5LwClROQncZ1NpPBUoD+H0rLjenCxSskQ/QDdl mXeTnZe/YQzWZe9BiwrjA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568820; x= 1667576020; bh=3Pt3v/H0yw0dXfcmwyxC7Cglg777DQnqTx8XySYty5Y=; b=K UfyODrCNu7vHDkihjvwjQepdDj0WMs4+PbeT2oWWcje1EMMrtCxL6rHgINwAmXs3 D4EEibqfGdT5A1fIVDleVgUjVF6tjyEDmnKhJE7Nw4udTEFD/PY6Lwk78vqtNk05 niN5spia/OEGpobkX291LiARzYkfvhP4pfYtWdCLfjJpHcAAMh36EDTM2KJjPWao IJiVfrxtBY4BONNWlDq0Sc11VHwdeszzkUcL7XLbSrIvDTe7s/zSNsv4iUO2vqoR gUKfhvtD551KUpIgBgwdzGJJH68N+nY9aCwHUzbKa0e4GFAKvmzH1KYVAGguA3DQ 7EPueGxPZmfRnAlAD1bHA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:39 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:10 +0100 Subject: [PATCH v2 53/65] clk: si5351: clkout: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-53-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3549; i=maxime@cerno.tech; h=from:subject:message-id; bh=SadWT5O41DNxcKxAO63fE5LsrsyZI5hQrTvwSci3hyI=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAl+3s9bqN97cc+GHEsORxkjVlN8FEXl/N+xcJ+d5+6bW /YkbOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjARx9kMf/hPq55YvO2KqG9Svzz3n/ yZCzRX3m6PEOG/ZFA2WVjIzZqRYZn14W8veQsCbPcqyp6a5bzi4nwOx5bAjw+ubOLvXnwvlRcA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063341_854054_85219BB8 X-CRM114-Status: GOOD ( 21.77 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The SI5351 clkout 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. Signed-off-by: Maxime Ripard --- drivers/clk/clk-si5351.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c index bfab05f4fe28..11aaa934da29 100644 --- a/drivers/clk/clk-si5351.c +++ b/drivers/clk/clk-si5351.c @@ -1037,11 +1037,12 @@ static unsigned long si5351_clkout_recalc_rate(struct clk_hw *hw, return parent_rate >> rdiv; } -static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int si5351_clkout_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct si5351_hw_data *hwdata = container_of(hw, struct si5351_hw_data, hw); + unsigned long rate = req->rate; unsigned char rdiv; /* clkout6/7 can only handle output freqencies < 150MHz */ @@ -1063,13 +1064,13 @@ static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate, rdiv += 1; rate *= 2; } - *parent_rate = rate; + req->best_parent_rate = rate; } else { unsigned long new_rate, new_err, err; /* round to closed rdiv */ rdiv = SI5351_OUTPUT_CLK_DIV_1; - new_rate = *parent_rate; + new_rate = req->best_parent_rate; err = abs(new_rate - rate); do { new_rate >>= 1; @@ -1080,14 +1081,15 @@ static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate, err = new_err; } while (1); } - rate = *parent_rate >> rdiv; + rate = req->best_parent_rate >> rdiv; dev_dbg(&hwdata->drvdata->client->dev, "%s - %s: rdiv = %u, parent_rate = %lu, rate = %lu\n", __func__, clk_hw_get_name(hw), (1 << rdiv), - *parent_rate, rate); + req->best_parent_rate, rate); - return rate; + req->rate = rate; + return 0; } static int si5351_clkout_set_rate(struct clk_hw *hw, unsigned long rate, @@ -1147,7 +1149,7 @@ static const struct clk_ops si5351_clkout_ops = { .set_parent = si5351_clkout_set_parent, .get_parent = si5351_clkout_get_parent, .recalc_rate = si5351_clkout_recalc_rate, - .round_rate = si5351_clkout_round_rate, + .determine_rate = si5351_clkout_determine_rate, .set_rate = si5351_clkout_set_rate, }; From patchwork Fri Nov 4 13:18:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031900 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 6CB54C4167D for ; Fri, 4 Nov 2022 13:35:09 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=soghCoTGUIeGew/QqYjs4f8MgP1cgMfiAEGTKH0z1Ss=; b=Tp0mjKNKINa/LQ 9ygsQiEveB2gmCXhB1rpjQaMyYmj5Pugit3TXmf7/ZY1GGlyYN2/Hhj88EHsNbQe+nBPxSObwndeN 5svM/77ddcLOukrr+3UoKLqr10UGod2XCW4yf6OOtw4ZUMjp6AdqMciIGhsNReQh5kYW5qn/Dr0j0 XX88sJiWHy/YnUbdrXrQzK5UIF6EikRdzdEJlgXyf7Kr/6AmZjZzYfJB0xUntkBXr1IXzXj1XCR4j OEDC+CALna1BRllcKtX8O3bIIAQMWVQnDc6FIXFuolA0KIGgXpIimYtehad63jracxUnXxCHK+h7M IRQwTnq1Ux+PEOUDU9gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqi-003jSh-Jn; Fri, 04 Nov 2022 13:35:08 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpL-003iMC-N3; Fri, 04 Nov 2022 13:33:45 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id CE31B58055B; Fri, 4 Nov 2022 09:33:42 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:33:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568822; x= 1667576022; bh=R/DplwUAt4nhTBW2vr4E0Jh+Cu3e6ZWFvgxyUc6nsTc=; b=K 8dp5qIHhrjyC0qSDz0kXY4svN41bk/6HGKbRXGpfEg8jwkFnMjTjIkzPEmj7rJWY 04DS9qZFNYMINw1OQ+pgzKTZeGeBy5reu80eqqOAA4u6uI9qCJo2u3UKxCAxkgjL IkerdlVglEl0Cp/wWPJfisL7TZBKvRaUsAH2vv1vkACa7Jzp/izqtAn5TxbLFmKG LD/2fC/d1Kk4bAyjOh0TJsB4ItfW4eHC7iZAvJ198G6K9V2T0rgsaML1xgIwBbqk wRvx/hjkS9lSFCYPfcBibxpbr306DEEce0sChoQ1p1g14SST8PdGiqp4f+1UOU9R uwklcvDoZrG+Uex0LokKg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568822; x= 1667576022; bh=R/DplwUAt4nhTBW2vr4E0Jh+Cu3e6ZWFvgxyUc6nsTc=; b=h DCxwsC0IahmQ0mDfoYhaMgMbq6upErIRT4GRS7VQlQ8ZVEco9VTiyBgwYM6crp0n Oc/Kd30WhJR7ovoBizULkdTfWi9Cz5ZlqzeiJKdsnP8uc2bxjfESVpoMFoPx8BD4 7ZMT0P0ysp8AzWVGeuwzcQj771lXoWMjJpBKnNowOMN1qbO3bfD4SAa3Am5tckwK GTGTJDsSRn3nIGyTjBGiASHp2SIVu6RcOa/RNxjl8AKwp9jb8cCwJ06V8jJmSu3b GbkXHNYKfr80hm+MjBx0s8VRMXZSPf2TGKHYMF10eCANB7XVvqO/LvN/EMCJr29u Cm+YRn/4FSzOsTt/T7T7w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:42 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:11 +0100 Subject: [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-54-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2574; i=maxime@cerno.tech; h=from:subject:message-id; bh=RpxATOZmvBLL00EJD9BBUbWIZTvIK1qjBFCyUubpy6c=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt/YltWZnGN3jJ/OHCTa+mZLlIq0vL7OHbf1Qo8aBLe/ WyzYUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIkEFTD8r3uUK5fZKrO449UnhSIn1Q Mr2Vp/7TKKK+ub4vqj7UjKe4b/7tOMr5Y5ubVcWd78nuV339y4l/XMapPmh7W5R7TufvOfHwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063343_886505_E8812F17 X-CRM114-Status: GOOD ( 20.30 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org 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. 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, }; From patchwork Fri Nov 4 13:18:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031901 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 679F2C43217 for ; Fri, 4 Nov 2022 13:35:16 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dWw09zfRSF7xNQHicB/FsukkQMVBFSziDAk6I/FJ2sM=; b=nPNMjp0j3WdxZa CaUWlfZeYclU+uoZojQDhWSPMTOurduMO0YUhPEfwGOLi/TAoc8/ujOIeOIYP/DcqcjZZ9j3Kpk5+ FzMK5+APUsisI4BWRJgctYT8NW44seR6fe5D9drAS/kcHoNug3LiGskKu2ErPeY0lSKoK++fBMVrS mti88DCT0VE1E4uKaJv9ev2lb/eI/SVCrJfGiMpEsHIKkLECLzj9G0WXCWB2jJnIf/qyAtVJROfkW pJGRx1evNRTCS3zxbKWzdSJUiGx3aOB2e1eVEHYv42feT4H4voVLVUVw58sswmxIDyYkJsyg4f3qx JrU00iHitbu3/2z/NxSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqp-003jYy-Eu; Fri, 04 Nov 2022 13:35:15 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpN-003iNt-Pr; Fri, 04 Nov 2022 13:33:49 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 1B151580587; Fri, 4 Nov 2022 09:33:45 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:33:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568825; x= 1667576025; bh=GYudzoyg7ll5SQ8pp0fhXNTbvCexyPHjho/+FEK6k10=; b=W KkG8XP+s+Jv+aqY4iePGn2aYw9GCccFkpg5PrCz2MMqTh8vaiRVffPRp7Jx78yzv N6W0uPJeyvuqyq8EbVYi3i3j9rSuhocHLjqVbwMh27lRvlcd1w0v1ByvPRBJ1LAR fO6d5mzyqh/rydIOLqXBrk/AoRaUBNaciASssI4iwTrxyPLs57snjYNerDAOj/C5 MvW50JC8c/SpztdX8J31/dKS8TvJHY93kY8KM23F0Mot2jwM51Ji3o9HyTUuvwLX 9jKDaJdI95o6voQ1jdgKBAAU9+9zYO/snXdtBEbqmgXXCPvI9fTqcDvcaYB2Lx2w 34AZQpiH1KbWuzDAH1Swg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568825; x= 1667576025; bh=GYudzoyg7ll5SQ8pp0fhXNTbvCexyPHjho/+FEK6k10=; b=X z/unGvE07EVaClbHmRvra+3+G9lcIyXrDjRtJ97xSkG2SSg9lk7lzlFqmLxjGdZu XHNPo6v6LxTIPL+M7076tW6nq4tpYlFk3TsOLymfqxKAtPkUL0D11gH4Tj2fVhWR LlEwm06hBrQ9cBuqr9wWc5w3Ds6thk3+poW86ksHtXivtpGREgTsJ6PhrV+oZPJR 7V8yzk6R8BoK4Q4Z0GUfVpVB/oP+XN0/61xqjvMZxpk/cjYm6uQ8rg9ErPQSsZRu bNmAAwiwZF4DRqmdShyXogVziD+brCgKNdzmlcK5FGV+peIOxOycmmHcw/tFP2fv xcljkDD1ZUBDtKf/imvAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:43 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:12 +0100 Subject: [PATCH v2 55/65] clk: imx: scu: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-55-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2736; i=maxime@cerno.tech; h=from:subject:message-id; bh=yds4KZyob0YLXbSMCzkvwutOEagEx8WboYbk+zh5xIo=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt9s+l9sPPA75/kO58KVkbfrTL74tS9X6pp14kbK0d6J mSoMHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZjIQXZGhvOb9rz4Fh+6cDP345TDZ1 984I47t25WEIvHsQlmNT4Pu+cxMtw4XMH5cscPL+V1P6a+vrhfbNOPHF3ne3ePP3TNy2wwOMMHAA== X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063346_077879_7A7D2A52 X-CRM114-Status: GOOD ( 22.14 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The iMX SCU 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. The round_rate() implementation being shared with other clocks, it's not removed. And if it was an oversight, the clock behaviour can be adjusted later on. Signed-off-by: Maxime Ripard --- drivers/clk/imx/clk-scu.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index 66e49fea5f8a..bbdc1b23f6f5 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -250,6 +250,23 @@ static unsigned long clk_scu_recalc_rate(struct clk_hw *hw, return le32_to_cpu(msg.data.resp.rate); } +/* + * clk_scu_determine_rate - Returns the closest rate for a SCU clock + * @hw: clock to round rate for + * @req: clock rate request + * + * Returns 0 on success, a negative error on failure + */ +static int clk_scu_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + /* + * Assume we support all the requested rate and let the SCU firmware + * to handle the left work + */ + return 0; +} + /* * clk_scu_round_rate - Round clock rate for a SCU clock * @hw: clock to round rate for @@ -425,7 +442,7 @@ static void clk_scu_unprepare(struct clk_hw *hw) static const struct clk_ops clk_scu_ops = { .recalc_rate = clk_scu_recalc_rate, - .round_rate = clk_scu_round_rate, + .determine_rate = clk_scu_determine_rate, .set_rate = clk_scu_set_rate, .get_parent = clk_scu_get_parent, .set_parent = clk_scu_set_parent, From patchwork Fri Nov 4 13:18:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031903 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 C06B6C4167B for ; Fri, 4 Nov 2022 13:35:26 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7WM9quTwLbiBS6TQ862VvAgJIrV4e1a4zlldjCaTJ94=; b=rjDDv1pRI8h4d8 gAkG51DYruE9wwRlum7q0aLBy2TZOLzMUTTdWSU5cIUNGeRKmPsncxNXbSEMUobENHEAWm+XMN/X/ lcUMaEUa6JNjW8KwFy0EWAnFXfvBjJDGl8A3SlYVzHhle4diPEtF3NBkPoWtaT3lRdoWLNCbngPfX bYKb4FAGKb8ShqFWqRKhOIej/zYzfJFr9b3drkCtSflSHuJccA4YyHiD4lrl1b/nzlFJiuyZDx6LE sCYSfqCDW2RXX7LxJhbWgvXiSuHP5GAWc9ORhSqQiUNFd+pRn1H8CpuKZbicQUSU9jS5O2xbWdWOd 5YjFemdR0texRiLEpbFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqz-003jh4-3B; Fri, 04 Nov 2022 13:35:25 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpQ-003iPO-7b; Fri, 04 Nov 2022 13:33:52 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 66C2F58058D; Fri, 4 Nov 2022 09:33:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:33:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568827; x= 1667576027; bh=+rhKeJrs2s5Tbw0epy9S7OEOW4HBQEwW9Fe83Y4csGg=; b=Q w0wQGCBxhQtQGlbixoAT+qMUoEcDsIy6LIps7XRmFMTWSVeMAPwmerqgfvyHejlr H+Z7b9CGlFGG34AUunuVAgFe9ldDrBxVnVsT1gwmV8TBkfz83A8AhpCoNMggXdBt F1kFxi0RFNocFCotjhk4SpJ43BRDT2hY7zxzMpvYEE83XqZ9js8diV47+CkVwAaO ySx+TS/26sSG+e0znlSf7XbPujdlMhxr1zDz7cRHSGQj4XKHsNAGbsbgFFLB3/jW 74PR6BaZ5bDmHXfDgffNZ8EK7y2GwVfJ4VvY8Jrj/A7F/kmeHQNGaMcQyRDr1RRd 4zl0atU59MB4U39mqZ19g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568827; x= 1667576027; bh=+rhKeJrs2s5Tbw0epy9S7OEOW4HBQEwW9Fe83Y4csGg=; b=R ucYl3m2HwHg2BDYRjcPtc07kAiRB4XogMmHQxKgbUP7UpoExrL2KcOrl06XmGhIT q2zlRB2WDpWumAfE3EdkrcCL0ajq4Cp58aXe8KWvmSva8rUP2XPVk9luTzW7TKnr Ss9WorYuMk0ZgzqNSOaRjUjdJh9sLubDuC2hGRj0s48C6WnHA/oJw8ug+n2lTXpU YcAbcXtsCKyX9j8/1Rn1U4vuUD7haUIKud6GSEINjfHHx8jsimgxrAd3TjtSXpt9 BsyRHGLucxDMwkzA6BIsM4HvkGYYKi4+2EsLBy0d2TY098MVdskwf7hQ4L2wRQMZ oI8AACrw1jFg16bNj2kIg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:46 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:13 +0100 Subject: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-56-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3004; i=maxime@cerno.tech; h=from:subject:message-id; bh=+/l/s0ydlizM56vbOYruDyw3Ne8uTB/GZrYOy/EaaeM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt8uhoWy8hfPYBPIa/m5cU5FueThKfVBKfUfVv3itJkf bavcUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIno6jAyHNqr91dgD3+Cm8SXP7ta/F Y8efnG16Gps/uRt8Xvj0erOhkZzqxomnxtfUKd47rNn30PKSVGTl7gOLNk2y3HN4Z/pohacAEA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063348_398397_C2F3AA8C X-CRM114-Status: GOOD ( 20.74 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Ingenic CGU 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. Signed-off-by: Maxime Ripard --- drivers/clk/ingenic/cgu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c index 1f7ba30f5a1b..0c9c8344ad11 100644 --- a/drivers/clk/ingenic/cgu.c +++ b/drivers/clk/ingenic/cgu.c @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw, return div; } -static long -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate, - unsigned long *parent_rate) +static int ingenic_clk_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); unsigned int div = 1; if (clk_info->type & CGU_CLK_DIV) - div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate); + div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate, + req->rate); else if (clk_info->type & CGU_CLK_FIXDIV) div = clk_info->fixdiv.div; else if (clk_hw_can_set_rate_parent(hw)) - *parent_rate = req_rate; + req->best_parent_rate = req->rate; - return DIV_ROUND_UP(*parent_rate, div); + req->rate = DIV_ROUND_UP(req->best_parent_rate, div); + return 0; } static inline int ingenic_clk_check_stable(struct ingenic_cgu *cgu, @@ -626,7 +627,7 @@ static const struct clk_ops ingenic_clk_ops = { .set_parent = ingenic_clk_set_parent, .recalc_rate = ingenic_clk_recalc_rate, - .round_rate = ingenic_clk_round_rate, + .determine_rate = ingenic_clk_determine_rate, .set_rate = ingenic_clk_set_rate, .enable = ingenic_clk_enable, From patchwork Fri Nov 4 13:18:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031902 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 7D71DC433FE for ; Fri, 4 Nov 2022 13:35:25 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0P7B6L4pmo9ofnLo0u0/VdIyiZwbgZs6Qgu8cb9HbN8=; b=j6n1krkD+p0yr2 fsse+QbfugEewFdLKkKxnQH7kf+f7i0OMG9TN3h+eMwNu8INrqKWaWCak/r+JfYu/s84KuN/j87Ti +yehUC6zfeKAXxyvkCaxB/uUiwsgZZUm/UamZMCW9jK1RLMbPTP80XWYiYQ/ihpMqhxfCRyCSTM/h n8UTcxPSohJwzjGkFTBDAsjWzFDQp+RyxunRx9tw+pxj2E/GOs+IdHHwmXLhFJ8zQbaVkgjqE1h48 vGAimPMpjH8k1NKjqr5CohZ6HI1jwVjEDtiNHEinvSfdv1s1jInjqrK1b09XeR1lxi1lluUEAF/Mn 7+zykfUdH7Z6mejTfN2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwqy-003jgh-KO; Fri, 04 Nov 2022 13:35:24 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpS-003iR9-EP; Fri, 04 Nov 2022 13:33:54 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id C50CB5805A0; Fri, 4 Nov 2022 09:33:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 09:33:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568829; x= 1667576029; bh=hEKOJDq7NCncgYxMXlHU+pU/ROWXe3uUCVEMV5q4hLU=; b=S 1pINkBqcWESXdghzvqqTZs9BO5lYuLhhZ5CGl0LcVdYKJznnGhoFG5VAn6oAtboI PyXtNU7GcGMKE6HOpd8uAuJ/yE/7GMkS72XKbuhyY885bfdumczASzwEy1Nf/zpT iOOjL9D46vC+kxk7CAzmcxo+kBvdt3oN3c9fc7YnuCEzZiHFLs2HrcOT4/JNaO9k ifs22l75gcVnUeRYd5I/Cld6iewIBHO8v6mMpazQjMa6kyJqYUWZI70+wU6V2BN+ ygHUDlhy4ufoILFm2mXWYbtNPP19UZoB/ugqgXh8HxR0mjVDq2QQ2wt9VUjcHnbA 8t7JSisnfH/d/NDMCH3pQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568829; x= 1667576029; bh=hEKOJDq7NCncgYxMXlHU+pU/ROWXe3uUCVEMV5q4hLU=; b=k ML05Bx+lgy7VkDGEd1tIwrJVJ99fvXAcPO+Ca3QUdxrT0gnJ0kRUJKT2wg1wxNRO AasTRQIK74xQgAjvRk+gFLLzTWL6JAz3rr6QHO4xSHkThMWMuoQuAedlFQ7oTjXB Pen0hx2qf0D+hasFFLKwlb2+53oGASLO/WWFQzTmprDJUZbgfkF1V70Jj59asmlZ UiA6df7slql0NX+AYcZ42QCnNSdxKDGAIS17jazcDb+EOu27jAvgGAPIaPcc/aHD ymKSmrbFpBKas4mAqmu9kMld3Dk0+xYlrycDhgL91+oMXn0jwzHLBd67LwBtaVXH TM4TW2lwglrsmvagKiebg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:48 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:14 +0100 Subject: [PATCH v2 57/65] clk: ingenic: tcu: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-57-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2825; i=maxime@cerno.tech; h=from:subject:message-id; bh=wUbMrwrN41Q9yshHLu56uxaXfBgvFGNU5DxK45MwFTw=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt9uZeRsEZz3PfGUUdnyeWsEFx2Zrns00b49+M+ZvAMB SteudJSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAi3/4z/GI2nHdaY3amI8vLK9+qo2 6+TZ3nc4894/uZ/PTrDZF2jccZGS4tya/dwt7vnOc018usYGdpTvTSknTbFd732ln+fOq/zg8A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063350_716749_3F1AD28E X-CRM114-Status: GOOD ( 21.27 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Ingenic TCU 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. Signed-off-by: Maxime Ripard --- drivers/clk/ingenic/tcu.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/clk/ingenic/tcu.c b/drivers/clk/ingenic/tcu.c index d5544cbc5c48..7d04ef40b7cf 100644 --- a/drivers/clk/ingenic/tcu.c +++ b/drivers/clk/ingenic/tcu.c @@ -178,18 +178,21 @@ static u8 ingenic_tcu_get_prescale(unsigned long rate, unsigned long req_rate) return 5; /* /1024 divider */ } -static long ingenic_tcu_round_rate(struct clk_hw *hw, unsigned long req_rate, - unsigned long *parent_rate) +static int ingenic_tcu_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { - unsigned long rate = *parent_rate; + unsigned long rate = req->best_parent_rate; u8 prescale; - if (req_rate > rate) - return rate; + if (req->rate > rate) { + req->rate = rate; + return 0; + } - prescale = ingenic_tcu_get_prescale(rate, req_rate); + prescale = ingenic_tcu_get_prescale(rate, req->rate); - return rate >> (prescale * 2); + req->rate = rate >> (prescale * 2); + return 0; } static int ingenic_tcu_set_rate(struct clk_hw *hw, unsigned long req_rate, @@ -219,7 +222,7 @@ static const struct clk_ops ingenic_tcu_clk_ops = { .set_parent = ingenic_tcu_set_parent, .recalc_rate = ingenic_tcu_recalc_rate, - .round_rate = ingenic_tcu_round_rate, + .determine_rate = ingenic_tcu_determine_rate, .set_rate = ingenic_tcu_set_rate, .enable = ingenic_tcu_enable, From patchwork Fri Nov 4 13:18:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031905 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 A77ACC433FE for ; Fri, 4 Nov 2022 13:35:59 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R6tKgUdx/UiS6Wz5F3TBX1ZR2P3rvkr2ZKEnETHtrZk=; b=OPppKx+rNjw8MP iCdcMR4AkqRUD1aTTHGBGDcvhNjk1Qesdd9vSM8r79kLW0H0T/sey4ED9VZ+1hbGyCPzhiTuQ3IYw tPCH3PbcaOkZZn9FUyS7I7iNLJT3drzS73XpJibjsC9PlOXswfIGgQQvvn7hfW94lQJGvPA62s2Xr n8xPr/6FIAu3JlOSbZkVfZk2WHrKK91/TX+QvdjIM+4kb7Y7p5w0khxdy5BXUe8midiQ8GmlzQydM qFoRLl3sldWiqoYLk3qNOfAUvRwmOQGQx2zykTsN1/SL0wp7kTBQooTIdjtA6xl423a4dDDMFWtLZ ceNIvdOgWHqvS9+LU3DA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwrW-003kN2-Nr; Fri, 04 Nov 2022 13:35:58 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpU-003iSh-RD; Fri, 04 Nov 2022 13:33:59 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id EC3235805A9; Fri, 4 Nov 2022 09:33:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 09:33:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568831; x= 1667576031; bh=3SayXt0/D6WxnYze/EYNShXO6XiADGikWDKu2qyjPH8=; b=Q 3alsfm9UsUSiVuvki3aPQBiMbtcumgeCqm/udg1EnIjDa4XLZiG/Gj/RNjpuFO3+ kHUxfVO7z+WjrfDZ9Jm0aoSbyodiNgm2DGJQRybGX3hChO9nDBHTsUbC1y9EgNqM z1zeJOHLSPDbJ1mqYNrfVMBcjjBnJk284GBSopqV/anlXaoEEEA2K3AQsiBRpNb3 NAF9Ip0GDIbLO7d/VyE5LwbVpFmDWhQBxCIvYEtMDnpcYkL4Ylz5mw3dSylSOPMC +7BSLzNwihfkTJe+KlSAI+CQFfEUXo/6pmDPBfoJQgRz6Q4dFmCQN8urky3mGz02 XI0G/xprHLTPqrursWLxg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568831; x= 1667576031; bh=3SayXt0/D6WxnYze/EYNShXO6XiADGikWDKu2qyjPH8=; b=k 2IfcCL8aVNsXppKPSwBg7YkXwLHTF+ofimflsF3lzaP0Wl3fC3zcYMWb87hTzeJb MjXWqTbiNiqbqn/ZlXWVKrQZjEwbaKsK88oGk18mcmQeSKKE21Rccx/Ti+/R3jVu XAcSMsBANE/iKkpVXVJmgWuAT2LzycZawKeIlYJ4GcifB5yAB7iOXQ0CUhCn1lNJ vQ8aCtlxuJBVCS7r2WRepwLaqX+MnJdVkRQA8Gk1zSnyf0mqIgFrWQb7cw4nLd/R GXaom5wnteT7EheB1X2eYFwprXyhpZc1G7N8mU0M3r9ExQpRwCv5atQaI5qT4hgx 7m393h0+PDTxONdwjF0cA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeeinecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:50 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:15 +0100 Subject: [PATCH v2 58/65] clk: sprd: composite: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-58-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2634; i=maxime@cerno.tech; h=from:subject:message-id; bh=MbfBGfNkM8+Fx2bW6mWZyrQOFEdgYBpFkszGxyCct/o=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt8q5ZTls+9o2XY9lc2ZaaDIeyCNPWbOGsN+pavfum4s ZcvrKGVhEONikBVTZIkRNl8Sd2rW6042vnkwc1iZQIYwcHEKwERi1jEyrCqQsJ926f6TzvqDFi7n1K qcLqfeufKy72+ZZtu7+89jexkZ5k5kX1LJdmVj15Z1r7ZGxm2ydpx1/FrrgjL2NWf/ybyczwgA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063353_148277_43BF9DF9 X-CRM114-Status: GOOD ( 21.42 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Spreadtrum composite 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. Signed-off-by: Maxime Ripard Acked-by: Chunyan Zhang --- drivers/clk/sprd/composite.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/clk/sprd/composite.c b/drivers/clk/sprd/composite.c index ebb644820b1e..d3a852720c07 100644 --- a/drivers/clk/sprd/composite.c +++ b/drivers/clk/sprd/composite.c @@ -9,13 +9,19 @@ #include "composite.h" -static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int sprd_comp_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct sprd_comp *cc = hw_to_sprd_comp(hw); + unsigned long rate; - return sprd_div_helper_round_rate(&cc->common, &cc->div, - rate, parent_rate); + rate = sprd_div_helper_round_rate(&cc->common, &cc->div, + req->rate, &req->best_parent_rate); + if (rate < 0) + return rate; + + req->rate = rate; + return 0; } static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw, @@ -53,7 +59,7 @@ const struct clk_ops sprd_comp_ops = { .get_parent = sprd_comp_get_parent, .set_parent = sprd_comp_set_parent, - .round_rate = sprd_comp_round_rate, + .determine_rate = sprd_comp_determine_rate, .recalc_rate = sprd_comp_recalc_rate, .set_rate = sprd_comp_set_rate, }; From patchwork Fri Nov 4 13:18:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031904 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 C90DAC4332F for ; Fri, 4 Nov 2022 13:35:36 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6UJNnLl46AhRElz1HEFAqxvoRGa8KwgDaYDJ0p2nY8o=; b=uSlVfw2HZNjWDI tIgj6Pcjmc8wD4cMjC272QQTTLrq6APz1JpOdyi9hdHf0iigInJyJ3S0TVbZKrAxbspB0g9V60/fb JvMCEqthkfPLpJ91dtUaffHeOhOBXHWtw5e0Z2AWTpIancpOQ6uT5DB8WyUn18RCJTRBfAuSvV1P5 NaLU8DJQKQuYMZWso9qD7lqm+O5Ag6Q8oOKtuKip/ele2Cc13vgbSCILrOntft4FYYsxSCtYbSKi1 q93+4RwDgJYAIdlEzg9AM/jWYxmQcPN/1rUym/u5slneOWlVmLj6Qr6tw1SjJvG9BXMbiEe3IwsCz aYFTxFjpomrwEoab18ZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwr9-003jsS-NX; Fri, 04 Nov 2022 13:35:35 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpW-003iUO-S6; Fri, 04 Nov 2022 13:33:56 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 09C265805A6; Fri, 4 Nov 2022 09:33:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 04 Nov 2022 09:33:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568834; x= 1667576034; bh=GG5ym4w6gS7mppovC+jUWC3Q6mS58OHFw/6k+J3fjVU=; b=S RCVgcuNLOZQWJqCmiFCaCWCIwu1itgRuWApbu0MWrG4xSFiOCksP+3wK8ALgy2Hp g5aiUqeQcPRAbTodFxK/Q5CJMQU/k/gI1B2LxPXSskE5fqULNkm5nQjz2mNyII/3 lHaLe+qkI6KI+0IcuxnQzJAJtiuMfUqPEbm3QTrqOfI52LVkGl/fsxaZAhZKEBHm Ao7kPzZiIz2Dipr6AwqKNuJI4LcoHQuN4chGOTjDFKOXzG4oVj5g+uf4q1rZmfpJ QxPlZXZcM0xX+V2RcdFQeEj5vPX1DdnNrwAAC038o1keXCuMaymOugtaZmAlgZn+ 0x3MiTyhy7MIP31Q2EAUw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568834; x= 1667576034; bh=GG5ym4w6gS7mppovC+jUWC3Q6mS58OHFw/6k+J3fjVU=; b=I 0O1xdRYDoueM7vK2wygcLY5do5ltiblZk6+oJdkoswTKR/k7tuZeYDmcfMKF5XHS XVq/mr4QXhMbuOqN3mQSeDXRbwUyaJ4GBzCdb1Ivx6/bbPpH+IQUZD6IDZCpUrRq l80OUc8seHcdJ49Co4eBzIISQVFoXJDSaQVKH66OdZUhoYTa5KXtspJlaf9l9snv kTtNAie1pzufoi+s8ETL6DxVtproo/QT2wIXO3I68HmScr/Wx+vXfzwUpoT3ova1 5v6jBzokCkQPm9IVY/lSBFisZzx4HAUqG4rlyrWOpZXIj7NHA/G0FH3Fm5Th47IO Al2Fx8WFaY1T/chDWT3QA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:53 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:16 +0100 Subject: [PATCH v2 59/65] clk: st: flexgen: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-59-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2844; i=maxime@cerno.tech; h=from:subject:message-id; bh=wHANmveZ5/10ctV/K4Ia+5unC0OKbDapXscWnzGylWQ=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt/ihaLmpGk9M3B/veFZ5Z39u+z5H337dDiz7uwFpnU7 A6x+dJSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAiv6czMlw5EfDuScBWX6uW9I4DXF 1K/4qV870X9/LGtazR2Z/UMovhn9bp3VEnDoc3WlzQuriXnz+1KC7fU2VqOf8Ui3eWJy5oMQEA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063355_024384_C6963B4D X-CRM114-Status: GOOD ( 19.17 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The ST Flexgen 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. Signed-off-by: Maxime Ripard --- drivers/clk/st/clk-flexgen.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c index 7ae4f656191e..5292208c4dd8 100644 --- a/drivers/clk/st/clk-flexgen.c +++ b/drivers/clk/st/clk-flexgen.c @@ -119,20 +119,21 @@ clk_best_div(unsigned long parent_rate, unsigned long rate) return parent_rate / rate + ((rate > (2*(parent_rate % rate))) ? 0 : 1); } -static long flexgen_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *prate) +static int flexgen_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { unsigned long div; /* Round div according to exact prate and wished rate */ - div = clk_best_div(*prate, rate); + div = clk_best_div(req->best_parent_rate, req->rate); if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { - *prate = rate * div; - return rate; + req->best_parent_rate = req->rate * div; + return 0; } - return *prate / div; + req->rate = req->best_parent_rate / div; + return 0; } static unsigned long flexgen_recalc_rate(struct clk_hw *hw, @@ -197,7 +198,7 @@ static const struct clk_ops flexgen_ops = { .is_enabled = flexgen_is_enabled, .get_parent = flexgen_get_parent, .set_parent = flexgen_set_parent, - .round_rate = flexgen_round_rate, + .determine_rate = flexgen_determine_rate, .recalc_rate = flexgen_recalc_rate, .set_rate = flexgen_set_rate, }; From patchwork Fri Nov 4 13:18:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031907 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 228B1C43217 for ; Fri, 4 Nov 2022 13:36:00 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yedV2r5M5uPkVgUKpnWGiOo2RnD/1B/HnNG2auG7GNM=; b=Cnl6QS/1IUl80P sDY7GMOIpM/sef0dr2siZD0AgjfNRsqyXIkF8BSe8dvpFyL2ioYlOtRIc8Jhv1wG5TrAPsE028fke YtVWw7e1Ds4Gyz1NM325l4KZIqCA/Ni4YAO2cdnDiDQogK67LZ0n3YGaAje+cKgn3QOeEjrj0VD+5 1u4Y1m3Bslz0lDCNNV7ogdn0Nd+aRojgU4XwbMUPBd2G+uYaTBBDgMdd7YHX930P11TsPtXKr7v41 5C8ZnH6j8UQfwZupEEz+i/PHCy7eRBI3COwq7lhgjSQb1v9ko7bU8V9mW6dba3sZAy5nHFZoC3hHB pZp4SFpdQJ35soFEasqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwrX-003kPo-3s; Fri, 04 Nov 2022 13:35:59 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpY-003iW3-Ud; Fri, 04 Nov 2022 13:33:59 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 1CB475805AF; Fri, 4 Nov 2022 09:33:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:33:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568836; x= 1667576036; bh=8i9Mndy2jbfBk1MIVA7c/A2hrdbXrLt4ZlzMYH+ZKBI=; b=Y tFpLN/RrfKWUEcWDR0f4VrdRTlj4gIMKGGpfK0akKub31fTdbquIY/iS3Ua2LFqo chXDAEUzsvUrNYDMr91oZozPbA1gpnelWwcINGl2rx+gHlT6em+qGNhMZ4Jpbo+s OxWGotUcAVThTMFOKgTnbY5eVDjboisUaiJqJXcvmmAQ/x8LioOlI0Gw4zjA8i0r YcF3pggSXgWn5eQd3A9hrEUHDTDKmXHsezYWpKflijmMJETSEA1OuyQakkyyKH9E f9Zw4Tj341f7UEjA+mG7kxo/uGP/D2HT32QZzh5aVzVo0fkdHtHEFgpklLUePDiu +/50mfTLVF8VAFoDbo+8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568836; x= 1667576036; bh=8i9Mndy2jbfBk1MIVA7c/A2hrdbXrLt4ZlzMYH+ZKBI=; b=I Dim9KnhBoO75TmaMviA33lXsyJaI5GzBZhMxr7PkD2xhbo4GP+AAk/aLXQuiGx5g gBq2LY6aTVQDjm/uWk9LEKn+6vlJTw0bdMMgvWzsxkNNLli5iPshkfcFqTZ983y9 UnSDBNmrN/PSdmukA7VZhzVEQTyNRUBT6R7kicjqHtX8UoTrBEreK9m56whIkCoP VTfrQM0aJfyLkF2x+qQpo2BugpbKSVEebmNKyHDY6PCE+4//j89QnLeD/Mr7LqZG 6xzsj9WkR4zZDyJa+fKLcPkGmFseQ2AJTkgkdowkMltbPQWAQBwIwRQHyq9/whOZ ZmaOxa1PlWGSgJ8frasGQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeeinecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:55 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:17 +0100 Subject: [PATCH v2 60/65] clk: stm32: composite: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-60-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3796; i=maxime@cerno.tech; h=from:subject:message-id; bh=wiPrQrPtwHN8JkTzjgovj5i1AFxQRgKSk4e/VekItv0=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt+2uc8y+efrdmg9i7mF6t9F12s1T8acW/1o/bozHvv/ 7rVO7yhlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBEvjUy/M9KP163gqVsrXqg9h954S fCJlMuyn63NnK9Xp+vJOM8kZGR4bf7tEXfjytNd2E8m5rGw/yAJfHgUtvQST9Zou1Ezl6sZgMA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063357_149981_A7C21BEF X-CRM114-Status: GOOD ( 21.81 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The STM32 composite 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. Signed-off-by: Maxime Ripard --- drivers/clk/stm32/clk-stm32-core.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c index 3247539683c9..4027ca7d9806 100644 --- a/drivers/clk/stm32/clk-stm32-core.c +++ b/drivers/clk/stm32/clk-stm32-core.c @@ -349,14 +349,15 @@ static int clk_stm32_divider_set_rate(struct clk_hw *hw, unsigned long rate, return ret; } -static long clk_stm32_divider_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *prate) +static int clk_stm32_divider_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct clk_stm32_div *div = to_clk_stm32_divider(hw); const struct stm32_div_cfg *divider; + unsigned long rate; if (div->div_id == NO_STM32_DIV) - return rate; + return 0; divider = &div->clock_data->dividers[div->div_id]; @@ -367,14 +368,24 @@ static long clk_stm32_divider_round_rate(struct clk_hw *hw, unsigned long rate, val = readl(div->base + divider->offset) >> divider->shift; val &= clk_div_mask(divider->width); - return divider_ro_round_rate(hw, rate, prate, divider->table, - divider->width, divider->flags, - val); + rate = divider_ro_round_rate(hw, req->rate, &req->best_parent_rate, + divider->table, divider->width, divider->flags, + val); + if (rate < 0) + return rate; + + req->rate = rate; + return 0; } - return divider_round_rate_parent(hw, clk_hw_get_parent(hw), - rate, prate, divider->table, - divider->width, divider->flags); + rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw), + req->rate, &req->best_parent_rate, + divider->table, divider->width, divider->flags); + if (rate < 0) + return rate; + + req->rate = rate; + return 0; } static unsigned long clk_stm32_divider_recalc_rate(struct clk_hw *hw, @@ -602,7 +613,7 @@ static void clk_stm32_composite_disable_unused(struct clk_hw *hw) const struct clk_ops clk_stm32_composite_ops = { .set_rate = clk_stm32_composite_set_rate, .recalc_rate = clk_stm32_composite_recalc_rate, - .round_rate = clk_stm32_composite_round_rate, + .determine_rate = clk_stm32_composite_determine_rate, .get_parent = clk_stm32_composite_get_parent, .set_parent = clk_stm32_composite_set_parent, .enable = clk_stm32_composite_gate_enable, From patchwork Fri Nov 4 13:18:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031906 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 2EE29C4321E for ; Fri, 4 Nov 2022 13:36:00 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ev+lPrbVrk0b+UKEbuzbHmhbeICY3SjilL78UAaw8b4=; b=2IhY8U7VYPliG6 Rz48p4vpRl9nAuURkAdLHc0VAIV+ZHeO216R5L9fLESdDzEjCY6B85hRvpXS1DH5S4qmon9PkoS+3 f9xV+Z4i9OA4i1UkEMUhRnRlruosNKTKBKpelTmECe4yppTfT1jRsAs+xSepHt2+QowGobNzvIgUW jcwxcF5i2sEdYcHqUmRxLl8RRsu3oI1aE4JWa9YL17jLiZbMnodt76Jey1qf9M+ZY/CQIug6j4kwJ DYeuE96kWX6fyKsdIi3+lgfNVUlbKturV972x9owPHhHIL5OqB9mDAv7AD17WY+ZVVhsvsMq5FoEk VmWaP4BvqfIOdKQUnmpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwrX-003kQO-BN; Fri, 04 Nov 2022 13:35:59 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwpa-003iXW-RE; Fri, 04 Nov 2022 13:34:00 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 388665805B4; Fri, 4 Nov 2022 09:33:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 09:33:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667568838; x= 1667576038; bh=RbJFjhJY2TFF1lJTZFwIQdxmhPzyUybipUNKWB96MsE=; b=Q 3Ra3AB2nKL0bgtpEsQAzlQKLFWbfTmOkYDnJ6/FBNt5fvG0QmLCbOnBxpF1ySwMC Yz2o1iITyZCZ8jtmro9Mb/V2WrKXs5eC79j7CMTzcPkC6z/Y38FStwoY8pYQK9EI /r+gApD6ujd0MgAAmaARvcDdJWc+43olJP/jtx1IeGhSAfaZmAoju6oGO7bJ23rB ex+P/h87RkdyD0rFRVYGWJdKBzt97cHL3t0OPgQMKO2CBluBCKUpsb6V0LaxIWVj j//39zQ5LeCS1J9z8y1h9pk9HOzs7oTdf4i8Rb5FsVCDAURRhS4Uh8QjkcahAHSl v9P8EoGK+xRh/maERpQDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667568838; x= 1667576038; bh=RbJFjhJY2TFF1lJTZFwIQdxmhPzyUybipUNKWB96MsE=; b=Y Uz2HJW7Df6UJ57JKYalorP5rZGStbcie3GXoywXbWbC16GVlmBsXgCGCDy3NCQFL VZ/7dHjsvlyPvnEfKZXsPyD/dd+Q1eaa39oLHIk1XWEkLRiuvZwXO2cBTM7q8JGU PbK7hiC80g/ZO3llZSkE53FB3JIm2uvS16keZ6efiQolGTNwoasvfxgF778M+g5G Hjmcd//FqwwpbfPkqFdNJnkPoL9Feh6QB4h36b7aQtc9INCjoaFupJSHu7c+FW8m m5Tp2iI4a9mlU5UoHfwyxpEwmwsknxyLAxeRSRCDFDdAMOE+XAUCbzPU5tTNBEQA o0wPP937kkPYLJfTUW0PA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:33:57 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:18 +0100 Subject: [PATCH v2 61/65] clk: tegra: periph: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-61-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3277; i=maxime@cerno.tech; h=from:subject:message-id; bh=daasTM65TpyDU3lTRJTlSg4u93TDv996zFOnzlSvaFA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt+4rIOjdVaH8RfG61mGJp45FtVdcfhKZpRK/Qohb0aj HZc6SlkYxLgYZMUUWWKEzZfEnZr1upONbx7MHFYmkCEMXJwCMBFuXob/voXac6IjnPkr7qw9Ent9fV Ln0gnzN9tEpL/prvX5Lf3AmOGf0XXfN+URC4VbDtzM3TzDbn7pR7PtDR3J4u+fWGc1MncwAgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_063359_034657_98D47BBA X-CRM114-Status: GOOD ( 21.81 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Tegra periph 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. Signed-off-by: Maxime Ripard --- drivers/clk/tegra/clk-periph.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c index 367396c62259..ce8cab5f1978 100644 --- a/drivers/clk/tegra/clk-periph.c +++ b/drivers/clk/tegra/clk-periph.c @@ -45,16 +45,22 @@ static unsigned long clk_periph_recalc_rate(struct clk_hw *hw, return div_ops->recalc_rate(div_hw, parent_rate); } -static long clk_periph_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *prate) +static int clk_periph_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct tegra_clk_periph *periph = to_clk_periph(hw); const struct clk_ops *div_ops = periph->div_ops; struct clk_hw *div_hw = &periph->divider.hw; + unsigned long rate; __clk_hw_set_clk(div_hw, hw); - return div_ops->round_rate(div_hw, rate, prate); + rate = div_ops->round_rate(div_hw, req->rate, &req->best_parent_rate); + if (rate < 0) + return rate; + + req->rate = rate; + return 0; } static int clk_periph_set_rate(struct clk_hw *hw, unsigned long rate, @@ -130,7 +136,7 @@ const struct clk_ops tegra_clk_periph_ops = { .get_parent = clk_periph_get_parent, .set_parent = clk_periph_set_parent, .recalc_rate = clk_periph_recalc_rate, - .round_rate = clk_periph_round_rate, + .determine_rate = clk_periph_determine_rate, .set_rate = clk_periph_set_rate, .is_enabled = clk_periph_is_enabled, .enable = clk_periph_enable, @@ -154,7 +160,7 @@ static const struct clk_ops tegra_clk_periph_no_gate_ops = { .get_parent = clk_periph_get_parent, .set_parent = clk_periph_set_parent, .recalc_rate = clk_periph_recalc_rate, - .round_rate = clk_periph_round_rate, + .determine_rate = clk_periph_determine_rate, .set_rate = clk_periph_set_rate, .restore_context = clk_periph_restore_context, }; From patchwork Fri Nov 4 13:18:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13031976 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 8405FC4332F for ; Fri, 4 Nov 2022 13:44:23 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=i/1y4svqTjTxEX+4HR1SlIlwGkEOq6Cn42cySEWG9FU=; b=rWkx5ESnOwX1aS 6dMiasmP2ucHXlH1WyQWdcTG31Nyb/pNauLcciuUOIs02Xt7x5g9aExueFdlFHK7N8NFLi95kmPUA Kip/m85v4KNO7qRzBPliixvU4L0jNz6IxTXFRrnFxF7OzSWqZtS6wtrG4EJ7wOiPUT8UDwC/1ci1/ Cy8wr/KPEHdOiYpzSIgSdjGgm94X5ITQ7Hvd35EUEeU0mKeLgrx/yE6zWdkLGuOTKlC5uWdmiqhLM 8k5ne1g2tRnEhu9jNxknN4C4md5XViR2OxqOJvBHrZJ8OCHXPww5+VTrC4evSk4lzOaZhEHcKb3rY y+cYIc3F5gd5vIZno4Vg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwze-003m8X-Rm; Fri, 04 Nov 2022 13:44:22 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqwzZ-003m6B-P0; Fri, 04 Nov 2022 13:44:19 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id C70E758027B; Fri, 4 Nov 2022 09:44:16 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 04 Nov 2022 09:44:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667569456; x= 1667576656; bh=tP0HGewViKfgCsDxSEncjuLu0rJM7VTaSvboP+A/WU8=; b=b E0xbq0PMydVNQfUpMYzNNJWNH6UXe+pff49FmCpzlJH86cJiC9BxwkLuwdaJ+2AQ BTOHlJBLCErPmiUDffmDb1KJfLkFiPffOE/ZzXL5HT0nyiM8VVIcDpxvKK/Hhrxw FfnFmQUhEBbmRBKk5ic2rAbyUXjCMAKfroPKxA3ejjX14H77Rb8i2LLzyD5jCRYs puvnfxcaFG6bHKjV/ov0jJrfIAC1TN/dfw9k/3/OAXGwPaRj4poGYnHgV97ICZ3R CGYA1RIULL50uFOjfgvr4P2wIh0gbbUs0shUT4dNvRnpjfV5xiw9Iga6iqBW6+Ac 8ra2R1jlh9z7cWMNmk5Lg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667569456; x= 1667576656; bh=tP0HGewViKfgCsDxSEncjuLu0rJM7VTaSvboP+A/WU8=; b=p c7IHiyhgJS72W1HWSaEm8pM4f6nRZLy62zVJ4NM1JCXqbrbdPv6fwXUi9orAO8yj JNR7VZyu0th0aG9ZuyxD7iNo+8lscOr2Uhv78sq2LTwhznHf6rBP6l3bzcFgEt/G TddGSp7pu+vfUkoN/Ex0tRZGtKzRaRAq8wQuIO4KJ3kfVq3dh5yo3TwS1nOsfYIH FhI4lYQpcvZwvBYC0VLmZotUx2vh9Z7H9oFOi6axCO/6N+mUjvoIsVGzOwjbv+MF dx/6kAUIa6WdALliOTWSaDc7ymoet/H03vZ4uAwO8GEmySu0/o1ykb1m2ZkqqjsB LkE03DPVycaPlJ+/9BzNg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdehfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 09:44:14 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:19 +0100 Subject: [PATCH v2 62/65] clk: tegra: super: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-62-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2834; i=maxime@cerno.tech; h=from:subject:message-id; bh=oMTph+HV5AiIbW0s6QwIveMIXBCjzwSykoljGPeW9XA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt88u47UXNawWxJ5d7npqrS8Y5ZCrjUrXVe5hFxy9Zq9 2Fq7o5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABNhY2P4ySj+6teunW9bdriyfdvwx+ /i/PaO7QHvZyx7//qPyKvYg7WMDNd2xG5fZZx/rU7s/lfbEEuP87dn69i67s2tnSGyPd5SmxsA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_064417_906309_58D0DCCC X-CRM114-Status: GOOD ( 21.28 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The Tegra super 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. Signed-off-by: Maxime Ripard --- drivers/clk/tegra/clk-super.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c index 8ad62e04fd8b..c035f0eb030d 100644 --- a/drivers/clk/tegra/clk-super.c +++ b/drivers/clk/tegra/clk-super.c @@ -142,15 +142,22 @@ static const struct clk_ops tegra_clk_super_mux_ops = { .restore_context = clk_super_mux_restore_context, }; -static long clk_super_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int clk_super_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct tegra_clk_super_mux *super = to_clk_super_mux(hw); struct clk_hw *div_hw = &super->frac_div.hw; + unsigned long rate; __clk_hw_set_clk(div_hw, hw); - return super->div_ops->round_rate(div_hw, rate, parent_rate); + rate = super->div_ops->round_rate(div_hw, req->rate, + &req->best_parent_rate); + if (rate < 0) + return rate; + + req->rate = rate; + return 0; } static unsigned long clk_super_recalc_rate(struct clk_hw *hw, @@ -193,7 +200,7 @@ const struct clk_ops tegra_clk_super_ops = { .get_parent = clk_super_get_parent, .set_parent = clk_super_set_parent, .set_rate = clk_super_set_rate, - .round_rate = clk_super_round_rate, + .determine_rate = clk_super_determine_rate, .recalc_rate = clk_super_recalc_rate, .restore_context = clk_super_restore_context, }; From patchwork Fri Nov 4 13:18:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13032076 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 8DA16C43219 for ; Fri, 4 Nov 2022 14:24:25 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tS3m6chnEyyTfIjioX6782pj0nWRzhpLjjsbAanK/K8=; b=TTZ2ZN5/quLErS KRmMMXTwg4n0xMcSSn+Hsg9DvlDWFoG3amokay4PGiDXjXFdHqF3q3Uo0ayqT2ssL/Fzmsxo8LJ8t 12YCs8r2OA4jKbmh4jWUXAChZtHpwm7D7qh3zqKmF7e8dQhThTc4X1y5My5XsyZgLmZ5d1w303V69 EM9Baig1545BHaSsawDEJ3xuliZz91Sd4rrXTeSqUhQuocP06vqUvjVec2D/wRTIMmlBeienIo3gQ E2Z8Jm3W/9pd6SkKv4mPE5kRTRV22QFAgFUztDDg9k0o1H1tpVuVnk5bk79VSeZxAouDvy/7YoGQf YswUn81/DhQhWGe2hv9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqxcO-003x5e-4Z; Fri, 04 Nov 2022 14:24:24 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqxap-003wKs-Lw; Fri, 04 Nov 2022 14:22:49 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 44FA258050C; Fri, 4 Nov 2022 10:22:43 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 04 Nov 2022 10:22:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667571763; x= 1667578963; bh=w3HVpr38dw1g+Gys8Rw5Ia6clclGhJnxPc1fiBkUAa8=; b=E e0t0U2puMyuy99W7bGnkNAmukTQvIXb2NXm5SkQCB0J/bxJ1WsUknJ/Wb/jvlf0/ O2qO/odDdLRKX3PdBSbuh/7l98td1DL6pEUb4OZJc5tBNGUDFZVvG7LiQqWLrFiX KkbRlxx1ocawrWDWTl6G3DR+4QrVzHOgJ4s3dOYJxpHMCWuVSCu5BK2ZromHuHo6 I6xXOM9FtoakO0RmvKLodXSAgsaqw36uPKpA/YoPpyWQs05xVybUkBoIFiy6r+Ky tGOTvTF8q3ni8ev4h+Lddy6mdtgosgR/g63CfukPXay+M3IOEchLWcWteOK8xR3s q11nxGDgSdRnDBqKO2yQw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667571763; x= 1667578963; bh=w3HVpr38dw1g+Gys8Rw5Ia6clclGhJnxPc1fiBkUAa8=; b=B B8f1ogJnnEu3uJSIlQA2q0BrDkmVY6amkDq6efXNPJdJzR2Ld3KXdMkxF+LEhXFD tBy9juFZZcHGTwN4spv2HNfbnIVBVTphicTKYGtmIByag3cQuLD+67g++88WTuCX EAQFLqxwqP+UojYKA2YLTfXtbC56/7ALm7VuLpQ7IB66p9XAAtlpSOmppZnKPcoA yLpnwRpNsPucYpJXhqdt4pmEovdCRT61dHw0+nEVxbzbRv+WG6JLFg5NGOcyskLQ YYqzJQV5Iz+kktF5l3/SGgGpdmSJpTXJVolpK1qzvKywW2GeSRlO6kTDpzgREb0D +0eMAAhiN5AlnrNoVZqYg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdeiudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 10:22:41 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:20 +0100 Subject: [PATCH v2 63/65] ASoC: tlv320aic32x4: pll: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-63-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3073; i=maxime@cerno.tech; h=from:subject:message-id; bh=wrb/gLlXObBQQfdHTgDTlHkPVh4Y+mxa5fDcw3PaFNc=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt8047Pc5aS5L7yeL+cw5aXhlN+LH9+ONM7OZjbkusf7 +bJoRykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACbCv4SRYfu9z/JZ69c0NLstffKwfu r+1T92e0y4GiA5z2/PWp1HTbcZ/ic1fpmYei17msgzKZGEn005Kxet12Rk3bLESN2Y99DzHYwA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_072248_248124_0EA387F6 X-CRM114-Status: GOOD ( 20.25 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The tlv320aic32x4 PLL 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. Signed-off-by: Maxime Ripard --- sound/soc/codecs/tlv320aic32x4-clk.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c index 65b72373cb95..d8b8ea3eaa12 100644 --- a/sound/soc/codecs/tlv320aic32x4-clk.c +++ b/sound/soc/codecs/tlv320aic32x4-clk.c @@ -205,18 +205,23 @@ static unsigned long clk_aic32x4_pll_recalc_rate(struct clk_hw *hw, return clk_aic32x4_pll_calc_rate(&settings, parent_rate); } -static long clk_aic32x4_pll_round_rate(struct clk_hw *hw, - unsigned long rate, - unsigned long *parent_rate) +static int clk_aic32x4_pll_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { struct clk_aic32x4_pll_muldiv settings; + unsigned long rate; int ret; - ret = clk_aic32x4_pll_calc_muldiv(&settings, rate, *parent_rate); + ret = clk_aic32x4_pll_calc_muldiv(&settings, req->rate, req->best_parent_rate); if (ret < 0) - return 0; + return -EINVAL; - return clk_aic32x4_pll_calc_rate(&settings, *parent_rate); + rate = clk_aic32x4_pll_calc_rate(&settings, req->best_parent_rate); + if (rate < 0) + return rate; + + req->rate = rate; + return 0; } static int clk_aic32x4_pll_set_rate(struct clk_hw *hw, @@ -267,7 +272,7 @@ static const struct clk_ops aic32x4_pll_ops = { .unprepare = clk_aic32x4_pll_unprepare, .is_prepared = clk_aic32x4_pll_is_prepared, .recalc_rate = clk_aic32x4_pll_recalc_rate, - .round_rate = clk_aic32x4_pll_round_rate, + .determine_rate = clk_aic32x4_pll_determine_rate, .set_rate = clk_aic32x4_pll_set_rate, .set_parent = clk_aic32x4_pll_set_parent, .get_parent = clk_aic32x4_pll_get_parent, From patchwork Fri Nov 4 13:18:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13032077 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 C089EC43217 for ; Fri, 4 Nov 2022 14:24:25 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9tMR2GKTZg9FsiLCOMbfd2+e7hxEpLFOpaa0xBdD2A4=; b=3If86POn+mgmyv Wd4rEWDSoc0JHAaKfJ8XqId03jFzGlhz5y103e1ruFwHuOSB1MdgD3NzbmS1SXNTGQyPkaN/t3Cgm /XmsqZfwjGQe4f4cHqrzfFtdMlw18LUuTq2/iFqQHrPoASFPI3NpfY1UttA4WrFL0Zi0ZosHnL23H r2IBs6guSVLWowoqfAGabMvYaoi6mHWH2U1yWEvn/O2gy13TbDW9EWaGVdRn/84ECNa6Qhl7GL4WK EQrWWOMk34pAnTU4y1Ds0Klu+v5P1qtgVyeKBaSmWwKBmWQtDhpe4EVqxVR+oFcycvBRkR6BViP6V BMrJ/mayZCmJPOvuac9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqxcO-003x5r-G8; Fri, 04 Nov 2022 14:24:24 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqxaq-003wMm-Bg; Fri, 04 Nov 2022 14:22:50 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id A879858057F; Fri, 4 Nov 2022 10:22:47 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 10:22:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667571767; x= 1667578967; bh=LFk2SQk2wzq81vwUtfsaZUQx2y6VxMzaqna40LeLxmw=; b=A 1mD9TdePrzElrKfNdH4DAa4BrTqdusatwtjJXhce2xkYJ1THVzjZ1jgFH5VCZIOd PsHqfbr/+pDyPQLNxWdBGQZRXnqo5/hNHrpJc3bD0y+eKioaUG04dblkoGMuw1lb x/s0NVR2Grr9hYFgofCxw8XlYPABasNK+vOEbH4e2kOQLo55fLWx/hC0KcG+Toka eNyWQ/iogf3Zz+Fi7y5vUlmDRLrPA6XEx91ViEIptj9wbnWpqn2g9x3DaG82wkoE keYvvWTFY+LgqK+kcf6c4JlbiIrVF8wTyf+Nw09RwgEdPGb8TL1H6xwzpZ1Ny5xI Z2QG6B2RlX7Cg2k09HShw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667571767; x= 1667578967; bh=LFk2SQk2wzq81vwUtfsaZUQx2y6VxMzaqna40LeLxmw=; b=q VwBtkx/nLqqINhFKg8IDkuXEihz6bUnSmCFuMuO5roPYqCIC5F9AhfZ/L6RK75Vv Rny6WaTkhnKLUTu3Ngi7RvY1ao0fsoegRSgk8Gb4GgdrJyuv3Mu1vtwKPpuu/Gvx wjzidNGgatkUWk31dSzRCvzi+/B4YFmQRTTOVeDloICfvZbXtvOPFkkhSR3idov2 3hC0OhMLP+ey2KQOfNuTQ7eERWDZgPhPOzKChLSfo0U90xGwjZBx+cZu7HpyJRFx u/FEbtELLq/1g2fW6jkS3RSDBhU/NgGnKpeeBVPjStQKJ/F8/0f5W8lBKyRyObu7 K14vmVaOFqOuYpobt95rQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdeiudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 10:22:44 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:21 +0100 Subject: [PATCH v2 64/65] ASoC: tlv320aic32x4: div: Switch to determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-64-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=3138; i=maxime@cerno.tech; h=from:subject:message-id; bh=oZ1+qP4VSAo6iGLJx+GPpYVjTZRxAtNyrtqK/8Cq0F8=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt/k/QXk+BZsmHT8/KRHh6977BTl3RxZZeayUmd/xGXu lP2+HaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZiInj0jw2b/tSLbqm9f3vcsecqfmt eVoRMqjQWETxaIJmmyu547fp3hn4naz+W33hz/ts/J+XuVmb9VdZrGlM4j/4SObe67zhuVyAcA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_072248_543931_840BF07C X-CRM114-Status: GOOD ( 20.34 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The tlv320aic32x4 divider 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. Signed-off-by: Maxime Ripard --- sound/soc/codecs/tlv320aic32x4-clk.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c index d8b8ea3eaa12..707c9951fac0 100644 --- a/sound/soc/codecs/tlv320aic32x4-clk.c +++ b/sound/soc/codecs/tlv320aic32x4-clk.c @@ -333,16 +333,17 @@ static int clk_aic32x4_div_set_rate(struct clk_hw *hw, unsigned long rate, AIC32X4_DIV_MASK, divisor); } -static long clk_aic32x4_div_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) +static int clk_aic32x4_div_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) { unsigned long divisor; - divisor = DIV_ROUND_UP(*parent_rate, rate); + divisor = DIV_ROUND_UP(req->best_parent_rate, req->rate); if (divisor > 128) return -EINVAL; - return DIV_ROUND_UP(*parent_rate, divisor); + req->rate = DIV_ROUND_UP(req->best_parent_rate, divisor); + return 0; } static unsigned long clk_aic32x4_div_recalc_rate(struct clk_hw *hw, @@ -361,7 +362,7 @@ static const struct clk_ops aic32x4_div_ops = { .prepare = clk_aic32x4_div_prepare, .unprepare = clk_aic32x4_div_unprepare, .set_rate = clk_aic32x4_div_set_rate, - .round_rate = clk_aic32x4_div_round_rate, + .determine_rate = clk_aic32x4_div_determine_rate, .recalc_rate = clk_aic32x4_div_recalc_rate, }; @@ -389,7 +390,7 @@ static const struct clk_ops aic32x4_bdiv_ops = { .set_parent = clk_aic32x4_bdiv_set_parent, .get_parent = clk_aic32x4_bdiv_get_parent, .set_rate = clk_aic32x4_div_set_rate, - .round_rate = clk_aic32x4_div_round_rate, + .determine_rate = clk_aic32x4_div_determine_rate, .recalc_rate = clk_aic32x4_div_recalc_rate, }; From patchwork Fri Nov 4 13:18:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13032078 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 51886C43217 for ; Fri, 4 Nov 2022 14:24:34 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x+NgJSrQafDeiAJzTw7a17k/1cRKp5DWtnVgAGemMbI=; b=rufTOcNtHKp61e pUnnxGaQ/Q3uglorVWR+dHzJMWA5gTFEWcbJiDzkKhY3oTPFfmLOuxPO0EBiHCyhwpymZnqJzXl3n C3nnU3GdRpXUcVnYGkSUmCCf2gBSEzbuccUQsEiOpYQ8RUYUHrtAi2wLzLgbY8eeFiPMQzIfYh/bg pQD+wdFJhucRLSCJFLIrZ5I26DFyKIOFJIO4l9cGj823b2Gz+DLpOcZlD8uGFqLvSj/tnkD48jOsA FTJGsPW6sV+oJMdb5Xky+Q5FPwq7kc0nxwIhCEZytJZmjwmSRyO7t+k20oyguJ+UY0gVbW19VUMRj uSejW20qocJdFyYeLYNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqxcX-003xBq-Ez; Fri, 04 Nov 2022 14:24:33 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqxat-003wOg-IP; Fri, 04 Nov 2022 14:22:53 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id A434C580576; Fri, 4 Nov 2022 10:22:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 04 Nov 2022 10:22:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1667571770; x= 1667578970; bh=Zsl6bVVVps307HxzZztymAJCQN/ILEw5Ph59AqnCdhw=; b=K TxsKcR4q7EGGVyZWdDfVXUy4B1+fSdvTmCqiNIN1wfeeE20cLhnw7rJqVVsIZAIt wDQBtg4tAP9uFikY+P5cUpF7dZqlP279+WWkI8Q8Q2j/Y2m/Wwtl/5DBYVyP0IJU NQjVqmIkmGZ7pA4yo/D8VkxNHjFkEQsQHi9gtPr+9ss6gER/umuK4mCa5lcoGNzA +fkY+Mm88ZVOaDxg3K6UuaVDozKXylcoSh1ToEON92R15ceXZddcbaRp5nlNk75i VyhoKWa4PeBPmXdO0dpVyDggc9dbioCsDT1LMjj+iuuIhSWpCB7ySGw07LbWsvAk WUEAy6P4gJeSGjK9C8V5A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667571770; x= 1667578970; bh=Zsl6bVVVps307HxzZztymAJCQN/ILEw5Ph59AqnCdhw=; b=H z2ye2GABR1w09S6BPNSZryj6NrRDJ0/OkR/EVOVz2N0Pinm1XbUVd8V/e9PSfSmz VrmWRqY1jyI4BdNcHcSsQuOfS3OzUAXpfKpaoUiK1G+EuLGcub7Usmj+Cxi+RtkU QZJcdRbQJjA7AiMGXeX0hEOrgpUDyuXTrI3aQf9D0IHmtspsULJY0mS+BpNkUjPx /y7h4bcX1wIhBK0+EejtHH9DD4t9oMHo0Hr2+okkuMgc5lRfBe5U1M4ahCj3gk2A /1Pb8qSmbrz8R1DFKVLMXVSLJhqbn+m0reW3A8FX7Xrp37DwNUB+fFPQauRGxMvI x18Z9RlJhkeuKccwWtEgw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugdeiudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 10:22:48 -0400 (EDT) From: Maxime Ripard Date: Fri, 04 Nov 2022 14:18:22 +0100 Subject: [PATCH v2 65/65] clk: Warn if we register a mux without determine_rate MIME-Version: 1.0 Message-Id: <20221018-clk-range-checks-fixes-v2-65-f6736dec138e@cerno.tech> References: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> In-Reply-To: <20221018-clk-range-checks-fixes-v2-0-f6736dec138e@cerno.tech> To: =?unknown-8bit?q?Stephen_Boyd_=3Csboyd=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Maxime_Coquelin_=3Cmcoquelin=2Estm32=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Chen-Yu_Tsai_=3Cwens=40csie=2Eorg=3E=2C_Daniel_Vetter_=3Cd?= =?unknown-8bit?q?aniel=40ffwll=2Ech=3E=2C?= =?unknown-8bit?q?_Nicolas_Ferre_=3Cnicolas=2Eferre=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Thierry_Reding_=3Cthierry=2Ereding=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Jaroslav_Kysela_=3Cperex=40perex=2Ecz=3E=2C_Shawn_Guo_=3Cs?= =?unknown-8bit?q?hawnguo=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Fabio_Estevam_=3Cfestevam=40gmail=2Ecom=3E=2C_Ulf_Hansson_?= =?unknown-8bit?q?=3Culf=2Ehansson=40linaro=2Eorg=3E=2C?= =?unknown-8bit?q?_Claudiu_Beznea_=3Cclaudiu=2Ebeznea=40microchip=2Ecom=3E=2C?= =?unknown-8bit?q?_Michael_Turquette_=3Cmturquette=40baylibre=2Ecom=3E=2C?= =?unknown-8bit?q?_Dinh_Nguyen_=3Cdinguyen=40kernel=2Eorg=3E=2C_Paul_Cercueil?= =?unknown-8bit?q?_=3Cpaul=40crapouillou=2Enet=3E=2C?= =?unknown-8bit?q?_Chunyan_Zhang_=3Czhang=2Elyra=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Manivannan_Sadhasivam_=3Cmani=40kernel=2Eorg=3E=2C?= =?unknown-8bit?b?IEFuZHJlYXMgRsOkcmJlciA8YWZhZXJiZXJAc3VzZS5kZT4s?= =?unknown-8bit?q?_Jonathan_Hunter_=3Cjonathanh=40nvidia=2Ecom=3E=2C_Abel_Ves?= =?unknown-8bit?q?a_=3Cabelvesa=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Charles_Keepax_=3Cckeepax=40opensource=2Ecirrus=2Ecom=3E?= =?unknown-8bit?q?=2C?= =?unknown-8bit?q?_Alessandro_Zummo_=3Ca=2Ezummo=40towertech=2Eit=3E=2C?= =?unknown-8bit?q?_Peter_De_Schrijver_=3Cpdeschrijver=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Orson_Zhai_=3Corsonzhai=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Torgue_=3Calexandre=2Etorgue=40foss=2Est=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Prashant_Gaikwad_=3Cpgaikwad=40nvidia=2Ecom=3E=2C?= =?unknown-8bit?q?_Liam_Girdwood_=3Clgirdwood=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Alexandre_Belloni_=3Calexandre=2Ebelloni=40bootlin=2Ecom?= =?unknown-8bit?q?=3E=2C?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=40sholland=2Eorg=3E=2C?= =?unknown-8bit?q?_Matthias_Brugger_=3Cmatthias=2Ebgg=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Richard_Fitzgerald_=3Crf=40opensource=2Ecirrus=2Ecom=3E=2C?= =?unknown-8bit?q?_Vinod_Koul_=3Cvkoul=40kernel=2Eorg=3E=2C_NXP_Linux_Team_?= =?unknown-8bit?q?=3Clinux-imx=40nxp=2Ecom=3E=2C?= =?unknown-8bit?q?_Sekhar_Nori_=3Cnsekhar=40ti=2Ecom=3E=2C_Kishon_Vijay_Abrah?= =?unknown-8bit?q?am_I_=3Ckishon=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Linus_Walleij_=3Clinus=2Ewalleij=40linaro=2Eorg=3E=2C_Taka?= =?unknown-8bit?q?shi_Iwai_=3Ctiwai=40suse=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Airlie_=3Cairlied=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Luca_Ceresoli_=3Cluca=2Eceresoli=40bootlin=2Ecom=3E=2C?= =?unknown-8bit?q?_Jernej_Skrabec_=3Cjernej=2Eskrabec=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Pengutronix_Kernel_Team_=3Ckernel=40pengutronix=2Ede=3E=2C?= =?unknown-8bit?q?_Baolin_Wang_=3Cbaolin=2Ewang=40linux=2Ealibaba=2Ecom=3E=2C?= =?unknown-8bit?q?_David_Lechner_=3Cdavid=40lechnology=2Ecom=3E=2C?= =?unknown-8bit?q?_Sascha_Hauer_=3Cs=2Ehauer=40pengutronix=2Ede=3E=2C_Mark_Br?= =?unknown-8bit?q?own_=3Cbroonie=40kernel=2Eorg=3E=2C?= =?unknown-8bit?q?_Max_Filippov_=3Cjcmvbkbc=40gmail=2Ecom=3E=2C?= =?unknown-8bit?q?_Geert_Uytterhoeven_=3Cgeert+renesas=40glider=2Ebe=3E?= 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, Maxime Ripard , 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 X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=1864; i=maxime@cerno.tech; h=from:subject:message-id; bh=dt/pK2gUwtn1gYsklYP5IdQYs7BUAEjWd1pf1CEewGo=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmpAt/2Tj3tvbH5jO8VD59F3ZETJk7zF+OQztO3+cS++s7f 0s9WHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZiI7FNGhpd8SlfOy51PfHnk3oya5H n6h8R+5Sx+FuwntFR/5yedeSmMDA9/pomddHLguiIhuFKO8ea8shUFn86U5M16Uui778IjYw4A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221104_072251_752145_D1BEFE2C X-CRM114-Status: GOOD ( 16.45 ) 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: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The determine_rate hook allows to select the proper parent and its rate for a given clock configuration. On another hand, set_parent is there to change the parent of a mux. Some clocks provide a set_parent hook but don't implement determine_rate. In such a case, set_parent is pretty much useless since the clock framework will always assume the current parent is to be used, and we will thus never change it. This situation can be solved in two ways: - either we don't need to change the parent, and we thus shouldn't implement set_parent; - or we don't want to change the parent, in this case we should set CLK_SET_RATE_NO_REPARENT; - or we're missing a determine_rate implementation. The latter is probably just an oversight from the driver's author, and we should thus raise their awareness about the fact that the current state of the driver is confusing. It's not clear at this point how many drivers are affected though, so let's make it a warning instead of an error for now. Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Maxime Ripard --- drivers/clk/clk.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 495d7497cc43..9eb0343629cc 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3701,6 +3701,13 @@ static int __clk_core_init(struct clk_core *core) goto out; } + if (core->ops->set_parent && !core->ops->determine_rate) { + pr_err("%s: %s must implement .set_parent & .determine_rate\n", + __func__, core->name); + ret = -EINVAL; + goto out; + } + if (core->num_parents > 1 && !core->ops->get_parent) { pr_err("%s: %s must implement .get_parent as it has multi parents\n", __func__, core->name);