Re: [PATCH v3 4/4] media: rcar-csi2: Add D-PHY support for V4H

From: Niklas Söderlund
Date: Thu Jun 12 2025 - 08:28:16 EST


On 2025-06-12 13:19:45 +0200, Geert Uytterhoeven wrote:
> On Thu, 12 Jun 2025 at 12:01, Niklas Söderlund
> <niklas.soderlund+renesas@xxxxxxxxxxxx> wrote:
> > On 2025-06-12 02:04:12 +0300, Laurent Pinchart wrote:
> > > > --- a/drivers/media/platform/renesas/rcar-csi2.c
> > > > +++ b/drivers/media/platform/renesas/rcar-csi2.c
> > > > + if (mbps >= 80) {
> > > > + if (mbps >= 2560)
> > > > + val = 6;
> > > > + else if (mbps >= 1280)
> > > > + val = 5;
> > > > + else if (mbps >= 640)
> > > > + val = 4;
> > > > + else if (mbps >= 320)
> > > > + val = 3;
> > > > + else if (mbps >= 160)
> > > > + val = 2;
> > > > + else if (mbps >= 80)
> > > > + val = 1;
> > >
> > > You could possibly replace this with
> > >
> > > val = ilog2(mbps / 80) + 1;
> > >
> > > Up to you.
> >
> > I opted to keep it as is to make it easier to match with the datasheet.
> > The ilog2() is clever but I will never remember why it was used ;-)
>
> +1 for ilog2() ;-)

When you two agree it's likely a good idea, I surrender ;-) Will use
ilog2() in next version. Thanks for your feedback.

>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
>
> 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

--
Kind Regards,
Niklas Söderlund