From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3DECC43381 for ; Mon, 4 Mar 2019 15:55:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0F14206B8 for ; Mon, 4 Mar 2019 15:55:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y5KLQh/9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0F14206B8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Digimzv9X1dbdRkeNQTIYJ2DfQPTVCKnjo5sP0y6kTc=; b=Y5KLQh/9iHjIH8+ab5K8jirdZ otxTwnhpS/7JizvFTUxIVAthtiFcKZT3pZKxMZt386kHs2g0R3Pw0QLUQXkDWQm5IRcp/Hz1a9qc6 hEI/9tCSH7nVOWWAb6KBLxCderv37WpwKmiIp7MzPRfwluPVsCFKR2SHeVBnxZ505NYYLmiqu43Wf I4OrfzveSKL/cRb6CaYK72oFrNIwkmv0QBkawLs5QIAVmx6J9vxpyjud5zr6oW2ofqNs4zhMlYzvl BSP3I4zp8WkFJH6pc6yqp0Yk0TQ5hZ3VjRyp6n0rsvC+uHH+7vWGc3sCbDpXTS6hXNQeFyI2iubwN jB5E5kFCg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h0pvg-0000bh-O6; Mon, 04 Mar 2019 15:55:00 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h0pvc-0000b7-IR for linux-arm-kernel@lists.infradead.org; Mon, 04 Mar 2019 15:54:58 +0000 X-Originating-IP: 185.94.189.188 Received: from localhost (unknown [185.94.189.188]) (Authenticated sender: maxime.ripard@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 24FB6E001C; Mon, 4 Mar 2019 15:54:44 +0000 (UTC) Date: Mon, 4 Mar 2019 16:54:44 +0100 From: Maxime Ripard To: Jagan Teki Subject: Re: [PATCH v9 1/5] drm/sun4i: sun6i_mipi_dsi: Fix hsync_porch overflow Message-ID: <20190304155444.rwslksn57uggpazw@flea> References: <20190303173527.31055-1-jagan@amarulasolutions.com> <20190303173527.31055-2-jagan@amarulasolutions.com> MIME-Version: 1.0 In-Reply-To: <20190303173527.31055-2-jagan@amarulasolutions.com> User-Agent: NeoMutt/20180716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190304_075456_760720_2CDA9F84 X-CRM114-Status: GOOD ( 18.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Chen-Yu Tsai , Daniel Vetter , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============5216275164328302641==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============5216275164328302641== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mr4wnokcjpwb6vbq" Content-Disposition: inline --mr4wnokcjpwb6vbq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 03, 2019 at 11:05:23PM +0530, Jagan Teki wrote: > Loop N1 instruction delay for burst mode devices are computed > based on horizontal sync and porch timing values. >=20 > The current driver is using u16 type for computing this hsync_porch > value, which would failed to fit within the u16 type for large sync > and porch timings devices. This would result in hsync_porch overflow > and eventually computed wrong instruction delay value. >=20 > Example, timings, where it produces the overflow > { > .hdisplay =3D 1080, > .hsync_start =3D 1080 + 408, > .hsync_end =3D 1080 + 408 + 4, > .htotal =3D 1080 + 408 + 4 + 38, > } >=20 > It reproduces the desired delay value 65487 but the correct working > value should be 7. >=20 > So, Fix it by computing hsync_porch value separately with u32 type. >=20 > Fixes: 1c1a7aa3663c ("drm/sun4i: dsi: Add burst support") > Signed-off-by: Jagan Teki > Tested-by: Merlijn Wajer > --- > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun= 4i/sun6i_mipi_dsi.c > index 6ff585055a07..465e7fc57899 100644 > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > @@ -457,8 +457,9 @@ static void sun6i_dsi_setup_inst_loop(struct sun6i_ds= i *dsi, > u16 delay =3D 50 - 1; > =20 > if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) { > - delay =3D (mode->htotal - mode->hdisplay) * 150; > - delay /=3D (mode->clock / 1000) * 8; > + u32 hsync_porch =3D (mode->htotal - mode->hdisplay); > + > + delay =3D ((hsync_porch * 150) / ((mode->clock / 1000) * 8)); shouldn't we keep the multiplication by 150 in the u32 assignation? Otherwise, we could keep a u16 for the delay Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --mr4wnokcjpwb6vbq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXH1KRAAKCRDj7w1vZxhR xZafAQD6uiqAMuKggWx309kfrFfKHuWFY/3zVKpCznVU6qqbZAD/bOyu/0FojYfa dEwRdepXajH5hSDlAoKHVG4fWH4itAQ= =3ZL1 -----END PGP SIGNATURE----- --mr4wnokcjpwb6vbq-- --===============5216275164328302641== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============5216275164328302641==--