On Wed, 27 Nov 2024 15:59:39 +0100 Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx> wrote: > If the maximal count of channels the driver supports isn't fully > utilized, add an attribute providing the internal temperature. > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx> LGTM For the whole series, I would ideally like an additional review from someone more familiar with these parts than I am. Thanks, Jonathan > @@ -902,6 +941,37 @@ static int ad7124_parse_channel_config(struct iio_dev *indio_dev, > chan[channel].channel2 = ain[1]; > } > > + if (num_channels < AD7124_MAX_CHANNELS) { > + st->channels[num_channels] = (struct ad7124_channel) { > + .nr = num_channels, > + .ain = AD7124_CHANNEL_AINP(AD7124_INPUT_TEMPSENSOR) | > + AD7124_CHANNEL_AINM(AD7124_INPUT_AVSS), > + .cfg = { > + .bipolar = true, > + }, > + }; > + > + chan[num_channels] = (struct iio_chan_spec) { > + .type = IIO_TEMP, > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | > + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET) | > + BIT(IIO_CHAN_INFO_SAMP_FREQ), > + .scan_type = { > + /* > + * You might find it strange that a bipolar > + * measurement yields an unsigned value, but > + * this matches the device's manual. I did indeed ;) So good comment. > + */ > + .sign = 'u', > + .realbits = 24, > + .storagebits = 32, > + .endianness = IIO_BE, > + }, > + .address = num_channels, > + .scan_index = num_channels, > + }; > + }; > + > return 0; > } >