Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5464022rwd; Mon, 12 Jun 2023 05:38:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4cB3cbyAxC5PGL83egNoH/Q9KQuh2zsplojGSe2DGf6tZ/RV3ADDLmoXwAJgjnrxZKXYi9 X-Received: by 2002:a17:907:7291:b0:973:7096:60c2 with SMTP id dt17-20020a170907729100b00973709660c2mr8746480ejc.20.1686573520690; Mon, 12 Jun 2023 05:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686573520; cv=none; d=google.com; s=arc-20160816; b=UcQ8dC/oUc2MXoSMxsN9xnebsnWSzbOAVIrQ+wptTnIv/LHRF1qCdYzTynG2QUpLaG z4/jBwYbKi4s6uNXJXJrJCp5AGYs2IJaiPQx9XdbYWp8TGFvHgf0vBEOOVKsCumX5Uxc IsrMYNpgw+xEDjPlDaIeHKh2vCMGUVxds/yJwMhRDoj/FzKiTo8nxmVA7sgy9Se1voG8 vuHa+0b2xiC2Vuxz4ZHaJSchLKLKZ5/94CadLLz7l5dixlIZPrB1RdKakeL42o2kOodi BqERNzigfVs3xq3hRW8WBZxEfW7uflZ8wDwqjP/k9s1yThc1Gt0YCmqvy5CbGfFpuOn/ cRsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=18ZmLcFszkml7bXV6xlP2cbQVd6SoNIPAXzHdGblAUo=; b=T4gPRCHUl25HkI85gcGrqSvX9uFSwVaRkRCD75qvoo7F15h+PGLcm3tp1Z5PNb8XDY Farqft47G9tCGFhh2HTBKK6iM4iyrWrhjbnuz5/5vEmGhaWfqEfdiD1bOZdprH7wvjvX f4SJmWjlV+i7Odb16aq6cTVFPas4tg2gv/sjf5VG/dmReIsPKZzSB+lcjybSfVzTVea2 qkf/mcIRpHHdLwwPeWpTWpcRkQkdhrV+4cvqNi8yvrBvL2CVUROsE4T8H1Mo6DnkSqxx bBnRjnD3UnCVHqTso60MplHkZC6m+wDcdZXt9Ml+7E2Gxl35Gdg6yfk1AMofYo6Kl275 5aXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=i00L+HAv; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=NYRwSONR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s25-20020a170906455900b00977abab484csi4676227ejq.762.2023.06.12.05.38.16; Mon, 12 Jun 2023 05:38:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=i00L+HAv; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=NYRwSONR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235028AbjFLMcd (ORCPT + 99 others); Mon, 12 Jun 2023 08:32:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235011AbjFLMcP (ORCPT ); Mon, 12 Jun 2023 08:32:15 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 938CD10DA; Mon, 12 Jun 2023 05:31:45 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 851995C0130; Mon, 12 Jun 2023 08:31:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 12 Jun 2023 08:31:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-type: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=fm2; t=1686573083; x=1686659483; bh=18 ZmLcFszkml7bXV6xlP2cbQVd6SoNIPAXzHdGblAUo=; b=i00L+HAvsds1HR+Nt8 U5hK/TCO+llTHSmmmGoOosh+8LtiCcZY8IDGJXozWJdX9Y2ea1syogRnfTYFs4BG Ly07en1f0lcAbq33nP7XYpjVwqVfgqtx0bHwD0ddsEG89PHCCdGiftCu4s3Xyq5Q dByucynJpaiLtI5MZdxTiHgwokAOcN2YKmDyh4px+X0TAW0fvmQtwDCqDSVuUe5C pHAgT5rAqIzIwd9VR14iiSyWzjfyzBltWGzqnFIfATvGc6GhdqCmhgCEMOc6SSwB ADXtwZH6OAIzPO/Pp5HI1q6f1jwyDMUYagxEjeaRB5AEaj+9xbdI5QbIdaFxYVOg WXDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type: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=fm2; t=1686573083; x=1686659483; bh=18ZmLcFszkml7 bXV6xlP2cbQVd6SoNIPAXzHdGblAUo=; b=NYRwSONRkr5CKpdTIt8W3yzSlgVW+ Z5cFqjOygHnJ093+g3AnUKT0YX7VDLtyLTZa+kKGAyZh8CSEO78KCGkJ9Ya2CeJN aQiXLboLoWMtfZoCbmkATLlF9Q8M4ffuBI2SkgupdYtCTIAx6FveQ+medpZMDm9c uFLJnox5bEGPmBeJHIcdwf7TXbYsa+591kM6eI0VLlgGjzv275pYEQ4Bf91wdAVB 24+MyRfMHH+SzcBIfgiMptmAYYc956SrBuEFrDV9sKbIugC/4Py0KnnCIswqa6fl T4aN00qCdPEiJVWFxiAM02rcdeEZEQ3aQRMjDRElFO+yBzm+12joQszEQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeduhedghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtsfertddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeeuveduheeutdekvefgudevjeeufedvvdevhfejgfelgfdtkeevueegteek gfelfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 12 Jun 2023 08:31:22 -0400 (EDT) Date: Mon, 12 Jun 2023 14:31:21 +0200 From: Maxime Ripard To: Frank Oltmanns Cc: Andre Przywara , Chen-Yu Tsai , Jernej Skrabec , Michael Turquette , Roman Beranek , Samuel Holland , Stephen Boyd , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH v2 1/2] clk: sunxi-ng: nkm: consider alternative parent rates when finding rate Message-ID: References: <20230611090143.132257-1-frank@oltmanns.dev> <20230611090143.132257-2-frank@oltmanns.dev> <87edmh12s7.fsf@oltmanns.dev> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="kkj73vrcelww3r3q" Content-Disposition: inline In-Reply-To: <87edmh12s7.fsf@oltmanns.dev> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --kkj73vrcelww3r3q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 12, 2023 at 10:51:52AM +0200, Frank Oltmanns wrote: > > @@ -28,12 +68,17 @@ static unsigned long ccu_nkm_find_best(unsigned lon= g parent, unsigned long rate, > > for (_m =3D nkm->min_m; _m <=3D nkm->max_m; _m++) { >=20 > According to the manual M/N has to be <=3D 3. Therefore we need a > different maximum value for the _m-for-loop: >=20 > unsigned long max_m =3D min(3 * _n, nkm->max_m); > for (_m =3D nkm->min_m; _m <=3D max_m; _m++) { >=20 > I suggest that I add an optional member max_mn_ratio to the structs > ccu_nkm and _ccu_nkm. Optional meaning: Ignore if 0. Which workload is affected by this restriction? > > unsigned long tmp_rate; > > > > - tmp_rate =3D parent * _n * _k / _m; > > - > > + if (parent_hw) { > > + tmp_parent =3D optimal_parent_rate(rate, _n, _k, _m); > > + tmp_parent =3D clk_hw_round_rate(parent_hw, tmp_parent); > > + } >=20 > Another constraint is PLL-VIDEO0 rate / M >=3D 24 MHz. Therefore we also = need: > if (tmp_parent < 24000000 * _m) > continue; > > So, we need another optional member min_m_times_parent or, for > shortness, maybe min_m_parent. I could use help finding a good name for > this. Again, if it's not causing any harm I'd rather keep the code as simple and maintainable as possible. Maxime --kkj73vrcelww3r3q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZIcQGQAKCRDj7w1vZxhR xY3hAQCtAk7IaNBuR32MugoIudSv2GZ8z2nwVAfFQtk5TRpjdgD/f+kcH1jhaq0d ykaty48CnAYO/yQevebm/aotTXaQgAA= =VEfS -----END PGP SIGNATURE----- --kkj73vrcelww3r3q--