linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/1] iio: adc: ad7124: allow more than 8 channels
@ 2021-03-11  9:11 alexandru.tachici
  2021-03-11  9:11 ` [PATCH v5 1/1] " alexandru.tachici
  0 siblings, 1 reply; 5+ messages in thread
From: alexandru.tachici @ 2021-03-11  9:11 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: jic23

From: Alexandru Tachici <alexandru.tachici@analog.com>

Currently AD7124-8 driver cannot use more than 8 IIO channels
because it was assigning the channel configurations bijectively
to channels specified in the device-tree. This is not possible
to do when using more than 8 channels as AD7124-8 has only 8
configuration registers.

All configurations are marked as live if they are
programmed on the device. Any change that happens from
userspace (sampling rate, filters etc.) will invalidate
them.

To allow the user to use all channels at once the driver
will keep in memory configurations for all channels but
will program only 8 of them at a time on the device.

If multiple channels have the same configuration, only
one configuration register will be used.

If there are more configurations needed than available registers
only the last 8 used configurations will be allowed to exist
on the device in a LRU fashion. (in case of raw reads).

If a read is requested on a channel whose configuration
is not programmed:
- check if there are similar configurations already programmed
	if yes: - point channel to that config
	if no:  - check if there are empty config slots
			- if yes: write config, push into queue of LRU configs
			- if no: pop one config, get it's config slot nr,
			write new config on the old slot, push new config
			in queue of LRU configs.

Alexandru Tachici (1):
  iio: adc: ad7124: allow more than 8 channels

Changelog v4 -> v5:
	- replaced ad7124_configs_equal function with a memcmp
	in order to check if two configs are equal
	- moved members that do not count to equality at the
	end of the ad7124_channel_config struct (live, cfg_slot)

 drivers/iio/adc/ad7124.c | 458 +++++++++++++++++++++++++--------------
 1 file changed, 301 insertions(+), 157 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-13 16:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-11  9:11 [PATCH v5 0/1] iio: adc: ad7124: allow more than 8 channels alexandru.tachici
2021-03-11  9:11 ` [PATCH v5 1/1] " alexandru.tachici
2021-03-11 11:32   ` kernel test robot
2021-03-11 12:34   ` kernel test robot
2021-03-13 16:37   ` Jonathan Cameron

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).