Linux Media Controller development
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Alexander Shiyan <eagle.alexander923@gmail.com>,
	linux-media@vger.kernel.org,
	Isaac Scott <isaac.scott@ideasonboard.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Dongcheng Yan <dongcheng.yan@intel.com>,
	devicetree@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Hans Verkuil <hverkuil@kernel.org>,
	Hans de Goede <johannes.goede@oss.qualcomm.com>,
	Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	Mehdi Djait <mehdi.djait@linux.intel.com>,
	Benjamin Mugnier <benjamin.mugnier@foss.st.com>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Jingjing Xiong <jingjing.xiong@intel.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>
Subject: Re: [RFC PATCH v3 1/2] dt-bindings: media: i2c: Add onsemi AR0234 image sensor binding
Date: Thu, 21 May 2026 10:48:24 +0100	[thread overview]
Message-ID: <20260521-dangling-utensil-610af5e07d79@spud> (raw)
In-Reply-To: <20260505163713.GE1547435@killaraus.ideasonboard.com>

[-- Attachment #1: Type: text/plain, Size: 5999 bytes --]

On Tue, May 05, 2026 at 07:37:13PM +0300, Laurent Pinchart wrote:
> On Tue, May 05, 2026 at 05:09:18PM +0300, Alexander Shiyan wrote:
> > > On Fri, Mar 06, 2026 at 01:36:13PM +0300, Alexander Shiyan wrote:
> > > > Add devicetree binding for the onsemi AR0234 CMOS image sensor.
> > > >
> > > > Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
> > > > ---
> > > >  .../bindings/media/i2c/onnn,ar0234.yaml       | 109 ++++++++++++++++++
> > > >  1 file changed, 109 insertions(+)
> > > >  create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,ar0234.yaml
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/media/i2c/onnn,ar0234.yaml b/Documentation/devicetree/bindings/media/i2c/onnn,ar0234.yaml
> > > > new file mode 100644
> > > > index 000000000000..d93fa99e6535
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/media/i2c/onnn,ar0234.yaml
> > > > @@ -0,0 +1,109 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/media/i2c/onnn,ar0234.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: ON Semiconductor AR0234 1/2.6-inch CMOS Digital Image Sensor
> > > > +
> > > > +description:
> > > > +  The AR0234 is a 1/2.6-inch CMOS digital image sensor with a pixel
> > > > +  array of 1940x1220 pixels, capable of 1920x1200 resolution at up
> > > > +  to 120 fps. It supports MIPI CSI-2 output with 1, 2, or 4 data lanes,
> > > > +  and raw Bayer (8/10-bit) or monochrome output.
> > > > +
> > > > +properties:
> > > > +  compatible:
> > > > +    const: onnn,ar0234cs
> > >
> > > Should we define separate compatible strings for the mono and colour
> > > variants ? I know you identify the variant at runtime in the driver, but
> > > avoid I2C communication at boot time can be beneficial (to reduce boot
> > > time, and also to avoid flashing the privacy LED on systems that have
> > > one, albeit the latter is probably less applicable to the AR0234).
> > 
> > We could do it like this — Color: ar0234cssc, Mono: ar0234cssm.
> > But the current approach is more universal...
> > Could we add two compatible strings and keep the base one for auto-detection?
> > For detection, it would still be good to check the identifier anyway...
> > Or just add two compatible strings but detect connected variant in any case?
> 
> I see multiple use cases:
> 
> 1. You know at build time that you have an AR0234CS, but the model (mono
>    or colour) is only known at runtime (e.g. a product exists in mono and
>    colour options, with the options being otherwise identical).
> 
>    This can be implemented with a single compatible string
>    "onnn,ar0234cs" and a runtime check of the model in the driver, *or*
>    with two compatible strings for the two models and a runtime check in
>    the boot loader that will set the correct compatible string.

You can kinda have both of these, runtime detection on a common fallback
compatible, and the bootloader selecting the right dtb/overlay etc with
specific ones.

> 
> 2. You know at build time what exact camera module you have, and you
>    want to avoid powering the sensor up at boot time (e.g. boot time
>    optimization, avoiding privacy LED flashing, ...).
> 
>    This requires two separate compatible strings for the two models.
> 
> 3. You know at build time what exact camera module you have, and you
>    want a runtime sanity check.
> 
>    This requires two separate compatible strings for the two models.

Maybe in media land this kind of thing is okay, because the likelihood
of compatibility between models is low, but overall I dislike this kind
of thing as it causes problems when using fallbacks. Perhaps here that
doesn't matter at all because you're only doing colour/mono
differentiation, not validating that this is an ar0234cs?

> In order to cover all those use cases, we could use
> 
> properties:
>   compatible:
>     enum:
>       - onnn,ar0234cssc
>       - onnn,ar0234cssm
>       - onnn,ar0234cs
> 
> The first two compatible strings would cover use case 1 with the boot
> loader detection, use case 2, and use case 3. The last compatible string
> would cover use case 1 without the boot loader detection. This is waht
> the sony,imx296.yaml binding does. The sony,imx290.yaml binding, on the
> other hand, has deprecated the generic compatible string.
> 
> We could also use
> 
> properties:
>   compatible:
>     oneOf:
>       - const: onnn,ar0234cs
>       - items:
>           - enum:
>               - onnn,ar0234cssc
>               - onnn,ar0234cssm
>           - const: onnn,ar0234cs
> 
> if we want a fallback compatible string, which could allow systems that
> only case about use case 1 without boot loader detection to only match
> on "onnn,ar0234cs" in their driver. I don't think we have any such
> bindings for image sensors.
> 
> I don't think we've decided on a recommended practice.

I definitely don't like the first suggestion here, the second is more
acceptable. With the first, it definitely seems just like abusing the
compatible property to have different behaviour for the exact same
hardware.

| properties:
|   compatible:
|     items: 
|       - enum:
|           - onnn,ar0234cssc
|           - onnn,ar0234cssm
|       - const: onnn,ar0234cs

Can also do this, but have all three devices in the driver, to promote
completely describing a device while also supporting lazy/cheap vendors
that want to reuse a dtb rather than implement two images or a selection
method. Obviously it'd produce dtbs_check warnings, but it is not as if
those sorts of vendors care about dtbs_check.
I mention vendors specifically here, since an end user can probably
update their dtb once they figure out which device they actually have,
which I think shouldn't be very difficult!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-05-21  9:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 10:36 [RFC PATCH v3 0/2] media: i2c: Add onsemi AR0234 camera sensor driver Alexander Shiyan
2026-03-06 10:36 ` [RFC PATCH v3 1/2] dt-bindings: media: i2c: Add onsemi AR0234 image sensor binding Alexander Shiyan
2026-05-05 10:15   ` Laurent Pinchart
2026-05-05 14:09     ` Alexander Shiyan
2026-05-05 16:37       ` Laurent Pinchart
2026-05-21  9:48         ` Conor Dooley [this message]
2026-03-06 10:36 ` [RFC PATCH v3 2/2] media: i2c: Add onsemi AR0234 image sensor driver Alexander Shiyan
2026-05-05  4:21   ` Quentin Freimanis
2026-05-05  7:27     ` Alexander Shiyan
2026-05-05 16:11   ` Laurent Pinchart
2026-05-06 18:41     ` Alexander Shiyan
2026-05-07 13:35     ` Alexander Shiyan
2026-05-07  4:12   ` Quentin Freimanis
2026-05-07 13:52     ` Alexander Shiyan
2026-05-05 10:29 ` [RFC PATCH v3 0/2] media: i2c: Add onsemi AR0234 camera " Laurent Pinchart

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=20260521-dangling-utensil-610af5e07d79@spud \
    --to=conor@kernel.org \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dongcheng.yan@intel.com \
    --cc=eagle.alexander923@gmail.com \
    --cc=hverkuil@kernel.org \
    --cc=isaac.scott@ideasonboard.com \
    --cc=jingjing.xiong@intel.com \
    --cc=johannes.goede@oss.qualcomm.com \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=vladimir.zapolskiy@linaro.org \
    /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