[PATCH/RFC 05/12] drm: rcar-du: lvds: Add data swap support

Geert Uytterhoeven geert at linux-m68k.org
Fri Aug 2 09:01:30 UTC 2019


Hi Laurent,

On Fri, Aug 2, 2019 at 10:06 AM Laurent Pinchart
<laurent.pinchart at ideasonboard.com> wrote:
> On Fri, Aug 02, 2019 at 08:34:02AM +0100, Fabrizio Castro wrote:
> > When in vertical stripe mode of operation, there is the option
> > of swapping even data and odd data on the two LVDS interfaces
> > used to drive the video output.
> > Add data swap support by exposing a new DT property named
> > "renesas,swap-data".
> >
> > Signed-off-by: Fabrizio Castro <fabrizio.castro at bp.renesas.com>

> > --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c

> > @@ -439,12 +440,16 @@ static void rcar_lvds_enable(struct drm_bridge *bridge)
> >       rcar_lvds_write(lvds, LVDCHCR, lvdhcr);
> >
> >       if (lvds->info->quirks & RCAR_LVDS_QUIRK_DUAL_LINK) {
> > -             /*
> > -              * Configure vertical stripe based on the mode of operation of
> > -              * the connected device.
> > -              */
> > -             rcar_lvds_write(lvds, LVDSTRIPE,
> > -                             lvds->dual_link ? LVDSTRIPE_ST_ON : 0);
> > +             u32 lvdstripe = 0;
> > +
> > +             if (lvds->dual_link)
> > +                     /*
> > +                      * Configure vertical stripe based on the mode of
> > +                      * operation of the connected device.
> > +                      */
> > +                     lvdstripe = LVDSTRIPE_ST_ON | (lvds->stripe_swap_data ?
> > +                                                    LVDSTRIPE_ST_SWAP : 0);
>
> Would the following be simpler ?
>
>                 lvdstripe = (lvds->dual_link ? LVDSTRIPE_ST_ON : 0)
>                           | (lvds->stripe_swap_data ? LVDSTRIPE_ST_SWAP : 0);

>From the point of view of "wc -l": yes.
>From the point of view of readability, I'd go for:

    if (lvds->dual_link)
            lvdstripe |= LVDSTRIPE_ST_ON;
    if (lvds->stripe_swap_data)
            lvdstripe |= LVDSTRIPE_ST_SWAP;

> > +             rcar_lvds_write(lvds, LVDSTRIPE, lvdstripe);
> >       }
> >
> >       /*
> > @@ -770,8 +775,12 @@ static int rcar_lvds_parse_dt(struct rcar_lvds *lvds)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-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


More information about the dri-devel mailing list