Re: [PATCH v2 4/9] iio: adc: qcom-vadc-common: use fixp_linear_interpolate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 3, 2020 at 5:33 PM Dmitry Baryshkov
<dmitry.baryshkov@xxxxxxxxxx> wrote:
>
> Use new function fixp_linear_interpolate() instead of hand-coding the
> linar interpolation.

...

>                 /* result is between search_index and search_index-1 */
>                 /* interpolate linearly */
> -               *output = (((s32)((pts[i].y - pts[i - 1].y) *
> -                       (input - pts[i - 1].x)) /
> -                       (pts[i].x - pts[i - 1].x)) +
> -                       pts[i - 1].y);
> +               *output = fixp_linear_interpolate(pts[i - 1].x, pts[i - 1].y,
> +                                                 pts[i].x, pts[i].y,
> +                                                 input);

I'm wondering if it's related to linear_range.h API
https://elixir.bootlin.com/linux/latest/source/include/linux/linear_range.h


>         }
>
>         return 0;


-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux