lkml.org 
[lkml]   [2021]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 05/13] iio: afe: rescale: add INT_PLUS_{MICRO,NANO} support
On Wed, 28 Jul 2021 09:19:58 +0200
Peter Rosin <peda@axentia.se> wrote:

> On 2021-07-28 02:21, Liam Beguin wrote:
> > On Fri Jul 23, 2021 at 5:16 PM EDT, Peter Rosin wrote:
> >> On 2021-07-21 05:06, Liam Beguin wrote:
> >>> From: Liam Beguin <lvb@xiphos.com>
> >>>
> >>> Some ADCs use IIO_VAL_INT_PLUS_{NANO,MICRO} scale types.
> >>> Add support for these to allow using the iio-rescaler with them.
> >>>
> >>> Signed-off-by: Liam Beguin <lvb@xiphos.com>
> >>> ---
> >>> drivers/iio/afe/iio-rescale.c | 14 ++++++++++++++
> >>> 1 file changed, 14 insertions(+)
> >>>
> >>> diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
> >>> index d0669fd8eac5..2b73047365cc 100644
> >>> --- a/drivers/iio/afe/iio-rescale.c
> >>> +++ b/drivers/iio/afe/iio-rescale.c
> >>> @@ -41,6 +41,20 @@ int rescale_process_scale(struct rescale *rescale, int scale_type,
> >>> do_div(tmp, 1000000000LL);
> >>> *val = tmp;
> >>> return scale_type;
> >>> + case IIO_VAL_INT_PLUS_NANO:
> >>> + tmp = ((s64)*val * 1000000000LL + *val2) * rescale->numerator;
> >>> + tmp = div_s64(tmp, rescale->denominator);
> >>> +
> >>> + *val = div_s64(tmp, 1000000000LL);
> >>> + *val2 = tmp - *val * 1000000000LL;
> >>> + return scale_type;
> >
> > Hi Peter,
> >
> >>
> >> Hi!
> >>
> >> My objection from v5 still stands. Did you forget or did you simply send
> >> the
> >> wrong patch?
> >
> > Apologies, again I didn't mean to make it seem like I ignored your comments.
> > I tried your suggestion, but had issues when *val2 would overflow into
> > the integer part.
>
> Not saying anything about it not working does indeed make it seem like you
> ignored it :-) Or did I just miss where you said this? Anyway, no problem,
> it can be a mess dealing with a string of commits when there are numerous
> things to take care of between each iteration. And it's very easy to burn
> out and just back away. Please don't do that!

Just to add here, I'm really appreciating the two of you figuring this out
between you and looking forward to getting the resulting improvements (particularly
the tests!) in place.

Thanks,

Jonathan

\
 
 \ /
  Last update: 2021-07-31 19:46    [W:0.348 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site