public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ceclan, Dumitru" <mitrutzceclan@gmail.com>
To: "Nuno Sá" <noname.nuno@gmail.com>, dumitru.ceclan@analog.com
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	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 v6 9/9] iio: adc: ad7173: Add support for AD411x devices
Date: Fri, 7 Jun 2024 12:41:42 +0300	[thread overview]
Message-ID: <1c6d409b-ba9e-4a19-a6cb-e06209a24154@gmail.com> (raw)
In-Reply-To: <389546877ae11b18928b432e86710acf83974f67.camel@gmail.com>

On 07/06/2024 12:20, Nuno Sá wrote:
> On Thu, 2024-06-06 at 19:07 +0300, Dumitru Ceclan via B4 Relay 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>
>> ---
>>  drivers/iio/adc/ad7173.c | 317 ++++++++++++++++++++++++++++++++++++++++++----
>> -
>>  1 file changed, 285 insertions(+), 32 deletions(-)
>>
>> diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c
>> index 58da5717fd36..cfcd12447e24 100644
>> --- a/drivers/iio/adc/ad7173.c
>> +++ b/drivers/iio/adc/ad7173.c
>>
> ...
> 
>>  static const struct ad7173_device_info ad7172_2_device_info = {
>>  	.name = "ad7172-2",
>>  	.id = AD7172_2_ID,
>> -	.num_inputs = 5,
>> +	.num_voltage_in = 5,
>>  	.num_channels = 4,
>>  	.num_configs = 4,
>>  	.num_gpios = 2,
>> +	.higher_gpio_bits = false,
> 
> No need to explicitly set to 'false'. Ditto for the other places...
> 
> ...
> 
>>
>>  static int ad7173_validate_voltage_ain_inputs(struct ad7173_state *st,
>>  					      unsigned int ain0, unsigned int
>> ain1)
>>  {
>> @@ -946,15 +1145,30 @@ static int ad7173_validate_voltage_ain_inputs(struct
>> ad7173_state *st,
>>  	    st->info->has_pow_supply_monitoring)
>>  		return 0;
>>  
>> -	special_input0 = AD7173_IS_REF_INPUT(ain0);
>> -	special_input1 = AD7173_IS_REF_INPUT(ain1);
>> +	special_input0 = AD7173_IS_REF_INPUT(ain0) ||
>> +			 (ain0 == AD4111_VINCOM_INPUT && st->info-
>>> has_vincom_input);
>> +	special_input1 = AD7173_IS_REF_INPUT(ain1) ||
>> +			 (ain1 == AD4111_VINCOM_INPUT && st->info-
>>> has_vincom_input);
>> +
> 
> Wondering... can ain1 (or ain0) be AD4111_VINCOM_INPUT and !st->info-
>> has_vincom_input? Would that actually be acceptable? It would assume it's not
> so we should check that right? Or am I missing something?
> 
> - Nuno Sá
> 

It will fail when we check for the number of voltage inputs:
(ain0 >= st->info->num_voltage_in && !special_input0) 
as special_input will not be true if has_vincom_input is false

Indeed this check is a bit hidden, should it be more explicit?


  reply	other threads:[~2024-06-07  9:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 16:07 [PATCH v6 0/9] Add support for AD411x Dumitru Ceclan via B4 Relay
2024-06-06 16:07 ` [PATCH v6 1/9] dt-bindings: iio: adc: Add common-mode-channel property Dumitru Ceclan via B4 Relay
2024-06-06 16:07 ` [PATCH v6 2/9] dt-bindings: adc: ad7173: add support for ad411x Dumitru Ceclan via B4 Relay
2024-06-06 16:38   ` Conor Dooley
2024-06-06 16:07 ` [PATCH v6 3/9] iio: adc: ad_sigma_delta: add disable_one callback Dumitru Ceclan via B4 Relay
2024-06-07  9:02   ` Nuno Sá
2024-06-07  9:29     ` Ceclan, Dumitru
2024-06-07 10:16       ` Nuno Sá
2024-06-06 16:07 ` [PATCH v6 4/9] iio: adc: ad7173: refactor channel configuration parsing Dumitru Ceclan via B4 Relay
2024-06-06 16:07 ` [PATCH v6 5/9] iio: adc: ad7173: refactor ain and vref selection Dumitru Ceclan via B4 Relay
2024-06-07  9:04   ` Nuno Sá
2024-06-07  9:37     ` Ceclan, Dumitru
2024-06-07 10:24       ` Nuno Sá
2024-06-06 16:07 ` [PATCH v6 6/9] iio: adc: ad7173: add support for special inputs Dumitru Ceclan via B4 Relay
2024-06-07  9:06   ` Nuno Sá
2024-06-07  9:34     ` Ceclan, Dumitru
2024-06-07 10:29       ` Nuno Sá
2024-06-06 16:07 ` [PATCH v6 7/9] iio: adc: ad7173: refactor device info structs Dumitru Ceclan via B4 Relay
2024-06-07  9:08   ` Nuno Sá
2024-06-06 16:07 ` [PATCH v6 8/9] iio: adc: ad7173: document sampling frequency behaviour Dumitru Ceclan via B4 Relay
2024-06-07  9:09   ` Nuno Sá
2024-06-06 16:07 ` [PATCH v6 9/9] iio: adc: ad7173: Add support for AD411x devices Dumitru Ceclan via B4 Relay
2024-06-07  9:20   ` Nuno Sá
2024-06-07  9:41     ` Ceclan, Dumitru [this message]
2024-06-07 10:39       ` Nuno Sá

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=1c6d409b-ba9e-4a19-a6cb-e06209a24154@gmail.com \
    --to=mitrutzceclan@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.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=noname.nuno@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