linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@amarulasolutions.com>
To: Maxime Ripard <maxime.ripard@bootlin.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Chen-Yu Tsai <wens@csie.org>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com,
	Jagan Teki <jagan@amarulasolutions.com>,
	michael@amarulasolutions.com, linux-amarula@amarulasolutions.com
Subject: [PATCH v10 07/11] drm/sun4i: dsi: Get tcon0_div at runtime
Date: Mon, 20 May 2019 14:33:14 +0530	[thread overview]
Message-ID: <20190520090318.27570-8-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com>

tcon0 divider is used while computing drq edge0 for burst mode
devices, currently driver is using default macro value 4 via
SUN6I_DSI_TCON_DIV.

Unfortunately not all the panel devices are working with this
default divider value 4, so to make future changes on this divider
value get the divider from tcon dot clock at runtime instead of
static macro value.

Tested-by: Merlijn Wajer <merlijn@wizzup.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 +++++++-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 2 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 1f9ed2642a47..5584e9c2f8bd 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -396,9 +396,15 @@ static u16 sun6i_dsi_get_drq_edge0(struct sun6i_dsi *dsi,
 				   struct drm_display_mode *mode,
 				   u16 line_num, u16 edge1)
 {
+	struct sun4i_tcon *tcon = dsi->tcon;
+	unsigned long dclk_rate, dclk_parent_rate, tcon0_div;
 	u16 edge0 = edge1;
 
-	edge0 += (mode->hdisplay + 40) * SUN6I_DSI_TCON_DIV / 8;
+	dclk_rate = clk_get_rate(tcon->dclk);
+	dclk_parent_rate = clk_get_rate(clk_get_parent(tcon->dclk));
+	tcon0_div = dclk_parent_rate / dclk_rate;
+
+	edge0 += (mode->hdisplay + 40) * tcon0_div / 8;
 
 	if (edge0 > line_num)
 		return edge0 - line_num;
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
index f2826e3ea165..156523859d82 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
@@ -13,8 +13,6 @@
 #include <drm/drm_encoder.h>
 #include <drm/drm_mipi_dsi.h>
 
-#define SUN6I_DSI_TCON_DIV	4
-
 struct sun6i_dsi {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
-- 
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

  parent reply	other threads:[~2019-05-20  9:09 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20  9:03 [PATCH v10 00/11] drm/sun4i: dsi: Fixes/updates (A33 reworked!) Jagan Teki
2019-05-20  9:03 ` [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits Jagan Teki
2019-05-23 20:34   ` Maxime Ripard
2019-05-24 10:18     ` Jagan Teki
2019-05-29 14:54       ` Maxime Ripard
2019-05-29 18:14         ` Jagan Teki
2019-06-04 10:00           ` Maxime Ripard
2019-06-05  7:47             ` Jagan Teki
2019-06-13 12:56               ` Maxime Ripard
2019-06-14  6:33                 ` Jagan Teki
2019-06-14 14:45                   ` Maxime Ripard
2019-06-18 10:51                     ` Jagan Teki
2019-06-18 11:43                       ` [linux-sunxi] " Chen-Yu Tsai
2019-06-18 12:11                         ` Jagan Teki
2019-06-18 14:45                           ` Chen-Yu Tsai
2019-06-20 18:51                             ` Jagan Teki
2019-06-21  3:13                               ` Chen-Yu Tsai
2019-05-20  9:03 ` [PATCH v10 02/11] drm/sun4i: dsi: Update start value in video start delay Jagan Teki
2019-05-23 20:37   ` Maxime Ripard
2019-05-24 10:25     ` Jagan Teki
2019-05-30 10:42       ` Maxime Ripard
2019-06-13  8:04         ` Jagan Teki
2019-06-14 14:28           ` Maxime Ripard
2019-06-18 11:02             ` Jagan Teki
2019-06-24  9:34   ` Chen-Yu Tsai
2019-05-20  9:03 ` [PATCH v10 03/11] drm/sun4i: dsi: Fix video start delay computation Jagan Teki
2019-05-23 20:38   ` Maxime Ripard
2019-05-24 10:26     ` Jagan Teki
2019-06-21  8:35       ` [linux-sunxi] " Chen-Yu Tsai
2019-06-24  8:52         ` Jagan Teki
2019-05-20  9:03 ` [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes Jagan Teki
2019-05-23 20:48   ` Maxime Ripard
2019-05-24 10:07     ` Jagan Teki
2019-06-04 14:30       ` Maxime Ripard
2019-06-05  7:41         ` [linux-sunxi] " Jagan Teki
2019-06-13 13:16           ` Maxime Ripard
2019-06-14 12:03             ` Jagan Teki
2019-06-24 13:04               ` Maxime Ripard
2019-06-24 16:02                 ` Jagan Teki
2019-06-25 14:37                   ` Maxime Ripard
2019-07-01 19:00                     ` Jagan Teki
2019-07-02 15:29                       ` Maxime Ripard
2019-07-02 15:40                         ` Jagan Teki
2019-07-03 11:51                           ` Maxime Ripard
2019-05-20  9:03 ` [PATCH v10 05/11] drm/sun4i: tcon: Export get tcon0 routine Jagan Teki
2019-05-20  9:03 ` [PATCH v10 06/11] drm/sun4i: dsi: Probe tcon0 during dsi_bind Jagan Teki
2019-05-20  9:03 ` Jagan Teki [this message]
2019-05-20  9:03 ` [PATCH v10 08/11] dt-bindings: sun6i-dsi: Add VCC-DSI supply property Jagan Teki
2019-05-20  9:03 ` [PATCH v10 09/11] drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support Jagan Teki
2019-06-03 13:49   ` Maxime Ripard
2019-06-13  7:55     ` Jagan Teki
2019-06-13 13:14       ` Maxime Ripard
2019-05-20  9:03 ` [DO NOT MERGE] [PATCH v10 10/11] drm/panel: Add Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge Jagan Teki
2019-05-20  9:03 ` [DO NOT MERGE] [PATCH v10 11/11] ARM: dts: sun8i: bananapi-m2m: Enable Bananapi S070WV20-CT16 DSI panel Jagan Teki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190520090318.27570-8-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.com \
    --cc=airlied@linux.ie \
    --cc=bshah@mykolab.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=michael@amarulasolutions.com \
    --cc=powerpan@qq.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).