[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210731184750.669af583@jic23-huawei>
Date: Sat, 31 Jul 2021 18:47:50 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Peter Rosin <peda@...ntia.se>
Cc: Liam Beguin <liambeguin@...il.com>, lars@...afoo.de,
pmeerw@...erw.net, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
robh+dt@...nel.org
Subject: Re: [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@...ntia.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@...hos.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@...hos.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
Powered by blists - more mailing lists