lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aQ3J_rJV-hB2nh91@pengutronix.de>
Date: Fri, 7 Nov 2025 11:29:18 +0100
From: Oleksij Rempel <o.rempel@...gutronix.de>
To: David Lechner <dlechner@...libre.com>
Cc: Jonathan Cameron <jic23@...nel.org>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	David Jander <david@...tonic.nl>, kernel@...gutronix.de,
	linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
	devicetree@...r.kernel.org,
	Andy Shevchenko <andy.shevchenko@...il.com>,
	Nuno Sá <nuno.sa@...log.com>
Subject: Re: [PATCH v1 2/2] iio: adc: Add TI ADS131M0x ADC driver

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 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ