[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DEU8OOETPWRO.12I8HY6SHTQAA@gmail.com>
Date: Tue, 09 Dec 2025 23:07:49 -0500
From: "Kurt Borja" <kuurtb@...il.com>
To: "Andy Shevchenko" <andy.shevchenko@...il.com>, "Kurt Borja"
<kuurtb@...il.com>
Cc: "Jonathan Cameron" <jic23@...nel.org>, "Rob Herring" <robh@...nel.org>,
"Krzysztof Kozlowski" <krzk+dt@...nel.org>, "Conor Dooley"
<conor+dt@...nel.org>, "Tobias Sperling" <tobias.sperling@...ting.com>,
"David Lechner" <dlechner@...libre.com>, Nuno Sá
<nuno.sa@...log.com>, "Andy Shevchenko" <andy@...nel.org>,
<linux-iio@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, "Jonathan Cameron"
<Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v7 2/2] iio: adc: Add ti-ads1018 driver
On Mon Dec 8, 2025 at 3:19 PM -05, Andy Shevchenko wrote:
...
>> +/**
>> + * ads1018_calc_delay - Calculates a suitable delay for a single-shot reading
>> + * @hz: Sampling frequency
>> + *
>> + * Calculates an appropriate delay for a single shot reading given a sampling
>> + * frequency.
>> + *
>> + * Return: Delay in microseconds (Always greater than 0).
>> + */
>> +static u32 ads1018_calc_delay(unsigned int hz)
>> +{
>> + /*
>> + * Calculate the worst-case sampling rate by subtracting 10% error
>> + * specified in the datasheet...
>> + */
>> + hz -= DIV_ROUND_UP(hz, 10);
>> +
>> + /* ...Then calculate time per sample in microseconds. */
>> + return DIV_ROUND_UP(MICROHZ_PER_HZ, hz);
>
> If time per sample is in µs, the associated frequency is in MHz, so
> the correct constant is HZ_PER_MHZ. What did I miss here?
I was very confused about this, but the dimensional analysis works with
HZ_PER_MHZ so it should be the right constant. Thanks!
...
> Other than above, LGTM!
> Reviewed-by: Andy Shevchenko <andy@...nel.org>
Thanks a lot for all your feedback!
I also found that the sysfs ABI specifies millivolt for voltage final
calculation and millidegree for temps. I will adjust scales to comply
with this in the next version.
Do you have a suggestion for this? I can keep the ADS1018_FSR_TO_SCALE()
macro but it will get a bit more complex or I can just hard code the
scales and document the calculation. I'm inclined to do the latter.
--
~ Kurt
Powered by blists - more mailing lists