From patchwork Sun May 12 18:41:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 409 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B49E03F033 for ; Sun, 12 May 2019 20:41:48 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id d10sf6890813plo.12 for ; Sun, 12 May 2019 11:41:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1557686507; cv=pass; d=google.com; s=arc-20160816; b=ZOyH9geHfUKdro0c5AgoXKX1qLQOxj7hpp1SMj6i+lDKkrbHNlTeVpc1qT6ZazLOl4 3YYcz5Ms48O6dR9AlmlWQhX7c1puQjdxsstrAvLeP5U+ss6G/FqbYyfnLJa92POypXFK sFMNmgU7CtY26CAOdjjG5djyFfpgdyVII+ruRBKu0igo7s09uf2UKK4qpiayCZW6y0EO RXXEe+BCiBHvKeV91LnrT45wyfqR5+xgHEiOkw6JB+VtTDy2uw38Wa9408XrtCTi0TNU 5623Wh3hpfRvuvVQFceK6cnWFgJ0//IZJhu5W/pGSa9P5rWShuvJVXQPARyNSaOgKgon x65Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=SwdbRpKzRS+xiHl1QvtU0L9EeJmAZyN+a2QBGiqDyUM=; b=FNLdmvdtDMDZaAYLKEt+q/zL+spDVBKdqzqDBbBfBLWxfIPq/baVi4BntsBBW3i2i4 PjEsGq5e703Tn+eySQEOaWFueFC1Fs6VbZ0JXuixVN+cz0vvEdmzgaokGwDoXG+2A4fC FCxekCmkKq/2F5Vk+MpmspR9D6S0uz2HLJrL15MwbBhqAi/OJ9nN2ZznmAthen92iroa g6upavSUfyBXkWttuZ/sY8fu/eJLqrCWOmC0PBgvdBdCgSj9ETrY0WXYEW1VwedIufxX +cdYtF5yY4/FWUUvJO8Px3c0fekTquSMppnGawoSyHlwGnjKLZFsQiS4lVtpcwuSKzhr +4sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SVFjdqYS; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=SwdbRpKzRS+xiHl1QvtU0L9EeJmAZyN+a2QBGiqDyUM=; b=jAs8fkNkaulL3CSNaPXRUm/tReCHaw0FT5blGIaOZG7/CetM/ggPxkQNkaDoHpvC8M Mm5U6vRstVXP0JYUz+WgVWx2/DE92BsP6HnjRqv5JqjM6untS6XXSbCAILKGYRJ9f1E2 rfVEvWkVHxuGGwWCdHSA/fA+fX07ES2rjyDTg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=SwdbRpKzRS+xiHl1QvtU0L9EeJmAZyN+a2QBGiqDyUM=; b=dKnEyZpCido5Ib02ucObpluI972tLHacVoFiVALQnodux2JAR8dmfAspFRgl1Q4n9x 6dnPSgmXqxccZTEBd+7c61kwnUB/lh1JZy5U1AIrsm3JQKiIyCP5xTHoWNfA0sg57mcZ 3qljn3ET0I5blRNyKlKZKnFdD8m92GZ+Pk3ZYzYf4i39uJ3B5/sP7HEH4jkBTwUP3bKH 9zFs/cuJxTB3PKhC1uIMXYpTgFoQDkcvVqpPvg5Qn1n9qOd+hjft1XerYDQNu0BxJ/14 4qQW/esu2bSzqED8/X1BLv9d895CQmqvQ29W8EBE7wSAcXp0OVzDWZuYG7vAHoDiHfrS EMZg== X-Gm-Message-State: APjAAAVV2P5e9bxmF2LFIE4cGpsWYmvGlpcgyhpx2AZn+a1hC86ZhuZV vN8swIkO4rrjXbJwZyEiApHy2HNe X-Google-Smtp-Source: APXvYqyf7Qw0fHpd8YaXeSnNMm8zovmy4FuLHfih0YKT6U1xO9wJ9AFPBNbAjQzL10TYmpUE4YVIuw== X-Received: by 2002:a17:902:7241:: with SMTP id c1mr26085319pll.326.1557686507540; Sun, 12 May 2019 11:41:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:9f8d:: with SMTP id g13ls1322098plq.13.gmail; Sun, 12 May 2019 11:41:47 -0700 (PDT) X-Received: by 2002:a17:902:e683:: with SMTP id cn3mr3576950plb.86.1557686507176; Sun, 12 May 2019 11:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557686507; cv=none; d=google.com; s=arc-20160816; b=YOXrWuZCjDPho5EHbrDZuvwkzq0CmNubkcvHILueyWdfCEiiaoik1Ukk0YO8FJ3c3z 6PUJo91QHrukR5viq4jj06SAjsaz/7mODN3RxMlc+espWQoW0Qkx5T7QFqq8dGO1uKS/ EKhJb63GE54BfAP+uC4rFkAl9W/sngD1kV2llggFMKIiXNG39QmGY5LNvSS4xiUMu5ph TeEJ5MLI4x9EKlvTg8/znFeS9+oTRXKxO/Muu1il7cUC94XWIt44PW8xIMO9SuY8ncyI WezTjCAf3zsMwZEF0yi9TBzXdq+cboe388BtzHuziXIovj48V8KK6n52XAzqo6NbFckr 6mSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=McU3A/Y2+KH8KsiZ+LTp3qJ8zWb4gZuzV4pCEGTBglg=; b=E4mCbcN9s01PYpA3Yrsc+RI2qo5TRwyCWmDwufdPs+ByuqGD90vqBmCEU1we7f0x6f LOmQf+KyKVAKleDKP2z30QyeSEalGSAS5IiZzNMgvJXo6rutcGu/IRsxM4a18oP56Zoz ZQcfSo87iXfnBbMaOq/y7CyibJ05iWebWq3oRow90XdfMPuuoqIWuLpR3J+psdWeJsUh DH/UzgQeCDVcCsQa6+7r0SZheLYOCL4/emseycmR6JenKjuDUek6jlk18WcMQU58pj/E 1UZAQa+x2i838WwOZc8vgseEjRXtm7SiPmN8qNeFjGxfamWBu6UwnJtxu0qf67wdclhi +ibQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SVFjdqYS; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id n9sor666933pgl.15.2019.05.12.11.41.47 for (Google Transport Security); Sun, 12 May 2019 11:41:47 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:f754:: with SMTP id f20mr26935381pgk.162.1557686506891; Sun, 12 May 2019 11:41:46 -0700 (PDT) Received: from localhost.localdomain ([115.97.185.144]) by smtp.gmail.com with ESMTPSA id 37sm11041291pgn.21.2019.05.12.11.41.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 May 2019 11:41:46 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Cc: michael@amarulasolutions.com, linux-amarula@amarulasolutions.com, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Jagan Teki Subject: [PATCH v10 1/2] drm/sun4i: sun6i_mipi_dsi: Fix hsync_porch overflow Date: Mon, 13 May 2019 00:11:26 +0530 Message-Id: <20190512184128.13720-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190512184128.13720-1-jagan@amarulasolutions.com> References: <20190512184128.13720-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SVFjdqYS; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Loop N1 instruction delay for burst mode devices are computed based on horizontal sync and porch timing values. 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. Example, timings, where it produces the overflow { .hdisplay = 1080, .hsync_start = 1080 + 408, .hsync_end = 1080 + 408 + 4, .htotal = 1080 + 408 + 4 + 38, } It reproduces the desired delay value 65487 but the correct working value should be 7. So, Fix it by computing hsync_porch value separately with u32 type. Fixes: 1c1a7aa3663c ("drm/sun4i: dsi: Add burst support") Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 6ff585055a07..bfa7e2b146df 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_dsi *dsi, u16 delay = 50 - 1; if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) { - delay = (mode->htotal - mode->hdisplay) * 150; - delay /= (mode->clock / 1000) * 8; + u32 hsync_porch = (mode->htotal - mode->hdisplay) * 150; + + delay = (hsync_porch / ((mode->clock / 1000) * 8)); delay -= 50; }