From: Oleksij Rempel <o.rempel@pengutronix.de>
To: David Lechner <dlechner@baylibre.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"David Jander" <david@protonic.nl>,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
"Andy Shevchenko" <andy.shevchenko@gmail.com>,
"Nuno Sá" <nuno.sa@analog.com>
Subject: Re: [PATCH v1 2/2] iio: adc: Add TI ADS131M0x ADC driver
Date: Fri, 7 Nov 2025 11:29:18 +0100 [thread overview]
Message-ID: <aQ3J_rJV-hB2nh91@pengutronix.de> (raw)
In-Reply-To: <5c618c00-f7f1-4260-8970-7c493d50315e@baylibre.com>
Hi David,
On Thu, Nov 06, 2025 at 10:57:26AM -0600, David Lechner wrote:
> ...
>
> > +/**
> > + * ads131m_rmw_reg - Reads, modifies, and writes a single register.
>
> Any reason we couldn't turn the read/write into a regmap and avoid
> implementing extras like this?
I thought about regmap, but it is a poor fit for this chip.
The problem is the device protocol. It is not a simple register-based device;
it is a frame-based protocol that uses opcodes.
- Hot Path (Data Read): The main data read (in read_raw) does not access
registers. It sends a NULL opcode frame to read all channel data at once.
- Cold Path (Setup): Register access (RREG/WREG) is a complex, stateful
3-cycle operation. It is only used in probe for setup.
This leaves two (bad?) options for regmap:
- Mixed Access: Use regmap only for the cold path (probe) and use raw
for the hot path (read_raw). This is messy because we mix two access methods.
- Virtual Registers: Try to model all opcodes (NULL, RREG, WREG) as virtual
registers. This is a very unnatural abstraction for this chip.
Using the regmap dependency just to replace one rmw function that runs only
once at probe seemed like the overkill.
Best Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2025-11-07 10:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 14:38 [PATCH v1 0/2] iio: adc: Add support for TI ADS131M0x ADCs Oleksij Rempel
2025-11-05 14:38 ` [PATCH v1 1/2] bindings: iio: adc: Add bindings " Oleksij Rempel
2025-11-05 18:40 ` Jonathan Cameron
2025-11-06 16:06 ` David Lechner
2025-11-05 14:38 ` [PATCH v1 2/2] iio: adc: Add TI ADS131M0x ADC driver Oleksij Rempel
2025-11-05 14:51 ` Marc Kleine-Budde
2025-11-05 19:34 ` Jonathan Cameron
2025-11-06 7:53 ` kernel test robot
2025-11-06 8:03 ` kernel test robot
2025-11-06 11:21 ` kernel test robot
2025-11-06 16:57 ` David Lechner
2025-11-07 10:29 ` Oleksij Rempel [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=aQ3J_rJV-hB2nh91@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=andy.shevchenko@gmail.com \
--cc=conor+dt@kernel.org \
--cc=david@protonic.nl \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.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;
as well as URLs for NNTP newsgroup(s).