Re: [PATCH] iio: afe: iio-rescale: Support processed channels

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

 



On Mon, Nov 2, 2020 at 1:23 AM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
>
> It happens that an ADC will only provide raw or processed
> voltage conversion channels. (adc/ab8500-gpadc.c).
> On the Samsung GT-I9070 this is used for a light sensor
> and current sense amplifier so we need to think of something.
>
> The idea is to allow processed channels and scale them
> with 1/1 and then the rescaler can modify the result
> on top.

...

>         case IIO_CHAN_INFO_SCALE:
> -               ret = iio_read_channel_scale(rescale->source, val, val2);
> +               if (rescale->chan_processed) {
> +                       /*
> +                        * Processed channels are scaled 1-to-1
> +                        */

> +                       ret = IIO_VAL_FRACTIONAL;

A nit: Move this to the end of the branch, so in both branches the ret
= will be the last code line (for better readability).

> +                       *val = 1;
> +                       *val2 = 1;
> +               } else {
> +                       ret = iio_read_channel_scale(rescale->source, val, val2);
> +               }

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux