mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: "Matti Vaittinen" <matti.vaittinen@fi.rohmeurope.com>,
	"Matti Vaittinen" <matti.vaittinen@linux.dev>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Marcelo Schmitt" <marcelo.schmitt@analog.com>,
	"Joshua Crofts" <joshua.crofts1@gmail.com>,
	"Radu Sabau" <radu.sabau@analog.com>,
	"Janani Sunil" <janani.sunil@analog.com>,
	"Salih Erim" <salih.erim@amd.com>,
	"Jishnu Prakash" <jishnu.prakash@oss.qualcomm.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Jakub Szczudlo" <jakubszczudlo40@gmail.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] dt-bindings: iio: Support ROHM BD79111
Date: Fri, 20 Nov 2026 17:37:52 +0000	[thread overview]
Message-ID: <20261120-unneeded-rockiness-7225e7368478@spud> (raw)
In-Reply-To: <bf0dd82b-e1a5-4ab9-9ab7-1641181d303f@gmail.com>

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

On Fri, Nov 20, 2026 at 02:01:36PM +0200, Matti Vaittinen wrote:
> On 18/11/2026 19:37, Conor Dooley wrote:
> > On Wed, Nov 18, 2026 at 04:19:11PM +0200, Matti Vaittinen wrote:
> > > From: Matti Vaittinen <mazziesaccount@gmail.com>
> > > 
> > > ROHM BD79111 is very similar to the BD79112. Both are ADC/GPIO devices,
> > > where pins can be configured to be either used as GPIO or ADC inputs.
> > > ADCs are 12-bit SAR ADCs and GPIOs support input/output but not being IRQ
> > > sources.
> > > 
> > > The main difference is amount of channels/GPIOs. The BD79112 has 32 pins
> > > for this use, the BD79111 has 16. Furthermore, the BD79111 data-sheet
> > > promises 0.5 MSPS sample rate with maximum of 10 MHz SPI clock,  whereas
> > > the BD79112 data-sheet mentioned 1MSPS rate with maximum of 20 MHz SPI
> > > clock.
> > > 
> > > Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> > > 
> > > ---
> > > 
> > > Note, I had to change the 'root-level' additionalProperties: false to
> > > unevaluatedProperties: false in order to allow the properties in the new
> > > allOf:
> > >    - if:
> > >       ...
> > > 
> > > section. It seems to me this is what a few other bindings in IIO do, but
> > > I suppose it makes this "less strict". Well, since I am terrible with
> > > writing bindings, I'd better point this out and ask if it's ok, or if
> > > there are better way(s) to handle this?
> > 
> > I don't think you should have to do that though, since the children are
> > described in the same file.
> > If you instead retained the pattern properties section, and lowered the
> > restriction to channel@<any number> with reg with the max of 31 and in
> > the conditional section constrained reg to a max of 16 does it work
> > without the unevaluatedProperties change? We typically want properties
> > defined at the top level and constrained in conditional sections anyway.
> 
> Gah. Either I don't know how to do this properly (which is likely), or there
> is a slight caveat. When I tried to do what you suggest, the binding allowed
> channel@X, where the <X> was is out of the range. Sure thing this was caught
> by 'reg' being out of the range, but it still allowed odd combination of
> 
> channel@X, reg = <Y>, if Y was in accepted range.
> 
> I suppose the 'X' and 'Y' in previous example are expected to always be the
> same, but I would still like to catch this type of an error.
> 
> I am about to spin v2 where I use the BD79112 limits (channels 0 to 31
> allowed) in the pattern properties, and then do:

Yeah, I kinda fucked you a bit here sorry. I just mentioned this way as an
easier way to fiddle around/debug it than having to meddle with the
regexes, with the intention of following up promptly when you replied
saying that what you have done for v2 is how you would implement it in
practice.

> 
> "^channel@(1[6-9]|2[0-9]|3[01])$": false
> to exclude 16 - 31 from the BD79111.
> 
> I am not super happy with it, but it seems to work and is still decently
> understandable even for someone yaml -illiterate like myself. :/ (At least
> for as long as we only have ICs which don't increase the amount of default
> channels. That might cause the exclusion regexp on other ICs to become
> ridiculously long or hard to read. Well, I don't have such ICs on sight for
> now.)
> 
> Well, let's see what people think of it :)
> 
> Yours,
> 	-- Matti
> 
> -- 
> Matti Vaittinen
> Linux kernel developer at ROHM Semiconductors
> Oulu Finland
> 
> ~~ When things go utterly wrong vim users can always type :help! ~~
> 

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

  reply	other threads:[~2026-11-20 17:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 14:18 [PATCH 0/2] Support ROHM BD79111 ADC/GPIO Matti Vaittinen
2026-11-18 14:19 ` [PATCH 1/2] dt-bindings: iio: Support ROHM BD79111 Matti Vaittinen
2026-11-18 17:37   ` Conor Dooley
2026-11-18 17:46     ` Matti Vaittinen
2026-11-20 12:01     ` Matti Vaittinen
2026-11-20 17:37       ` Conor Dooley [this message]
2026-11-18 14:19 ` [PATCH 2/2] iio: adc: rohm-bd79112: " Matti Vaittinen
2026-11-19  2:51   ` Jonathan Cameron
2026-11-19  7:13     ` Matti Vaittinen
2026-11-19  9:00   ` Andy Shevchenko
2026-11-19  9:09     ` Matti Vaittinen

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=20261120-unneeded-rockiness-7225e7368478@spud \
    --to=conor@kernel.org \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jakubszczudlo40@gmail.com \
    --cc=janani.sunil@analog.com \
    --cc=jic23@kernel.org \
    --cc=jishnu.prakash@oss.qualcomm.com \
    --cc=joshua.crofts1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt@analog.com \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=matti.vaittinen@linux.dev \
    --cc=mazziesaccount@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=radu.sabau@analog.com \
    --cc=robh@kernel.org \
    --cc=salih.erim@amd.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

all inboxes | Powered by JetHome®