From: "Nuno Sá" <noname.nuno@gmail.com>
To: Rodrigo Alencar <455.rodrigo.alencar@gmail.com>,
Jonathan Cameron <jic23@kernel.org>,
David Lechner <dlechner@baylibre.com>
Cc: rodrigo.alencar@analog.com, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Andy Shevchenko <andy@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>
Subject: Re: [PATCH RFC 0/8] AD9910 Direct Digital Synthesizer
Date: Mon, 09 Mar 2026 13:14:29 +0000 [thread overview]
Message-ID: <0b8b484575bb106ebabb1519073a416cd2e152c8.camel@gmail.com> (raw)
In-Reply-To: <ii3gz6t4ufaiznypykneeqrc2hgrrrea26pvyffhbr5ryx2u73@zar3awo4mvxh>
On Mon, 2026-03-09 at 09:52 +0000, Rodrigo Alencar wrote:
> On 26/03/08 06:12PM, Jonathan Cameron wrote:
> > On Sat, 7 Mar 2026 14:01:14 -0600
> > David Lechner <dlechner@baylibre.com> wrote:
> >
> > > On 3/7/26 12:54 PM, Rodrigo Alencar wrote:
> > > > On 26/03/07 04:58PM, Jonathan Cameron wrote:
> > > > > On Sat, 7 Mar 2026 10:50:14 -0600
> > > > > David Lechner <dlechner@baylibre.com> wrote:
> > > > >
> > > > > > On 3/7/26 8:09 AM, Jonathan Cameron wrote:
> > > > > > > On Mon, 2 Mar 2026 10:22:47 +0000
> > > > > > > Rodrigo Alencar <455.rodrigo.alencar@gmail.com> wrote:
> > > > > > >
> > > > > > > > On 26/03/01 01:38PM, Jonathan Cameron wrote:
> > > > > > > > > On Mon, 23 Feb 2026 10:02:00 +0000
> > > > > > > > > Nuno Sá <noname.nuno@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > > On Sun, 2026-02-22 at 14:32 -0600, David Lechner wrote:
> > > > > > > > > > > On 2/22/26 4:01 AM, Rodrigo Alencar wrote:
> > > > > > > > > > > > On 26/02/21 02:16PM, David Lechner wrote:
> > > > > > > > > > > > > On 2/20/26 10:46 AM, Rodrigo Alencar via B4 Relay wrote:
> > > > > > > > > > > > > > This patch series adds support for the Analog Devices AD9910 DDS.
> > > > > > > > > > > > > > This is an RFC so that we can agree/discuss on the design that follows:
>
> ...
>
> > > > > > > > > > > > > > represents a distinct signal path into the DDS accumulator, so the
> > > > > > > > > > > > > > driver
> > > > > > > > > > > > > > models them as separate IIO output channels (all IIO_ALTVOLTAGE
> > > > > > > > > > > > > > type).
> > > > > > > > > > > > >
> > > > > > > > > > > > > Generally IIO channels represent the physical input/output, not the
> > > > > > > > > > > > > internal channels.
> > > > > > > > > > > >
> > > > > > > > > > > > That is part of the reason for this RFC. Dividing those top-level modes
> > > > > > > > > > > > into channels allows for better organization, as they can operate together,
> > > > > > > > > > > > i.e., phase or scale can be provided by single-tone profile, while
> > > > > > > > > > > > frequency is controlled by the digital ramp generator (see Mode Priority
> > > > > > > > > > > > section in the datasheet). Also, it allows to explore the most of standard
> > > > > > > > > > > > ABIs like, scale, frequency, phase, sampling_frequency and enable.
> > > > > > > > > > > > Putting everything into a single channel would make things a lot messy
> > > > > > > > > > > > to interface with.
>
> ...
>
> > > > > > > > > > > Looking at Table 5 in the datasheet really helped me understand this better.
> > > > > > > > > > > I think this series could benefit from a documentation patch that explains
> > > > > > > > > > > more about how the driver works with some diagrams.
> > > > > > > > > > >
> > > > > > > > > > > So really what we have here are a bunch of digital data generators rather
> > > > > > > > > > > than a bunch of altvotlage output channels. And the same data channels can be
> > > > > > > > > > > mixed and match as the source for up to 3 different components of the output
> > > > > > > > > > > (frequency, phase, amplitude) depending on the priority rules defined in
> > > > > > > > > > > Table 5.
> > > > > > > > > >
> > > > > > > > > > More bellow... But note that all of the (or most of it) generators are going to
> > > > > > > > > > be feed into a DAC. Your output is altvoltage but maybe we can treat the
> > > > > > > > > > internals as voltage. Not sure.
> > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Digital data sources are really more like a buffer in IIO terms than a
> > > > > > > > > > > channel. And before we added the IIO backend stuff, there wasn't really
> > > > > > > > > > > any other digital data source/sink that I am aware of other than buffers
> > > > > > > > > > > (but there are certainly a lot of odd corners of IIO that I haven't explored
> > > > > > > > > > > yet, so maybe I missed some).
> > > > > > > > > > >
> > > > > > > > > > > In a recent discussion, the idea of possibly needing a way to provide
> > > > > > > > > > > some userspace interface to be able to tweak knobs of an IIO backend
> > > > > > > > > > > was also brought up.
> > > > > > > > > > >
> > > > > > > > > > > Putting those ideas together, I'm wondering if we need some new channel
> > > > > > > > > > > type or even a whole new interface (e.g. a new sysfs directory like buffers
> > > > > > > > > > > and events) for managing these digital data sources/sinks that are not an
> > > > > > > > > > > IIO buffer.
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > But what would be that channel? In the end of the day, we typically have voltage
> > > > > > > > > > or
> > > > > > > > > > current DACs and a DDS primary function is indeed to generate alternating
> > > > > > > > > > waveforms
> > > > > > > > > > that you then typically feed into a DAC (and in some cases from the DAC into a
> > > > > > > > > > power amplifier). So the DDS is just part of the data/signal path. Anyways, not
> > > > > > > > > > sure
> > > > > > > > > > on the new type and I think we already have the "blocks" in IIO for dealing with
> > > > > > > > > > this:
> > > > > > > > > >
> > > > > > > > > > . frequency
> > > > > > > > > > . phase
> > > > > > > > > > . amplitude (raw + scale + offset)
> > > > > > > > > >
> > > > > > > > > > But you're right that maybe it's time to think in a better way to fit them
> > > > > > > > > > together.
> > > > > > > > > > Maybe a new type (as buffers or events) can make sense where the above are
> > > > > > > > > > treated as, example, scan
> > > > > > > > > > elements. Maybe it's overcomplicating, not sure. It surely needs discussion and
> > > > > > > > > > thinking :).
>
> ...
>
> > > > > > > > > For history buffs, we had a bunch of DDS chips in staging at one point and never
> > > > > > > > > manage to figure out the questions being raised here :( They are complex
> > > > > > > > > beasts. Clarity of ABI proposal and documentation is going to be key to driving
> > > > > > > > > this series forwards. In a sense the code is the easy part.
> > > > > > > >
> > > > > > > > Does that mean that once good documentation is provided, the presented design can
> > > > > > > > be accepted? Even though data generators/sources might not be interpreted as
> > > > > > > > altvoltage channels?
> > > > > > >
> > > > > > > I'm not sure yet :( It's a pretty complex design and we haven't really come to a
> > > > > > > conclusion
> > > > > > > on how to handle this channel 'mixing' case.
> > > > > > >
> > > > > > > If we did go this way, we'd need to figure out a way to describe the mixing part.
> > > > > > > So either we describe it as one channel (which is going to be really complex)
> > > > > > > or we describe it as multiple channels but add extra ABI to make it clear they
> > > > > > > are mixed into a single 'physical' channel.
> > > > > > >
>
> ...
>
> > > > > > Some ideas have crossed my mind, like adding new option to the in_/out_
> > > > > > prefix for "internal" channels. But I it would take a long time to teach
> > > > > > existing generic userspace libraries/tools about this.
> > > > > >
> > > > > > What has popped into my head just now is that perhaps we could do like
> > > > > > Rodrigo is proposing here reusing existing channels and standard attributes
> > > > > > as much as possible and add a new "subcomponent_of" attribute to provide
> > > > > > the link, similar to "current_trigger" for triggers.
> > > > > >
> > > > > > This way, it would still work with existing userspace tools (even if it
> > > > > > looks a bit confusing). And userspace tools could eventually be taught
> > > > > > to present the channels as a tree-like structure with the main channel
> > > > > > and subcomponents nested under it.
> > > > > >
> > > > > > We would want to spell out up front what all of the anticipated ways of
> > > > > > using it are. For example, I suspect eventually someone will want this
> > > > > > attribute to be writeable to assign a specific limited resource to a
> > > > > > specific channel. An I expect that we would eventually see something were
> > > > > > a single subcomponent is shared between multiple physical channels. In
> > > > > > this case, we would want the value of the "subcomponent_of" attribute to
> > > > > > be able to be a list.
> > > > >
> > > > > Something along those lines might work. I'd not thought about the case
> > > > > of one 'internal' going to multiple 'external'. Otherwise I was wondering
> > > > > if something informal related to labels would work. We've done that where
> > > > > we've been associating things like voltage and power measurement from a single
> > > > > pin. It's rather adhoc though. Possibly we could roll it into a newer
> > > > > more general scheme.
> > >
> > > Hmm... in this case, it sounds more flat where there isn't a clear channel
> > > that would be the "root" of a tree relation.
> > >
> > > > >
> > > > > If the association is done as meta data attributes alongside existing
> > > > > channels then as you say existing tools will kind of work, just need some
> > > > > human understanding of what is actually being controlled until they catch
> > > > > up with the newer schemes.
> > > > >
> > > > > Lots of ways we could actually represent the graphs. Going to take some
> > > > > figuring out!
> > > >
> > > > I like the idea of subchannels to create logical tree-structures. It opens
> > > > up for other possibilities.
> > > >
> > > > I wonder if the varying channel index would still confuse a user, even
> > > > with this metadata attribute, like:
> > > > - out_altvoltage0
> > > > - out_altvoltage1
> > > > - out_altvoltage1_subcomponent_of = out_altvoltage0
> > > >
> > > > would there be a different way to name the full_postfix in
> > > > __iio_device_attr_init() that would allow to keep channel index the same
> > > > (e.g. altvoltage0 for multiple internal sub-channel) and still be
> > > > compatible with userspace tools? I don't know, something like:
> > > > - out_altvoltage0
> > > > - out_altvoltage0_0
> > > > - out_altvoltage0_1
> > > > - out_altvoltage0_2
> > > >
> > > > userspace tools would understand out_altvoltage0_0_frequency as:
> > > > - direction: out
> > > > - type: altvoltage
> > > > - channel idx: 0
> > > > - attr name: 0_frequency
> > > >
> > > > and that would be a problem?
> > > >
> > >
> > > I have a feeling that could be problematic for existing attribute
> > > parsers.
> >
> > Agreed. This smells like extend_name and that caused all sorts
> > of annoying problems for the userspace folk.
> >
> > >
> > > How about using higher numbered channel indexes instead?
> > >
> > > out_altvoltage100_* = physical channel
> > >
> > > out_altvoltage101_* = subcomponent
> > > out_altvoltage102_* = subcomponent
> > > ...
> > Have to be careful we don't run out of space for events.
> > #define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
> > So we do have 16 bits hence this might work.
> >
> > I'm not sure we want to make rules around this though.
>
> Ok, I think we are reaching an agreement. With this, I think there
> is room for a small redesign, i.e., having a root channel to represent
> the physical DAC and child channels as follows (* on custom ABI):
> - out_altvoltage100: root/physical channel
> - profile*: for profile selection
> - sampling_frequency: sysclk frequency value
> - out_altvoltage110: single tone channel
> - frequency: single tone profile FTW
> - phase: single tone profile POW
> - scale: single tone profile ASF
> - out_altvoltage120: parallel port channel
> - en
> - frequency_scale* or frequency_gain*: for FM gain
> - frequency or frequency_offset*
> - phase or phase_offset*
> - scale or scale_offset*
> - out_altvoltage130: drg channel
> - en
> - destination*
> - operating_mode*
> - out_altvoltage131: drg upper limit channel
> - frequency
> - frequency_step*
> - phase
> - phase_step*
> - scale
> - scale_step*
> - sampling_frequency
> - out_altvoltage132: drg lower limit channel
> - frequency
> - frequency_step*
> - phase
> - phase_step*
> - scale
> - scale_step*
> - sampling_frequency
> - out_altvoltage140: ram channel
> - en
> - frequency: global FTW
> - phase: global POW
> - sampling_frequency
> - destination*
> - operating_mode*
> - address_start*
> - address_end*
> - out_altvoltage150: osk channel
> - en
> - scale: global ASF
> - scale_step*
> - sampling_frequency
> - pinctrl_en*
>
> so I ended up with 8 channels (rather than the initial 5). Breaking up the
> DRG channel, following the tree structure allows to explore more of the
> standard ABI. I suppose that even with this, documentation is no less
> important. How does it look?
FWIW, I kind of like this "child" channel concept and think it might be useful
for other things to. One thing that comes to mind is how do we want to handle this
in terms of scan_elements? Do we have it completely independent or do we want to play some
games with it? Like allowing arbitrary sizes (not power of 2) in child channels as long as the
sum matches what was defined in the parent/physical channel.
One usecase for the above would be the ad4030 ADC where we went with two channels (for the common
mode voltage) for one physical one and we define two scan elements where the total storage does
not directly map the actual physical size. And while we can get away with it for SW buffers, for HW
buffers it's not "so simple".
Can be a bit tricky to implement but the above concept might open the door for it.
- Nuno Sá
prev parent reply other threads:[~2026-03-09 13:13 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 16:46 [PATCH RFC 0/8] AD9910 Direct Digital Synthesizer Rodrigo Alencar via B4 Relay
2026-02-20 16:46 ` [PATCH RFC 1/8] dt-bindings: iio: frequency: add ad9910 Rodrigo Alencar via B4 Relay
2026-02-21 20:43 ` David Lechner
2026-02-21 22:43 ` Conor Dooley
2026-02-22 10:49 ` Rodrigo Alencar
2026-02-22 13:24 ` Conor Dooley
2026-02-22 10:47 ` Rodrigo Alencar
2026-02-22 20:28 ` David Lechner
2026-02-22 20:31 ` Conor Dooley
2026-03-01 12:50 ` Jonathan Cameron
2026-02-20 16:46 ` [PATCH RFC 2/8] iio: frequency: ad9910: initial driver implementation Rodrigo Alencar via B4 Relay
2026-03-01 13:20 ` Jonathan Cameron
2026-02-20 16:46 ` [PATCH RFC 3/8] iio: frequency: ad9910: add simple parallel port mode support Rodrigo Alencar via B4 Relay
2026-02-23 8:27 ` Andy Shevchenko
2026-03-01 13:22 ` Jonathan Cameron
2026-02-20 16:46 ` [PATCH RFC 4/8] iio: frequency: ad9910: expose sysclk_frequency device attribute Rodrigo Alencar via B4 Relay
2026-03-01 13:23 ` Jonathan Cameron
2026-02-20 16:46 ` [PATCH RFC 5/8] iio: frequency: ad9910: add digital ramp generator support Rodrigo Alencar via B4 Relay
2026-03-01 13:26 ` Jonathan Cameron
2026-02-20 16:46 ` [PATCH RFC 6/8] iio: frequency: ad9910: add RAM mode support Rodrigo Alencar via B4 Relay
2026-03-01 13:31 ` Jonathan Cameron
2026-03-03 15:32 ` Rodrigo Alencar
2026-03-03 17:16 ` Nuno Sá
2026-03-03 17:32 ` Rodrigo Alencar
2026-03-07 14:07 ` Jonathan Cameron
2026-03-10 17:40 ` Rodrigo Alencar
2026-03-11 0:11 ` David Lechner
2026-03-11 13:11 ` Rodrigo Alencar
2026-03-11 16:54 ` Nuno Sá
2026-03-11 17:08 ` Rodrigo Alencar
2026-02-20 16:46 ` [PATCH RFC 7/8] iio: frequency: ad9910: add output shift keying support Rodrigo Alencar via B4 Relay
2026-02-20 16:46 ` [PATCH RFC 8/8] iio: frequency: ad9910: add channel labels Rodrigo Alencar via B4 Relay
2026-02-21 20:16 ` [PATCH RFC 0/8] AD9910 Direct Digital Synthesizer David Lechner
2026-02-22 10:01 ` Rodrigo Alencar
2026-02-22 20:32 ` David Lechner
2026-02-23 10:02 ` Nuno Sá
2026-03-01 13:38 ` Jonathan Cameron
2026-03-02 10:22 ` Rodrigo Alencar
2026-03-07 14:09 ` Jonathan Cameron
2026-03-07 16:50 ` David Lechner
2026-03-07 16:58 ` Jonathan Cameron
2026-03-07 18:54 ` Rodrigo Alencar
2026-03-07 20:01 ` David Lechner
2026-03-08 18:12 ` Jonathan Cameron
2026-03-09 9:52 ` Rodrigo Alencar
2026-03-09 13:14 ` Nuno Sá [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=0b8b484575bb106ebabb1519073a416cd2e152c8.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=455.rodrigo.alencar@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=rodrigo.alencar@analog.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