Received: by 10.223.148.5 with SMTP id 5csp7255059wrq; Thu, 18 Jan 2018 03:05:58 -0800 (PST) X-Google-Smtp-Source: ACJfBot9kGmOM9rbn5YqhAPGpmC6JboSxuIWC4xqXWT4G2CyjSZ6R3zo4KKoqCK4OHDJ7UWFAp8O X-Received: by 10.98.103.209 with SMTP id t78mr30046569pfj.53.1516273558289; Thu, 18 Jan 2018 03:05:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516273558; cv=none; d=google.com; s=arc-20160816; b=kR7OVT4Z8azyq1tLmnJv/ixUpRlYaCyDL5dR6R6jRcyX9jinyeyN3JJyZDX/h2/oLI P4AwCkXoQQkR9v3/StRreMgMAKyVolna5XzYtJ4snKOP/zUmFWFjPbjYwQHBHKh7o7cW KG80yn7K2qVr/B2ckjQl/eU8Gzg2xEPXv9jo7tNvdwSzdSjnBg7KtalGObz6j5jjFFVK 2c2u/gLcZLnEcvNC0kk/WS1ATZjtPlqcP5OBGK1ndc22oJfQc3pJyL9/KFhVsdC938np m71z92cF2DtKmIE0btwv9NHvm7cDB97iQNPOfw/MPyY/ObwrH+48Niy7hT0Tu1J/5lTv 8QXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Fta2VtM2l92TPpqr5rrxdxHgi5xIxXwx6hgPnf6V5RE=; b=f5clB1EbZrJTnXm4O9FxDWI1FwIVFR9nR7skFhND71b1G9O8YIus/UsoxwpMdF0vTV VC2uYUf8Y4i8A/0eVyQX1IsUwe13sqe0UOdDo3AYqoQI45K73zjq4+6NPjbEpDXBW15F nhncT+zndS6reVvQyUPixy7hxcwVjTCBkRpx6I2JkT8e5tQYN66w6CRSpD1cXLFwesTo MVmmWysflp26c2TBqi1agcOoxwt9Y5jYO0aZ43UAo3lokuSVGNhlxuSkrMCLqA+oOWbG +Qag67HfmeotL5DjdXdtaCbI/XGlWkCVvyy0QDQIPYo6YxbgJPCqk7YHaOGrgIqoZbhT xB0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k65si6688407pfa.98.2018.01.18.03.05.43; Thu, 18 Jan 2018 03:05:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755909AbeARK6p (ORCPT + 99 others); Thu, 18 Jan 2018 05:58:45 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:57302 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753534AbeARK6n (ORCPT ); Thu, 18 Jan 2018 05:58:43 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 57ADA20810; Thu, 18 Jan 2018 11:58:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 0754D2061A; Thu, 18 Jan 2018 11:58:41 +0100 (CET) Date: Thu, 18 Jan 2018 11:58:41 +0100 From: Maxime Ripard To: Jernej Skrabec Cc: airlied@linux.ie, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, architt@codeaurora.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, mturquette@baylibre.com, sboyd@codeaurora.org, Jose.Abreu@synopsys.com, narmstrong@baylibre.com, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [PATCH v3 02/12] clk: sunxi-ng: Change formula for NKMP PLLs Message-ID: <20180118105841.73rwj3he2exd7pno@flea.lan> References: <20180117201421.25954-1-jernej.skrabec@siol.net> <20180117201421.25954-3-jernej.skrabec@siol.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bjqey3xnhxqbomrf" Content-Disposition: inline In-Reply-To: <20180117201421.25954-3-jernej.skrabec@siol.net> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --bjqey3xnhxqbomrf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Wed, Jan 17, 2018 at 09:14:11PM +0100, Jernej Skrabec wrote: > This commit changes formula from this: >=20 > Freq =3D (parent_freq * N * K) / (M * P) >=20 > to this: >=20 > Freq =3D (parent_freq / M) * N * K / P >=20 > This improves situation when N is in the range 1-255. PLL parent clock > is almost always 24 MHz, which means that for N >=3D 180 original formula > overflows and result becomes useless. Situation can be improved if M is > used as predivider as it can be seen in the second formula. That way at > least M > 1 is considered, but it still leaves small gap for wrong result > when M =3D 1 and N >=3D 180. >=20 > Using M as predivider shouldn't cause any issue, because it is in range > 1-4 at most, so there is no or only minimal rounding error. >=20 > Signed-off-by: Jernej Skrabec I'd really prefer to stick to the formula documented and that we've used so far. NKMP clocks are most notably used for the CPU PLLs and I've debugged way too many cpufreq bugs already :) What about using long long types for the parent * n * k result? Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --bjqey3xnhxqbomrf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlpgfeAACgkQ0rTAlCFN r3QsuA//ZPN9qEwKK3dPLf4cg/Dkj1qD6kvO014duItcgmcz/eNHU4wiQg7ebexf SSjKctf7Ne5FEnzeyIDq+wxsElAJS49k/xUbDQpLRy3y05LY2WUVw4UnQmPUqC3K oNmpMkXg7oa2bA5jPWzpbNCRwZUeHay88vqwB/TD5jXeJ+2G0X9MqEHsWOBS9Pyy jiNLYc2MVASw3d+LWA4wwYYbidGfGSrGfxjcdBtxaRMNV1CU8ZaeAhsSda7e+A7f tMRjpP02iJh0CMuGqGXhffgCwfnnFp+lfGHynUVY8dXgIF7+MLb/xmfpXvmfu5f7 eq44GdsitmEb/QE0u9ZQR6Jrbatz53+MqpYUrEANTVgBRf6SRS35Ucjt7+W1riBZ ueuPIAz2xUqfYXJ/q9FKtcZ6Wwoi0hShv32AsSY7vzhxAwsqq5Ckv6INS1bVwKeC aaGCqRfoRD7EZCmOdi7PGidKncKMZxecjO1TUIoXHl07aDSDawwlsaLusdkLcW5V qclRtiKiE0uRRcbPcVTs4R9IeensI6lC064Sh1gy/OWlU3s3Kl+bKFvkda5qkZoB REKPElNO1CRllXTmg4iyJl90nC8y4AuARx3PFLbK/Q48Y/ZTx79WZnWsG7cDxPAX wMi5U4DstAq5xfXTOw2iG79CDb0v4LDtHTrWzXqWiKwu2rafsqg= =u95o -----END PGP SIGNATURE----- --bjqey3xnhxqbomrf--