Devicetree
 help / color / mirror / Atom feed
* [PATCH v5 00/13] AD9910 Direct Digital Synthesizer
@ 2026-05-17 18:37 Rodrigo Alencar via B4 Relay
  2026-05-17 18:37 ` [PATCH v5 01/13] iio: core: validate file offset in iio_debugfs_write_reg() Rodrigo Alencar via B4 Relay
                   ` (12 more replies)
  0 siblings, 13 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-05-17 18:37 UTC (permalink / raw)
  To: linux-iio, devicetree, linux-kernel, linux-doc, linux-hardening
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Andy Shevchenko, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Jonathan Corbet, Shuah Khan,
	Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar, sashiko-bot

This patch series adds support for the Analog Devices AD9910 DDS.

This is a follow-up of the V3/V4 discussion. For V1, we reached into
this channel composition agreement where physical channels may have
sub-channels. That adds the flexibility necessary for this design.
During V2, some feedback indicated that the ABI is too device-specific,
so DRG/RAM destination and operating modes are configured through
alternate paths and profile channels are created. In V3, there was
further discussion on the ABI and on mode priority debug.

The AD9910 DDS core can be driven through several independent mechanisms:
single tone profiles, a digital ramp generator, an internal RAM playback
engine, a parallel data port, and output shift keying. Each of these
represents a distinct signal path into the DDS accumulator, so the driver
models them as separate IIO output channels (all IIO_ALTVOLTAGE type).
This per-channel separation allows userspace to configure each mode
independently through its own set of sysfs attributes, and to
enable/disable modes individually via IIO_CHAN_INFO_ENABLE, relying on
the hardware's own mode selection architecture.

The AD9910 register map is not suited for the regmap framework: register
widths vary across the map (16, 32, and 64 bits). The driver instead
implements direct SPI access helpers with a software register cache, using
type-specific read/write/update functions (ad9910_reg{16,32,64}_{read,
write,update}) that handle endianness conversion and cache coherency.

Registers are cached for several reasons. The control/function registers
(CFR1, CFR2) are frequently queried to determine the current operating
mode (e.g., checking RAM_ENABLE before every profile register access),
and caching avoids repeated SPI read transactions for what are
essentially state checks. The cache also enables efficient
read-modify-write updates on multi-byte registers: the update functions
merge new field values with the cached register content without issuing
a SPI read, and skip the write entirely when the value is unchanged.
Finally, the profile registers serve dual purposes depending on whether
RAM mode is active -- they hold single tone parameters (FTW, POW, ASF)
in normal operation but are repurposed for RAM playback configuration
(start/end address, step rate, operating mode) when RAM is enabled. A
shadow register array (reg_profile[]) preserves the inactive mode's
settings across transitions, so no state is lost when switching between
single tone and RAM operation.

RAM data is loaded through firmware upload infrastructure. Userspace
writes the waveform data as a raw binary buffer (up to 4096 bytes for
the full 1024x32-bit RAM), and the driver reverses the byte array and
transfers it to the device in a single SPI transaction. Per-profile
start/end addresses and playback parameters (operating mode, step rate,
no-dwell control) are also configured through firmware update, using
metadata in the header.

Streaming data to the DDS core through the parallel data port at the
PD_CLK rate is not covered by this series. That functionality would
be added in a separate patch series, building on top of the IIO backend
infrastructure to provide a proper buffered data path.

Kind regards,

Rodrigo Alencar

Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
Changes in v5:
- Drop RFC tag to the patch series.
- Address sashiko's comments.
- Add parent-child relationship between iio channels.
- List vs Table changes in documentation.
- Add crc and version check to RAM mode firmware update.
- Link to v4: https://lore.kernel.org/r/20260508-ad9910-iio-driver-v4-0-d26bfd20ee3d@analog.com

Changes in v4:
- Digital Ramp step exposed as a rate of change.
- Dwell modes of Digital Ramp are controlled with dwell_en attribute. 
- Disable of active profile behaves as a software powerdown.
- Expose debugfs attributes to show mode priority.
- Add 64-bit debugfs reg access support into iio core.
- Link to v3: https://lore.kernel.org/r/20260417-ad9910-iio-driver-v3-0-29b93712a228@analog.com

Changes in v3:
- RAM custom configs (address range, destination, modes) loaded during firmware write.
- DRG destination defined when attrs are written.
- DRG modes broken down into enable attrs for ramp up/down channels.
- Add separate profile channels, switching done through enable attr
- Link to v2: https://lore.kernel.org/r/20260318-ad9910-iio-driver-v2-0-e79f93becf11@analog.com

Changes in v2:
- Device-tree bindings changes.
- RAM loading to use firmware update interface.
- Rearrange of channels into a hierarchy.
- Link to v1: https://lore.kernel.org/r/20260220-ad9910-iio-driver-v1-0-3b264aa48a10@analog.com

---
Rodrigo Alencar (13):
      iio: core: validate file offset in iio_debugfs_write_reg()
      iio: core: support 64-bit register through debugfs
      iio: core: add hierarchical channel relationships
      Documentation: ABI: testing: add parent entry for iio channels
      dt-bindings: iio: frequency: add ad9910
      iio: frequency: ad9910: initial driver implementation
      iio: frequency: ad9910: add basic parallel port support
      iio: frequency: ad9910: add digital ramp generator support
      iio: frequency: ad9910: add RAM mode support
      iio: frequency: ad9910: add output shift keying support
      iio: frequency: ad9910: show channel priority in debugfs
      Documentation: ABI: testing: add docs for ad9910 sysfs entries
      docs: iio: add documentation for ad9910 driver

 Documentation/ABI/testing/sysfs-bus-iio            |   13 +
 .../ABI/testing/sysfs-bus-iio-frequency-ad9910     |   76 +
 .../bindings/iio/frequency/adi,ad9910.yaml         |  200 ++
 Documentation/iio/ad9910.rst                       |  666 ++++++
 Documentation/iio/index.rst                        |    1 +
 MAINTAINERS                                        |   10 +
 drivers/iio/frequency/Kconfig                      |   21 +
 drivers/iio/frequency/Makefile                     |    1 +
 drivers/iio/frequency/ad9910.c                     | 2413 ++++++++++++++++++++
 drivers/iio/industrialio-core.c                    |   73 +-
 include/linux/iio/iio-opaque.h                     |    2 +-
 include/linux/iio/iio.h                            |    9 +
 12 files changed, 3474 insertions(+), 11 deletions(-)
---
base-commit: 1548c54e9adc32a719499216f63fba14b2fc07c3
change-id: 20260218-ad9910-iio-driver-9b3d214c251f

Best regards,
-- 
Rodrigo Alencar <rodrigo.alencar@analog.com>



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

end of thread, other threads:[~2026-05-17 19:20 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-17 18:37 [PATCH v5 00/13] AD9910 Direct Digital Synthesizer Rodrigo Alencar via B4 Relay
2026-05-17 18:37 ` [PATCH v5 01/13] iio: core: validate file offset in iio_debugfs_write_reg() Rodrigo Alencar via B4 Relay
2026-05-17 19:04   ` sashiko-bot
2026-05-17 18:37 ` [PATCH v5 02/13] iio: core: support 64-bit register through debugfs Rodrigo Alencar via B4 Relay
2026-05-17 18:56   ` sashiko-bot
2026-05-17 18:37 ` [PATCH v5 03/13] iio: core: add hierarchical channel relationships Rodrigo Alencar via B4 Relay
2026-05-17 18:56   ` sashiko-bot
2026-05-17 18:37 ` [PATCH v5 04/13] Documentation: ABI: testing: add parent entry for iio channels Rodrigo Alencar via B4 Relay
2026-05-17 18:45   ` sashiko-bot
2026-05-17 18:37 ` [PATCH v5 05/13] dt-bindings: iio: frequency: add ad9910 Rodrigo Alencar via B4 Relay
2026-05-17 18:44   ` sashiko-bot
2026-05-17 18:37 ` [PATCH v5 06/13] iio: frequency: ad9910: initial driver implementation Rodrigo Alencar via B4 Relay
2026-05-17 19:20   ` sashiko-bot
2026-05-17 18:37 ` [PATCH v5 07/13] iio: frequency: ad9910: add basic parallel port support Rodrigo Alencar via B4 Relay
2026-05-17 18:37 ` [PATCH v5 08/13] iio: frequency: ad9910: add digital ramp generator support Rodrigo Alencar via B4 Relay
2026-05-17 18:37 ` [PATCH v5 09/13] iio: frequency: ad9910: add RAM mode support Rodrigo Alencar via B4 Relay
2026-05-17 19:19   ` sashiko-bot
2026-05-17 18:37 ` [PATCH v5 10/13] iio: frequency: ad9910: add output shift keying support Rodrigo Alencar via B4 Relay
2026-05-17 18:37 ` [PATCH v5 11/13] iio: frequency: ad9910: show channel priority in debugfs Rodrigo Alencar via B4 Relay
2026-05-17 18:37 ` [PATCH v5 12/13] Documentation: ABI: testing: add docs for ad9910 sysfs entries Rodrigo Alencar via B4 Relay
2026-05-17 19:00   ` sashiko-bot
2026-05-17 18:37 ` [PATCH v5 13/13] docs: iio: add documentation for ad9910 driver Rodrigo Alencar via B4 Relay
2026-05-17 19:00   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox