[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAEt3qoTDgZYXkZU@smile.fi.intel.com>
Date: Thu, 17 Apr 2025 19:35:42 +0300
From: Andy Shevchenko <andy@...nel.org>
To: Ivan Vecera <ivecera@...hat.com>, Hans de Goede <hdegoede@...hat.com>
Cc: Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org,
Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>,
Jiri Pirko <jiri@...nulli.us>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Prathosh Satish <Prathosh.Satish@...rochip.com>,
Lee Jones <lee@...nel.org>, Kees Cook <kees@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Schmidt <mschmidt@...hat.com>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v3 net-next 3/8] mfd: Add Microchip ZL3073x support
+Cc: Hans, author of the below mentioned APIs.
On Thu, Apr 17, 2025 at 06:29:01PM +0200, Ivan Vecera wrote:
> On 17. 04. 25 5:42 odp., Andy Shevchenko wrote:
> > > > Would it be acceptable for you something like this:
> > V4L2 (or media subsystem) solve the problem by providing a common helpers for
> > reading and writing tons of different registers in cameras. See the commit
> > 613cbb91e9ce ("media: Add MIPI CCI register access helper functions").
> >
> > Dunno if it helps here, though.
>
> Bingo, this approach looks very good.
>
> I can use unsigned int (32bit) to encode everything necessary:
> Bits 0..15 - register address (virtual range offset, page, offset)
> Bits 16..21 - size in bits (enough for max 48)
> Bits 22..26 - max items (32 values - enough for any indexed register)
> Bits 27..31 - stride between (up to 32 - enough per datasheet)
>
> Only thing I don't like is that MIPI CCI API uses for calls u64 as value:
>
> int cci_read(struct regmap *map, u32 reg, u64 *val, ...);
>
> This forces a caller to use u64 for every register read. I rather to use
> 'void *val' the same way as regmap_read().
You may discuss with them why they choose that and how to make that code shared
more widely if needed.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists