Re: [PATCH v2 6/7] iio: adc: ad4170: Add support for internal temperature sensor

Andy Shevchenko
2025-04-29T22:16:54Z

On Mon, Apr 28, 2025 at 3:29 PM Marcelo Schmitt
<marcelo.schmitt@analog.com> wrote:
>
> The AD4170 has an internal temperature sensor that can be read using the
> ADC. Whenever possible, configure an IIO channel to provide the chip's
> temperature.

...

> + case IIO_TEMP:
> + /*
> + * The scale_tbl converts output codes to mV units so
> + * multiply by MILLI to make the factor convert to µV.
> + * Then, apply the temperature sensor change sensitivity
> + * of 477 μV/K. Finally, multiply the result by MILLI
> + * again to comply with milli degrees Celsius IIO ABI.
> + */
> + *val = 0;
> + *val2 = DIV_ROUND_CLOSEST(chan_info->scale_tbl[pga][1] * MILLI,
> + 477) * MILLI;

Do not wrap lines like this. Use a logical approach, i.e. the '477) *'
part should be on the previous line.

> + return IIO_VAL_INT_PLUS_NANO;
> + default:
> + return -EINVAL;
> + }

--
With Best Regards,
Andy Shevchenko