From patchwork Fri Nov 16 16:39:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 44 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f198.google.com (cartago.priv [10.11.12.1]) by cassiopea (Postfix) with ESMTPS id 70FA42E53B4 for ; Fri, 16 Nov 2018 17:39:47 +0100 (CET) Received: by mail-pl1-f198.google.com with SMTP id m1-v6sf17509508plb.13 for ; Fri, 16 Nov 2018 08:39:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1542386386; cv=pass; d=google.com; s=arc-20160816; b=sjAPsjjSqkXXcRJdDWqdGtJjj2uMla0QbLvcfblRrM+EA5FdCXSM2oVxHO8+dLctFe Y70jVk+26MO3JEktW7DeSKa5Kejfgy7IU9xyXzXJwyPoRjNSopDiavZzkXBm3aToMbCV 3Ip2MWSydWUYi3eYwlS2RgTun21AvNte+dFC9hMvUAB34z4MIvUmVf5C+SNAQkrXMR30 MIKBESL7Ln5Is/4qb21UQCqdZOR3Utk+Iw13CfH9oKMKqBxrdhVVPqTiRz6ABklT52g/ zSE7loscGWmdLxmME0JdBSR7yme2EZTCgB0rXOh+ADHE1s7SpEyibmAayfkAeWIOUKAi Z5gg== 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:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BNh71MWK36UL5AiiDZH8rXZrXUHyz8v782txUp4gWBo=; b=ESffGHbr2sXhM0GflUV1vH400pOsUsYJqxUpeijIjAhQDqqWNoGMAvHLj1oniLZLlB /cFrkcVdaUluMp5xaugf3Swh+LfIRm15+JviWqiHO3/8gPUcTjw/H8idCo0rJicW9/49 SAukMf59RrOVVbzMs7WxNBheavtYUX9MM9hgDZeaLbWz0tZcrAVVyBIJx6OGlKmoTQio X8v9crzLJR54cu/PzEsUMPIcfE8TDWBAbrRlflAvk0426irVQPvUk0fUFWhCQgxTTg02 iqAQaHv0x34rcp8/+77rjy+71oo0PEfe/oIDBEJ67wvXuv5zYAWs86PxxKIJgmCi3YqJ MRYg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EyK+bgba; 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:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=BNh71MWK36UL5AiiDZH8rXZrXUHyz8v782txUp4gWBo=; b=T35NubQlbhwH0zG7QxkV2hdaDy1nn9UD+6PAixDSf0ESj0gHERoNJj+Ql6IIQ5wcTj 6Fxnaac9NdTKMc/SqC79vJKNR6Uzl44fTZ1aDupdwe+ljkN0HuHe2kNvHti4CljMKmEA KB8hF2PQf5dqUQ3RGE3eT2yVH9GipQka8EcPw= 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: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=BNh71MWK36UL5AiiDZH8rXZrXUHyz8v782txUp4gWBo=; b=pLsmGNmnnA0csUnuIgeoXwJU9lCxSrvVeoPLePidrnH62g8nn+rCThfHdolFv5gWRU eR8ej87zm0EyHGVf0zrMf7MeL43eP82eldSXfolyMyLyH+w9DM7ZRkzt6R3lbjlxcJLr d4fJ4iEdv7b3sCuBuPhjhBKqxUM5FEFHsEXCrYvwks3/8nYSemqLmiBg0jNc8Q9UXxd0 RILtPDuKVY4cMx/u7k8aw35i7SjDa1bafCjYIFj8jzFECYpk7opd06ymDsKL0HQDPhml +xVJPifTr7GTnKFXx3WWA1QWL73xHTPu+9XQ4ko5I9XsP3Px0X55edA9B+Mo1w8tD1cm Af2A== X-Gm-Message-State: AGRZ1gIiV30q/I4WmJamLoLf0LKnCHWvOyp45/nqVMiHdU6mesRhX+jh aSWr+HcVUagUEpYNl8iJphFbEko/ X-Google-Smtp-Source: AJdET5ezdY8EpEvApKxq2yc8oewpDqczdd//dKS+5GZ0Fbl39l5j67bxAidpUfA3NBOTZbHP2qe0qA== X-Received: by 2002:a65:5087:: with SMTP id r7mr2638287pgp.141.1542386386161; Fri, 16 Nov 2018 08:39:46 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:6a0a:: with SMTP id f10ls4294592pgc.0.gmail; Fri, 16 Nov 2018 08:39:45 -0800 (PST) X-Received: by 2002:a63:e749:: with SMTP id j9-v6mr10402715pgk.246.1542386385822; Fri, 16 Nov 2018 08:39:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542386385; cv=none; d=google.com; s=arc-20160816; b=RSpUPU2evnPFjWDRLBRQ+6haLZuhYzRVbxEhu4ZoCJmgZFjE+bsFavJde0sm7VyJqf L0ePeWFo1IDnP6ueWbl3BuvwfBJQ+XFASpEWrLFB7YFkL/rrIGIZvFX2dIJctizzCqG/ oREx7gpJJg2tR4RK1KjpD462AGDMVlmF5cDx+jpzoZG0ae2zIGvc5ZPLu7RKwzi5lKdr guqEFX7ghBSZrdTatVaQ+e5Eq5r/DmCSSTtr+y6Kehn+oYQ99z2Bq+zrSRCOVrKJIR6J m16O6jwITUMLUfzDDc3hB32z+G9TPu9NdWKTBfWc+lYwjSS3ZZfPP1ykfYZjMRCtNHOZ gCVQ== 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=BNh71MWK36UL5AiiDZH8rXZrXUHyz8v782txUp4gWBo=; b=pQmwK4Z22fuIpMnnyro4l0ac1vbrA2bWhNdC28vFC96LgUrt3Oh08ngpCY9qITEqfF RVogcDKybLRuPagDOZE3sPi9eZjfrA6r63obdTi5UwztUsUgxmrapDERKJIZyClckRuE rQQK3bCIiHylKlvg7SgIYvGkFa6BSfrXKLO+6YJ6uzT3EfwIlHOScgF3gjDu7pCfvrYl zSIRsmGtKcBldESPI/CL0aLAE3TdpKpSNvyx5NNwA7IjY0d1VWN47XUmbr8l7uAGqibx eZtQWG2xaDC0kgpDfgple34wU9GV1u9cSopfuQr8wA71vKG3ctxgNciLowVu4IfD7ERE 5Adw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EyK+bgba; 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 z65-v6sor38529138pfz.36.2018.11.16.08.39.45 for (Google Transport Security); Fri, 16 Nov 2018 08:39:45 -0800 (PST) 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:a62:2292:: with SMTP id p18mr8881397pfj.9.1542386385490; Fri, 16 Nov 2018 08:39:45 -0800 (PST) Received: from localhost.localdomain ([115.97.190.86]) by smtp.gmail.com with ESMTPSA id p5-v6sm34622213pfb.109.2018.11.16.08.39.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 08:39:44 -0800 (PST) From: Jagan Teki To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Rob Herring , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Thierry Reding , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Trimarchi , TL Lim , linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v2 01/12] drm/sun4i: sun6i_mipi_dsi: Compute burst mode loop N1 instruction delay Date: Fri, 16 Nov 2018 22:09:05 +0530 Message-Id: <20181116163916.29621-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181116163916.29621-1-jagan@amarulasolutions.com> References: <20181116163916.29621-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=EyK+bgba; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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 lcd panel are computed as per BSP code. 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 use the similar computation for loop N1 delay. 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 def145086a5c..43ab7127d428 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -379,6 +379,24 @@ static u16 sun6i_dsi_get_timings_vblk(struct sun6i_dsi *dsi, return vblk; } +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) { @@ -418,7 +436,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) |