[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <160589646471.2717324.9945709609037099045@swboyd.mtv.corp.google.com>
Date: Fri, 20 Nov 2020 10:21:04 -0800
From: Stephen Boyd <swboyd@...omium.org>
To: Doug Anderson <dianders@...omium.org>
Cc: Jonathan Cameron <jic23@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-iio <linux-iio@...r.kernel.org>,
Daniel Campello <campello@...omium.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Gwendal Grignou <gwendal@...omium.org>,
Evan Green <evgreen@...omium.org>
Subject: Re: [PATCH] iio: sx9310: Fix semtech,avg-pos-strength setting when > 16
Quoting Doug Anderson (2020-11-20 10:16:28)
>
> Checking the math for the documented possible values of pos. What we want:
>
> 0 => 0
> 16 => 1
> 64 => 2
> 128 => 3
> 256 => 4
> 512 => 5
> 1024 => 6
> 4294967295 => 7
>
> So looks OK. Do we care about anything other than the documented
> numbers? If my understanding of ilog2 is correct, then you'll get the
> wrong answer for 17. I think you could fix it with:
>
> pos = min(max(ilog2(pos), 3), 11) - (pos >= 32 ? 4 : 3);
>
I don't think we really care about the rounding but to be consistent
with the first two it is better to do that. I'll send a fix.
Powered by blists - more mailing lists