public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Santos <jonath4nns@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: 58ea1899-05be-4743-911b-77a56f08c347@baylibre.com,
	David Lechner <dlechner@baylibre.com>,
	Jonathan Santos <Jonathan.Santos@analog.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, lars@metafoo.de,
	Michael.Hennerich@analog.com, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	marcelo.schmitt1@gmail.com
Subject: Re: [PATCH v1 03/15] Documentation: ABI: testing: ad7768-1: Add device specific ABI documentation.
Date: Mon, 13 Jan 2025 22:06:37 -0300	[thread overview]
Message-ID: <Z4W4nS8a5A2PZ4wV@JSANTO12-L01.ad.analog.com> (raw)
In-Reply-To: <20250112131021.5601aaea@jic23-huawei>

On 01/12, Jonathan Cameron wrote:
> On Sun, 12 Jan 2025 12:20:47 +0000
> Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > On Sat, 11 Jan 2025 20:22:36 -0300
> > Jonathan Santos <jonath4nns@gmail.com> wrote:
> > 
> > > On 01/07, David Lechner wrote:  
> > > > On 1/7/25 9:24 AM, Jonathan Santos wrote:    
> > > > > Add ABI documentation specific to the ad7768-1 device, detailing
> > > > > the decimation_rate attribute for better clarity and usability.
> > > > > 
> > > > > Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
> > > > > ---
> > > > >  .../ABI/testing/sysfs-bus-iio-adc-ad7768-1          | 13 +++++++++++++
> > > > >  1 file changed, 13 insertions(+)
> > > > >  create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-ad7768-1
> > > > > 
> > > > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-ad7768-1 b/Documentation/ABI/testing/sysfs-bus-iio-adc-ad7768-1
> > > > > new file mode 100644
> > > > > index 000000000000..065247f07cfb
> > > > > --- /dev/null
> > > > > +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-ad7768-1
> > > > > @@ -0,0 +1,13 @@
> > > > > +What:		/sys/bus/iio/devices/iio:deviceX/decimation_rate_available
> > > > > +KernelVersion:
> > > > > +Contact:	linux-iio@vger.kernel.org
> > > > > +Description:
> > > > > +		Reading returns a range of possible decimation rate values.
> > > > > +
> > > > > +What:		/sys/bus/iio/devices/iio:deviceX/decimation_rate
> > > > > +KernelVersion:
> > > > > +Contact:	linux-iio@vger.kernel.org
> > > > > +Description:
> > > > > +		Sets up the decimation rate for the digital filter. This can
> > > > > +		directly impact in the final sampling frequency. Reading returns
> > > > > +		the decimation rate. Writing sets the decimation rate.    
> > > > 
> > > > If this only affects the filter, I would suggest to add `filter_` to the
> > > > beginning of the attribute names.
> > > > 
> > > > Also, an explanation of how to interpret the numbers would be helpful. It looks
> > > > like a unitless number that acts a sort of a multiplier or divider, but that
> > > > part isn't so clear to me. 
> > > > 
> > > > Or...
> > > > 
> > > > Since the decimation rate affects the -3dB point of the filters we could use
> > > > the standard IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY instead of introducing
> > > > a new attribute.    
> > > 
> > > Well, here the -3dB cutoff depends on the ODR, which is determined by both the MCLK
> > > divider and decimation rate.
> > > 
> > > Wideband: -3dB at 0.433 × ODR
> > > Sinc5: -3dB at 0.204 × ODR
> > > Sinc3: -3dB at 0.2617 × ODR
> > > 
> > > If we use _filter_low_pass_3db_frequency to control the decimation and _sampling_frequency
> > > to control the MCLK divider, wouldn’t it be confusing for one to always affect the other?
> > > A different ODR would result in a different cutoff, and vice versa.  
> > 
> > We should definitely not have a filter control changing sampling frequency (which tends to
> > be a more common control for users to fiddle with).  However the other way around is
> > fine.  So for a given _sampling_frequency present via
> > in_xx_filter_low_pass_3db_frequency_available the list of
> > possible 3db frequencies and use them to configure the decimation.
> > 
> > > 
> > > Would something like <type>[_name]_oversampling_ratio make more sense? Let me know what you think  
> > 
> > I'd rather not if we can avoid that new ABI, but it is is better than a new term
> > like decimation_rate.
> Reading the code I realised I'd misunderstood this question.
> Yes for controlling decimation via oversampling.  Decimation (to me at least)
> means 'ignoring' data but seems here it means averaging it.
> 

Yes, for this device the decimation is indeed averaging the data.

> Controls should be in order of preference
> sampling_frequency (try to keep this constant as others chagnes - if you have to because of range issues,
>   tweak it) This is the rate we get data at after filter.
> oversampling_ratio (again try to keep constant) - controls samples taken per output one.
> _3db_frequency - anything left to control on the filter, or just a RO output of what it currently means.
> 
> Jonathan
> 

Great, then. Decimation will be controlled by oversampling, frequency 
modulator controlled by sampling frequency and _3db_frequency as RO 
attribute, since there are no parameters left.

> 
> 
> > 
> > Jonathan
> > 
> > >   
> > 
> > 
> 

  reply	other threads:[~2025-01-14  1:06 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 15:23 [PATCH v1 00/15] iio: adc: ad7768-1: Add features, improvements, and fixes Jonathan Santos
2025-01-07 15:24 ` [PATCH v1 01/15] dt-bindings: iio: adc: ad7768-1: add synchronization over SPI property Jonathan Santos
2025-01-07 23:35   ` David Lechner
2025-01-11 22:34     ` Jonathan Santos
2025-01-12 12:12       ` Jonathan Cameron
2025-01-14  0:18         ` Jonathan Santos
2025-01-14 16:05           ` David Lechner
2025-01-18 11:58             ` Jonathan Cameron
2025-01-12 17:14       ` David Lechner
2025-01-10 21:51   ` Marcelo Schmitt
2025-01-12 12:05     ` Jonathan Cameron
2025-01-14  0:41       ` Jonathan Santos
2025-01-18 12:00         ` Jonathan Cameron
2025-01-07 15:24 ` [PATCH v1 02/15] Documentation: ABI: add wideband filter type to sysfs-bus-iio Jonathan Santos
2025-01-07 23:38   ` David Lechner
2025-01-11 22:50     ` Jonathan Santos
2025-01-12 12:16       ` Jonathan Cameron
2025-01-14  0:44         ` Jonathan Santos
2025-01-12 17:39       ` David Lechner
2025-01-12 17:41         ` David Lechner
2025-01-07 15:24 ` [PATCH v1 03/15] Documentation: ABI: testing: ad7768-1: Add device specific ABI documentation Jonathan Santos
2025-01-07 23:38   ` David Lechner
2025-01-11 23:22     ` Jonathan Santos
2025-01-12 12:20       ` Jonathan Cameron
2025-01-12 13:10         ` Jonathan Cameron
2025-01-14  1:06           ` Jonathan Santos [this message]
2025-01-07 15:25 ` [PATCH v1 04/15] iio: adc: ad7768-1: Fix conversion result sign Jonathan Santos
2025-01-07 23:39   ` David Lechner
2025-01-10 21:52   ` Marcelo Schmitt
2025-01-12  0:00     ` Jonathan Santos
2025-01-12 12:22   ` Jonathan Cameron
2025-01-07 15:25 ` [PATCH v1 05/15] iio: adc: ad7768-1: set MOSI idle state to high Jonathan Santos
2025-01-07 23:40   ` David Lechner
2025-01-10 21:56     ` Marcelo Schmitt
2025-01-12 12:30       ` Jonathan Cameron
2025-01-13 12:19         ` Marcelo Schmitt
2025-01-18 12:09           ` Jonathan Cameron
2025-01-18 13:17             ` Marcelo Schmitt
2025-01-07 15:25 ` [PATCH v1 06/15] iio: adc: ad7768-1: Update reg_read function Jonathan Santos
2025-01-10 21:57   ` Marcelo Schmitt
2025-01-07 15:25 ` [PATCH v1 07/15] iio: adc: ad7768-1: Add reset gpio Jonathan Santos
2025-01-07 23:40   ` David Lechner
2025-01-12 12:35     ` Jonathan Cameron
2025-01-07 15:25 ` [PATCH v1 08/15] iio: adc: ad7768-1: use guard(mutex) to simplify code Jonathan Santos
2025-01-07 23:42   ` David Lechner
2025-01-12  0:26     ` Jonathan Santos
2025-01-07 15:26 ` [PATCH v1 09/15] iio: adc: ad7768-1: Move buffer allocation to a separate function Jonathan Santos
2025-01-10 22:01   ` Marcelo Schmitt
2025-01-12 12:39     ` Jonathan Cameron
2025-01-12 12:40   ` Jonathan Cameron
2025-01-14  1:14     ` Jonathan Santos
2025-01-07 15:26 ` [PATCH v1 10/15] iio: adc: ad7768-1: Add support for variable VCM Jonathan Santos
2025-01-07 23:46   ` David Lechner
2025-01-12  2:37     ` Jonathan Santos
2025-01-12 12:45       ` Jonathan Cameron
2025-01-07 15:26 ` [PATCH v1 11/15] iio: adc: ad7768-1: Add reg_write_masked function Jonathan Santos
2025-01-07 23:46   ` David Lechner
2025-01-10 22:34   ` Marcelo Schmitt
2025-01-12  2:42     ` Jonathan Santos
2025-01-07 15:26 ` [PATCH v1 12/15] iio: adc: ad7768-1: Add GPIO controller support Jonathan Santos
2025-01-07 23:48   ` David Lechner
2025-01-07 15:26 ` [PATCH v1 13/15] iio: adc: ad7768-1: add multiple scan types to support 16-bits mode Jonathan Santos
2025-01-07 23:49   ` David Lechner
2025-01-12  3:21     ` Jonathan Santos
2025-01-12 12:50       ` Jonathan Cameron
2025-01-12 17:51         ` David Lechner
2025-01-07 15:27 ` [PATCH v1 14/15] iio: adc: ad7768-1: add support for Synchronization over SPI Jonathan Santos
2025-01-07 23:50   ` David Lechner
2025-01-12 12:59     ` Jonathan Cameron
2025-01-14  1:27       ` Jonathan Santos
2025-01-07 15:27 ` [PATCH v1 15/15] iio: adc: ad7768-1: add filter type and decimation rate attributes Jonathan Santos
2025-01-07 23:50   ` David Lechner
2025-01-12 13:04     ` Jonathan Cameron
2025-01-14  1:39       ` Jonathan Santos
2025-01-10 22:32   ` Marcelo Schmitt
2025-01-07 23:33 ` [PATCH v1 00/15] iio: adc: ad7768-1: Add features, improvements, and fixes David Lechner
2025-01-11 21:56   ` Jonathan Santos

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=Z4W4nS8a5A2PZ4wV@JSANTO12-L01.ad.analog.com \
    --to=jonath4nns@gmail.com \
    --cc=20250112131021.5601aaea@jic23-huawei \
    --cc=58ea1899-05be-4743-911b-77a56f08c347@baylibre.com \
    --cc=Jonathan.Santos@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --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=marcelo.schmitt1@gmail.com \
    --cc=robh@kernel.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