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,URIBL_BLOCKED,USER_AGENT_GIT 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 AD82DC43381 for ; Sun, 3 Mar 2019 17:36:26 +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 7DEBB20842 for ; Sun, 3 Mar 2019 17:36:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ard9kkfT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="LflUIddU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DEBB20842 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.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-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ItJZP8qgeBrXLmldKg0Qo/kVUttwcH3hEF/4Lq8zqDk=; b=Ard9kkfTovbwIU cZZKiBNGhggsCkWFKUWLPz1EMcdZUYFOL/RkCpaUjsH5vqXiPvbex8PSbcOaWe31AV+tsrcQtr5J8 SjSIIsB67DQ9IuhRPWcbRaNdhqRfcjq2KsU2BfboO/oreN8EnbFt8+n3vFImt5chcOyVRgf6QdX3I x1znfeeJoZNHfPPtfZNUNR3f9434wkjlS1Fdg9vzaJLfdAxEVZVlTa6EAxWi5WiIuhDDbWvlJW6YI 4RqIoR7vG82VYU+J0usuCgRaMFddww8T9dRvL19zvLbMsqgrEBcACuTon3NdetJAaEEk+dHoIqOOJ qLiLS77qk16gYY1qrmIA==; 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 1h0V2H-0001uU-75; Sun, 03 Mar 2019 17:36:25 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h0V2A-0001hj-PP for linux-arm-kernel@lists.infradead.org; Sun, 03 Mar 2019 17:36:22 +0000 Received: by mail-pl1-x644.google.com with SMTP id v11so1358088plg.9 for ; Sun, 03 Mar 2019 09:36:16 -0800 (PST) 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:content-transfer-encoding; bh=YvQ56Xx1Bmp0kWQNDK2nAiI9K4YgbqYzq9u72/Tb/Wo=; b=LflUIddUoNDPr+yhSqv8YqZrx+sPJX8q6IeVAKXozXBQmd+7QqdF5FC/Nnfuh4HgEb P0P7322O1SSJswkLmEli+W4c4fUmqaQsvLpS23zbRTSmaNeBpt5i1mKVUS9aYaD6d08r 50szGzTOFiwKeoS4HmqpCI/fn6Ka88k8gLleo= 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:content-transfer-encoding; bh=YvQ56Xx1Bmp0kWQNDK2nAiI9K4YgbqYzq9u72/Tb/Wo=; b=f289XbpZ8Rhkr1Fv7zZRK5QPfxY1xcZu8VSNVAiWcBnPTgMtZ0JYnQvAXnNdcDfuD4 i55rEZ0Dkr0clA8upX7IjU7ukfa+2TL+CflFRcl2xSXJP5ca1grbsFcY2npTAIwcM21Y ktXlS+/+eRj3ImIICMTLgsAydS/WMsZEdEtj4wb3XWR3VWcVL6afjrExBf2CA+/b4sPd 2Dvvjt5ep+27oRC+B5FHsxIINgveJngdx6hbneIqvoE5MaYgrihaokQTPcLZVHr9n69w ENuplLojLNYQ+bwruQccs0URlINRqs6t/sqj9l+VWP0PQq4uV/LmQcWiRNfqiZs3Y+O5 IzHg== X-Gm-Message-State: APjAAAUji+/ZpO6/At8e6duhboW7c+1R5SPDje9AzJQd3d6kY2Xr1MCZ T9WGYFfTtvWtNrjQXDmxUc81lA== X-Google-Smtp-Source: APXvYqwMfcEqRj8CRJW1LCxN3K8d+OryA2fDRcxHfLMc10INVG90SRQRlL8++UlhSKwM0Kz41FXC0Q== X-Received: by 2002:a17:902:52c:: with SMTP id 41mr16382818plf.331.1551634575454; Sun, 03 Mar 2019 09:36:15 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id d129sm5614737pgc.59.2019.03.03.09.36.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Mar 2019 09:36:14 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v9 1/5] drm/sun4i: sun6i_mipi_dsi: Fix hsync_porch overflow Date: Sun, 3 Mar 2019 23:05:23 +0530 Message-Id: <20190303173527.31055-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190303173527.31055-1-jagan@amarulasolutions.com> References: <20190303173527.31055-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190303_093619_117503_3E14EA0A X-CRM114-Status: GOOD ( 13.78 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Tested-by: Merlijn Wajer --- 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..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_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); + + delay = ((hsync_porch * 150) / ((mode->clock / 1000) * 8)); delay -= 50; } -- 2.18.0.321.gffc6fa0e3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel