Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6055596rwd; Mon, 5 Jun 2023 12:17:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7vXTrUPOKjWJKd+ZT6JT+PiZWuMX8KrZbWHicHB31QdHDwWQlhbBAJ23K+cEGthW1MfVCy X-Received: by 2002:a17:902:7284:b0:1ac:a02f:c9a4 with SMTP id d4-20020a170902728400b001aca02fc9a4mr3642343pll.4.1685992621749; Mon, 05 Jun 2023 12:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685992621; cv=none; d=google.com; s=arc-20160816; b=H5Ubv+EQsygP6DfInlPjLvt+BlM0qU4z7uwFInIVLqsL75u24SPPOoMv81Jg1xNFfQ Xc5dP2rNc/1oy93/u6PSywS8itCWOvS7fD5CrGDThWRuzcHDiKeri9abWX+3sRNtfvSj 7Hx41sWZ89IvWzIRPlO7wOa/oEOBRPtDx0AfRXEAyItl9wHsH+bPP375ZCdGzbBruIb/ GMXlWm0W0St0NTMvWoPM+9nwb8apTD2ElkWCNKq9E995Oxe94K4SZsRCOnB7dpMfmdu8 45lprzC2SOa79hVBmSgjGy+t2kunDaOX3Ijz10AQ69opQXhNIi6nS7QqUM5fiiwS+DHV ekGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=A6+BxjI7OK+Zyu+DiOoC1GzWLKWtwv1JdA+R6MwHfl4=; b=ss7vXSILl3n8Imeaa2yKUPzWAAnlwKlWm07qbeDApQgs/xgfcB8lU+1XxwGwETaZJ3 1vPEkMkD76Ngz+9j6syTldGZw4SihsNrKbKzmkkuUhLoMDMTI+x+255pF+x28vM3pK1Y XVLMNx4mkWuwtDdqeSGbAFesnLdbCeF11G3PxjzflPq9QqWrPY6RbktYFgr4hpaUS3O2 xxiZbqdFsLeFt+utz0Og+EimVaWSW+s0gatMulPcQifTR/PyECWr5Cs0TKSm/wgLRzKO j2Hv7vxUDwVWs8sC5dzozY4c7KtXkUKlZwudip3Z1G+hj93+PSGhQba5DPEDFkqjqBYs JZyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=KoDdPpgr; 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=oltmanns.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jj11-20020a170903048b00b001afaae8a0a8si5658088plb.8.2023.06.05.12.16.43; Mon, 05 Jun 2023 12:17:01 -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=@oltmanns.dev header.s=MBO0001 header.b=KoDdPpgr; 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=oltmanns.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232598AbjFETIj (ORCPT + 99 others); Mon, 5 Jun 2023 15:08:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234380AbjFETIe (ORCPT ); Mon, 5 Jun 2023 15:08:34 -0400 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A66D994; Mon, 5 Jun 2023 12:08:25 -0700 (PDT) Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4QZjn01gZDz9sTy; Mon, 5 Jun 2023 21:08:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1685992100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=A6+BxjI7OK+Zyu+DiOoC1GzWLKWtwv1JdA+R6MwHfl4=; b=KoDdPpgrPHnijD0a50D5hOz8zC93mnwA+hyD+GX8pKtCIG2Anlw1UhOWmATQNnEwcO1pax IxCXo7IQ+GBWO06LxE1JRn3Mb/viG0A+3IaRQWeeCCmtLp+kvNSEK2VdprTG+gYGuijZi4 dLP/Ir8mP4/mtcFWDLlAePfRYbreDniKfi7ljscyDUeb6rZJbLkp5BxqlSCz/PgypHKi1+ yfVy9UVqYxfMRIF2XeaP0jkM1h73IPx13CVYGVgqZW02Dy+rr8tzKKbY629zU3iKFqGFZz VvgEJoA1W5vHcWn6E0/qmvV3yIgB7nskmGXNDdU8dAqaIuaNCl1LG8SIGKsWQw== From: Frank Oltmanns To: Andre Przywara , Chen-Yu Tsai , Frank Oltmanns , Jernej Skrabec , Maxime Ripard , Michael Turquette , Roman Beranek , Samuel Holland , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH 0/2] clk: sunxi-ng: Consider alternative parent rates when determining NKM clock rate Date: Mon, 5 Jun 2023 21:07:43 +0200 Message-Id: <20230605190745.366882-1-frank@oltmanns.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,SPF_HELO_NONE, 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 I would like to share a patchset that enables the NKM clock in pll-video0 to consider alternative parent rates. I have found this feature particularly useful to adjust the pll-video0's clock on Allwinner A64, as it allows me to achieve an optimal rate for driving the board's panel (in my case, the Pinephone). To provide some context, the clock structure involved in this process is as follows: clock clock type -------------------------------------- pll-video0 ccu_nm pll-mipi ccu_nkm tcon0 ccu_mux tcon-data-clock sun4i_dclk The divider between tcon0 and tcon-data-clock is fixed at 4. Therefore, in order to achieve a rate that closely matches the desired rate of the panel, I need pll-mipi to operate at a specific rate. However, I must emphasize that setting the parent's rate for NKM clocks results in a significant increase in the time required to find the optimal rate. For instance, setting DCLK on the pinephone has seen a 60-fold increase in the time taken, from approximately 0.5 ms to around 30 ms. These figures were obtained through informal measurements on my pinephone, involving kernel logging and a few reboots. The worst-case scenario observed was approximately 37 ms, while the majority of cases were just under 30 ms. The reason for this considerable increase in time is that the code now iterates over all combinations of NKM for pll-mipi. For each combination, it subsequently iterates over all combinations of NM for pll-video0. I greatly appreciate your feedback and suggestions for further improving this patchset. Thanks, Frank Frank Oltmanns (2): clk: sunxi-ng: nkm: consider alternative parent rates when finding rate clk: sunxi-ng: a64: allow pll-mipi to set parent's rate drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 3 +- drivers/clk/sunxi-ng/ccu_nkm.c | 40 +++++++++++++++++++++------ 2 files changed, 33 insertions(+), 10 deletions(-) -- 2.40.1