Linux Media Controller development
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: ALOK TIWARI <alok.a.tiwari@oracle.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] media: rcar-csi2: Add D-PHY support for V4H
Date: Mon, 12 May 2025 10:48:43 +0200	[thread overview]
Message-ID: <20250512084843.GE2365307@ragnatech.se> (raw)
In-Reply-To: <CAMuHMdUbMRBFV-7hDMQ3-UKAhzfbGM5yZJz05aGAHpOKZ5eKcQ@mail.gmail.com>

On 2025-05-12 09:37:48 +0200, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> On Sun, 11 May 2025 at 22:03, Niklas Söderlund
> <niklas.soderlund+renesas@ragnatech.se> wrote:
> > On 2025-05-12 00:37:09 +0530, ALOK TIWARI wrote:
> > > On 11-05-2025 23:17, Niklas Söderlund wrote:
> > > > +   rcsi2_write16(priv, V4H_CORE_DIG_COMMON_RW_DESKEW_FINE_MEM_REG, 0x0404);
> > > > +   rcsi2_write16(priv, V4H_CORE_DIG_COMMON_RW_DESKEW_FINE_MEM_REG, 0x040c);
> > > > +   rcsi2_write16(priv, V4H_CORE_DIG_COMMON_RW_DESKEW_FINE_MEM_REG, 0x0414);
> > > > +   rcsi2_write16(priv, V4H_CORE_DIG_COMMON_RW_DESKEW_FINE_MEM_REG, 0x041c);
> 
>  [...]
> 
> > > Instead of manually writing each call, it could use a loop ?
> > >
> > > for (int i = 0x0404; i <= 0x07fc; i += 0x08) {
> > >     rcsi2_write16(priv, V4H_CORE_DIG_COMMON_RW_DESKEW_FINE_MEM_REG, i);
> >
> > Unfortunately the values are not all sequential, see the progression
> > 0x061c -> 0x0623 and 0x071c -> 0x0723 for example.
> >
> > > or if values are not strictly sequential, iterating over the array.
> > > static const u16 register_values[]= {0x0404, 0x040c, 0x0414 etc,,}
> > > rcsi2_write16(priv, V4H_CORE_DIG_COMMON_RW_DESKEW_FINE_MEM_REG,
> > > register_values[i]);
> >
> > I agree with you, a array of values would make this look a tad less
> > silly and would reduce the number of lines. I considered this while
> > writing it but opted for this. My reason was as most of the register
> > writes needed to setup the PHY are not documented in the docs I have and
> > I wanted to keep the driver as close to the table of magic values I have
> > to make it easy to compare driver and the limited documentation.
> >
> > I guess it's really a matter of style. I have no real strong opinion, if
> > people think an array would be nicer I have no issue switching to that.
> 
> Have you looked at the impact on kernel size?

That is a good point, I'm sure an array would reduce the kernel size. I 
could possibly even craft a few clever loops to to generate the values 
as they are almost sequential. As these are magic values I had opted to 
keep it close to the docs, but seems people prefere something else. Will 
change this and send new version.

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

-- 
Kind Regards,
Niklas Söderlund

  reply	other threads:[~2025-05-12  8:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-11 17:47 [PATCH v2 0/4] media: rcar-csi2: Add D-PHY support for V4H Niklas Söderlund
2025-05-11 17:47 ` [PATCH v2 1/4] media: rcar-csi2: Clarify usage of mbps and msps Niklas Söderlund
2025-05-30 12:31   ` Tomi Valkeinen
2025-05-30 13:04   ` Laurent Pinchart
2025-05-11 17:47 ` [PATCH v2 2/4] media: rcar-csi2: Rework macros to access AFE lanes Niklas Söderlund
2025-05-30 13:06   ` Laurent Pinchart
2025-05-11 17:47 ` [PATCH v2 3/4] media: rcar-csi2: Update start procedure for V4H Niklas Söderlund
2025-05-30 13:42   ` Laurent Pinchart
2025-05-11 17:47 ` [PATCH v2 4/4] media: rcar-csi2: Add D-PHY support " Niklas Söderlund
2025-05-11 19:07   ` ALOK TIWARI
2025-05-11 20:03     ` Niklas Söderlund
2025-05-12  7:37       ` Geert Uytterhoeven
2025-05-12  8:48         ` Niklas Söderlund [this message]
2025-05-30 13:38           ` Laurent Pinchart
2025-05-30 12:31 ` [PATCH v2 0/4] " Tomi Valkeinen

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=20250512084843.GE2365307@ragnatech.se \
    --to=niklas.soderlund+renesas@ragnatech.se \
    --cc=alok.a.tiwari@oracle.com \
    --cc=geert@linux-m68k.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomi.valkeinen+renesas@ideasonboard.com \
    /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