[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcCgcOd4z7OYm67ijpad2NjmEBOM5gMJHyWbjd2M9-hkw@mail.gmail.com>
Date: Wed, 30 Apr 2025 01:16:16 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Marcelo Schmitt <marcelo.schmitt@...log.com>
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, jic23@...nel.org, lars@...afoo.de,
Michael.Hennerich@...log.com, dlechner@...libre.com, nuno.sa@...log.com,
andy@...nel.org, robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
marcelo.schmitt1@...il.com
Subject: Re: [PATCH v2 6/7] iio: adc: ad4170: Add support for internal
temperature sensor
On Mon, Apr 28, 2025 at 3:29 PM Marcelo Schmitt
<marcelo.schmitt@...log.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
Powered by blists - more mailing lists