From patchwork Mon Jun 5 19:07:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Oltmanns X-Patchwork-Id: 13267897 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 E79DEC7EE24 for ; Mon, 5 Jun 2023 19:08:56 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9+rlIMXMq+pppOsKx+HTsyklSKonO8Bvd/TOEulb9EA=; b=XYsE09nDW8aKLp DeVYqDJInSbqpWru8xq+/4A5A3SAEonkSATKx98uyp+ni01XPF6d86XQsEIKepFSb9BMKmMbNjyOs 5eFrLOONpSBFckxGCPyonAuSwLvOaLPcs7oQSLcVZdwvy3tBZKpje6aouiye802mbpPJnNdy4hoqP jWRMIV2KZpvWTSmnU46LSeX2g2qw4QNJkL2fbmWNIFUSiEUpe4y0WQgau9nV6jjzTZCEnILb9jqVb HZRLiq6ktrFp7Ahk0/OB9YlWkGrJNtNmK6r4DOugy4mzkmXNtXe7F5PDAirpZ4itcj/06rbvGfDL1 U5zs0fKMAlI5idpyXKEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6FZ9-00GVIC-2u; Mon, 05 Jun 2023 19:08:31 +0000 Received: from mout-p-102.mailbox.org ([80.241.56.152]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q6FZ4-00GVGh-36 for linux-arm-kernel@lists.infradead.org; Mon, 05 Jun 2023 19:08:30 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230605_120828_754098_60E647E8 X-CRM114-Status: UNSURE ( 8.62 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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(-)