From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
Matti Vaittinen <matti.vaittinen@linux.dev>,
Jakub Szczudlo <jakubszczudlo40@gmail.com>
Cc: "Matti Vaittinen" <matti.vaittinen@fi.rohmeurope.com>,
"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>,
"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: adc: rohm-bd79112: Support ROHM BD79111
Date: Thu, 19 Nov 2026 09:13:36 +0200 [thread overview]
Message-ID: <4dccb83b-a612-4c93-a625-f5881b63410c@gmail.com> (raw)
In-Reply-To: <20261119025137.6bfc27c2@jic23-hlaptop>
Hi & Thanks Jonathan!
On 19/11/2026 04:51, Jonathan Cameron wrote:
> On Wed, 18 Nov 2026 16:19:35 +0200
> Matti Vaittinen <matti.vaittinen@linux.dev> 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.
>>
>> NOTE: In order to achieve those speeds one needs to use more optimized
>> protocol compared to the one implemented in this driver. This driver
>> retrieves samples using two 16-bit SPI transactions. The first
>> transaction writes the channel to be sampled, and ignores data on MISO.
>> Then the next 16-bit transaction carries the data.
>>
>> Achieving maximum sample-rate would require the driver to interpret the
>> MISO data of each 16-bit transaction so, that when the
>> channel-to-be-sampled was sent in transaction N, the data is read at
>> transaction N+1 - which also already configures the channel to be
>> sampled for transaction N+2. Supporting this would require the
>> channel-to-be-read for the future read to be known when the current
>> channel data is retrieved. For raw-reads this is not possible and for
>> buffered reads it would make things a bit hairy.
>
> FWIW there are quite a few drivers implementing that scheme for
> buffered capture. Look for drivers that preprepare an SPI transfer.
> Absolutely fine to not support that optimization!
>
> This seems like text that probably applies to both parts rather than
Yes. This applies to both of these ADCs. And thanks for the pointer!
Once again, I really appreciate your help. I will definitely take a look
at how this is done by other ADCs. These two aren't the only (ROHM) ICs
using this type of mechanism, so spending some time is well justified :)
> being directly relevant to what is added here? If you did add that
> support it would be in a different patch.
Sure.
> I'd cut most of that info
> to keep the commit message focused.
I kind of agree - while I also believe that noting the performance
limitation coming from the driver itself makes sense. It does not need
to be this verbose though. Besides, the verbosity already worked as it
made you to drop me the above info ;)
//snip
>> static const struct gpio_chip bd79112_gpio_chip = {
>> - .label = "bd79112-gpio",
>> .get_direction = bd79112_gpio_dir_get,
>> .direction_input = bd79112_gpio_input,
>> .direction_output = bd79112_gpio_output,
>> @@ -378,20 +387,20 @@ static const struct gpio_chip bd79112_gpio_chip = {
>> .set_multiple = bd79112_gpio_set_multiple,
>> .init_valid_mask = bd79112_gpio_init_valid_mask,
>> .can_sleep = true,
>> - .ngpio = 32,
>> .base = -1,
>> };
>
> There are only two parts, maybe it is simpler to have dual gpio_chip
> instances pointed to by your chip_data? Keep the full state of each in
> one place? I don't mind much either way on this.
I didn't even evaluate such option. I'll try it out and see how it looks
like.
I agree with all other comments - even though declaring the indexer
variable in a for-loop requires a bit of learning ;) (Which doesn't mean
limiting the scope didn't make sense when index is not used outside the
loop).
Thanks!
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
prev parent reply other threads:[~2026-11-19 7:13 UTC|newest]
Thread overview: 7+ 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-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 [this message]
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=4dccb83b-a612-4c93-a625-f5881b63410c@gmail.com \
--to=mazziesaccount@gmail.com \
--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=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=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®