From patchwork Mon Feb 5 15:22:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Oltmanns X-Patchwork-Id: 196860 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp945788dyb; Mon, 5 Feb 2024 07:23:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlfajqW9aEF3qmTWb/4dLTxeakp/AZi0L+2oAtVJf3Uf11ALJrt0mUlHPtLEX5ha6cLFq0 X-Received: by 2002:a2e:b1c4:0:b0:2d0:b537:60ed with SMTP id e4-20020a2eb1c4000000b002d0b53760edmr36059lja.12.1707146632958; Mon, 05 Feb 2024 07:23:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707146632; cv=pass; d=google.com; s=arc-20160816; b=sY6Wl73x5iqMQwGOyQrU6XmwhG+Gh4kHYx/+qTV2JlxrCp3X/1o5R4iNTFr7hYQuEQ XREqJIRJ0avcfdUOYW9xCNA7FkIDheCDg0Lz5+ticgsOqZ2xPY/2A6pfL9L8etb433cj 30YSKKM+7qsuEpUfcZN9VrCn/4cmRU1RwghqcAlGAWUQJghBCLQHY+wZdhFGuvfqWZb0 ut+yEGffevnD9mtP4NvzPFN3+4LQPf1+lITDujLCbkKfFUHlc0B2SqhibbA8UbeqXZj3 OMwPi1D1NBP4ASuwoUgFBr/luesSR2QhPFPt2xSJfbAx/YizCJzVNPlWZwjzvzLtzGiT 1evQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=uta2Nryx0fYmEgPuIsmh9A9sOCuB/mTE4m8nKAVHA8Q=; fh=PyDcK7tV1OqZmgSMi+shcuBqrcBx2qIEvg/FuoPTlYI=; b=OB/J4ZukBJx6RAgnYNveh0w+G3k9VYCvXPBYeoLu3p785W13d4rac3ofXTbXN/PXcn spNMo0LjlqAE1sPk6Yp4sFpD7tT+KnKZhUSColIVZyPpIQOnvG9sXOjpTg0hfl/z/M3G qJ5EbHHOG/ESoWayNt+yVQGh5yH9crzmekDoYN2t1hxW2l/OKhEwO9xfAKkuBLb/ohUz 3M+I5M+e0NeMCzckNLV4d/EIXycAu7SS/IwjR2ejmejVWPg0A9Q/e9/NDxn3vCT4FcEF /7op4qzXXT6/UZHNDwHpp7NPgBnZw9+UtYgjeboFC48dUjKx/9DVYc4qYid95jlTHZm9 skjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=lsJ7xPwS; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52891-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52891-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev X-Forwarded-Encrypted: i=1; AJvYcCWrl0KMAQrd2S1IRKk0yrL1KzGcb9hYDyDxVVCah3mlNBjt3g5hxmYdixSrGkxY/IdP97Wni3HJmQhlAnfmqfts1iS7Gw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l21-20020aa7d955000000b0055feedbf264si3915976eds.470.2024.02.05.07.23.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 07:23:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52891-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=lsJ7xPwS; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52891-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52891-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D7FBB1F221F5 for ; Mon, 5 Feb 2024 15:23:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DFF035F0C; Mon, 5 Feb 2024 15:23:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b="lsJ7xPwS" Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CBA92D050; Mon, 5 Feb 2024 15:23:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146584; cv=none; b=uOihlYp4Vss7gp6crHDGCRQvQK+9y2nZ/UpSFMIcQ60HRUu5pbtGE7c1ufsxtoMfzXKWxiNg7QOcLE1LfhIakgOjFm50FcFsus9r5GucvJ2N8+jHQX2GEBppsp5se/2S9JEpzFX3w1TeJs72fZC/XH5g5LjBLaK4/LorAD6rrtQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146584; c=relaxed/simple; bh=SMz7oXCauq2UtH/EdNshDEESJjkCnkK/ixNVXPl/TYE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a5sqMPc7poND7mhwQqx/pQ0BFDilmkxv25Fc530mvOWC64D1wfx3L6qjpREZiTkHGd8WlTYAOsLSgbUUuQ3ki3MYaQMIxaBXSoctckuXg+ts95yvODwbzgZPJ/HwYdVngkyKX/+UUclRra9T3Ta5a1lt37uSzc3l4r6xcsa9OQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev; spf=pass smtp.mailfrom=oltmanns.dev; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b=lsJ7xPwS; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oltmanns.dev Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TT99m6LV3z9t3f; Mon, 5 Feb 2024 16:22:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1707146572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uta2Nryx0fYmEgPuIsmh9A9sOCuB/mTE4m8nKAVHA8Q=; b=lsJ7xPwSdL7B4+pW5JQoBa6ENjytk87Ee0zBakVyxREbgOL2C9gYzXJeDDZRMbgD/qWdQq mwg5aeXNeIzoxIKw2LxUVZ441guKRszDAcVXXTDPjX3utFo/UTOfLuHUZY5Enf/ZW7hpjS Zx0MI/tfdJyVeLHMZzTtLFPiJo7sQHo9txDOkcC6npxzMowoj+EP8Narobrcsm2gIlz9BI 0muEV9WrFEWOwFiaM77bQgxbR1hFiV6h+HBjPaCrQpaSVyN+PEkdo7WDpF12IgGT/HR15q JU5CkoOGdD9oUJr/wGfx1pspbYRnzO64z9VAAA3aR8oZddnODhXNpDgZ2ppuaw== From: Frank Oltmanns Date: Mon, 05 Feb 2024 16:22:24 +0100 Subject: [PATCH v2 1/6] clk: sunxi-ng: nkm: Support constraints on m/n ratio and parent rate Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240205-pinephone-pll-fixes-v2-1-96a46a2d8c9b@oltmanns.dev> References: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> In-Reply-To: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> To: Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , =?utf-8?q?Guido_G=C3=BCnther?= , Purism Kernel Team , Ondrej Jirman , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Frank Oltmanns X-Developer-Signature: v=1; a=openpgp-sha256; l=2525; i=frank@oltmanns.dev; h=from:subject:message-id; bh=SMz7oXCauq2UtH/EdNshDEESJjkCnkK/ixNVXPl/TYE=; b=owEB7QES/pANAwAIAZppogiUStPHAcsmYgBlwP0+pe4JnotZRs/UXF6HlNDa9bl3VgkiZTM5l VEOUAv9h1KJAbMEAAEIAB0WIQQC/SV7f5DmuaVET5aaaaIIlErTxwUCZcD9PgAKCRCaaaIIlErT xwlIC/9hxvGWs1GKMhVzxbaLGtyJWEFaVNQr/lzeqPpbqBCYwSOV7ckyAre1awUZ4uAEAp8GanA nDGgiORBExs5h1YYGQz0MD8ETP4OlPQndoEuXT8uaAPKHpNoPp/pjsAwBvrcjDIQ+1BWeOli9ZY r+NmL0jCdaGn98KSlLJKBcdlxLEt4Ywr+KPPuBH1sAdRdXOiw2K4smqlFs9QqD+5COCTF77i7sz LwpF8Awp+DyrobksONjAMf5F9tr8fvL3V/0HaMdYNchBXM7oLJUlvFGzRwSACUNxO/o59bHYu1N 9x9kkChfsztI65nTzq1CVTGyuAomU+Fwh008WXOnQ86gFRwJdywtOr4Omkbk8oFz5XVF2x9jgwB 8KcFHIfLwp7bSBqkmYDYEjAdgTKYvtJHfmR1uEChNJ7Mo6nJSY8fsiHG42eI+aovsapCCme+hO1 PoIeFzFK/l6aw12HdOY4xCBZpNbpy0f1FtS2gvYFoEEkHI8oN2LSIBaRjA89ONrBWZjuU= X-Developer-Key: i=frank@oltmanns.dev; a=openpgp; fpr=02FD257B7F90E6B9A5444F969A69A208944AD3C7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790072987737784992 X-GMAIL-MSGID: 1790072987737784992 The Allwinner A64 manual lists the following constraints for the PLL-MIPI clock: - M/N <= 3 - (PLL_VIDEO0)/M >= 24MHz The PLL-MIPI clock is implemented as ccu_nkm. Therefore, add support for these constraints. Signed-off-by: Frank Oltmanns Reviewed-by: Jernej Skrabec --- drivers/clk/sunxi-ng/ccu_nkm.c | 21 +++++++++++++++++++++ drivers/clk/sunxi-ng/ccu_nkm.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c index 853f84398e2b..1168d894d636 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.c +++ b/drivers/clk/sunxi-ng/ccu_nkm.c @@ -16,6 +16,20 @@ struct _ccu_nkm { unsigned long m, min_m, max_m; }; +static bool ccu_nkm_is_valid_rate(struct ccu_common *common, unsigned long parent, + unsigned long n, unsigned long m) +{ + struct ccu_nkm *nkm = container_of(common, struct ccu_nkm, common); + + if (nkm->max_m_n_ratio && (m > nkm->max_m_n_ratio * n)) + return false; + + if (nkm->min_parent_m_ratio && (parent < nkm->min_parent_m_ratio * m)) + return false; + + return true; +} + static unsigned long ccu_nkm_find_best_with_parent_adj(struct ccu_common *common, struct clk_hw *parent_hw, unsigned long *parent, unsigned long rate, @@ -31,6 +45,10 @@ static unsigned long ccu_nkm_find_best_with_parent_adj(struct ccu_common *common unsigned long tmp_rate, tmp_parent; tmp_parent = clk_hw_round_rate(parent_hw, rate * _m / (_n * _k)); + + if (!ccu_nkm_is_valid_rate(common, tmp_parent, _n, _m)) + continue; + tmp_rate = tmp_parent * _n * _k / _m; if (ccu_is_better_rate(common, rate, tmp_rate, best_rate) || @@ -64,6 +82,9 @@ static unsigned long ccu_nkm_find_best(unsigned long parent, unsigned long rate, for (_k = nkm->min_k; _k <= nkm->max_k; _k++) { for (_n = nkm->min_n; _n <= nkm->max_n; _n++) { for (_m = nkm->min_m; _m <= nkm->max_m; _m++) { + if (!ccu_nkm_is_valid_rate(common, parent, _n, _m)) + continue; + unsigned long tmp_rate; tmp_rate = parent * _n * _k / _m; diff --git a/drivers/clk/sunxi-ng/ccu_nkm.h b/drivers/clk/sunxi-ng/ccu_nkm.h index 6601defb3f38..c409212ee40e 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.h +++ b/drivers/clk/sunxi-ng/ccu_nkm.h @@ -27,6 +27,8 @@ struct ccu_nkm { struct ccu_mux_internal mux; unsigned int fixed_post_div; + unsigned long max_m_n_ratio; + unsigned long min_parent_m_ratio; struct ccu_common common; }; From patchwork Mon Feb 5 15:22:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Oltmanns X-Patchwork-Id: 196861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp946325dyb; Mon, 5 Feb 2024 07:24:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IExofbjMkBhkZ5bdwSCEMY8juG/nd18Ozpyjl5mN7mGeOXsaJTdCk0XfLHdZPNMxwApqh3x X-Received: by 2002:a17:90b:438d:b0:296:6a37:c528 with SMTP id in13-20020a17090b438d00b002966a37c528mr3927807pjb.24.1707146695430; Mon, 05 Feb 2024 07:24:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707146695; cv=pass; d=google.com; s=arc-20160816; b=Flr4Hg9RmzQE5Hb1Gb53Apa47PcHMeZcBPbqJ5VaQDm40tqdUXJbqmLFkTOftKXiaO 1fnxmRCl3RAewZijqH+DnPGp01qB5zwkOHMg5JuiBqY+f930I3bpxs+SIHiqThCmStvX 9x4ihSmvCSfAZ5/Q4dWnAYNSeZBhNwqXmZWsdaXMK+TVAkr2D9gPYe4kzFnMN/RlBdh0 aedVcQj/U8rJUUfFmxYqip6dHZMUZxHUsRYSy/fXcmgxfJCp3jFWLWPmrCXkqnh2J4ZC ehP7AVAUCYiIN75cFaCXLN2/0GXDQdr746In1QooSXsRGlpMjR37YrpQSQWvadMw6uF1 Ar8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=PGwJiBi4FWl+Hj92FEhx+IKZwGNvNuswqgy6NGKOs3Y=; fh=NdDNkNJkTc+ZDhPJdRhz5VpAkLdfYRHHv4Zkz/3/V4I=; b=ub5GrE6KNOwaUu2hsnBBO2PXB10HB60zNaG+A6vi6Z3KpmulpxK36ZLVmGQB2Jd9Cl bN7xRT+rgxtAIJWENOs/V0sKNGZY45lSwZQEHAQY9hXae5h/gLSYQcRcOvEVfTqwvrLt CRYbz6dOIALAcng/tUGIc7MGTDXWLUzNvvJ60ZfPo2UfMlnft0y1n9fXB/S1bsVG+Fb+ 8DuXnDXkLpFKs7fH9zSRAiilpYEmSnEC4hS2RgUPh6VolxLZq0uuOQmIFwHuDXnn6L4i SQMH9g02K8ERvUJbc3+1VEcsLVaom14Cwxvo4PWvX4kPoMLrP9slIhHSfYkpXAAP14T/ 2IRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=Pb7PTvOt; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52892-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52892-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev X-Forwarded-Encrypted: i=1; AJvYcCVZKOn/5mELashL5G1wbQAihBHOdh8b9PZzyQunPstfzDFbz4WxuGlr1PRxkUcTmDvbZpXFgQLqKycf3KkL4gTJv3s7jg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k4-20020a17090a9d8400b0029641c715ffsi4652637pjp.90.2024.02.05.07.24.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 07:24:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52892-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=Pb7PTvOt; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52892-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52892-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 96407281EB5 for ; Mon, 5 Feb 2024 15:23:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D0EA39856; Mon, 5 Feb 2024 15:23:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b="Pb7PTvOt" Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED9272D046; Mon, 5 Feb 2024 15:23:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146585; cv=none; b=qFfMtxPg90nwJwuLF5ueDITSSGRDuSjI0h4yIvPTzLk6oItd//Q6igj3YnZnzpHRmYzSAXIunoBgjD9JzYwUqGKFtHu5qP2/Qqe6tnRZEU+pCjk1pWkwjfGtRLdiAk/1FoyTIcaydQczsmkOxS5wJgxRxJb/BkZAAbHQyF6W968= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146585; c=relaxed/simple; bh=sZRQlV2c4BS8M6XigJWtt6aYtH5u38JavT1jr/9e9vM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jhFBf/YDf6M1Dii9mepN6uYyoEAKnmfmbU+uD3yXPVEwA7To6bfMJMvupMzOdgttcaYy0mwwBOrgWuK5KhFxCuX6+Ng2Bek/9aeEvZ3sVJnwM4brCkiHEENswGAcLn4CSd/b81494We7JbyZ1oC6CnASFDWelkwwKB9t8u10iRQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev; spf=pass smtp.mailfrom=oltmanns.dev; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b=Pb7PTvOt; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oltmanns.dev Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TT99t2YpRz9t3t; Mon, 5 Feb 2024 16:22:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1707146578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PGwJiBi4FWl+Hj92FEhx+IKZwGNvNuswqgy6NGKOs3Y=; b=Pb7PTvOtBoF0YCt7t7yc/FR+uBaYL4E0cGVHAiuOx/bbWVQJgYduuxBfdYWjNQpwXqNqTJ GZXjovPTa6me6Od0SPDbLLymfKeVVbW8Ptd5NVMX0EKAmVKmx/SFN6E5h+g1VlJspltNJ0 altR293r31BcKwFcgnqIinPraY4LtxKW1b8cMrVq9CmpLHEPsUElItE+iVgAXDZ0POcU0q uvYrbJ2hVPNq/RyW1tHG1Cntu12rdHcPVU6tMDL8d8ev2qgKmjLUTPxMy1GMxhKNa5/Dsn Xc12u8FSBsr7PxlhzlRP0cgRP6i4OGRFebZpdNMOJ1iPHHpp6KXQfcOpNERubQ== From: Frank Oltmanns Date: Mon, 05 Feb 2024 16:22:25 +0100 Subject: [PATCH v2 2/6] clk: sunxi-ng: a64: Add constraints on PLL-MIPI's n/m ratio and parent rate Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240205-pinephone-pll-fixes-v2-2-96a46a2d8c9b@oltmanns.dev> References: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> In-Reply-To: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> To: Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , =?utf-8?q?Guido_G=C3=BCnther?= , Purism Kernel Team , Ondrej Jirman , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Frank Oltmanns X-Developer-Signature: v=1; a=openpgp-sha256; l=1203; i=frank@oltmanns.dev; h=from:subject:message-id; bh=sZRQlV2c4BS8M6XigJWtt6aYtH5u38JavT1jr/9e9vM=; b=owEB7QES/pANAwAIAZppogiUStPHAcsmYgBlwP0/QMs40wrSKAWsSNGJOA7nyoav8bTj6AaMP eS7Ec9O7k2JAbMEAAEIAB0WIQQC/SV7f5DmuaVET5aaaaIIlErTxwUCZcD9PwAKCRCaaaIIlErT x1qbC/9s2mCUwVcw3RzsoClXh6EIF3rndAidiRIOU3Ntt0A6E40+v4Q+fAvsxkui09AzvmaEtoh p6r394Intis9B1C+QQpXcN2jxVEu6i9wXi9ZKkwSwjhGbqXigueaySui7WqHPOWap9EtlXF6UCZ zAd7FU8s4d4JUFWLaRLoNAKKDO896cVYd7PnC2QOTTr1Xjm3ki0rK5RuV1LVGMOAY1JwlQ1kl6Q +wznvE9A//AvK+UYPGU+qHhHHN+vR6s9xqULHs41kfUpBnOsFeuERrD/n3hG2aoVg4Hd41IEXPg alaPtj3RqFjD4sQimgz1HuqbXEIz1U3l0LtTdsuIGuDKB6Nmr/tG+Gj5JCD7aBG33g4oQRXymHu hF+jlpCfqFX3qhGk9nBfyr5qLDlO7+GNY0yCEwf4Y4Ik0VM/zrYuXMP3hOBGkbp5F+rrz10AdZ+ fPMPhm2l5qne684CNYQ7usOOZROuEUsiIbgXSm28wy/eJL76J/ETfOBfv6djpJtaI1f1w= X-Developer-Key: i=frank@oltmanns.dev; a=openpgp; fpr=02FD257B7F90E6B9A5444F969A69A208944AD3C7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790073053167185680 X-GMAIL-MSGID: 1790073053167185680 The Allwinner A64 manual lists the following constraints for the PLL-MIPI clock: - M/N <= 3 - (PLL_VIDEO0)/M >= 24MHz Use these constraints. Signed-off-by: Frank Oltmanns Reviewed-by: Jernej Skrabec --- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c index 8951ffc14ff5..df679dada792 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c @@ -171,11 +171,13 @@ static struct ccu_nkm pll_mipi_clk = { * user manual, and by experiments the PLL doesn't work without * these bits toggled. */ - .enable = BIT(31) | BIT(23) | BIT(22), - .lock = BIT(28), - .n = _SUNXI_CCU_MULT(8, 4), - .k = _SUNXI_CCU_MULT_MIN(4, 2, 2), - .m = _SUNXI_CCU_DIV(0, 4), + .enable = BIT(31) | BIT(23) | BIT(22), + .lock = BIT(28), + .n = _SUNXI_CCU_MULT(8, 4), + .k = _SUNXI_CCU_MULT_MIN(4, 2, 2), + .m = _SUNXI_CCU_DIV(0, 4), + .max_m_n_ratio = 3, + .min_parent_m_ratio = 24000000, .common = { .reg = 0x040, .hw.init = CLK_HW_INIT("pll-mipi", "pll-video0", From patchwork Mon Feb 5 15:22:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Oltmanns X-Patchwork-Id: 196881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp963670dyb; Mon, 5 Feb 2024 07:53:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVmCXvplWCLtvpVfLHu2ovu58beUPwW2IS+jiQmJaQa8Nu3YpyUaWMha+QHaUlHHuPgQLD X-Received: by 2002:a05:6a00:92a9:b0:6e0:4e0f:62a8 with SMTP id jw41-20020a056a0092a900b006e04e0f62a8mr2432078pfb.2.1707148419515; Mon, 05 Feb 2024 07:53:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707148419; cv=pass; d=google.com; s=arc-20160816; b=G8ok3i7Xdqbm5zJmjRlG9Hb3tEynC2BQjGa/V310ZyZ3/XL+l2MDpWfvxBFk9VbeSt eEQhQwi7VNByVSSWV9IhSk5U0HWw4TCClWlzYu64Y7TRhlC98t8EfGLGeizOPn8g8QGT onh1pOnQU1C0KcxmFfIiVC9W+f/kLbEHxY29Y32qEITDC8i/pjDDYgvP+tVcLo93T8BZ B3I5OpcQszJA6zgCmq0ylphUJV8sKj5wE6DxkYX0lwRciwUi/2DnGuf+SqOuxhswlFzO H12ESRXpXVE2eAVPlmcaDrult4bg0VWrj6a/hIljWKh/K8iegL65BwDACesZ6gfq1XB9 GlYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=jU9BjDKbdWvhuTRibGk4N23TVvjyO4DZIzgSg1oCo6o=; fh=XyzQNGTKkXmFRc7x6vMEaoDxBwwsx1peVGUXJHX7/eY=; b=uWf8wdCbPkLqm6MUje2j/b2JRxM/dK37CySDRNWByGS/jb7CXV8vIi5WwWPTj1jXCQ odLCStI6SOrw9ZRXrbNsJbiKmDLwiUmCPStlIHrLTYW2eXMQLgoxVZdZe2xC1+gx7o8+ KHJf9AWiO/yZ6BpAEb53NO6hpyl/ms+d7psi/IuPkIJerxIW5aX/8cUCnfjCES4nth4J WGcQQ81WAsJAXHS//wOEop79eyfY3NWnh6x0iHMUNaqULLq6ozSlFL6Pe+bFqOT5J3j/ U+trDD/IfOLHuNORH9ND/v66rlL6GnOHCT++yReIwNx3Lf1YLsgAyQlVZ0IGwXQOJgse PY1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=IDaUUJ5P; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52894-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52894-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev X-Forwarded-Encrypted: i=1; AJvYcCVIVOsuvyUDirbkV305oZP/kbKIqYMTTAQHfQYSG3/kWFdCgd3xpHNVvKyK3PHIvjlhOR5DTTJztHU2/gzycWCq2G1Rkw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z6-20020a634c06000000b005d512d7e4b9si57381pga.690.2024.02.05.07.53.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 07:53:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52894-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=IDaUUJ5P; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52894-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52894-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9BE10B26680 for ; Mon, 5 Feb 2024 15:24:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B1543E486; Mon, 5 Feb 2024 15:23:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b="IDaUUJ5P" Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E0EF3A8F4; Mon, 5 Feb 2024 15:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146595; cv=none; b=H3LR4bAPhlxlMf27GSmmeVf8dmr67choPN1ptqP+Qvue2pzlPwurHtu7GaNwDcn33ZUD8Z3iclKiCNFTphSgdZ3XzqV1XbFetGo7OXZLVxSmpbHpLo8V34t7a1W3YJOVWNMLGYOmcwF2cCQnqVhfUBKnMvIQFY5gAposaJ8IwMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146595; c=relaxed/simple; bh=/3dNKggDHZ8IDpHedZkuDBEbq+kfTgK2pJtlaJ3P5io=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OE/SHb8v2XNolGpNVJYHxwHDcvxYt5jA0bzMh53ZJnPPhW87BEagE8o4Gl7wrGRcjAAlqBrcTYzuH9Y+qVvVoUqU0CEEdfTiip/ww41A5n8bp9ip0InBO3qUDrLI6FCQdPnMGtolGEt1pA6MIY1lv7iLc+v/ZHZrwrpTitqVYhg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev; spf=pass smtp.mailfrom=oltmanns.dev; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b=IDaUUJ5P; arc=none smtp.client-ip=80.241.56.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oltmanns.dev Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4TT9B00qv3z9sqg; Mon, 5 Feb 2024 16:23:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1707146584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jU9BjDKbdWvhuTRibGk4N23TVvjyO4DZIzgSg1oCo6o=; b=IDaUUJ5PaOMkW+Dzmqmhvw1A2j2Lfq6AF6jkWqYyvuUV1mnPji1NK36FRhHisVpA1kq91J N9nQAbdp5x1uKIQ2nJMSsJBfeEHeU3Lg9wlnrwSTrGCBbbi4aekUehgkYMOuMyjdmRX9Cm /HR6dLUGcoGE9kf3JY6qhuiTgh3x5FGGw5WaK7OZ/NYc/XBo5xkaX5CJMwKyMDWdZBYdTc OXJ2OcDHedVgWThIGV1viXPs+xhuOKsRMHQoSZ2rQEguyscQBTVXgunD07NfRF2RbDin8P OhYcz/VzrOJo7cdUDvCVE+Y5ISgk6LdGAIg3AWTcgjra1KaYtxslApH5S7yN5g== From: Frank Oltmanns Date: Mon, 05 Feb 2024 16:22:26 +0100 Subject: [PATCH v2 3/6] clk: sunxi-ng: nkm: Support minimum and maximum rate Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240205-pinephone-pll-fixes-v2-3-96a46a2d8c9b@oltmanns.dev> References: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> In-Reply-To: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> To: Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , =?utf-8?q?Guido_G=C3=BCnther?= , Purism Kernel Team , Ondrej Jirman , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Frank Oltmanns X-Developer-Signature: v=1; a=openpgp-sha256; l=1857; i=frank@oltmanns.dev; h=from:subject:message-id; bh=/3dNKggDHZ8IDpHedZkuDBEbq+kfTgK2pJtlaJ3P5io=; b=owEB7QES/pANAwAIAZppogiUStPHAcsmYgBlwP0/R/bYRLSWDoR8LFJNAtlZjd3AuDTv0TkSy h6Q/t85+q+JAbMEAAEIAB0WIQQC/SV7f5DmuaVET5aaaaIIlErTxwUCZcD9PwAKCRCaaaIIlErT x7cUC/90hwXY99Ja4sPw6whiQKjE2ZtXg2fE1iRFw0+6vh1HBrZuuzBYjAond8O2cZhSszDwTV6 fsKjWCndURyzjCM50NZOZidj8q2F2hNxNfwzYtd2DeYxhaT7IzHpzwWiS150YVdru/4YTgc+zmm 6fePa2l5nnrf+nr1LL2371HweSyQbxUHiAzrCR2iaZhkhDpkEmRQBmkzIQRIKlLHf6TkaG1j0IQ mzbCbsCDTfewQUPHe+sRDAndVbsxwi65ZoCI5BPtDlLoW9SgJLeawQ27nR22EsgA1VR1+FqSKgt JUka8btp+cH79A2OeLbeZoKapTa3T3BcU8gYviht8L24G99WcywrYzEOKfxJkZGwaXzfXJWTzjs NjaepFV6e+z/1Xy6E7oRgHP2Ns+4brhuPhnqfwBgjK9bmo7ogE0uC9OV4JtNygG/5CDGm8IIOaO UE5j/+5B8D47kn6fIaozCmuA1f3Ti/UgXv2t63jjvvM0LYNdWpiBJf8IZ/SmdsXkpFNNU= X-Developer-Key: i=frank@oltmanns.dev; a=openpgp; fpr=02FD257B7F90E6B9A5444F969A69A208944AD3C7 X-Rspamd-Queue-Id: 4TT9B00qv3z9sqg X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790074860701660649 X-GMAIL-MSGID: 1790074860701660649 According to the Allwinner User Manual, the Allwinner A64 requires PLL-MIPI to run at 500MHz-1.4GHz. Add support for that to ccu_nkm. Signed-off-by: Frank Oltmanns --- drivers/clk/sunxi-ng/ccu_nkm.c | 13 +++++++++++++ drivers/clk/sunxi-ng/ccu_nkm.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c index 1168d894d636..7d135908d6e0 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.c +++ b/drivers/clk/sunxi-ng/ccu_nkm.c @@ -181,6 +181,12 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux, if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV) rate *= nkm->fixed_post_div; + if (nkm->min_rate && rate < nkm->min_rate) + rate = nkm->min_rate; + + if (nkm->max_rate && rate > nkm->max_rate) + rate = nkm->max_rate; + if (!clk_hw_can_set_rate_parent(&nkm->common.hw)) rate = ccu_nkm_find_best(*parent_rate, rate, &_nkm, &nkm->common); else @@ -220,6 +226,13 @@ static int ccu_nkm_set_rate(struct clk_hw *hw, unsigned long rate, _nkm.min_m = 1; _nkm.max_m = nkm->m.max ?: 1 << nkm->m.width; + + if (nkm->min_rate && rate < nkm->min_rate) + rate = nkm->min_rate; + + if (nkm->max_rate && rate > nkm->max_rate) + rate = nkm->max_rate; + ccu_nkm_find_best(parent_rate, rate, &_nkm, &nkm->common); spin_lock_irqsave(nkm->common.lock, flags); diff --git a/drivers/clk/sunxi-ng/ccu_nkm.h b/drivers/clk/sunxi-ng/ccu_nkm.h index c409212ee40e..358a9df6b6a0 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.h +++ b/drivers/clk/sunxi-ng/ccu_nkm.h @@ -27,6 +27,8 @@ struct ccu_nkm { struct ccu_mux_internal mux; unsigned int fixed_post_div; + unsigned long min_rate; + unsigned long max_rate; unsigned long max_m_n_ratio; unsigned long min_parent_m_ratio; From patchwork Mon Feb 5 15:22:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Oltmanns X-Patchwork-Id: 196880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp963591dyb; Mon, 5 Feb 2024 07:53:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvmR1OaOCO7Rw4Sn7Gqzyj/QvNrhMFDK4T+q66unAtvFCI7eMCd+x4/7KTYPbcgCeo3lsm X-Received: by 2002:a05:6a00:4f8d:b0:6e0:4a04:cd1 with SMTP id ld13-20020a056a004f8d00b006e04a040cd1mr2651785pfb.17.1707148413272; Mon, 05 Feb 2024 07:53:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707148413; cv=pass; d=google.com; s=arc-20160816; b=JnQOuN1odi+AHe44urHqjNVfuyI0K4o+6baQY/XPfElI95lyPugFyz07gHwwUnafyk maDA/72KDIfFHKZ0WtfVmWpmj1MxahZzz9F5yaZXzOIqTZjrYvr2mQYvfPJDgbYb8M2M W5VC7/F777aIZomQb5i2ymb4e6IDaXNEOthY7ckLKEUcDzb0JQ/wUgR/6oq/XfC3q3eh 8J5fyadlu4fH3x9sHIXa+KhMTMEySBfvloLmNwotulh0tVRA8Xdi1J0YFXiCiMCqbgtg b/gz8YWKFvONGx6Q0p0WTQ/+amGR0xHcb7WiKkylU5wZA/tH26eZrx+dioN07exBYlwW XAGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=LBDoGEw5H7zjvt4Tn4WN7vmGiia6CbPYmP+MFo66pMQ=; fh=ROKEkfBpilXRgdatFYDcBQzzWqrG35BHdR1FXOYdP90=; b=GLqnBPtQlq3wfunoMV1ndmINQ0gSCBpq2t6mqqUsDjjkOQud472xKQo3LI5mnAAzA6 wPeSZk/M3aN//4qNV0EzIClqWrit6CwHS79HzSHXbvn7zKrSvt7IeocYtOn4o4ZNC2bc bwABc62TKuUhpiKaSV1/4BkHXD0zu/c4b23codR+/NouKrS8OlZGixge8fdNnM5xN5zK gMGqnmDzmiX3zeu/U0Jpk0k6wf/lkU5EjRSQSf5AXJ1m+VSO5oYdah6Qyycf3LcV7a9j Tnr12DkA1dHa+LBVg+ijK0owz6TOSvSyg4j6OLuN7SMO0yobuUbmub2IsXlk1ru1mtQs fgYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=K+kMj2W+; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52893-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52893-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev X-Forwarded-Encrypted: i=1; AJvYcCW6VyCq8K9b6r3XTZXTckyFZOwl5qVjm30d5U3NC40Lj8oYF4SBSGfGrlcUFSDVnXhehk+PHGdUAxej5pquCADVDn3OBg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id m2-20020a635802000000b005cda184c288si69973pgb.212.2024.02.05.07.53.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 07:53:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52893-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=K+kMj2W+; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52893-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52893-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4C041B20A76 for ; Mon, 5 Feb 2024 15:24:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54EE03CF5E; Mon, 5 Feb 2024 15:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b="K+kMj2W+" Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC7843A1B6; Mon, 5 Feb 2024 15:23:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146594; cv=none; b=qOPzP2zZmn2rs4QmVqwNRmNjxeTcwolDCwRQRVeWyOaWjTrCU0nThVpjZLmkF22QdAHF1DcM0+GGff9btw3BYSR3VWnOOneMYElAN9hAZ8BLSeENda/31KmBBzcXBtV7N4vgorjvg8KgZB+DZMY37Y8YmfczchazLFDLnP80qto= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146594; c=relaxed/simple; bh=IJ2XTYWEqbQDEDOuM1uZXEh/F0ICX+aNVO21sCOdmPI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=paCTGSplAvS73uvTqRJy9hzqNz35M5hU0D41gMZ80333iYlk6E9v0VijgEHhLg1X4/O8VbiMfNP4GG1X4Qy3OhkE9tL8KmnKI5kNehAXt24InvQQKEF77ZZjz1bMxklfPG/BYBGD76Lx7p4VHFKc48xqHFGycN8Gtom1Q1bdUJs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev; spf=pass smtp.mailfrom=oltmanns.dev; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b=K+kMj2W+; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oltmanns.dev Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TT9B539gnz9t42; Mon, 5 Feb 2024 16:23:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1707146589; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LBDoGEw5H7zjvt4Tn4WN7vmGiia6CbPYmP+MFo66pMQ=; b=K+kMj2W+vma/KQ9lAWxsYbj+TWWA3C2lkGsfIe6441w1ujtQ2uNtMn6ZUO7h5vb4SIHRBr Jzmb5bqn+dwiDBPrnXeU5V6iOsR8gkYsw9lxyBowwqW31AbcbuSEyn/IGt9kRlM3eH5y56 4eqitwpRFKd3OKpGpg3za4bMpBgjeGhA+CczJZ3AGol9ULQUmB3sfV63QZr2Wt1XRsUfXp 4+FeUMH7ElT+IL0RtfEKiiFqjHYx2ilENgx+8F5Oj1b5VQkdXqni9KShvH9lK07JVJYD9D DqnQk5K7D7expRK/BSqA9G74tW7ywW3qfBdg8pSAzrGrLTuLobnHCzuRwcweLw== From: Frank Oltmanns Date: Mon, 05 Feb 2024 16:22:27 +0100 Subject: [PATCH v2 4/6] clk: sunxi-ng: a64: Set minimum and maximum rate for PLL-MIPI Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240205-pinephone-pll-fixes-v2-4-96a46a2d8c9b@oltmanns.dev> References: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> In-Reply-To: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> To: Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , =?utf-8?q?Guido_G=C3=BCnther?= , Purism Kernel Team , Ondrej Jirman , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Frank Oltmanns X-Developer-Signature: v=1; a=openpgp-sha256; l=777; i=frank@oltmanns.dev; h=from:subject:message-id; bh=IJ2XTYWEqbQDEDOuM1uZXEh/F0ICX+aNVO21sCOdmPI=; b=owEB7QES/pANAwAIAZppogiUStPHAcsmYgBlwP0/l0UwLaujQoqVqlgAplWnj9SkVd43u27AR hJ8ppQSdNeJAbMEAAEIAB0WIQQC/SV7f5DmuaVET5aaaaIIlErTxwUCZcD9PwAKCRCaaaIIlErT x7FXC/90qKkh7DIYRrFjWYgNWY0/pU4JrxhWDBtAHt5wJpTbydki4DTNL+Q1Fn3RK90LKDg1II8 lByqgCm7+mE5XoGJaawBugzun8o0ScmhgkL08Jh+qfmb6nW/TKHXK7Fnt930z/k8dEbA229cxcE ASuS6FKwzV5bMoLe9PLDgbCuN+qbLvaPFq0XI7CV3pbKlasuOZ7IeC31au5eqAyLFJLO3Z6N5yI Ze35tLjN4dvaESV5GOJIBFsVxeai4Gl0gjkPLU+ls+W9BHJWVGtvuLiQLnF3xzvuJXZ26rOf3Xa 4AXWLf6S6J49g1SIO58p7ZOEdMy8nrgMgNZJcLgFcJcihRtO+unPygRjBxaeGD4q8HL7KLr4fwS TX4zIQFIbeDigF8Nuzgh/J54TwigFxXduAEif32q3xH1wLbMeioZ8SW/SUC60jQAvpXADOrf4YA qg7rZVpM5e/yaZmTs9o85fHF8F/k2HyRF2Xe52/BI+Bl5TlplgEJ8G82yD4oMsFclQiW0= X-Developer-Key: i=frank@oltmanns.dev; a=openpgp; fpr=02FD257B7F90E6B9A5444F969A69A208944AD3C7 X-Rspamd-Queue-Id: 4TT9B539gnz9t42 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790074854347739690 X-GMAIL-MSGID: 1790074854347739690 Set the minimum and maximum rate of Allwinner A64's PLL-MIPI according to the Allwinner User Manual. Signed-off-by: Frank Oltmanns Reviewed-by: Jernej Skrabec --- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c index df679dada792..99c2ce11da74 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c @@ -178,6 +178,8 @@ static struct ccu_nkm pll_mipi_clk = { .m = _SUNXI_CCU_DIV(0, 4), .max_m_n_ratio = 3, .min_parent_m_ratio = 24000000, + .min_rate = 500000000, + .max_rate = 1400000000, .common = { .reg = 0x040, .hw.init = CLK_HW_INIT("pll-mipi", "pll-video0", From patchwork Mon Feb 5 15:22:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Oltmanns X-Patchwork-Id: 196875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp956819dyb; Mon, 5 Feb 2024 07:41:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHGUDzKNkTx9yl7BUYj/O4OowAIJPc4tDXfnitZHgA20AVFPHr6R3+2yI9bPGXgwKwei680 X-Received: by 2002:a17:906:ae93:b0:a36:3f34:9476 with SMTP id md19-20020a170906ae9300b00a363f349476mr6397084ejb.44.1707147696328; Mon, 05 Feb 2024 07:41:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707147696; cv=pass; d=google.com; s=arc-20160816; b=Heo3iQRwR7jKuWzIlUgZsZOcDDSwrlnYHXlFnafw8kwUnT/d7h3uR29AM97URFzHBn qL8lHQ26+96Lq0X3vKZgoQRgF6jCQaIEWRGCF0LHhTksCdrMeZhhSndX7XTVsWvUc0U8 w1to72wyupb3lEJ55avrg0mgejZUz133OUReOCU7Q9/1GKRIeoChuvw2i99dFQVYRNGj 7jWujDdJ26eBbF89wHpux9Dew0FFA0pUujOY/MZZM3RrNNKbUpC382wmcszwVlqM6xAL qRc0OwPzWMpLdWjyVhzvvyBswgxE/p1QcKXCgZoEzV94A1JvSEi24VERZZZU8dZfz+nf 9UVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=HMiu8mBySgExM6KnP08YCgNs308ubxzfSD1bMdoSvkY=; fh=eTeBk9xilDHWnK35YWeY92kzsDXPmhpegReCs5mJsVU=; b=Jbj/obP4KvbD+q1/gvgibeguXJcrle6aSz1gn33cM85kFZN0Z0iI6t+HgU2gEBX9Yj GRV+5+YV1R/Km7CkKr6/ZIJHZexXZYHsXY5uGwp3CJlv7M2MFVaTuryUb2ypsxhLBlop LqlsZxl3u83a/hpyPMHJlHgjDTj2CHn3nMuRhs0VbxiruU4+zS5FXwv/MCl2rv8Ip9ei e696T46WIBH+RxzorgrRVyHCobt5mxXUZlRMqo2q6Mw2FyR2IFGX4TPhuPR/XtU4ofhW XG/Pkg/vxEpWaVwJKMyblePr26FMcx5M9Q4quBHJ7TpjBgKpoKcrQywJYiUmgJ73/tjt xRlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=w6kjYLuC; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52895-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52895-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev X-Forwarded-Encrypted: i=1; AJvYcCXJqZSYESIzSWrZEiAaBuh706xGzse+DmKdtfqc5+kILVRFxnJ0W5+fJzihEdithdWnUsgUfY7TxgPjMNjfwRELynv8Lw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id kl12-20020a170907994c00b00a37015eae5bsi3839223ejc.903.2024.02.05.07.41.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 07:41:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52895-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=w6kjYLuC; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52895-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52895-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 40BD11F25D8A for ; Mon, 5 Feb 2024 15:24:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB0803FE42; Mon, 5 Feb 2024 15:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b="w6kjYLuC" Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA5473F8CA; Mon, 5 Feb 2024 15:23:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146600; cv=none; b=ZBbRTEJ5O2etY6O+Vb/DKzmUYDd5SawtPCgizUQsuLEd0TTwFbPZh0AMgCIfoKfswhLsDjLcEaAK6Mmg/uKsFJr+Ad1QCDbpls8HgbEFG4AevgysFihI+rIPhPZmV7orWTT+ibIln6NTgM286dj53yw10SVJ2W7UW1CczSemFpY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146600; c=relaxed/simple; bh=LSFmengqkqFNIcTkqiKdRYtwv5rLf2wHfu4gB3QVAfo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lAwEviHVlc9FxtP83SZ9lbx+diYIrulYjoKp+zBxYxh92WfpE8dcU+LxxNwzuBKxvQj6Er8KhDE4polMZg5bstrmxMJG6En+3HHyjgtp3kcUfxPpBcqi9t5R+F/6SGy+rEXgz9INeupMv06duVzDwQFf5fHvScuxrzS+GCOz41Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev; spf=pass smtp.mailfrom=oltmanns.dev; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b=w6kjYLuC; arc=none smtp.client-ip=80.241.56.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oltmanns.dev Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4TT9BB6x4Vz9sSw; Mon, 5 Feb 2024 16:23:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1707146595; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HMiu8mBySgExM6KnP08YCgNs308ubxzfSD1bMdoSvkY=; b=w6kjYLuCRS3PYRkS6IqG9bJQWNXSkIeBNUQ0a/K9Q3EmD2SqZ9dyoKN1X+kvFkc+kcq0fE 3ZGSTlVdQ/emHV4ZSXkzYMw2jzA5Iw2bYOgs4f37ss5kISEkby6ruKD05m3dWKM9djXBFp KDVFgvoHsC+IjL7XKQ0qmMQSAh2B15bNpriFEe/YhwrORFqQBr1f73CSwMCWkAE7lao7Ke mOt0Wmkqh+lKRt8KZ+uKLgFRaLYnA+s4L9VoFjydLO3dj1SznAntvNjJ9+ERCruWlLlZW5 xqFmQEqzkRe5F1W4sTAdkVKOCN62t1issOg6UbWjwLLrqnD9jz8CGWJMyUhByQ== From: Frank Oltmanns Date: Mon, 05 Feb 2024 16:22:28 +0100 Subject: [PATCH v2 5/6] drm/panel: st7703: Drive XBD599 panel at higher clock rate Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240205-pinephone-pll-fixes-v2-5-96a46a2d8c9b@oltmanns.dev> References: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> In-Reply-To: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> To: Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , =?utf-8?q?Guido_G=C3=BCnther?= , Purism Kernel Team , Ondrej Jirman , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Frank Oltmanns X-Developer-Signature: v=1; a=openpgp-sha256; l=2123; i=frank@oltmanns.dev; h=from:subject:message-id; bh=LSFmengqkqFNIcTkqiKdRYtwv5rLf2wHfu4gB3QVAfo=; b=owEB7QES/pANAwAIAZppogiUStPHAcsmYgBlwP0/wUrDb0L4eaQ3AOCfpz1m+nA/BCEEvgN2u 7U9SQoHUPmJAbMEAAEIAB0WIQQC/SV7f5DmuaVET5aaaaIIlErTxwUCZcD9PwAKCRCaaaIIlErT x4kRC/4rCGnrv1sdHdQhxuE+E7Qs/Ixz80c+RlRevhWxSLuchp7r/ZRPGL8HBukk/gTMbsbHW9m B+eVzGS02ZXLAmI1dwPxqdojPbw7i1L2aBa9yfm0MGh1YBRlHA4PXiFJ51RT3Vbb3GZG4OMp528 o/z5QdRbg+0ArhHok8ahCtbtArSEkBIk3NmOmd+u7m2Ei21wXiN5/fPLILnLLutplZfYd3BqE59 4QkwFX7Iq2mjK/2rpnLEilhv76Bh5hwBrL46RchB/NgflkWArkO1TImCQWM+c8lOOhND1ws6wCH J5kgYo7XlEtqxOL18kcu7AkIbr1lg3etPq5xoSrefTZlJcmRK4jm7BKVJ6E5yIZUYJwOSl6dyra Zt+Cs/Ciow0CWZxUZmwdYgTYhO96y9Nf30Xu3ffDTS305T6Kf1PooAdFnOyLwDArpj3XtfM6cdZ ukgrNAsTLOicxp0C6hGAxj+yWW+ISTaRwNyREGjCvAAbafE/Dy+25QHlzPnSM++ROsQ7c= X-Developer-Key: i=frank@oltmanns.dev; a=openpgp; fpr=02FD257B7F90E6B9A5444F969A69A208944AD3C7 X-Rspamd-Queue-Id: 4TT9BB6x4Vz9sSw X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790074102937142521 X-GMAIL-MSGID: 1790074102937142521 This panel is used in the pinephone that runs on a Allwinner A64 SOC. The SOC requires pll-mipi to run at more than 500 MHz. This is the relevant clock tree: pll-mipi tcon0 tcon-data-clock tcon-data-clock has to run at 1/4 the DSI per-lane bit rate. The XBD599 has 24 bpp and 4 lanes. Therefore, the resulting requested tcon-data-clock rate is: crtc_clock * 1000 * (24 / 4) / 4 tcon-data-clock runs at tcon0 / 4 (fixed divisor), so it requests a parent rate of 4 * (crtc_clock * 1000 * (24 / 4) / 4) Since tcon0 is a ccu_mux, the rate of tcon0 equals the rate of pll-mipi. pll-mipi's constraint to run at 500MHz or higher forces us to have a crtc_clock >= 83333 kHz if we want a 60 Hz vertical refresh rate. Change [hv]sync_(start|end) so that we reach a clock rate of 83502 kHz so that it is high enough to align with pll-pipi limits. Signed-off-by: Frank Oltmanns --- drivers/gpu/drm/panel/panel-sitronix-st7703.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c index b55bafd1a8be..6886fd7f765e 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -320,14 +320,14 @@ static int xbd599_init_sequence(struct st7703 *ctx) static const struct drm_display_mode xbd599_mode = { .hdisplay = 720, - .hsync_start = 720 + 40, - .hsync_end = 720 + 40 + 40, - .htotal = 720 + 40 + 40 + 40, + .hsync_start = 720 + 65, + .hsync_end = 720 + 65 + 65, + .htotal = 720 + 65 + 65 + 65, .vdisplay = 1440, - .vsync_start = 1440 + 18, - .vsync_end = 1440 + 18 + 10, - .vtotal = 1440 + 18 + 10 + 17, - .clock = 69000, + .vsync_start = 1440 + 30, + .vsync_end = 1440 + 30 + 22, + .vtotal = 1440 + 30 + 22 + 29, + .clock = (720 + 65 + 65 + 65) * (1440 + 30 + 22 + 29) * 60 / 1000, .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, .width_mm = 68, .height_mm = 136, From patchwork Mon Feb 5 15:22:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Oltmanns X-Patchwork-Id: 196882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp964007dyb; Mon, 5 Feb 2024 07:54:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZIA6t4PhFyoi2UF86K6gN/QirkvJBgYl1QrlzVUd2KIkUsZ7dRzPG0gCV1y65GVi/DTUh X-Received: by 2002:a05:6a21:4005:b0:19e:3c4e:d0f8 with SMTP id wa5-20020a056a21400500b0019e3c4ed0f8mr7354865pzb.32.1707148452698; Mon, 05 Feb 2024 07:54:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707148452; cv=pass; d=google.com; s=arc-20160816; b=ubeZYqLHdFr7PdpVBbBOpqnQ06GyMxprHBW/7PU5r+jAuohiUaES8sgwsSLOiiItI8 4pUL4fJIPE6RCkB9/ptDPB3uoOlQYu0ByEbzktsPXvJJicUSlVa1Kk+6qUJ2sOygv76I eTFiVsX9lEUjGEWdFD6wxZcmWDtw7Y4Nn84Ii3pVsNIaqjr9mDz5fJNKn1rjCdwuUM6n t8oOWbTt5jTjMpa9XabVCw/FweBDzY9k0PxC53tRjUudC+30P2zGaXS7yK+R0T7QUyzJ wtLHbiFYtfvQQqUUFFvTh9YihtgGv0rMkhPTyA5z4jQ9Eny7tU6bnOsoIIye6itlJGt6 IzDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=qC4mq/tsfLRuzLmRs5JjHQXl/DynYoHApRzxf1WL2uM=; fh=IUKZpJaHO7zMQg+Bu1BDiV6aNOUsbeooQYJuS2HDfQY=; b=X4Guu+dr3L/8g5ZdOzlVUHi6u3Oe3PdkSArU/jzGHk/gBIFL8QDO4/zHlptATwxL6H Qi5EtIfKKhhZmonGvfazffqVUX/taJkUZyC+bsTGHN8lVbSMmS0YoSsOIkJ+lgLm0wmw lS+cZwKCKHvNgLwoFNgAzPVJAcQU2/tubaJ+DK8TNJ17f4bzs+NvKetJxQT3vTpgg0cE QFy5t+kAt4zWizsj2JNd5L3j2bnaY8GAtNXGJAhPbe8tDLWfvbFqSrwTLNDjRfX3P9ME z1TRWTR8qz8uvQ1YUpTH8Sc4egH7cWk0Dx9S4sfG2LbewFxqJ1s2iubXc93gSq52WwZN YWug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=p5BOTlx7; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52896-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52896-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev X-Forwarded-Encrypted: i=1; AJvYcCWfUyLpBcSuLsWYDioHuvz0YeSE3+kIIUHBMQtB/AVOchwZs5dKFCLI4lsa1HSaIVuq34kGTeaq4MjeAoSy2GZIim+EZA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z6-20020a634c06000000b005d512d7e4b9si57381pga.690.2024.02.05.07.54.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 07:54:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52896-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=p5BOTlx7; arc=pass (i=1 spf=pass spfdomain=oltmanns.dev dkim=pass dkdomain=oltmanns.dev dmarc=pass fromdomain=oltmanns.dev); spf=pass (google.com: domain of linux-kernel+bounces-52896-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52896-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 125E6B269D4 for ; Mon, 5 Feb 2024 15:25:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 595F440BE5; Mon, 5 Feb 2024 15:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b="p5BOTlx7" Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A18463FE5D; Mon, 5 Feb 2024 15:23:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146607; cv=none; b=D1YACqvJzQuFMRcMxk+20iM2G68oiOQx9inGUK+L1fWORg4pSAjwjmWageyI++LVjrKenRWZCMUqt8TIb6KZ4DaLbL6sLoYuAm8T4e3VxTLPCzASVqMILf6MEG/2oXRZZOgBoa2NNuNiYQS1I7nJqym3npusjnndNvIhTZLMfO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707146607; c=relaxed/simple; bh=zwBfjIxPZERVFfsaNgpqFLdeiKWw7hboXJ6uRiKwYxM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pVemkB+gQPWRl6IC/Qo4ZRfcIKk4uEO1H9dE99Peoee6umr0sqhLSxLnmJYBnefvzMRJ7E1ZLONdyA7ga4+zEZ0LPwFSbXovKf0nPQTUURa5fzJvD8RO3CfXjDJf4+wzw7OHlURYy1Kb3S1zHiTQkJIwjzoPvZ03y/pK6cY/qnw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev; spf=pass smtp.mailfrom=oltmanns.dev; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b=p5BOTlx7; arc=none smtp.client-ip=80.241.56.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oltmanns.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oltmanns.dev Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4TT9BJ5DfPz9swV; Mon, 5 Feb 2024 16:23:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1707146600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qC4mq/tsfLRuzLmRs5JjHQXl/DynYoHApRzxf1WL2uM=; b=p5BOTlx7BFzH5jfkDYpQViWSxKs5abIL8hm2KzHBy21+XzrQNcnG7drDYZmaNPxgoq6svd VOSQLdXUhkmNUjvvyni3MqpxfHJ9FfT9ALjLCZUljFNWk19ObC6iFsezdkutZunV5B8fHZ jB+XIXs90OYNf3K9Mt+jErTvhXbdBH2ROAKG4uAEMbwpQOo1819ukPoEBy4tBSRQqt/JOf 8anff4Wsl++LcK4cx5OCjA5bJWAMRppsY9M4jJCNb+xzJPwHfl2rW/S52m2QxEs4zPnOTp iljLh3JK+krTqxPfsWyMMUrjP6VeycUjCDdi+Autvy4D6dY/G0E7QW2NosNGUQ== From: Frank Oltmanns Date: Mon, 05 Feb 2024 16:22:29 +0100 Subject: [PATCH v2 6/6] arm64: dts: allwinner: a64: Fix minimum GPU OPP rate Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240205-pinephone-pll-fixes-v2-6-96a46a2d8c9b@oltmanns.dev> References: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> In-Reply-To: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> To: Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , =?utf-8?q?Guido_G=C3=BCnther?= , Purism Kernel Team , Ondrej Jirman , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Frank Oltmanns X-Developer-Signature: v=1; a=openpgp-sha256; l=1574; i=frank@oltmanns.dev; h=from:subject:message-id; bh=zwBfjIxPZERVFfsaNgpqFLdeiKWw7hboXJ6uRiKwYxM=; b=owEB7QES/pANAwAIAZppogiUStPHAcsmYgBlwP0/YywsMvB2h9f3zxar+UUpwxyriOAGKTLGS ZdrqQvmPRqJAbMEAAEIAB0WIQQC/SV7f5DmuaVET5aaaaIIlErTxwUCZcD9PwAKCRCaaaIIlErT x3RxDACBLK+cLnbt4nqBmvnVYYuwNDvDRxFAxO4EA3xfHnuyUi9obGXAhbHRwu5r0O73xHPRVNr 4Wom+6tBs3/fQuItFP79IP5TmiAFQrzSkoGLQ92bS5iXGhBEcIYFwlpkUXgOrCTqtXWypBAdp29 RAQI6ih2i6NilPU/cyy0Y+cdmz/NlslvlnloC2NIgNtCgna8EqxXVuznxxOIsfw70TXsMZa7FEL nG4hYb1xsmY98DZy2qeZA3OJNg+sXOyxL+J3Vey8KfaAx3NJdZ5eQo0RiwX/Lrvc/bOweP6oovx Bs8nYRM/GJ5zndYzn49FwuuIIzmtWco7Era813fL1BsSdT0EdMFQSE4b/7TqbKkE3zj9Xnq+9BD /P0du+E3yb6d8fHwBbUqfBL6QtBVwrxvsC68I5utxurpsD07McLUo54uaOBRrufJoJHceUfjGRV vGonUD0GohydlHH8bkAhELUd6IZTEOOawyGWyIOycvEhaBrM5Rmbdj1jFE/oBIptqjiM0= X-Developer-Key: i=frank@oltmanns.dev; a=openpgp; fpr=02FD257B7F90E6B9A5444F969A69A208944AD3C7 X-Rspamd-Queue-Id: 4TT9BJ5DfPz9swV X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790074895694687663 X-GMAIL-MSGID: 1790074895694687663 The PLL-GPU has a minimum rate of 192 MHz according to the A64 manual. If run at less than 192 MHz the pinephone (based on the A64) sometimes replays the last few frames that were displayed over and over (see first link below). Note, that running PLL-GPU at 240 MHz and using a divisor of 2 *should* circumvent this problem as well. But unfortunately, the GPU shows the erratic behaviour even more often, even though its parent is driven at a supported range. This might be due to a similar issue to the one observed on the Allwinner H6 (see second link). Running both the GPU and PLL-GPU at more then 192 MHz reduces the occurrenc of the issue. Therefore, increase the minimum rate in the GPU OPP table to 192 MHz. Link: https://gitlab.com/postmarketOS/pmaports/-/issues/805 Link: https://lore.kernel.org/linux-arm-kernel/2562485.k3LOHGUjKi@kista/T/ Signed-off-by: Frank Oltmanns --- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi index 57ac18738c99..448d7fbdd1a9 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi @@ -107,8 +107,8 @@ de: display-engine { gpu_opp_table: opp-table-gpu { compatible = "operating-points-v2"; - opp-120000000 { - opp-hz = /bits/ 64 <120000000>; + opp-192000000 { + opp-hz = /bits/ 64 <192000000>; }; opp-312000000 {