From: David Lechner <dlechner@baylibre.com>
To: Trevor Gamblin <tgamblin@baylibre.com>,
Jonathan Cameron <jic23@kernel.org>
Cc: "Michael Hennerich" <michael.hennerich@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Jonathan Corbet" <corbet@lwn.net>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: Re: [PATCH 1/2] iio: adc: ad4695: add offload-based oversampling support
Date: Wed, 8 Jan 2025 14:39:30 -0600 [thread overview]
Message-ID: <ec8bf32b-2414-4538-9fe4-2b32d890bc66@baylibre.com> (raw)
In-Reply-To: <dbf6dc15-ec2e-4779-9a0a-4038aaa59624@baylibre.com>
On 1/8/25 1:54 PM, Trevor Gamblin wrote:
>
> On 2025-01-07 16:02, David Lechner wrote:
>> On 1/7/25 2:21 PM, Trevor Gamblin wrote:
>>> On 2025-01-04 07:30, Jonathan Cameron wrote:
>>>> On Thu, 2 Jan 2025 13:19:19 -0500
>>>> Trevor Gamblin <tgamblin@baylibre.com> wrote:
>>>>
>>>>> On 2024-12-19 11:13, Jonathan Cameron wrote:
>>>>>> On Tue, 17 Dec 2024 16:47:28 -0500
>>>>>> Trevor Gamblin <tgamblin@baylibre.com> wrote:
>>>>>>
...
>>> else
>>> val_calc = val * scale + val2 * scale / MICRO;
>>>
>>> val_calc /= 2;
>>>
>>> return clamp_t(int, val_calc, S16_MIN, S16_MAX);
>>> }
>>>
>>> This seems to match all of the expected outputs for the pre-simplification version in this patch series when I test it. If there are no issues with it, I'll send a v2.
>> Probably not a big deal, but there is unhanded overflow when val is near S32_MAX
>> or S32_MIN.
> Should I handle that with an extra call to clamp_t()?
It wouldn't hurt. val = clamp_t(int, val, S32_MIN / 8, S32_MAX / 8); before
the rest of the math should do the trick since the max scale is 8.
next prev parent reply other threads:[~2025-01-08 20:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 21:47 [PATCH 0/2] iio: adc: ad4695: add oversampling support Trevor Gamblin
2024-12-17 21:47 ` [PATCH 1/2] iio: adc: ad4695: add offload-based " Trevor Gamblin
2024-12-19 16:13 ` Jonathan Cameron
2024-12-23 16:33 ` Trevor Gamblin
2025-01-02 18:19 ` Trevor Gamblin
2025-01-04 12:30 ` Jonathan Cameron
2025-01-07 20:21 ` Trevor Gamblin
2025-01-07 21:02 ` David Lechner
2025-01-08 19:54 ` Trevor Gamblin
2025-01-08 20:39 ` David Lechner [this message]
2024-12-17 21:47 ` [PATCH 2/2] doc: iio: ad4695: describe " Trevor Gamblin
2024-12-19 15:53 ` Jonathan Cameron
2024-12-19 15:46 ` [PATCH 0/2] iio: adc: ad4695: add " Jonathan Cameron
2025-01-09 18:09 ` Trevor Gamblin
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=ec8bf32b-2414-4538-9fe4-2b32d890bc66@baylibre.com \
--to=dlechner@baylibre.com \
--cc=corbet@lwn.net \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.hennerich@analog.com \
--cc=nuno.sa@analog.com \
--cc=tgamblin@baylibre.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox