Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp249134ybi; Wed, 29 May 2019 20:37:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZ/DjY61osiSJXUB2Fdfa98CnHdsL5WfvFUjt5vKy+OLpWyX9HiYFQA4dYnTB48X4RVpqk X-Received: by 2002:a17:902:30a3:: with SMTP id v32mr1757572plb.6.1559187449812; Wed, 29 May 2019 20:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187449; cv=none; d=google.com; s=arc-20160816; b=LCkW4wBhbcewFjRS9I1vLfTs7c8XqMOzeET3Qnl6vl2Z7uGhNO3aP8C2VyciOBgBt/ NF/vxMyDXxJ4sJrE+sQXwxrZCg5dGkuW2X19OQfMWaRn3gMseJq7/1vy78aHfHsz5tT4 oKP5nt9mezjf9dqF6V6giIJkoPZiNvZGyx27f/f+KfRfemBma5QqqPsPo58sqffCqsfR odNyBJt2yn1ROy6CRfogtbUiFnllBpMvqoWraykvh9zZangE3OIhKvd2LJrvNDRvKGdc Q/cUxa8caD9lSpwXt4AhX0aJ8ioxfAVlKF6N0rZCPlTkmxiO6YGd63QmKreJ2FFc4vuQ lGIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BVFbTKtk93b96kBLhtRjh4iS162Ee5Cq7HrRvIEJtuQ=; b=GCL4b9UAGPko+2CNsDTDPIcJ4PrEKXn/NvIMY2q9inCV1uJXVfrOdsGJCr+gz6lkFn iYt4lB6JrY1JhBjwWMsqnRVCDCvJ8h8l1lX4zLcHcz0j0vYiXlX4oa0XXlO80gegB4o+ DZiAG0dYYeo8pWKrOKuoMckHNK5ML0TI428m8us81y29lEvPmXMpTban1oug9WOJ4nGC g25SYnJPDUvIeTjlpvMdUTFIT/Ba/X/I8Pa+6lU7ebJjkUI8h8TSjgp+IG3OlDAYJnUC 3U/paSXV2wSXUVl3SYkif8DCYDIyOkEbILRI2CWIqoAbYOQ9mjKPddXLjMyorGNG3SHj /sWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="H1q/y9Us"; 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 t10si1944560plh.252.2019.05.29.20.37.14; Wed, 29 May 2019 20:37:29 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b="H1q/y9Us"; 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 S2387550AbfE3DZ3 (ORCPT + 99 others); Wed, 29 May 2019 23:25:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:51424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731563AbfE3DS3 (ORCPT ); Wed, 29 May 2019 23:18:29 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B17B5247C2; Thu, 30 May 2019 03:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186308; bh=j5IrkmXoqipm6SS+hShpCMelEn2qPU/FEDpbZVsmWNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H1q/y9UscHsksiRgcXiGnGVYABFNhjtslU4z0Mrqn/gjRm2pi48EPojA9WcYT/DIM 0E9tKI6GaW+Upf+YucljD7aXzxmP5n/rmsiNe+sHOeMarZQDtCtvVli5dAavETbQdV wKTjxGHcaLrMHosqv0vJgW0D+53oUnZ5AD+cqC44= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Paul Kocialkowski , Sasha Levin Subject: [PATCH 4.19 275/276] drm/sun4i: dsi: Enforce boundaries on the start delay Date: Wed, 29 May 2019 20:07:13 -0700 Message-Id: <20190530030542.392185247@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit efa31801203ac2f5c6a82a28cb991c7163ee0f1d ] The Allwinner BSP makes sure that we don't end up with a null start delay or with a delay larger than vtotal. The former condition is likely to happen now with the reworked start delay, so make sure we enforce the same boundaries. Signed-off-by: Maxime Ripard Reviewed-by: Paul Kocialkowski Link: https://patchwork.freedesktop.org/patch/msgid/c9889cf5f7a3d101ef380905900b45a182596f56.1549896081.git-series.maxime.ripard@bootlin.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 3de41de43127b..97a0573cc5145 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -358,8 +358,12 @@ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100); + u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; - return mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; + if (delay > mode->vtotal) + delay = delay % mode->vtotal; + + return max_t(u16, delay, 1); } static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, -- 2.20.1