From: Maxime Ripard <maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
To: Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
Thierry Reding
<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
Mark Van den Borre <mark-8Ycg9RsmSNMdnm+yROfE0A@public.gmane.org>,
Gerry Demaret <gerry-8Ycg9RsmSNMdnm+yROfE0A@public.gmane.org>,
Luc Verhaegen <libv-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>
Subject: Re: [PATCH 1/4] drm/sun4i: tcon: Support an active-low DE signal with RGB interface
Date: Fri, 26 Oct 2018 12:20:15 +0100 [thread overview]
Message-ID: <20181026112015.55wa4f6b7odpuusw@flea> (raw)
In-Reply-To: <265be8b3daab5b9fedcf7646c68c4319a2564b3c.camel-W9ppeneeCTY@public.gmane.org>
On Wed, Oct 24, 2018 at 07:24:32PM +0200, Paul Kocialkowski wrote:
> Hi,
>
> Le mercredi 24 octobre 2018 à 17:47 +0100, Maxime Ripard a écrit :
> > On Tue, Oct 23, 2018 at 11:33:10AM +0200, Paul Kocialkowski wrote:
> > > Hi,
> > >
> > > Le mercredi 10 octobre 2018 à 16:57 +0200, Maxime Ripard a écrit :
> > > > On Wed, Oct 10, 2018 at 01:41:31PM +0200, Paul Kocialkowski wrote:
> > > > > Some panels need an active-low data enable (DE) signal for the RGB
> > > > > interface. This requires flipping a bit in the TCON0 polarity register
> > > > > when setting up the mode for the RGB interface.
> > > > >
> > > > > Add a new helper function to match specific bus flags and use it to set
> > > > > the polarity inversion bit for the DE signal when required.
> > > > >
> > > > > Signed-off-by: Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org>
> > > > > ---
> > > > > drivers/gpu/drm/sun4i/sun4i_tcon.c | 28 ++++++++++++++++++++++++++--
> > > > > drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 +
> > > > > 2 files changed, 27 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > > > > index 3fb084f802e2..d249a462ec09 100644
> > > > > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > > > > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > > > > @@ -78,6 +78,24 @@ static int sun4i_tcon_get_pixel_depth(const struct drm_encoder *encoder)
> > > > > return -EINVAL;
> > > > > }
> > > > >
> > > > > +static bool sun4i_tcon_match_bus_flags(const struct drm_encoder *encoder,
> > > > > + u32 bus_flags)
> > > > > +{
> > > > > + struct drm_connector *connector;
> > > > > + struct drm_display_info *info;
> > > > > +
> > > > > + connector = sun4i_tcon_get_connector(encoder);
> > > > > + if (!connector)
> > > > > + return false;
> > > > > +
> > > > > + info = &connector->display_info;
> > > > > +
> > > > > + if ((info->bus_flags & bus_flags) == bus_flags)
> > > > > + return true;
> > > > > +
> > > > > + return false;
> > > > > +}
> > > > > +
> > > > > static void sun4i_tcon_channel_set_status(struct sun4i_tcon *tcon, int channel,
> > > > > bool enabled)
> > > > > {
> > > > > @@ -415,6 +433,7 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
> > > > > }
> > > > >
> > > > > static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
> > > > > + const struct drm_encoder *encoder,
> > > > > const struct drm_display_mode *mode)
> > > > > {
> > > > > unsigned int bp, hsync, vsync;
> > > > > @@ -474,8 +493,13 @@ 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;
> > > > >
> > > > > + if (sun4i_tcon_match_bus_flags(encoder, DRM_BUS_FLAG_DE_LOW))
> > > > > + val |= SUN4I_TCON0_IO_POL_DE_NEGATIVE;
> > > > > +
> > > >
> > > > There's other flags in use in that function, you should also migrate
> > > > them (ideally by splitting that new function into a separate patch).
> > >
> > > Actually, these other flags are not DRM bus flags but DRM mode flags,
> > > which can be accessed directly from the mode pointer passed as
> > > argument. Thus, they don't require a helper.
> >
> > I was talking about DRM_BUS_FLAG_PIXDATA_POSEDGE and
> > DRM_BUS_FLAG_PIXDATA_NEGEDGE, which are in the current tree.
>
> Thanks, I guess I need to rebase these patches atop the current tree!
>
> Looking at how these flags are used in the current tree, I see that the
> connector's display_info structure (that contains the bus flags) is
> retreived from tcon->panel.
>
> Would it make sense to change this and retreive it from the encoder,
> passed as argument to that function (as I've done in this patch)
> instead? This way, this wouldn't only apply to panels, but also to
> external bridges. It would also somewhat streamline the logic.
>
> What do you think?
That looks like a good idea :)
Maxime
--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
prev parent reply other threads:[~2018-10-26 11:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-10 11:41 [PATCH 1/4] drm/sun4i: tcon: Support an active-low DE signal with RGB interface Paul Kocialkowski
2018-10-10 11:41 ` [PATCH 2/4] drm/panel: simple: Add support for the Lemaker BL035 3.5" LCD Paul Kocialkowski
[not found] ` <20181010114134.8211-2-contact-W9ppeneeCTY@public.gmane.org>
2018-10-10 14:58 ` Maxime Ripard
2018-10-23 10:08 ` Paul Kocialkowski
[not found] ` <30178c8b263656a9c285e45c78e1908927c99c48.camel-W9ppeneeCTY@public.gmane.org>
2018-10-24 16:57 ` Maxime Ripard
2018-10-10 11:41 ` [PATCH 3/4] ARM: dts: sun7i: Add pinmux configuration for LCD0 RGB888 pins Paul Kocialkowski
[not found] ` <20181010114134.8211-3-contact-W9ppeneeCTY@public.gmane.org>
2018-10-10 14:59 ` Maxime Ripard
[not found] ` <20181010114134.8211-1-contact-W9ppeneeCTY@public.gmane.org>
2018-10-10 11:41 ` [PATCH NOT FOR MERGE 4/4] ARM: dts: sun7i-a20-bananapi: Add bindings for the BL035 3.5" LCD Paul Kocialkowski
2018-10-10 14:57 ` [PATCH 1/4] drm/sun4i: tcon: Support an active-low DE signal with RGB interface Maxime Ripard
2018-10-23 9:33 ` Paul Kocialkowski
[not found] ` <224ec158bf627b4d2f577b1dadf10bd87891e2a7.camel-W9ppeneeCTY@public.gmane.org>
2018-10-24 16:47 ` Maxime Ripard
2018-10-24 17:24 ` Paul Kocialkowski
[not found] ` <265be8b3daab5b9fedcf7646c68c4319a2564b3c.camel-W9ppeneeCTY@public.gmane.org>
2018-10-26 11:20 ` Maxime Ripard [this message]
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=20181026112015.55wa4f6b7odpuusw@flea \
--to=maxime.ripard-ldxbnhwyfcjbdgjk7y7tuq@public.gmane.org \
--cc=airlied-cv59FeDIM0c@public.gmane.org \
--cc=contact-W9ppeneeCTY@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=gerry-8Ycg9RsmSNMdnm+yROfE0A@public.gmane.org \
--cc=libv-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
--cc=mark-8Ycg9RsmSNMdnm+yROfE0A@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=wens-jdAy2FN1RRM@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