From: Jonathan Cameron <jic23@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Linus Walleij <linus.walleij@linaro.org>,
Nuno Sa <nuno.sa@analog.com>,
David Lechner <dlechner@baylibre.com>,
Dumitru Ceclan <mitrutzceclan@gmail.com>,
Trevor Gamblin <tgamblin@baylibre.com>,
Matteo Martelli <matteomartelli3@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-iio@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [RFC PATCH 0/5] Support ROHM BD79124 ADC/GPO
Date: Sat, 1 Feb 2025 16:30:51 +0000 [thread overview]
Message-ID: <20250201163051.1d54cdd7@jic23-huawei> (raw)
In-Reply-To: <5cc01bc7-95b7-4a58-86d7-d4293e0e9966@gmail.com>
On Sat, 1 Feb 2025 17:00:51 +0200
Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> Hi Jonathan,
>
> Thanks a ton for the help! :)
>
> On 31/01/2025 19:08, Jonathan Cameron wrote:
> > On Fri, 31 Jan 2025 15:34:43 +0200
> > Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> >
> >> Support ROHM BD79124 ADC.
> >>
> >> Quite usual stuff. 12-bit, 8-channel ADC with threshold monitoring.
> >>
> >> Except that:
> >> - each ADC input pin can be configured as a general purpose output.
> >> - manually starting an ADC conversion and reading the result would
> >> require the I2C _master_ to do clock stretching(!) for the duration
> >> of the conversion... Let's just say this is not well supported.
> >> - IC supports 'autonomous measurement mode' and storing latest results
> >> to the result registers. This mode is used by the driver due to the
> >> "peculiar" I2C when doing manual reads.
> >>
> >> I sent this as an RFC because I implemented the pin purposing (GPO/ADC)
> >> using pinmux - which I've never done for upstream stuff before. Hence
> >> it's better to ask if this makes sense, or if there is better way to go.
> >> Anyways, resulted drivers spread to 3 subsystems (MFD, pinctrl and IIO)
> > In principle nothing against pin mux for this.
> > There are other options though if pin mux ends up being too complex.
> >
> > - provide ADC channels in the binding channel@x etc.
> > Anything else is freely available as a GPIO.
> > Normal GPIO bindings etc for those.
> >
> > The channel bit is common on SoC ADC anyway where we don't want to
> > expose channels that aren't wired out.
>
> Thanks for the insight on how things are usually done :)
>
> I think the only reason for having all the channels visible in IIO,
> could be, if there was a need to provide a runtime configuration.
>
> > For combined ADC GPIO chips we normally don't bother with an MFD.
> > Just host the gpio driver in the ADC one unless there is a strong
> > reasons someone will put this down for GPIO usage only.
>
> I don't really know about that. I don't like arguing, yet I seem to do
> that all the time XD
>
> I personally like using MFD and having smaller drivers in relevant
> subsystems, because it tends to keep the drivers leaner - and allows
> re-use of drivers when some of the hardware blocks are re-used. In some
> cases this results (much) cleaner drivers.
I'm fully in agreement with MFD being useful, but for very simple
parts of a device it can be overkill.
>
> (Let's assume they did "new" ADC, and just dropped the GPO from it. With
> the MFD the deal is to add new compatible, and have an MFD cell array
> without the pinctrl/GPO matching this new device. And lets imagine they
> later add this ADC to a PMIC. We add yet another MFD cell array for this
> new device, with a cell for the regulators, power-supply and the ADC...
> The same platform subdevice can be re-used to drive ADC (well, with
> added register offsets)).
>
> Allright. I believe you have more experience on this area than I do, but
> I definitely think MFD has it's merits also for ADCs - they do tend to
> put ADCs to all kinds of devices (like in PMICs after all, although
> maybe not with 8 channels and less often without an accumulator).
It's a trade off. Sometimes we just have a little code duplication
to the need for a more complex design.
Enjoy the rest of Fosdem
Jonathan
next prev parent reply other threads:[~2025-02-01 16:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-31 13:34 [RFC PATCH 0/5] Support ROHM BD79124 ADC/GPO Matti Vaittinen
2025-01-31 13:36 ` [RFC PATCH 1/5] dt-bindings: " Matti Vaittinen
2025-01-31 13:37 ` [RFC PATCH 2/5] mfd: Add " Matti Vaittinen
2025-01-31 17:14 ` Jonathan Cameron
2025-02-01 16:04 ` Matti Vaittinen
2025-02-05 13:40 ` Matti Vaittinen
2025-01-31 13:37 ` [RFC PATCH 3/5] iio: adc: Support ROHM BD79124 ADC Matti Vaittinen
2025-01-31 17:41 ` Jonathan Cameron
2025-02-01 15:38 ` Matti Vaittinen
2025-02-01 16:26 ` Jonathan Cameron
2025-02-05 13:58 ` Matti Vaittinen
2025-02-08 13:01 ` Jonathan Cameron
2025-01-31 13:38 ` [RFC PATCH 4/5] pinctrl: Support ROHM BD79124 pinmux / GPO Matti Vaittinen
2025-02-05 13:40 ` Matti Vaittinen
2025-02-06 9:39 ` Linus Walleij
2025-02-06 10:05 ` Matti Vaittinen
2025-02-06 10:09 ` Matti Vaittinen
2025-02-13 11:53 ` Linus Walleij
2025-02-13 12:10 ` Matti Vaittinen
2025-02-13 16:18 ` David Lechner
2025-01-31 13:38 ` [RFC PATCH 5/5] MAINTAINERS: Add ROHM BD79124 ADC/GPO Matti Vaittinen
2025-01-31 17:08 ` [RFC PATCH 0/5] Support " Jonathan Cameron
2025-02-01 15:00 ` Matti Vaittinen
2025-02-01 16:30 ` Jonathan Cameron [this message]
2025-02-01 17:12 ` 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=20250201163051.1d54cdd7@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matteomartelli3@gmail.com \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mazziesaccount@gmail.com \
--cc=mitrutzceclan@gmail.com \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=tgamblin@baylibre.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