linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marjan Pascolo <marjan.pascolo@trexom.it>
To: Giulio Benetti <giulio.benetti@benettiengineering.com>,
	Maxime Ripard <maxime@cerno.tech>
Cc: wens@csie.org, daniel@ffwll.ch, airlied@linux.ie,
	treding@nvidia.com, Jernej Skrabec <jernej.skrabec@siol.net>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Giulio Benetti <giulio.benetti@micronovasrl.com>
Subject: Re: [PATCH v5] drm/sun4i: tcon: fix inverted DCLK polarity
Date: Thu, 14 Jan 2021 08:58:44 +0100	[thread overview]
Message-ID: <d244aa6b-00b7-d768-83cb-e5a228b7ee08@trexom.it> (raw)
In-Reply-To: <20210113160526.928766-1-giulio.benetti@benettiengineering.com>

Hi Giulio,

You did a typo

Il 13/01/2021 17:05, Giulio Benetti ha scritto:
> From: Giulio Benetti <giulio.benetti@micronovasrl.com>
>
> During commit 88bc4178568b ("drm: Use new
> DRM_BUS_FLAG_*_(DRIVE|SAMPLE)_(POS|NEG)EDGE flags") DRM_BUS_FLAG_*
> macros have been changed to avoid ambiguity but just because of this
> ambiguity previous DRM_BUS_FLAG_PIXDATA_(POS/NEG)EDGE were used meaning
> _SAMPLE_ not _DRIVE_. This leads to DLCK inversion and need to fix but
> instead of swapping phase values, let's adopt an easier approach Maxime
> suggested:
> It turned out that bit 26 of SUN4I_TCON0_IO_POL_REG is dedicated to
> invert DCLK polarity and this makes things really easier than before. So
> let's handle DCLK polarity by adding SUN4I_TCON0_IO_POL_DCLK_DRIVE_NEGEDGE
> as bit 26 and activating according to bus_flags the same way it is done
> for all the other signals polarity.
>
> Fixes: 88bc4178568b ("drm: Use new DRM_BUS_FLAG_*_(DRIVE|SAMPLE)_(POS|NEG)EDGE flags")
> Suggested-by: Maxime Ripard <maxime@cerno.tech>
> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
> ---
> V2->V3:
> - squash 2 patches into 1
> V3->V4:
> - add SUN4I_TCON0_IO_POL_DCLK_POSITIVE to regmap_update_bits()
> V4->V5:
> polarity is still wrong so:
> - let's use SUN4I_TCON0_IO_POL_DCLK_DRIVE_NEGEDGE macro
>    instead of _DCLK_POSITIVE(that would make sense only in realtion with DCLK)
> - invert condition using _NEGEDGE instead of _POSEDGE and then matching with
>    register bit SUN4I_TCON0_IO_POL_DCLK_DRIVE_NEGEDGE
> - correct commit log according to V4->V5 changes
> ---
>   drivers/gpu/drm/sun4i/sun4i_tcon.c | 21 ++-------------------
>   drivers/gpu/drm/sun4i/sun4i_tcon.h |  1 +
>   2 files changed, 3 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index eaaf5d70e352..c172ccfff7e5 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -569,30 +569,13 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
>   	if (info->bus_flags & DRM_BUS_FLAG_DE_LOW)
>   		val |= SUN4I_TCON0_IO_POL_DE_NEGATIVE;
>   
> -	/*
> -	 * On A20 and similar SoCs, the only way to achieve Positive Edge
> -	 * (Rising Edge), is setting dclk clock phase to 2/3(240°).
> -	 * By default TCON works in Negative Edge(Falling Edge),
> -	 * this is why phase is set to 0 in that case.
> -	 * Unfortunately there's no way to logically invert dclk through
> -	 * IO_POL register.
> -	 * The only acceptable way to work, triple checked with scope,
> -	 * is using clock phase set to 0° for Negative Edge and set to 240°
> -	 * for Positive Edge.
> -	 * On A33 and similar SoCs there would be a 90° phase option,
> -	 * but it divides also dclk by 2.
> -	 * Following code is a way to avoid quirks all around TCON
> -	 * and DOTCLOCK drivers.
> -	 */
> -	if (info->bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE)
> -		clk_set_phase(tcon->dclk, 240);
> -
>   	if (info->bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)
> -		clk_set_phase(tcon->dclk, 0);
> +		val |= SUN4I_TCON0_IO_POL_DCLK_DRIVE_NEGEDGE;
>   
>   	regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG,
>   			   SUN4I_TCON0_IO_POL_HSYNC_POSITIVE |
>   			   SUN4I_TCON0_IO_POL_VSYNC_POSITIVE |
Here Below you missed an 'E'
> +			   SUN4I_TCON0_IO_POL_DCLK_DRIVE_NEGDGE |
>   			   SUN4I_TCON0_IO_POL_DE_NEGATIVE,
>   			   val);
>   
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
> index cfbf4e6c1679..c5ac1b02482c 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
> @@ -113,6 +113,7 @@
>   #define SUN4I_TCON0_IO_POL_REG			0x88
>   #define SUN4I_TCON0_IO_POL_DCLK_PHASE(phase)		((phase & 3) << 28)
>   #define SUN4I_TCON0_IO_POL_DE_NEGATIVE			BIT(27)
> +#define SUN4I_TCON0_IO_POL_DCLK_DRIVE_NEGEDGE		BIT(26)
>   #define SUN4I_TCON0_IO_POL_HSYNC_POSITIVE		BIT(25)
>   #define SUN4I_TCON0_IO_POL_VSYNC_POSITIVE		BIT(24)
>   

  parent reply	other threads:[~2021-01-14  8:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 19:27 [PATCH 0/2] drm/sun4i: fix DCLK and improve its handling Giulio Benetti
2021-01-06 19:27 ` [PATCH 1/2] drm/sun4i: tcon: fix inverted DCLK polarity Giulio Benetti
2021-01-06 21:00   ` Jernej Škrabec
2021-01-07  2:30     ` [PATCH v2 0/2] drm/sun4i: fix DCLK and improve its handling Giulio Benetti
2021-01-07  2:30       ` [PATCH v2 1/2] drm/sun4i: tcon: fix inverted DCLK polarity Giulio Benetti
2021-01-07  2:30       ` [PATCH v2 2/2] drm/sun4i: tcon: improve DCLK polarity handling Giulio Benetti
2021-01-08  9:23         ` Maxime Ripard
2021-01-08 14:34           ` Giulio Benetti
2021-01-11 17:20             ` Maxime Ripard
2021-01-11 17:37               ` Giulio Benetti
2021-01-11 17:46               ` [PATCH v3] drm/sun4i: tcon: fix inverted DCLK polarity Giulio Benetti
2021-01-13  9:42                 ` Maxime Ripard
2021-01-13 10:47                   ` [PATCH v4] " Giulio Benetti
2021-01-13 16:05                     ` [PATCH v5] " Giulio Benetti
2021-01-14  1:32                       ` kernel test robot
2021-01-14  7:58                       ` Marjan Pascolo [this message]
2021-01-14  8:12                         ` Giulio Benetti
2021-01-14  8:17                         ` [PATCH v6] " Giulio Benetti
2021-01-14 11:40                           ` Marjan Pascolo
2021-01-14 11:42                           ` Maxime Ripard
2021-02-10 16:22                             ` [PATCH] pinctrl/sunxi: adding input-debounce-ns property Marjan Pascolo
2021-02-17 11:03                               ` Maxime Ripard
2021-02-26 12:53                                 ` Marjan Pascolo
2021-03-04 15:51                                   ` Maxime Ripard
2021-01-13 10:48                   ` [PATCH v3] drm/sun4i: tcon: fix inverted DCLK polarity Giulio Benetti
     [not found]           ` <00f21d15-7a88-2d01-dd48-dc49e9295e34@trexom.it>
2021-01-08 14:46             ` [PATCH v2 2/2] drm/sun4i: tcon: improve DCLK polarity handling Giulio Benetti
2021-01-06 19:28 ` [PATCH " Giulio Benetti

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=d244aa6b-00b7-d768-83cb-e5a228b7ee08@trexom.it \
    --to=marjan.pascolo@trexom.it \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=giulio.benetti@micronovasrl.com \
    --cc=jernej.skrabec@siol.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=treding@nvidia.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).