From: "Kurt Borja" <kuurtb@gmail.com>
To: "Andy Shevchenko" <andy.shevchenko@gmail.com>,
"Kurt Borja" <kuurtb@gmail.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Tobias Sperling" <tobias.sperling@softing.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v7 2/2] iio: adc: Add ti-ads1018 driver
Date: Tue, 09 Dec 2025 23:07:49 -0500 [thread overview]
Message-ID: <DEU8OOETPWRO.12I8HY6SHTQAA@gmail.com> (raw)
In-Reply-To: <CAHp75VcOVpGbb3UBm+QQrw25=yU+J624c29ptMk8yrJpNEL=jA@mail.gmail.com>
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@kernel.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
next prev parent reply other threads:[~2025-12-10 4:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 19:24 [PATCH v7 0/2] iio: Add support for TI ADS1X18 ADCs Kurt Borja
2025-12-08 19:24 ` [PATCH v7 1/2] dt-bindings: iio: adc: Add TI ADS1018/ADS1118 Kurt Borja
2025-12-08 19:24 ` [PATCH v7 2/2] iio: adc: Add ti-ads1018 driver Kurt Borja
2025-12-08 20:19 ` Andy Shevchenko
2025-12-10 4:07 ` Kurt Borja [this message]
2025-12-10 11:13 ` Andy Shevchenko
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=DEU8OOETPWRO.12I8HY6SHTQAA@gmail.com \
--to=kuurtb@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=tobias.sperling@softing.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.