devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ceclan, Dumitru" <mitrutzceclan@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
	Dumitru Ceclan via B4 Relay
	<devnull+dumitru.ceclan.analog.com@kernel.org>
Cc: dumitru.ceclan@analog.com, Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	David Lechner <dlechner@baylibre.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 6/6] iio: adc: ad7173: Add support for AD411x devices
Date: Mon, 3 Jun 2024 13:11:33 +0300	[thread overview]
Message-ID: <93ebe75b-5a7d-4d69-9515-7cbeb66c8e7e@gmail.com> (raw)
In-Reply-To: <20240601201912.32fe3524@jic23-huawei>

On 01/06/2024 22:19, Jonathan Cameron wrote:
> On Fri, 31 May 2024 22:42:32 +0300
> Dumitru Ceclan via B4 Relay <devnull+dumitru.ceclan.analog.com@kernel.org> wrote:
> 
>> From: Dumitru Ceclan <dumitru.ceclan@analog.com>
>>
>> Add support for AD4111/AD4112/AD4114/AD4115/AD4116.
>>
>> The AD411X family encompasses a series of low power, low noise, 24-bit,
>> sigma-delta analog-to-digital converters that offer a versatile range of
>> specifications.
>>
>> This family of ADCs integrates an analog front end suitable for processing
>> both fully differential and single-ended, bipolar voltage inputs
>> addressing a wide array of industrial and instrumentation requirements.
>>
>> - All ADCs have inputs with a precision voltage divider with a division
>>   ratio of 10.
>> - AD4116 has 5 low level inputs without a voltage divider.
>> - AD4111 and AD4112 support current inputs (0 mA to 20 mA) using a 50ohm
>>   shunt resistor.
>>
>> Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com>
> Hi Dumitru,
> 
> A follow on comment on the validation code.
> Also there is some good docs for the sampling frequency but are they
> actually related to the rest of this change?  They also raise
> questions about ABI compliance that we may want to deal with as
> a follow up patch.
> 
> A few other trivial things inline.
> 
> This is looking pretty good, so hopefully we'll get the last few corners
> sorted in v5.
> 
> Thanks,
> 
> Jonathan
> 
> 
>> ---
>>  drivers/iio/adc/ad7173.c | 336 +++++++++++++++++++++++++++++++++++++++++++----
>>  1 file changed, 307 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c
>> index ed8ff8c5f343..91ff984eedf4 100644
>> --- a/drivers/iio/adc/ad7173.c
>> +++ b/drivers/iio/adc/ad7173.c
>> @@ -1,8 +1,9 @@
> 
>>  #define AD7173_INTERFACE_DATA_STAT	BIT(6)
>> @@ -125,26 +132,46 @@
>>  #define AD7173_VOLTAGE_INT_REF_uV	2500000
>>  #define AD7173_TEMP_SENSIIVITY_uV_per_C	477
>>  #define AD7177_ODR_START_VALUE		0x07
>> +#define AD4111_SHUNT_RESISTOR_OHM	50
>> +#define AD4111_DIVIDER_RATIO		10
>> +#define AD411X_VCOM_INPUT		0X10
> 
> AD4111_VCOM_INPUT . Looks like one wildcard escaped an earlier edit?
> 
>> +#define AD4111_CURRENT_CHAN_CUTOFF	16
>>  
>> @@ -736,6 +918,21 @@ static int ad7173_write_raw(struct iio_dev *indio_dev,
>>  		return ret;
>>  
>>  	switch (info) {
>> +	/*
>> +	 * This attribute sets the sampling frequency to each channel individually.
> 
> frequency for each channel?
> 
>> +	 * There are no issues for raw or buffered reads of an individual channel.
>> +	 *
>> +	 * When multiple channels are enabled in buffered mode, the effective
>> +	 * sampling rate of a channel is lowered in correlation to the number
>> +	 * of channels enabled and the sampling rate of the other channels.
>> +	 *
>> +	 * Example: 3 channels enabled with rates CH1:6211sps CH2,CH3:10sps
>> +	 * While the reading of CH1 takes only 0.16ms, the reading of CH2 and CH3
>> +	 * will take 100ms each.
>> +	 *
>> +	 * This will cause the reading of CH1 to be actually done once every
>> +	 * 200.16ms, an effective rate of 4.99sps.
> 
> Hmm. This is a bit unfortunate as if I understand correctly that's not really what
> people will expect when they configure the sampling frequency.  However I can't immediately
> think of a better solution.  You could let userspace write a value that is cached
> then attempt to get as near as possible as channels are enabled.
> 
> Still this looks like a documentation enhancement of existing behavior
> in which case any functional change can be in a future patch.
> However I don't think the docs update belongs in this patch unless
> I'm missing some reason for it?
>

Well, it would seem like this exact behaviour is already documented:

 "
 What:		/sys/bus/iio/devices/iio:deviceX/in_voltageX_sampling_frequency
 What:		/sys/bus/iio/devices/iio:deviceX/in_powerY_sampling_frequency
 What:		/sys/bus/iio/devices/iio:deviceX/in_currentZ_sampling_frequency
 KernelVersion:	5.20
 Contact:	linux-iio@vger.kernel.org
 Description:
		Some devices have separate controls of sampling frequency for
		individual channels. If multiple channels are enabled in a scan,
		then the sampling_frequency of the scan may be computed from the
		per channel sampling frequencies.
 "
Does it still make sense to keep this comment here? But if kept, yeah, a different patch

...

  reply	other threads:[~2024-06-03 10:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 19:42 [PATCH v4 0/6] Add support for AD411x Dumitru Ceclan via B4 Relay
2024-05-31 19:42 ` [PATCH v4 1/6] dt-bindings: adc: ad7173: add support for ad411x Dumitru Ceclan via B4 Relay
2024-06-01 18:35   ` Jonathan Cameron
2024-06-03  9:46     ` Ceclan, Dumitru
2024-06-03 20:00       ` Jonathan Cameron
2024-06-05  6:54         ` Ceclan, Dumitru
2024-06-06 19:58           ` Jonathan Cameron
2024-06-07  7:29             ` Ceclan, Dumitru
2024-05-31 19:42 ` [PATCH v4 2/6] iio: adc: ad7173: refactor channel configuration parsing Dumitru Ceclan via B4 Relay
2024-05-31 19:42 ` [PATCH v4 3/6] iio: adc: ad7173: refactor ain and vref selection Dumitru Ceclan via B4 Relay
2024-06-01 18:49   ` Jonathan Cameron
2024-06-03 13:00     ` Nuno Sá
2024-06-03 13:08       ` Ceclan, Dumitru
2024-06-03 16:00         ` David Lechner
2024-06-03 16:39           ` Ceclan, Dumitru
2024-05-31 19:42 ` [PATCH v4 4/6] iio: adc: ad7173: add support for special inputs Dumitru Ceclan via B4 Relay
2024-06-01 18:51   ` Jonathan Cameron
2024-05-31 19:42 ` [PATCH v4 5/6] iio: adc: ad7173: refactor device info structs Dumitru Ceclan via B4 Relay
2024-06-01 18:52   ` Jonathan Cameron
2024-05-31 19:42 ` [PATCH v4 6/6] iio: adc: ad7173: Add support for AD411x devices Dumitru Ceclan via B4 Relay
2024-06-01 19:19   ` Jonathan Cameron
2024-06-03 10:11     ` Ceclan, Dumitru [this message]
2024-06-03 20:07       ` Jonathan Cameron

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=93ebe75b-5a7d-4d69-9515-7cbeb66c8e7e@gmail.com \
    --to=mitrutzceclan@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+dumitru.ceclan.analog.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=dumitru.ceclan@analog.com \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).