public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: David Ung <davidu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Dave Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Subject: Re: [PATCH V2] gpu: drm: tegra: Adjust dsi phy timing
Date: Mon, 8 Dec 2014 11:24:19 +0100	[thread overview]
Message-ID: <20141208102413.GA19060@ulmo.nvidia.com> (raw)
In-Reply-To: <CAOw6vb+B_AkA6NLuaRhFLrLuTEW0m02ptrkL0sOp6Ov=eJ34XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 1923 bytes --]

On Fri, Dec 05, 2014 at 02:28:18PM -0800, Sean Paul wrote:
> On Fri, Dec 5, 2014 at 2:17 PM, Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> wrote:
> 
> > On Fri, Dec 05, 2014 at 01:48:42PM -0800, Sean Paul wrote:
> > > On Tue, Dec 2, 2014 at 5:40 PM, David Ung <davidu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:
> > >
> > > > Fix DSI PHY HS Trail setting on Tegra.
> > > > It is found that HS Trail is off -12% during compliance testing
> > > >
> > > >
> > > [this time from the correct email address]
> > >
> > > Our timing tests pass now.
> > >
> > > Tested-by: Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> >
> > Can describe what kinds of timing tests these are? I obviously lack the
> > kind of equipment for this, but I'd still like to know how you get these
> > results.
> >
> >
> Hi Thierry,
> The test that was failing was the THS-TRAIL test. You can find the details
> at [1], test is 8.1.13. The time was 7.7ns too short (or 12%, as David
> stated).
> 
> I'm not sure how David arrived at the value he did to extend HS-TRAIL, but
> that particular test is now passing.

From reading the document that you linked to and comparing to the D-PHY
specification (version 1.2, Table 14, Page 40), the proper formula for
the HSTrail parameter would be:

	max(n * 8 * period, 60 + n * 4 * period)

I suspect that the additional 3 * period * 8 in this patch is derived
from the note about "n", which is 1 for forward-direction high-speed
mode and 4 for reverse-direction high-speed mode. Translating this to
the code, the correct line would really be:

	timing->hstrail = max(4 * 8 * period, 60 + 4 * 4 * period);

Since the "n" parameter appears in the second term, too. Also this is
not Tegra-specific after all, so mipi_dphy_timing_get_default() indeed
is the right place for it.

How about the attached patch?

Thierry

[-- Attachment #1.2: 0001-drm-tegra-dsi-Adjust-D-PHY-timing.patch --]
[-- Type: text/x-diff, Size: 2822 bytes --]

From 3399b7247fdc9609daea9919c444326fb9ddbdac Mon Sep 17 00:00:00 2001
From: David Ung <davidu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Date: Fri, 5 Dec 2014 15:30:05 -0800
Subject: [PATCH] drm/tegra: dsi: Adjust D-PHY timing

Compliance testing shows that HS Trail is off by -12%. Increase the HS
Trail time to make this test pass.

Signed-off-by: David Ung <davidu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
[treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org: update specification references, add comment]
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/gpu/drm/tegra/mipi-phy.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/tegra/mipi-phy.c b/drivers/gpu/drm/tegra/mipi-phy.c
index 486d19d589c8..ba2ae6511957 100644
--- a/drivers/gpu/drm/tegra/mipi-phy.c
+++ b/drivers/gpu/drm/tegra/mipi-phy.c
@@ -12,9 +12,9 @@
 #include "mipi-phy.h"
 
 /*
- * Default D-PHY timings based on MIPI D-PHY specification. Derived from
- * the valid ranges specified in Section 5.9 of the D-PHY specification
- * with minor adjustments.
+ * Default D-PHY timings based on MIPI D-PHY specification. Derived from the
+ * valid ranges specified in Section 6.9, Table 14, Page 40 of the D-PHY
+ * specification (v1.2) with minor adjustments.
  */
 int mipi_dphy_timing_get_default(struct mipi_dphy_timing *timing,
 				 unsigned long period)
@@ -34,7 +34,20 @@ int mipi_dphy_timing_get_default(struct mipi_dphy_timing *timing,
 	timing->hszero = 145 + 5 * period;
 	timing->hssettle = 85 + 6 * period;
 	timing->hsskip = 40;
-	timing->hstrail = max(8 * period, 60 + 4 * period);
+
+	/*
+	 * The MIPI D-PHY specification (Section 6.9, v1.2, Table 14, Page 40)
+	 * contains this formula as:
+	 *
+	 *     T_HS-TRAIL = max(n * 8 * period, 60 + n * 4 * period)
+	 *
+	 * where n = 1 for forward-direction HS mode and n = 4 for reverse-
+	 * direction HS mode. There's only one setting and this function does
+	 * not parameterize on anything other that period, so this code will
+	 * assumes that reverse-direction HS mode is supported and uses n = 4.
+	 */
+	timing->hstrail = max(4 * 8 * period, 60 + 4 * 4 * period);
+
 	timing->init = 100000;
 	timing->lpx = 60;
 	timing->taget = 5 * timing->lpx;
@@ -46,8 +59,8 @@ int mipi_dphy_timing_get_default(struct mipi_dphy_timing *timing,
 }
 
 /*
- * Validate D-PHY timing according to MIPI Alliance Specification for D-PHY,
- * Section 5.9 "Global Operation Timing Parameters".
+ * Validate D-PHY timing according to MIPI D-PHY specification (v1.2, Section
+ * Section 6.9 "Global Operation Timing Parameters").
  */
 int mipi_dphy_timing_validate(struct mipi_dphy_timing *timing,
 			      unsigned long period)
-- 
2.1.3


[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-12-08 10:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03  1:40 [PATCH V2] gpu: drm: tegra: Adjust dsi phy timing David Ung
     [not found] ` <CAOw6vbJmq1QtPPeWeE=mjgD1RjCeYGO=zdKR3vMn9AZaTOOc_w@mail.gmail.com>
     [not found]   ` <CAOw6vbJmq1QtPPeWeE=mjgD1RjCeYGO=zdKR3vMn9AZaTOOc_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-05 22:17     ` Thierry Reding
     [not found]       ` <CAOw6vb+B_AkA6NLuaRhFLrLuTEW0m02ptrkL0sOp6Ov=eJ34XA@mail.gmail.com>
     [not found]         ` <CAOw6vb+B_AkA6NLuaRhFLrLuTEW0m02ptrkL0sOp6Ov=eJ34XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-08 10:24           ` Thierry Reding [this message]
     [not found] ` <1417570823-19977-1-git-send-email-davidu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-12-05 22:41   ` Thierry Reding

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=20141208102413.GA19060@ulmo.nvidia.com \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=davidu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.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