Message ID | 20231218-pinephone-pll-fixes-v1-4-e238b6ed6dc1@oltmanns.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-3751-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1243476dyi; Mon, 18 Dec 2023 05:36:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgL+MqJ3GNKbsPPz24g86qef6dz6IvW1SnAOwY40avun8x1KCmQqPRYMjWN5YGdIsbgB24 X-Received: by 2002:a0c:ec01:0:b0:67a:d255:72c2 with SMTP id y1-20020a0cec01000000b0067ad25572c2mr16945716qvo.67.1702906608977; Mon, 18 Dec 2023 05:36:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702906608; cv=none; d=google.com; s=arc-20160816; b=B79Ayqph7Ju6GDSEvFLZWKIhU2CXu5LHPi4H8GwDn/WZi5irh8X6UsNz5PhyR4Z9vB /zAGGy51kidM6TNzJfWzvikrN+Pw4zMOChCBnJASiIxV5ZzKuBfyHYXArnv1zQr4a09m +6c6h1Ja9awEgm0g8bbmxG+m6P9x9dGsWeepB+VHGy8lmwBgq41j+b7rm1umCjeO/ysH KI5k0oBr9BmlSD9hi0JX0ctk7acuYlzay+JHc8IMmUeb1I5RQD2tNCng50NwwnuiXZu6 KD6cZ/6q2WbO60FBOl+cT5KBsIpca89RnArP57RuPHbtE2BuRJ7NwFfLg0wm/jfO+yeQ VEwA== ARC-Message-Signature: i=1; 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=3knn0KnfHEWgYWaadr1J0evJJiSgFisyuPOwfE6u7RA=; fh=Cik4nBs1VMxe7SDk4FjLPu75elh3pWslp9/ZGKW1BWs=; b=lWeTK3hEH+IaxM9GiVW7YKewhlAmb3a8RFvWZy90IZI4PY0QOt2lioSh/NIUq2xCCa VUL5gmHtV7FASJYXazjp2V7eRhZNYeUIFgyTch5HYQ3zDRy/bxyBeeVw1F0w0QlAoPcu qbQMerjuwWjR9GknRvhlicoax7DBQPqDvoD4XLeIxw2g67MHYTaBg+GeHfBHUcFSFvcd kVms0Z/YcKkdLFRlN4zGvB0w5ck0cWgPC/PI0bCppOMb6YZhMSZcVt084sgA6zzUtm6X Xj2obu/Z10bkqjIUVjz+b33ftSsVecLyA3YfmQa//EbPqtUOKVWvhSqcpYaZore8/yG0 ZuVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=WB3Doh5k; spf=pass (google.com: domain of linux-kernel+bounces-3751-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3751-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m16-20020a0cdb90000000b0067f0c7bd16dsi4591302qvk.162.2023.12.18.05.36.48 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 05:36:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3751-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=WB3Doh5k; spf=pass (google.com: domain of linux-kernel+bounces-3751-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3751-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C16C51C23E88 for <ouuuleilei@gmail.com>; Mon, 18 Dec 2023 13:36:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 94E851D158; Mon, 18 Dec 2023 13:36:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oltmanns.dev header.i=@oltmanns.dev header.b="WB3Doh5k" X-Original-To: linux-kernel@vger.kernel.org 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 CA8751D136; Mon, 18 Dec 2023 13:36:16 +0000 (UTC) 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 smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (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 4Sv17K2gCpz9ssY; Mon, 18 Dec 2023 14:36:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1702906573; 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=3knn0KnfHEWgYWaadr1J0evJJiSgFisyuPOwfE6u7RA=; b=WB3Doh5kKvL3k78nLJhWQFOk2fz64k4yLEVREuaYRL11WlmELNwJnVC4VMp90rfJ9MZ2ul dwbxOOckPhBVugw1Ja6zntM4xHkDYJxoYuCCiMKf25IhBnGbatVlzdZ/Bf7xBrFc3LYAjb UMkcloU9B44sJ+gLt0SAZXQKoBJmYDlhlDcN3bO6DvFaEjlsPdEuuneqRGEsUoErAJ0abH OrAFgyWCw2AEl6N/62c+eiR7zKJioQZTXYnnOKFp4gmZ7Uen2i+G7rtAASgJsQcJRZCbsH RzSxFpyKaGjap7H2pCuAxGqJ6PZetOb6i+qumcyTlMFXn51HRrIJBKQW1midvw== From: Frank Oltmanns <frank@oltmanns.dev> Date: Mon, 18 Dec 2023 14:35:22 +0100 Subject: [PATCH 4/5] clk: sunxi-ng: a64: Add constraints on PLL-VIDEO0's n/m ratio Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231218-pinephone-pll-fixes-v1-4-e238b6ed6dc1@oltmanns.dev> References: <20231218-pinephone-pll-fixes-v1-0-e238b6ed6dc1@oltmanns.dev> In-Reply-To: <20231218-pinephone-pll-fixes-v1-0-e238b6ed6dc1@oltmanns.dev> To: Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Chen-Yu Tsai <wens@csie.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org>, =?utf-8?q?Guido_G=C3=BCnther?= <agx@sigxcpu.org>, Purism Kernel Team <kernel@puri.sm>, Ondrej Jirman <megi@xff.cz>, Neil Armstrong <neil.armstrong@linaro.org>, Jessica Zhang <quic_jesszhan@quicinc.com>, Sam Ravnborg <sam@ravnborg.org>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch> 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, Frank Oltmanns <frank@oltmanns.dev> X-Developer-Signature: v=1; a=openpgp-sha256; l=1435; i=frank@oltmanns.dev; h=from:subject:message-id; bh=jj1kC8r64WXDg1/5wbxM9P8hCH8A2GebZKvM1vIvFPo=; b=owEB7QES/pANAwAIAZppogiUStPHAcsmYgBlgEq1xinOlh9sftstb32086w7Ky1jm6/lGaxZ5 NrpDnJiE4+JAbMEAAEIAB0WIQQC/SV7f5DmuaVET5aaaaIIlErTxwUCZYBKtQAKCRCaaaIIlErT x93iC/9GPVPladgryx1JLV+61g8cBhKv2Cudg3FL/5IIT/LP93v+OTcSmNzjfcQNGNz1czgvP3P m2srxWLpJXHtskjrNSrFM2K16MDEUHig33MfYl1n8Q4vN0taaY+bLFbKlFKZjhuMvuQte12QG1m oRbq5Gm6B1ss/VIjAksUn+QzzMjHz0xlllP894PtmNR7yrfYU7eBdvEnV1xx53Q0nVuWFfww7AZ dTdG+1RiE4j68NAnJtiB4E4nni7OITmxS1es1FK4UDLC/38jSLl2FjGkvv+kLLwAJGRcmVt49PS vIRWeslKFohfcV7CJDoVhuKX1vExq6PBoTiB94VCmo3DgsIJPgZ6k/XusI2eFYQxpaEuQcYhzFD bwSOtn2l6ZGTf+nCqnTLltr3qAFY/flWypH1qs1fNzWOHtXZoPBpct6xJU3pEe0XPkA9tpQmUPk RsrQui/HQyrioIOF9OI+iJFPG9ZxK8J0p0xV3Zx0ABNPxg6fDgalK/l4zkxh1LeH5WwHA= X-Developer-Key: i=frank@oltmanns.dev; a=openpgp; fpr=02FD257B7F90E6B9A5444F969A69A208944AD3C7 X-Rspamd-Queue-Id: 4Sv17K2gCpz9ssY X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785627000249398507 X-GMAIL-MSGID: 1785627000249398507 |
Series |
Pinephone video out fixes (flipping between two frames)
|
|
Commit Message
Frank Oltmanns
Dec. 18, 2023, 1:35 p.m. UTC
The Allwinner A64 manual lists the following constraint for the
PLL-VIDEO0 clock: 8 <= N/M <= 25
Use this constraint.
Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
---
drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Comments
Dne ponedeljek, 18. december 2023 ob 14:35:22 CET je Frank Oltmanns napisal(a): > The Allwinner A64 manual lists the following constraint for the > PLL-VIDEO0 clock: 8 <= N/M <= 25 > > Use this constraint. > > Signed-off-by: Frank Oltmanns <frank@oltmanns.dev> > --- > drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > index c034ac027d1c..75d839da446c 100644 > --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > @@ -68,7 +68,8 @@ static SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", > BIT(28), /* lock */ > CLK_SET_RATE_UNGATE); > > -static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-video0", > +static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT_NM_RATIO(pll_video0_clk, > + "pll-video0", > "osc24M", 0x010, > 192000000, /* Minimum rate */ > 1008000000, /* Maximum rate */ > @@ -80,7 +81,10 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-vid > 297000000, /* frac rate 1 */ > BIT(31), /* gate */ > BIT(28), /* lock */ > - CLK_SET_RATE_UNGATE); > + CLK_SET_RATE_UNGATE, > + CCU_FEATURE_FRACTIONAL | > + CCU_FEATURE_CLOSEST_RATE, Above flags are unrelated change, put them in new patch if needed. Best regards, Jernej > + 8, 25); /* min/max nm ratio */ > > static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", > "osc24M", 0x018, > >
On 2023-12-19 at 17:54:19 +0100, Jernej Škrabec <jernej.skrabec@gmail.com> wrote: > Dne ponedeljek, 18. december 2023 ob 14:35:22 CET je Frank Oltmanns napisal(a): >> The Allwinner A64 manual lists the following constraint for the >> PLL-VIDEO0 clock: 8 <= N/M <= 25 >> >> Use this constraint. >> >> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev> >> --- >> drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c >> index c034ac027d1c..75d839da446c 100644 >> --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c >> +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c >> @@ -68,7 +68,8 @@ static SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", >> BIT(28), /* lock */ >> CLK_SET_RATE_UNGATE); >> >> -static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-video0", >> +static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT_NM_RATIO(pll_video0_clk, >> + "pll-video0", >> "osc24M", 0x010, >> 192000000, /* Minimum rate */ >> 1008000000, /* Maximum rate */ >> @@ -80,7 +81,10 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-vid >> 297000000, /* frac rate 1 */ >> BIT(31), /* gate */ >> BIT(28), /* lock */ >> - CLK_SET_RATE_UNGATE); >> + CLK_SET_RATE_UNGATE, >> + CCU_FEATURE_FRACTIONAL | >> + CCU_FEATURE_CLOSEST_RATE, > > Above flags are unrelated change, put them in new patch if needed. You might notice that I am using a new macro for initializing the pll_video0_clk struct: New: SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT_NM_RATIO Old: SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST Setting the two CCU_FEATURE flags is part of the old initialization macro. I'll add SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_NM_RATIO_CLOSEST which hopefully resolves the confusion. Thanks, Frank > > Best regards, > Jernej > >> + 8, 25); /* min/max nm ratio */ >> >> static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", >> "osc24M", 0x018, >> >>
Dne sreda, 20. december 2023 ob 08:09:28 CET je Frank Oltmanns napisal(a): > > On 2023-12-19 at 17:54:19 +0100, Jernej Škrabec <jernej.skrabec@gmail.com> wrote: > > Dne ponedeljek, 18. december 2023 ob 14:35:22 CET je Frank Oltmanns napisal(a): > >> The Allwinner A64 manual lists the following constraint for the > >> PLL-VIDEO0 clock: 8 <= N/M <= 25 > >> > >> Use this constraint. > >> > >> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev> > >> --- > >> drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 8 ++++++-- > >> 1 file changed, 6 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > >> index c034ac027d1c..75d839da446c 100644 > >> --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > >> +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > >> @@ -68,7 +68,8 @@ static SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", > >> BIT(28), /* lock */ > >> CLK_SET_RATE_UNGATE); > >> > >> -static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-video0", > >> +static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT_NM_RATIO(pll_video0_clk, > >> + "pll-video0", > >> "osc24M", 0x010, > >> 192000000, /* Minimum rate */ > >> 1008000000, /* Maximum rate */ > >> @@ -80,7 +81,10 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-vid > >> 297000000, /* frac rate 1 */ > >> BIT(31), /* gate */ > >> BIT(28), /* lock */ > >> - CLK_SET_RATE_UNGATE); > >> + CLK_SET_RATE_UNGATE, > >> + CCU_FEATURE_FRACTIONAL | > >> + CCU_FEATURE_CLOSEST_RATE, > > > > Above flags are unrelated change, put them in new patch if needed. > > You might notice that I am using a new macro for initializing the > pll_video0_clk struct: > New: SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT_NM_RATIO > Old: SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST > > Setting the two CCU_FEATURE flags is part of the old initialization > macro. > > I'll add SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_NM_RATIO_CLOSEST which > hopefully resolves the confusion. I'm in doubt if we need so many macros. How many users of these macro we'll have? I see that R40 SoC would also need same ratio limits, but other that that, none? Best regards, Jernej > > Thanks, > Frank > > > > > Best regards, > > Jernej > > > >> + 8, 25); /* min/max nm ratio */ > >> > >> static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", > >> "osc24M", 0x018, > >> > >> >
On 2023-12-20 at 16:12:42 +0100, Jernej Škrabec <jernej.skrabec@gmail.com> wrote: > Dne sreda, 20. december 2023 ob 08:09:28 CET je Frank Oltmanns napisal(a): >> >> On 2023-12-19 at 17:54:19 +0100, Jernej Škrabec <jernej.skrabec@gmail.com> wrote: >> > Dne ponedeljek, 18. december 2023 ob 14:35:22 CET je Frank Oltmanns napisal(a): >> >> The Allwinner A64 manual lists the following constraint for the >> >> PLL-VIDEO0 clock: 8 <= N/M <= 25 >> >> >> >> Use this constraint. >> >> >> >> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev> >> >> --- >> >> drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 8 ++++++-- >> >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> >> >> diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c >> >> index c034ac027d1c..75d839da446c 100644 >> >> --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c >> >> +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c >> >> @@ -68,7 +68,8 @@ static SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", >> >> BIT(28), /* lock */ >> >> CLK_SET_RATE_UNGATE); >> >> >> >> -static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-video0", >> >> +static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT_NM_RATIO(pll_video0_clk, >> >> + "pll-video0", >> >> "osc24M", 0x010, >> >> 192000000, /* Minimum rate */ >> >> 1008000000, /* Maximum rate */ >> >> @@ -80,7 +81,10 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-vid >> >> 297000000, /* frac rate 1 */ >> >> BIT(31), /* gate */ >> >> BIT(28), /* lock */ >> >> - CLK_SET_RATE_UNGATE); >> >> + CLK_SET_RATE_UNGATE, >> >> + CCU_FEATURE_FRACTIONAL | >> >> + CCU_FEATURE_CLOSEST_RATE, >> > >> > Above flags are unrelated change, put them in new patch if needed. >> >> You might notice that I am using a new macro for initializing the >> pll_video0_clk struct: >> New: SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT_NM_RATIO >> Old: SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST >> >> Setting the two CCU_FEATURE flags is part of the old initialization >> macro. >> >> I'll add SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_NM_RATIO_CLOSEST which >> hopefully resolves the confusion. > > I'm in doubt if we need so many macros. How many users of these macro we'll have? > I see that R40 SoC would also need same ratio limits, but other that that, none? Ok, IIUC no additional macro and we keep this part of the patch as is. Best regards, Frank > > Best regards, > Jernej > >> >> Thanks, >> Frank >> >> > >> > Best regards, >> > Jernej >> > >> >> + 8, 25); /* min/max nm ratio */ >> >> >> >> static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", >> >> "osc24M", 0x018, >> >> >> >> >>
On 2023-12-19 at 17:54:19 +0100, Jernej Škrabec <jernej.skrabec@gmail.com> wrote: > Dne ponedeljek, 18. december 2023 ob 14:35:22 CET je Frank Oltmanns napisal(a): >> The Allwinner A64 manual lists the following constraint for the >> PLL-VIDEO0 clock: 8 <= N/M <= 25 >> >> Use this constraint. >> >> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev> >> --- >> drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c >> index c034ac027d1c..75d839da446c 100644 >> --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c >> +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c >> @@ -68,7 +68,8 @@ static SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", >> BIT(28), /* lock */ >> CLK_SET_RATE_UNGATE); >> >> -static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-video0", >> +static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT_NM_RATIO(pll_video0_clk, >> + "pll-video0", >> "osc24M", 0x010, >> 192000000, /* Minimum rate */ >> 1008000000, /* Maximum rate */ I just realized that adding the whole ratio limits for ccu_nm is superfluous as you could just as well express them in for of a minimum and maximum range: Since 8 <= N/M <= 25 and parent_rate = 24 MHz, therefore 192 MHz <= rate <= 600 MHz. These absolute limits are also listed in Allwinner's A64 manual. BUT, here the upper limit was raised to 1008 MHz: 5de39acaf34604bd04834f092479cf4dcc946dd "clk: sunxi-ng: a64: Add max. rate constraint to video PLL" With this upper limit the ratio limitation is effectively: 8 <= N/M <= 42 Icenowy Zheng (added to CC) had the reasonable explanation that this was used in the BSP kernel, so we should probably stick to that and ditch the two PLL-VIDEO0 related patches. What are your thoughts on that? >> @@ -80,7 +81,10 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-vid >> 297000000, /* frac rate 1 */ >> BIT(31), /* gate */ >> BIT(28), /* lock */ >> - CLK_SET_RATE_UNGATE); >> + CLK_SET_RATE_UNGATE, >> + CCU_FEATURE_FRACTIONAL | >> + CCU_FEATURE_CLOSEST_RATE, > > Above flags are unrelated change, put them in new patch if needed. > > Best regards, > Jernej > >> + 8, 25); /* min/max nm ratio */ >> >> static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", >> "osc24M", 0x018, >> >>
Dne nedelja, 31. december 2023 ob 10:10:40 CET je Frank Oltmanns napisal(a): > > On 2023-12-19 at 17:54:19 +0100, Jernej Škrabec <jernej.skrabec@gmail.com> wrote: > > Dne ponedeljek, 18. december 2023 ob 14:35:22 CET je Frank Oltmanns napisal(a): > >> The Allwinner A64 manual lists the following constraint for the > >> PLL-VIDEO0 clock: 8 <= N/M <= 25 > >> > >> Use this constraint. > >> > >> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev> > >> --- > >> drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 8 ++++++-- > >> 1 file changed, 6 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > >> index c034ac027d1c..75d839da446c 100644 > >> --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > >> +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c > >> @@ -68,7 +68,8 @@ static SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", > >> BIT(28), /* lock */ > >> CLK_SET_RATE_UNGATE); > >> > >> -static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-video0", > >> +static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT_NM_RATIO(pll_video0_clk, > >> + "pll-video0", > >> "osc24M", 0x010, > >> 192000000, /* Minimum rate */ > >> 1008000000, /* Maximum rate */ > > I just realized that adding the whole ratio limits for ccu_nm is > superfluous as you could just as well express them in for of a minimum > and maximum range: > Since 8 <= N/M <= 25 and parent_rate = 24 MHz, therefore > 192 MHz <= rate <= 600 MHz. Good point! > > These absolute limits are also listed in Allwinner's A64 manual. > > BUT, here the upper limit was raised to 1008 MHz: > 5de39acaf34604bd04834f092479cf4dcc946dd "clk: sunxi-ng: a64: Add max. > rate constraint to video PLL" > > With this upper limit the ratio limitation is effectively: > 8 <= N/M <= 42 > > Icenowy Zheng (added to CC) had the reasonable explanation that this was > used in the BSP kernel, so we should probably stick to that and ditch > the two PLL-VIDEO0 related patches. What are your thoughts on that? Ok, it seems that these patches are really superfluous. Remove them for v2. Best regards, Jernej > > >> @@ -80,7 +81,10 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-vid > >> 297000000, /* frac rate 1 */ > >> BIT(31), /* gate */ > >> BIT(28), /* lock */ > >> - CLK_SET_RATE_UNGATE); > >> + CLK_SET_RATE_UNGATE, > >> + CCU_FEATURE_FRACTIONAL | > >> + CCU_FEATURE_CLOSEST_RATE, > > > > Above flags are unrelated change, put them in new patch if needed. > > > > Best regards, > > Jernej > > > >> + 8, 25); /* min/max nm ratio */ > >> > >> static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", > >> "osc24M", 0x018, > >> > >> >
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c index c034ac027d1c..75d839da446c 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c @@ -68,7 +68,8 @@ static SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", BIT(28), /* lock */ CLK_SET_RATE_UNGATE); -static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-video0", +static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT_NM_RATIO(pll_video0_clk, + "pll-video0", "osc24M", 0x010, 192000000, /* Minimum rate */ 1008000000, /* Maximum rate */ @@ -80,7 +81,10 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST(pll_video0_clk, "pll-vid 297000000, /* frac rate 1 */ BIT(31), /* gate */ BIT(28), /* lock */ - CLK_SET_RATE_UNGATE); + CLK_SET_RATE_UNGATE, + CCU_FEATURE_FRACTIONAL | + CCU_FEATURE_CLOSEST_RATE, + 8, 25); /* min/max nm ratio */ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve", "osc24M", 0x018,