From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Chen-Yu Tsai <wens@csie.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
David Airlie <airlied@linux.ie>,
dri-devel <dri-devel@lists.freedesktop.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Rob Herring <robh+dt@kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-clk <linux-clk@vger.kernel.org>,
Priit Laes <plaes@plaes.org>, Icenowy Zheng <icenowy@aosc.io>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Quentin Schulz <quentin.schulz@free-electrons.com>,
Mylene Josserand <mylene.josserand@free-electrons.com>
Subject: Re: [PATCH 06/23] drm/sun4i: tcon: Don't rely on encoders to set the TCON mode
Date: Tue, 17 Oct 2017 16:39:35 +0200 [thread overview]
Message-ID: <20171017143935.hdpo5enms3qjqbcy@flea.lan> (raw)
In-Reply-To: <CAGb2v679FWRRiTfS5jReFqiAEEiqAg13wUPHOYdT_=gebh25tg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 8276 bytes --]
On Tue, Oct 17, 2017 at 05:56:47PM +0800, Chen-Yu Tsai wrote:
> On Tue, Oct 17, 2017 at 5:06 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Just like we did for the TCON enable and disable, for historical reasons we
> > used to rely on the encoders calling the TCON mode_set function, while the
> > CRTC has a callback for that.
> >
> > Let's implement it in order to reduce the boilerplate code.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> > drivers/gpu/drm/sun4i/sun4i_crtc.c | 10 +++++++-
> > drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c | 1 +-
> > drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 7 +-----
> > drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 1 +-
> > drivers/gpu/drm/sun4i/sun4i_rgb.c | 15 +-----------
> > drivers/gpu/drm/sun4i/sun4i_tcon.c | 31 +++++++++++++++++-----
> > drivers/gpu/drm/sun4i/sun4i_tcon.h | 11 ++------
> > drivers/gpu/drm/sun4i/sun4i_tv.c | 6 +----
> > 8 files changed, 37 insertions(+), 45 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
> > index e86baa3746af..5decae0069d0 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
> > @@ -115,11 +115,21 @@ static void sun4i_crtc_atomic_enable(struct drm_crtc *crtc,
> > sun4i_tcon_set_status(scrtc->tcon, encoder, true);
> > }
> >
> > +static void sun4i_crtc_mode_set_nofb(struct drm_crtc *crtc)
> > +{
> > + struct drm_display_mode *mode = &crtc->state->adjusted_mode;
> > + struct drm_encoder *encoder = sun4i_crtc_get_encoder(crtc);
> > + struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
> > +
> > + sun4i_tcon_mode_set(scrtc->tcon, encoder, mode);
> > +}
> > +
> > static const struct drm_crtc_helper_funcs sun4i_crtc_helper_funcs = {
> > .atomic_begin = sun4i_crtc_atomic_begin,
> > .atomic_flush = sun4i_crtc_atomic_flush,
> > .atomic_enable = sun4i_crtc_atomic_enable,
> > .atomic_disable = sun4i_crtc_atomic_disable,
> > + .mode_set_nofb = sun4i_crtc_mode_set_nofb,
> > };
> >
> > static int sun4i_crtc_enable_vblank(struct drm_crtc *crtc)
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
> > index 04f85b1cf922..e826da34e919 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
> > @@ -13,7 +13,6 @@
> > #include <linux/clk-provider.h>
> > #include <linux/regmap.h>
> >
> > -#include "sun4i_tcon.h"
> > #include "sun4i_hdmi.h"
> >
> > struct sun4i_ddc {
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> > index 482bf03d55c1..d2eb0a60e568 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> > @@ -30,7 +30,6 @@
> > #include "sun4i_crtc.h"
> > #include "sun4i_drv.h"
> > #include "sun4i_hdmi.h"
> > -#include "sun4i_tcon.h"
> >
> > static inline struct sun4i_hdmi *
> > drm_encoder_to_sun4i_hdmi(struct drm_encoder *encoder)
> > @@ -120,15 +119,9 @@ static void sun4i_hdmi_mode_set(struct drm_encoder *encoder,
> > struct drm_display_mode *adjusted_mode)
> > {
> > struct sun4i_hdmi *hdmi = drm_encoder_to_sun4i_hdmi(encoder);
> > - struct sun4i_crtc *crtc = drm_crtc_to_sun4i_crtc(encoder->crtc);
> > - struct sun4i_tcon *tcon = crtc->tcon;
> > unsigned int x, y;
> > u32 val;
> >
> > - sun4i_tcon1_mode_set(tcon, mode);
> > - sun4i_tcon_set_mux(tcon, 1, encoder);
> > -
> > - clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
> > clk_set_rate(hdmi->mod_clk, mode->crtc_clock * 1000);
> > clk_set_rate(hdmi->tmds_clk, mode->crtc_clock * 1000);
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> > index 1b6b37aefc38..dc332ea56f6c 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
> > @@ -12,7 +12,6 @@
> >
> > #include <linux/clk-provider.h>
> >
> > -#include "sun4i_tcon.h"
> > #include "sun4i_hdmi.h"
> >
> > struct sun4i_tmds {
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> > index a7f297ed40c1..832f8f9bc47f 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> > @@ -153,22 +153,7 @@ static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
> > }
> > }
> >
> > -static void sun4i_rgb_encoder_mode_set(struct drm_encoder *encoder,
> > - struct drm_display_mode *mode,
> > - struct drm_display_mode *adjusted_mode)
> > -{
> > - struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> > - struct sun4i_tcon *tcon = rgb->tcon;
> > -
> > - sun4i_tcon0_mode_set(tcon, mode);
> > - sun4i_tcon_set_mux(tcon, 0, encoder);
> > -
> > - /* FIXME: This seems to be board specific */
> > - clk_set_phase(tcon->dclk, 120);
> > -}
> > -
> > static struct drm_encoder_helper_funcs sun4i_rgb_enc_helper_funcs = {
> > - .mode_set = sun4i_rgb_encoder_mode_set,
> > .disable = sun4i_rgb_encoder_disable,
> > .enable = sun4i_rgb_encoder_enable,
> > };
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > index 964cf22a1ced..7ecd4f7c8411 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > @@ -139,7 +139,6 @@ void sun4i_tcon_set_mux(struct sun4i_tcon *tcon, int channel,
> > DRM_DEBUG_DRIVER("Muxing encoder %s to CRTC %s: %d\n",
> > encoder->name, encoder->crtc->name, ret);
> > }
> > -EXPORT_SYMBOL(sun4i_tcon_set_mux);
> >
> > static int sun4i_tcon_get_clk_delay(const struct drm_display_mode *mode,
> > int channel)
> > @@ -159,8 +158,8 @@ static int sun4i_tcon_get_clk_delay(const struct drm_display_mode *mode,
> > return delay;
> > }
> >
> > -void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
> > - struct drm_display_mode *mode)
> > +static void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
> > + struct drm_display_mode *mode)
>
> This doesn't have const...
>
> > {
> > unsigned int bp, hsync, vsync;
> > u8 clk_delay;
> > @@ -233,10 +232,9 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
> > /* Enable the output on the pins */
> > regmap_write(tcon->regs, SUN4I_TCON0_IO_TRI_REG, 0);
> > }
> > -EXPORT_SYMBOL(sun4i_tcon0_mode_set);
> >
> > -void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
> > - struct drm_display_mode *mode)
> > +static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
> > + const struct drm_display_mode *mode)
> > {
> > unsigned int bp, hsync, vsync, vtotal;
> > u8 clk_delay;
> > @@ -324,7 +322,26 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
> > SUN4I_TCON_GCTL_IOMAP_MASK,
> > SUN4I_TCON_GCTL_IOMAP_TCON1);
> > }
> > -EXPORT_SYMBOL(sun4i_tcon1_mode_set);
> > +
> > +void sun4i_tcon_mode_set(struct sun4i_tcon *tcon,
> > + const struct drm_encoder *encoder,
> > + const struct drm_display_mode *mode)
>
> But this does...
>
> > +{
> > + switch (encoder->encoder_type) {
> > + case DRM_MODE_ENCODER_NONE:
> > + sun4i_tcon0_mode_set(tcon, mode);
>
> So you're likely to get some warning about dropping const here.
>
> Otherwise,
>
> Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Strangely enough, it doesn't. I've fixed it and applied.
Thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
next prev parent reply other threads:[~2017-10-17 14:39 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 9:06 [PATCH 00/23] drm/sun4i: Add A83t LVDS support Maxime Ripard
2017-10-17 9:06 ` [PATCH 01/23] drm/sun4i: Implement endpoint parsing using kfifo Maxime Ripard
2017-10-17 9:19 ` Chen-Yu Tsai
2017-10-17 14:29 ` Maxime Ripard
2017-10-17 9:06 ` [PATCH 02/23] drm/sun4i: Realign Makefile padding and reorder it Maxime Ripard
2017-10-17 9:14 ` Chen-Yu Tsai
2017-10-17 14:34 ` Maxime Ripard
2017-10-17 9:06 ` [PATCH 03/23] drm/sun4i: tcon: Make tcon_set_mux mode argument const Maxime Ripard
2017-10-17 9:21 ` Chen-Yu Tsai
2017-10-17 14:35 ` Maxime Ripard
2017-10-17 9:06 ` [PATCH 04/23] drm/sun4i: tcon: Make tcon_get_clk_delay " Maxime Ripard
2017-10-17 9:22 ` Chen-Yu Tsai
2017-10-17 14:37 ` Maxime Ripard
2017-10-17 9:06 ` [PATCH 05/23] drm/sun4i: tcon: Don't rely on encoders to enable the TCON Maxime Ripard
2017-10-17 9:28 ` Chen-Yu Tsai
2017-10-17 14:38 ` Maxime Ripard
2017-10-17 9:06 ` [PATCH 06/23] drm/sun4i: tcon: Don't rely on encoders to set the TCON mode Maxime Ripard
2017-10-17 9:56 ` Chen-Yu Tsai
2017-10-17 14:39 ` Maxime Ripard [this message]
2017-10-17 9:06 ` [PATCH 07/23] drm/sun4i: tcon: Move out the tcon0 common setup Maxime Ripard
2017-10-17 10:00 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 08/23] dt-bindings: panel: lvds: Document power-supply property Maxime Ripard
2017-10-17 10:01 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 09/23] drm/panel: lvds: Add support for the " Maxime Ripard
2017-10-17 10:02 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 10/23] clk: sunxi-ng: Add A83T display clocks Maxime Ripard
2017-10-17 10:04 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 11/23] drm/sun4i: Rename layers to UI planes Maxime Ripard
2017-10-17 10:09 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 12/23] drm/sun4i: sun8i: properly support UI channels Maxime Ripard
2017-10-17 12:17 ` icenowy
2017-10-17 9:06 ` [PATCH 13/23] drm/sun4i: Reorder and document DE2 mixer registers Maxime Ripard
2017-10-17 9:06 ` [PATCH 14/23] drm/sun4i: Create minimal multipliers and dividers Maxime Ripard
2017-10-17 10:15 ` Chen-Yu Tsai
2017-10-24 2:12 ` [14/23] " Jonathan Liu
2017-10-17 9:06 ` [PATCH 15/23] drm/sun4i: Add LVDS support Maxime Ripard
2017-10-17 11:51 ` Chen-Yu Tsai
2017-10-22 18:52 ` Priit Laes
2017-10-23 2:23 ` [15/23] " Jonathan Liu
2017-10-23 20:17 ` [PATCH 15/23] " Priit Laes
2017-10-17 9:06 ` [PATCH 16/23] drm/sun4i: Add A83T support Maxime Ripard
2017-10-17 10:34 ` Chen-Yu Tsai
2017-10-17 12:28 ` icenowy
2017-10-17 9:06 ` [PATCH 17/23] arm: dts: sun8i: a83t: Add display pipeline Maxime Ripard
2017-10-17 10:48 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 18/23] arm: dts: sun8i: a83t: Enable the PWM Maxime Ripard
2017-10-17 11:57 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 19/23] arm: dts: sun8i: a83t: Add LVDS pins group Maxime Ripard
2017-10-17 10:50 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 20/23] arm: dts: sun8i: a83t: Add the PWM pin group Maxime Ripard
2017-10-17 10:51 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 21/23] arm: dts: sun8i: a711: Add regulator support Maxime Ripard
2017-10-17 12:08 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 22/23] arm: dts: sun8i: a711: Enable USB OTG Maxime Ripard
2017-10-17 10:53 ` Chen-Yu Tsai
2017-10-17 9:06 ` [PATCH 23/23] arm: dts: sun8i: a711: Enable the LCD Maxime Ripard
2017-10-17 12:16 ` Chen-Yu Tsai
2017-10-17 12:16 ` [PATCH 00/23] drm/sun4i: Add A83t LVDS support Chen-Yu Tsai
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=20171017143935.hdpo5enms3qjqbcy@flea.lan \
--to=maxime.ripard@free-electrons.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=icenowy@aosc.io \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mylene.josserand@free-electrons.com \
--cc=plaes@plaes.org \
--cc=quentin.schulz@free-electrons.com \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@free-electrons.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
all inboxes | Powered by JetHome®