Linux Documentation
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Rodrigo Alencar <455.rodrigo.alencar@gmail.com>
Cc: Rodrigo Alencar via B4 Relay
	<devnull+rodrigo.alencar.analog.com@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-hardening@vger.kernel.org,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	David Lechner <dlechner@baylibre.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>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Kees Cook <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>
Subject: Re: [PATCH v6 16/16] docs: iio: add documentation for ad9910 driver
Date: Mon, 6 Jul 2026 16:51:20 +0100	[thread overview]
Message-ID: <20260706165120.156f67a2@jic23-huawei> (raw)
In-Reply-To: <p77cvtvjmo7hr6i6jxhfxps3if6fyy5kdwxrwlcnsziixycyen@rf5zfchlxgt6>

On Mon, 6 Jul 2026 15:23:28 +0100
Rodrigo Alencar <455.rodrigo.alencar@gmail.com> wrote:

> On 03/07/26 19:30, Jonathan Cameron wrote:
> > On Thu, 18 Jun 2026 14:27:32 +0100
> > Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@kernel.org> wrote:
> >   
> > > From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> > > 
> > > Add documentation for the AD9910 DDS IIO driver, which describes channels,
> > > DDS modes, attributes and ABI usage examples.  
> 
> ...
> 
> > > +Digital ramp generator (DRG)
> > > +----------------------------
> > > +
> > > +The DRG produces linear frequency, phase or amplitude sweeps using dedicated
> > > +hardware. The active ramp target (destination) is selected by enabling the
> > > +corresponding typed channel at channel number 130:
> > > +
> > > +- ``out_frequency130`` (label ``drg_frequency``) — ramp targets frequency
> > > +- ``out_phase130`` (label ``drg_phase``) — ramp targets phase
> > > +- ``out_altcurrent130`` (label ``drg_amplitude``) — ramp targets amplitude
> > > +
> > > +Writing ``en=1`` to one of these channels enables the DRG and switches its
> > > +destination. Writing ``en=0`` disables the DRG if the channel is the current
> > > +active destination; writing to an already-inactive destination is a no-op.
> > > +
> > > +Each destination channel also exposes a read-only ``scale`` attribute
> > > +reporting the physical quantity per ramp register LSB, which allows converting
> > > +raw limit codes to physical values.
> > > +
> > > +The two ramp channels ``out_altcurrent131`` (``drg_rising``) and
> > > +``out_altcurrent132`` (``drg_falling``) configure ascending and descending
> > > +ramp parameters independently.
> > > +
> > > +Destination channel attributes
> > > +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > +
> > > +.. flat-table::
> > > +   :header-rows: 1
> > > +
> > > +   * - Attribute
> > > +     - Unit
> > > +     - Description
> > > +
> > > +   * - ``en``
> > > +     - boolean
> > > +     - Enable the DRG with this channel as the active destination. Only one
> > > +       destination can be active at a time.
> > > +
> > > +   * - ``scale``
> > > +     - Hz/LSB, rad/LSB or mA/LSB
> > > +     - Read-only. Physical quantity per raw units. Multiply a ramp
> > > +       rising/falling channel ``raw`` value by this scale to get the physical
> > > +       ramp target.
> > > +
> > > +Ramp channel attributes
> > > +^^^^^^^^^^^^^^^^^^^^^^^
> > > +
> > > +.. flat-table::
> > > +   :header-rows: 1
> > > +
> > > +   * - Attribute
> > > +     - Unit
> > > +     - Description
> > > +
> > > +   * - ``dwell_en``
> > > +     - boolean
> > > +     - Enable dwell at the ramp limit. When disabled, the ramp
> > > +       auto-transitions at this limit without waiting for the DRCTL pin.
> > > +       Disabling both creates a bidirectional continuous ramp (triangular
> > > +       pattern). Other combinations create single-shot ramps at the DRCTL
> > > +       pin transition.
> > > +
> > > +   * - ``raw``
> > > +     - integer (64-bit)
> > > +     - Ramp limit expressed as a raw DRG register code in
> > > +       :math:`[0, 2^{32}-1]`. The physical value is ``raw * scale`` where
> > > +       ``scale`` is read from the active destination channel.
> > > +
> > > +   * - ``sampling_frequency``
> > > +     - Hz
> > > +     - Ramp clock rate. Controlled by an integer divider; the written value
> > > +       is adjusted to the nearest supported rate.
> > > +
> > > +   * - ``raw_roc``
> > > +     - /s
> > > +     - Rate of change. Number of register codes advanced per second, computed
> > > +       from the hardware step size and the current ramp clock. Writing
> > > +       requires ``sampling_frequency`` to be configured first.
> > > +
> > > +Usage examples
> > > +^^^^^^^^^^^^^^
> > > +
> > > +Configure a frequency sweep from 40 MHz to 60 MHz with a rate of change of
> > > +25 GHz/s:
> > > +
> > > +.. code-block:: bash
> > > +
> > > +  # Disable dwell on both limits for a bidirectional continuous ramp
> > > +  echo 0 > /sys/bus/iio/devices/iio\:device0/out_altcurrent131_dwell_en
> > > +  echo 0 > /sys/bus/iio/devices/iio\:device0/out_altcurrent132_dwell_en
> > > +
> > > +  # Set ramp rate at 250 MHz
> > > +  echo 250000000 > /sys/bus/iio/devices/iio\:device0/out_altcurrent131_sampling_frequency
> > > +  echo 250000000 > /sys/bus/iio/devices/iio\:device0/out_altcurrent132_sampling_frequency
> > > +
> > > +  # read the frequency scale to convert physical values to raw units
> > > +  cat /sys/bus/iio/devices/iio\:device0/out_frequency130_scale
> > > +  0.232830643650
> > > +
> > > +  # 40 MHz / 0.232830643650 = 171798692
> > > +  echo 171798692 > /sys/bus/iio/devices/iio\:device0/out_altcurrent131_raw
> > > +  # 60 MHz / 0.232830643650 = 257698038
> > > +  echo 257698038 > /sys/bus/iio/devices/iio\:device0/out_altcurrent132_raw  
> > 
> > Why is this writing frequencies to altcurrent channels? Shouldn't this be the
> > frequency ones?  
> 
> All the attributes for ramp up/down channels would do the same thing in separate
> channel types: sampling_frequency, raw, raw_roc and dwell_en... do we need frequency
> and phase ones? For the DRG, right now I have:
> 
> * out_frequency130: en, scale
> * out_phase130: en, scale
> * out_altcurrent130: en: scale
> 	* out_altcurrent131: raw, raw_roc, dwell_en, sampling_frequency
> 	* out_altcurrent132: raw, raw_roc, dwell_en, sampling_frequency

Yes. I think we should have separate ones.  If later we did have a device
that was otherwise similar but had separate registers, maybe for some weird
sync sweep of frequency and magnitude then the naming would match the thing
being enabled.   I'm not that bothered if they 'overwrite' each other, as in
there is only one backend store of the value.  Also fine if you think some
caching layer would be more user friendly.

Thanks,

Jonathan

>  
> > > +
> > > +  # 25 GHz/s / 0.232830643650 = 107374182402
> > > +  echo 107374182402 > /sys/bus/iio/devices/iio\:device0/out_altcurrent131_raw_roc
> > > +  echo 107374182402 > /sys/bus/iio/devices/iio\:device0/out_altcurrent132_raw_roc
> > > +
> > > +  # Enable the DRG with frequency as the destination
> > > +  echo 1 > /sys/bus/iio/devices/iio\:device0/out_frequency130_en
> > > +  
> 
> ...
> 


      reply	other threads:[~2026-07-06 15:51 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18 13:27 [PATCH v6 00/16] AD9910 Direct Digital Synthesizer Rodrigo Alencar via B4 Relay
2026-06-18 13:27 ` [PATCH v6 01/16] iio: ABI: add attributes for altcurrent channels Rodrigo Alencar via B4 Relay
2026-07-03  1:17   ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 02/16] iio: ABI: scale and offset for frequency/phase channels Rodrigo Alencar via B4 Relay
2026-06-18 13:27 ` [PATCH v6 03/16] iio: ABI: add parent entry for iio channels Rodrigo Alencar via B4 Relay
2026-07-03  1:18   ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 04/16] iio: add IIO_FREQUENCY channel type Rodrigo Alencar via B4 Relay
2026-06-18 13:27 ` [PATCH v6 05/16] iio: core: support 64-bit register through debugfs Rodrigo Alencar via B4 Relay
2026-06-18 14:45   ` Nuno Sá
2026-07-03  1:21     ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 06/16] iio: core: create local __iio_chan_prefix_emit() for reuse Rodrigo Alencar via B4 Relay
2026-06-18 15:06   ` Nuno Sá
2026-06-18 16:14     ` Rodrigo Alencar
2026-06-18 18:14       ` Andy Shevchenko
2026-06-19  7:43         ` Rodrigo Alencar
2026-06-19  9:20           ` Nuno Sá
2026-06-19  9:19         ` Nuno Sá
2026-06-19  9:16       ` Nuno Sá
2026-07-03  1:08         ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 07/16] iio: core: add hierarchical channel relationships Rodrigo Alencar via B4 Relay
2026-07-03  1:33   ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 08/16] dt-bindings: iio: frequency: add ad9910 Rodrigo Alencar via B4 Relay
2026-06-30 14:02   ` Rob Herring
2026-07-03  1:13     ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 09/16] iio: frequency: ad9910: initial driver implementation Rodrigo Alencar via B4 Relay
2026-07-03  2:13   ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 10/16] iio: frequency: ad9910: add basic parallel port support Rodrigo Alencar via B4 Relay
2026-07-03  2:57   ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 11/16] iio: frequency: ad9910: add digital ramp generator support Rodrigo Alencar via B4 Relay
2026-07-03  3:01   ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 12/16] iio: frequency: ad9910: add RAM mode support Rodrigo Alencar via B4 Relay
2026-07-03  3:05   ` Jonathan Cameron
2026-07-03 14:09     ` Nuno Sá
2026-07-04 16:50       ` David Lechner
2026-07-04 22:55         ` Jonathan Cameron
2026-07-06  9:47         ` Nuno Sá
2026-07-06 14:10           ` David Lechner
2026-06-18 13:27 ` [PATCH v6 13/16] iio: frequency: ad9910: add output shift keying support Rodrigo Alencar via B4 Relay
2026-07-03 18:09   ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 14/16] iio: frequency: ad9910: show channel priority in debugfs Rodrigo Alencar via B4 Relay
2026-06-18 13:27 ` [PATCH v6 15/16] iio: ABI: add docs for ad9910 sysfs entries Rodrigo Alencar via B4 Relay
2026-07-03 18:13   ` Jonathan Cameron
2026-06-18 13:27 ` [PATCH v6 16/16] docs: iio: add documentation for ad9910 driver Rodrigo Alencar via B4 Relay
2026-07-03 18:30   ` Jonathan Cameron
2026-07-06 14:23     ` Rodrigo Alencar
2026-07-06 15:51       ` Jonathan Cameron [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=20260706165120.156f67a2@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=455.rodrigo.alencar@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+rodrigo.alencar.analog.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gustavoars@kernel.org \
    --cc=kees@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=skhan@linuxfoundation.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