Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2462208imu; Mon, 19 Nov 2018 00:33:45 -0800 (PST) X-Google-Smtp-Source: AJdET5cDDCDuUw/KFwH0v+pz5Fy01xyOAhu0qyQRrkJCKeeBhx54VsbYzGBle14qWtuZ60NaPxYC X-Received: by 2002:a17:902:a81:: with SMTP id 1-v6mr21529185plp.20.1542616424928; Mon, 19 Nov 2018 00:33:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542616424; cv=none; d=google.com; s=arc-20160816; b=HY3qAnbGl3v/id7KQqJ3NoSCXile7lp84rkbHnHhTDZLVslIhCT3eFrDgbydh1okBB 2LkThi1QhUhyww025a4cogJjQVq6C0bnbEwmfKfQPhJMWX7SPStqw1fBQ9FfkQONy+lk CKr8jFa6K52x1h40zAn+WhaFs/gRClOQb6i1D94Zh5z1KuSulhG8/VvrB5TuvxL4wY9A mhdPMa6njFa7lz8ydMsBJKcB4RJDWBCLk4BUtopTdxpeSLV4hf+zZr7SqofRvdge4liZ fAIch6bjDBJzXt3vGb3f62kgElbdaEa8sCdjYrVtNK2FMcX06YEO+iYmlaVm6tUd/UFF v+7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=TrDi3zUHaoyvaegvF1IHygTCb/KU9UdbI82oVuuXgII=; b=shl/R8KAyhsJo3jIgT4hyis0c2GUjXDQdzoPUQzX56t4qHVhEYmPipgnJHRcecgicO DQeui7+JSoRMpE4kBQRwSq9OXU7B3bcCmDGn3d98rACqjKdHRCjJ2YBDMgz+lx8YXL5R F8QTGXw2Z7I7cRiv2iCHsA4cA9nr+wf2sK1htvYvnH9dxjYlc1uugJDjbnY7Xsbk6psr IKSfs0yF4AqCPNcBhQFNEtyA0wT6ODkecEU28fH/zavlJpKeR8xDyXHJZ1cCMcGydYbo wwiWhSY8hFPzkXJXJhLxZrMbxi0hmaGjwz51ZlRqM1MCeV2VQlEOfHxzaRegjwnzO5HR CpKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d37-v6si39687785plb.167.2018.11.19.00.33.30; Mon, 19 Nov 2018 00:33:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727314AbeKSSzl (ORCPT + 99 others); Mon, 19 Nov 2018 13:55:41 -0500 Received: from mail.bootlin.com ([62.4.15.54]:37238 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727010AbeKSSzk (ORCPT ); Mon, 19 Nov 2018 13:55:40 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id A8F6A20CFD; Mon, 19 Nov 2018 09:32:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (aaubervilliers-681-1-13-146.w90-88.abo.wanadoo.fr [90.88.134.146]) by mail.bootlin.com (Postfix) with ESMTPSA id 776612039F; Mon, 19 Nov 2018 09:32:43 +0100 (CET) Date: Mon, 19 Nov 2018 09:32:43 +0100 From: Maxime Ripard To: Jagan Teki Cc: Maarten Lankhorst , Sean Paul , David Airlie , Rob Herring , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Thierry Reding , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Trimarchi , TL Lim , linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Subject: Re: [PATCH v2 04/12] drm/sun4i: sun6i_mipi_dsi: Simplify drq set to support all modes Message-ID: <20181119083243.4njj2p2sy2xf2zyf@flea> References: <20181116163916.29621-1-jagan@amarulasolutions.com> <20181116163916.29621-5-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xic26kum5qm77vqt" Content-Disposition: inline In-Reply-To: <20181116163916.29621-5-jagan@amarulasolutions.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --xic26kum5qm77vqt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 16, 2018 at 10:09:08PM +0530, Jagan Teki wrote: > Allwinner MIPI DSI DRQ set value can be varied with respective > video modes. > - burst mode the set value is always 0 > - video modes whose front porch greater than 20, the set value > can be computed based front porch and bpp. > - video modes whose front porch is not greater than 20, the set value > is simply 0 >=20 > This patch simplifies existing drq set value code by grouping > into sun6i_dsi_get_drq and support all video modes. >=20 > Signed-off-by: Jagan Teki > --- > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 38 ++++++++++++++++---------- > 1 file changed, 23 insertions(+), 15 deletions(-) >=20 > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun= 4i/sun6i_mipi_dsi.c > index efd08bfd0cb8..d60955880c43 100644 > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > @@ -363,6 +363,26 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *ds= i, > SUN6I_DSI_INST_JUMP_CFG_NUM(1)); > }; > =20 > +static int sun6i_dsi_get_drq(struct sun6i_dsi *dsi, > + struct drm_display_mode *mode) > +{ > + struct mipi_dsi_device *device =3D dsi->device; > + int drq =3D 0; So, here, you declaring a variable called drq, set to 0. > + if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) > + return drq; That you return here. You could just return 0, to be clearer. > + if ((mode->hsync_start - mode->hdisplay) > 20) { > + /* Maaaaaagic */ > + u16 drq =3D (mode->hsync_start - mode->hdisplay) - 20; You re-declare a variable with the same name here, but a different type.... > + drq *=3D mipi_dsi_pixel_format_to_bpp(device->format); > + drq /=3D 32; > + } > + > + return drq; And then return the first one? How is that even working? > + > static u16 sun6i_dsi_get_timings_vblk(struct sun6i_dsi *dsi, > struct drm_display_mode *mode, u16 hblk) > { > @@ -478,21 +498,9 @@ static u16 sun6i_dsi_get_video_start_delay(struct su= n6i_dsi *dsi, > static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, > struct drm_display_mode *mode) > { > - struct mipi_dsi_device *device =3D dsi->device; > - u32 val =3D 0; > - > - if ((mode->hsync_start - mode->hdisplay) > 20) { > - /* Maaaaaagic */ > - u16 drq =3D (mode->hsync_start - mode->hdisplay) - 20; > - > - drq *=3D mipi_dsi_pixel_format_to_bpp(device->format); > - drq /=3D 32; > - > - val =3D (SUN6I_DSI_TCON_DRQ_ENABLE_MODE | > - SUN6I_DSI_TCON_DRQ_SET(drq)); > - } > - > - regmap_write(dsi->regs, SUN6I_DSI_TCON_DRQ_REG, val); > + regmap_write(dsi->regs, SUN6I_DSI_TCON_DRQ_REG, > + SUN6I_DSI_TCON_DRQ_ENABLE_MODE | > + SUN6I_DSI_TCON_DRQ_SET(sun6i_dsi_get_drq(dsi, mode))); On top of that, you now enable the DRQ stuff all the time, while it was conditional before. --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --xic26kum5qm77vqt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCW/J1KwAKCRDj7w1vZxhR xWZZAPwIptQE4vTx5lH3nECBMHT77qQdWrR5HLWWifK0PzUfswEA473gEJF8qMPR aZD2c/c5xY4at4eU8jxNkiytdl/ENg4= =dwiT -----END PGP SIGNATURE----- --xic26kum5qm77vqt--