Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2393386imu; Thu, 24 Jan 2019 12:01:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN6lEqMGyDiSdGaGKOIcu49cLz/Nl1wnV5BXJHRVd8S8+RN/I6J99DYpH90pXcr5Y4utJ6Ge X-Received: by 2002:a63:2507:: with SMTP id l7mr6919606pgl.22.1548360060777; Thu, 24 Jan 2019 12:01:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548360060; cv=none; d=google.com; s=arc-20160816; b=r9MrZz/4y0zfBhn7JpMTk+Qp9FJ3nyaurpnieG3JxPgsElAKJkaoxPzMb5ivMgcNB3 SQWyjpzATbU4r4OHL6XRvWyH5x0MQi4yj3dDfpbOuVdBfA/SE7b23Bs6RUXEtrbfQXwW 3zZx3T8d9La6Rz3NDKbAp4kYe6GSFXjWQkGy9anvv58CUoICf0mBJHF2OUf+B3HIZL8S iZuNhAH5EvdTTJPbcz9qjuJTwXJwivUkgXZsxTWzTPnkfITMy9ncw9Pg7mep6Fdp/JFf HhsKoXrDP7Yu7RrBHzqS7vgr+HMOaIiaTMWri1Kks1pTM7D5QFOiHhhf3ZCV54iprZD9 5UXA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Cv7G+uVy+k+Tf6IPY0z7Yjji/++uyA4xCwVVFJCJxkM=; b=G5bwu4ZYqZryufLXDRaTBt2d+F/3i2rzLGd077TtIYQ6wD8AvYS259vgEqYWglPhw7 yOjN5JSYkNIHMzVq+gJgzGqHgs7canvCYksxxap/0Qe5b4x5dKfoKnV+/ZIoSlxCNhs5 h6hIEqiZauuKn/gPFfxgpNcUxO1qqmZsbqt6pr1esxLbhD7ZdfhYjnZlFSjy5aF3vwKP Bkhxp0gdsDWjlJPJE6BNXHaI45gcC6xz0sR2bEe1dLTn4YGlVigala0+th9MMQlj5gPs o1oHJi/Yir3B6MD0bnoWRyA2P8aXCSgy6q6fr/1HJAFNiD1OyF1SxTEkK+8Dc5GJ86IE CtXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f0m7RZmy; 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 j20si21303602pgb.520.2019.01.24.12.00.45; Thu, 24 Jan 2019 12:01:00 -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; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f0m7RZmy; 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 S1727940AbfAXT7Z (ORCPT + 99 others); Thu, 24 Jan 2019 14:59:25 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:45290 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729477AbfAXT7X (ORCPT ); Thu, 24 Jan 2019 14:59:23 -0500 Received: by mail-pl1-f193.google.com with SMTP id a14so3358974plm.12 for ; Thu, 24 Jan 2019 11:59:22 -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=Cv7G+uVy+k+Tf6IPY0z7Yjji/++uyA4xCwVVFJCJxkM=; b=f0m7RZmyu24bHhy+RMBGhJS68qlkuPGVmNyOJ+TuYa1l8utHvIfQCUANzU1trU4H0J YUySIARQpI1o2XDCjOlsHDNc/rshvTFF+ioRKXwWDenXF7pOJQ3h8ohK7s+0C33gIMsC lVJMy7gV+a4YPVV+9K5g40DXtsvD59X1MvRao= 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=Cv7G+uVy+k+Tf6IPY0z7Yjji/++uyA4xCwVVFJCJxkM=; b=QWP/ThDpHSo78nkBL5dTyxYEc6Obkhu4fsXj+pxmft1h/b9IlGmmMOP0QSJdmZDhzl 4gkjCypf5975fdhb8C3qIIhK6dEoxCrqYmEFtFO2x5ZDVCGAaPul9QBxsqxs0MDVmHgC VvfqK/5zWC7+ARwCjh83Mwt6Pd0VORvlPtj+us87fU4Y3Hq1qwKJPq5EIJsS55A4wEU0 PKIFuNHXaJUPaqTpkQUPH4p4AjWAPbc2asWA89sgtpkJT04MbnH6Ez6wWXNXTaY3reiO /Eb/5RvecYSh3G0RgE1tS3poqnFz5D0LohrMzXE6Xb15gWZi/rPQL7GnrBJPZszWDhsU Glgg== X-Gm-Message-State: AJcUukfcG9dIUJUfueGMFl9tTAiBPArIjZudrhaN5bRsnvSXkkJuC4p2 z7jkhfZb7hfAwwNcGHgMUaEpog== X-Received: by 2002:a17:902:9a8b:: with SMTP id w11mr7699262plp.121.1548359962542; Thu, 24 Jan 2019 11:59:22 -0800 (PST) Received: from localhost.localdomain ([115.97.179.75]) by smtp.gmail.com with ESMTPSA id x11sm61637003pfe.72.2019.01.24.11.59.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 11:59:21 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , Michael Turquette , Rob Herring , Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki Subject: [PATCH v6 01/22] drm/sun4i: sun6i_mipi_dsi: Compute burst mode loop N1 instruction delay Date: Fri, 25 Jan 2019 01:28:39 +0530 Message-Id: <20190124195900.22620-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190124195900.22620-1-jagan@amarulasolutions.com> References: <20190124195900.22620-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Loop N1 instruction delay varies between burst and non-burst video modes. for burst mode panels it is computed based on the panel clock along with horizontal sync and porch timings and the rest it is simply (50 - 1) Reference code is available in BSP (from linux-sunxi drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_dev[sel]->dsi_inst_loop_num.bits.loop_n1= (panel->lcd_ht-panel->lcd_x)*(150)/(panel->lcd_dclk_freq*8) - 50; => (((mode->htotal - mode->hdisplay) * 150) / ((mode->clock / 1000) * 8)) - 50; So, this patch add loop N1 computation for burst mode, for non-burst which is already available. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index e3b34a345546..a5fcee750bee 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -354,6 +354,24 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, SUN6I_DSI_INST_JUMP_CFG_NUM(1)); }; +static u16 sun6i_dsi_setup_inst_delay(struct sun6i_dsi *dsi, + struct drm_display_mode *mode) +{ + struct mipi_dsi_device *device = dsi->device; + u32 hsync_porch, dclk; + u16 delay; + + hsync_porch = (mode->htotal - mode->hdisplay); + dclk = (mode->clock / 1000); + + if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) + delay = ((hsync_porch * 150) / (dclk * 8)) - 50; + else + delay = 50 - 1; + + return delay; +} + static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { @@ -383,7 +401,7 @@ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, static void sun6i_dsi_setup_inst_loop(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { - u16 delay = 50 - 1; + u16 delay = sun6i_dsi_setup_inst_delay(dsi, mode); regmap_write(dsi->regs, SUN6I_DSI_INST_LOOP_NUM_REG(0), SUN6I_DSI_INST_LOOP_NUM_N0(50 - 1) | -- 2.18.0.321.gffc6fa0e3