[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdU_gvs1+KtN14DxAMY+Qa2YTo8KL3L4VnL3yG2zYiH6JQ@mail.gmail.com>
Date: Fri, 23 Jun 2023 19:51:07 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Thomas Zimmermann <tzimmermann@...e.de>,
Magnus Damm <magnus.damm@...il.com>,
dri-devel@...ts.freedesktop.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 23/39] drm: renesas: shmobile: Move interface handling to
connector setup
Hi Laurent,
On Fri, Jun 23, 2023 at 6:39 PM Laurent Pinchart
<laurent.pinchart@...asonboard.com> wrote:
> On Thu, Jun 22, 2023 at 11:21:35AM +0200, Geert Uytterhoeven wrote:
> > Move legacy interface handling to the connector setup code.
> > Set up bus_flags and bus_formats in display_info according to the
> > bus format and panel information from platform data, to make it more
> > similar with DT-based connector/bridge/panel setup.
> > This will allows us to use the same LCD interface setup code for both
>
> s/allows/allow/
>
> > legacy and DT-based systems.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
> > --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c
> > +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c
> > @@ -8,6 +8,7 @@
> > */
> >
> > #include <linux/clk.h>
> > +#include <linux/media-bus-format.h>
> > #include <linux/pm_runtime.h>
> >
> > #include <drm/drm_crtc.h>
> > @@ -66,15 +67,65 @@ static void shmob_drm_crtc_setup_geometry(struct shmob_drm_crtc *scrtc)
> > {
> > struct drm_crtc *crtc = &scrtc->crtc;
> > struct shmob_drm_device *sdev = to_shmob_device(crtc->dev);
> > - enum display_flags dpy_flags = sdev->connector.mode->flags;
> > + const struct drm_display_info *info = &sdev->connector->display_info;
> > const struct drm_display_mode *mode = &crtc->mode;
> > u32 value;
> >
> > - value = sdev->ldmt1r
> > - | ((mode->flags & DRM_MODE_FLAG_PVSYNC) ? 0 : LDMT1R_VPOL)
> > - | ((mode->flags & DRM_MODE_FLAG_PHSYNC) ? 0 : LDMT1R_HPOL)
> > - | ((dpy_flags & DISPLAY_FLAGS_PIXDATA_POSEDGE) ? LDMT1R_DWPOL : 0)
> > - | ((dpy_flags & DISPLAY_FLAGS_DE_LOW) ? LDMT1R_DIPOL : 0);
> > + if (!info->num_bus_formats || !info->bus_formats) {
> > + dev_warn(sdev->dev, "No bus format reported, using RGB888\n");
> > + value = LDMT1R_MIFTYP_RGB24;
> > + } else {
> > + switch (info->bus_formats[0]) {
> > + case MEDIA_BUS_FMT_RGB888_3X8:
> > + value = LDMT1R_MIFTYP_RGB8;
> > + break;
> > +
> > + case MEDIA_BUS_FMT_RGB666_2X9_BE:
> > + value = LDMT1R_MIFTYP_RGB9;
> > + break;
> > +
> > + case MEDIA_BUS_FMT_RGB888_2X12_BE:
> > + value = LDMT1R_MIFTYP_RGB12A;
> > + break;
> > +
> > + case MEDIA_BUS_FMT_RGB444_1X12:
> > + value = LDMT1R_MIFTYP_RGB12B;
> > + break;
> > +
> > + case MEDIA_BUS_FMT_RGB565_1X16:
> > + value = LDMT1R_MIFTYP_RGB16;
> > + break;
> > +
> > + case MEDIA_BUS_FMT_RGB666_1X18:
> > + value = LDMT1R_MIFTYP_RGB18;
> > + break;
> > +
> > + case MEDIA_BUS_FMT_RGB888_1X24:
> > + value = LDMT1R_MIFTYP_RGB24;
> > + break;
> > +
> > + case MEDIA_BUS_FMT_UYVY8_1X16:
> > + value = LDMT1R_MIFTYP_YCBCR;
> > + break;
> > +
> > + default:
> > + dev_warn(sdev->dev,
> > + "unsupported bus format 0x%x, using RGB888\n",
> > + info->bus_formats[0]);
> > + value = LDMT1R_MIFTYP_RGB24;
> > + break;
> > + }
>
> It's a bit annoying to lose the ability to validate the bus format at
> probe time. Can it be kept. I'm also OK with restoring it later in the
> series if it gets in the way of the conversion, in which case a mention
> in the commit message would be nice.
I guess I can keep it, somewhere.
Probably it should be validated for the DT case later, too.
BTW, drivers/gpu/drm/renesas/rcar-du/rcar_lvds.s doesn't check this
either, so I copied the bad example from the expert ;-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists