From: giulio.benetti@micronovasrl.com (Giulio Benetti)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] drm/sun4i: Handle DRM_BUS_FLAG_PIXDATA_*EDGE checking if panel is used.
Date: Wed, 18 Jul 2018 16:42:25 +0200 [thread overview]
Message-ID: <e1fcedb1-64d5-24fb-ffc1-d418620ec795@micronovasrl.com> (raw)
In-Reply-To: <20180718142357.120998-1-giulio.benetti@micronovasrl.com>
Hi Paul,
can you give a try to this patch on A13 with VGA DAC?
Unfortunately I don't have an A13 board to test it.
Thanks in advance.
Giulio
Il 18/07/2018 16:23, Giulio Benetti ha scritto:
> Handle both positive and negative dclk polarity,
> according to bus_flags, taking care of this:
>
> 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.
> This patch is a way to avoid quirks all around TCON and DOTCLOCK drivers
> for using A33 90? phase divided by 2 and consequently increase code
> complexity.
>
> Check if panel is used. TCON can also handle VGA DAC, then panel could
> be empty.
>
> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
> ---
> drivers/gpu/drm/sun4i/sun4i_tcon.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index 8232b39e16ca..5c7d6ae53111 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -17,6 +17,7 @@
> #include <drm/drm_encoder.h>
> #include <drm/drm_modes.h>
> #include <drm/drm_of.h>
> +#include <drm/drm_panel.h>
>
> #include <uapi/drm/drm_mode.h>
>
> @@ -474,6 +475,33 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
> if (mode->flags & DRM_MODE_FLAG_PVSYNC)
> val |= SUN4I_TCON0_IO_POL_VSYNC_POSITIVE;
>
> + /*
> + * 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 (!IS_ERR(tcon->panel)) {
> + struct drm_panel *panel = tcon->panel;
> + struct drm_connector *connector = panel->connector;
> + struct drm_display_info display_info = connector->display_info;
> +
> + if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
> + clk_set_phase(tcon->dclk, 240);
> +
> + if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
> + clk_set_phase(tcon->dclk, 0);
> + }
> +
> regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG,
> SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | SUN4I_TCON0_IO_POL_VSYNC_POSITIVE,
> val);
>
next prev parent reply other threads:[~2018-07-18 14:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-13 8:16 [PATCH] Revert "drm/sun4i: Handle DRM_BUS_FLAG_PIXDATA_*EDGE" Paul Kocialkowski
2018-06-13 21:52 ` Giulio Benetti
2018-06-14 7:26 ` Paul Kocialkowski
2018-06-15 20:54 ` Giulio Benetti
2018-06-18 8:27 ` Maxime Ripard
2018-07-18 14:23 ` [PATCH] drm/sun4i: Handle DRM_BUS_FLAG_PIXDATA_*EDGE checking if panel is used Giulio Benetti
2018-07-18 14:42 ` Giulio Benetti [this message]
2018-07-19 15:37 ` Maxime Ripard
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=e1fcedb1-64d5-24fb-ffc1-d418620ec795@micronovasrl.com \
--to=giulio.benetti@micronovasrl.com \
--cc=linux-arm-kernel@lists.infradead.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