Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1571020

Re: [PATCH v3 17/24] drm/rockchip: dw-mipi-dsi: improve PLL configuration

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Sean Paul <seanpaul@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3 17/24] drm/rockchip: dw-mipi-dsi: improve PLL configuration
Date Tue, 31 Jan 2017 20:20:03 +0100
Message-ID <t5M8a-4ww-25@gated-at.bofh.it> (permalink)
References <t4Yl3-811-7@gated-at.bofh.it> <t4ZqO-cH-29@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mRgZ/JZgWM5uyrqB7GPN/tpzP96F8aoYfl67RgwP1F4=; b=OZ4SuC4H1jplnLvy6AKnNfLkW6jJ9OzTKXU5TY7jjTNLfFq/o4oXhtPabTNfHAX1gO sZ6Ywi75YG6Ab6dvLxkQDKyoZ3R+TWJoUlzw5h+mtsvSOt6thJOPllJOaQlSz90RbvRp hujgW2FFLGhWDMRq1orf8/jNTCmVAKeZRMBB4=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mRgZ/JZgWM5uyrqB7GPN/tpzP96F8aoYfl67RgwP1F4=; b=b9OR2arUCuKm3veZzUB5j7z6nYN+z75kpeOBi3qGCmmSi3hOQ4MAoJ1YjlYKBmj3C5 nKvzpkjlpqhJyHLhSw0WDiZL6LTJepejvQ4FaNsj+/5hE4duO0YEwhqAm5yHuBryqbRI aIQJh1vzGh73rR6Z80fSQ/rJ2TjNNNk7ABJNZYVEcV6S3OF//S7lmn+q0BABgmbYnQ1L BCbk0NeVUK8wQsscyxW9KsaXtNH6eUxvA0isRXa2iJn5amrA0pOMAZOlcaurjKsqtDpq 8S7yM18p+p03Zlx6sA+ltItgpkFbCE3oUdxQttZTJc/0QCrn9OAXYyeNbgxzDnzdwJhg AU9Q==
X-Gm-Message-State AIkVDXIfphIS7+q+L81cvgkZjcCEQnXdhg4x3lAnVcIIgU7V//7xOMlVKq37stI9WMxprc/+
X-Received by 10.55.97.207 with SMTP id v198mr30927520qkb.242.1485889434715; Tue, 31 Jan 2017 11:03:54 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.21 (2010-09-15)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 60
Organization linux.* mail to news gateway
X-Original-Cc Mark Yao <mark.yao@rock-chips.com>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Chris Zhong <zyw@rock-chips.com>, linux-arm-kernel@lists.infradead.org
X-Original-Date Tue, 31 Jan 2017 14:03:52 -0500
X-Original-Message-ID <20170131190352.GB20076@art_vandelay>
X-Original-References <20170129132444.25251-1-john@metanate.com> <20170129132444.25251-18-john@metanate.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1571020

Show key headers only | View raw


On Sun, Jan 29, 2017 at 01:24:37PM +0000, John Keeping wrote:
> The multiplication ratio for the PLL is required to be even due to the
> use of a "by 2 pre-scaler".  Currently we are likely to end up with an
> odd multiplier even though there is an equivalent set of parameters with
> an even multiplier.
> 
> For example, using the 324MHz bit rate with a reference clock of 24MHz
> we end up with M = 27, N = 2 whereas the example in the PHY databook
> gives M = 54, N = 4 for this bit rate and reference clock.
> 
> By walking down through the available multiplier instead of up we are
> more likely to hit an even multiplier.  With the above example we do now
> get M = 54, N = 4 as given by the databook.
> 
> While doing this, change the loop limits to encode the actual limits on
> the divisor, which are:
> 
> 	40MHz >= (pllref / N) >= 5MHz
> 
> Signed-off-by: John Keeping <john@metanate.com>
> ---
> Unchanged in v3
> Unchanged in v2
> 
>  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> index 85edf6dd2bac..dcb66a21e1f1 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> @@ -522,7 +522,7 @@ static int dw_mipi_dsi_get_lane_bps(struct dw_mipi_dsi *dsi,
>  	pllref = DIV_ROUND_UP(clk_get_rate(dsi->pllref_clk), USEC_PER_SEC);
>  	tmp = pllref;
>  
> -	for (i = 1; i < 6; i++) {
> +	for (i = pllref / 5; i > (pllref / 40); i--) {

I've convinced myself that this is right, but it took reading through the commit
message a few times. I think this code would benefit greatly from a comment so
readers don't need to go through git history.

With that,

Reviewed-by: Sean Paul <seanpaul@chromium.org>


>  		pre = pllref / i;
>  		if ((tmp > (target_mbps % pre)) && (target_mbps / pre < 512)) {
>  			tmp = target_mbps % pre;
> -- 
> 2.11.0.197.gb556de5.dirty
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v3 17/24] drm/rockchip: dw-mipi-dsi: improve PLL  configuration Sean Paul <seanpaul@chromium.org> - 2017-01-31 20:20 +0100

csiph-web