Re: [PATCH 8/8] iio: adc: rzt2h: Add support for RZ/V2H(P) SoC

From: Andy Shevchenko

Date: Wed Sep 30 2026 - 05:35:42 EST


On Tue, Sep 29, 2026 at 01:42:48PM +0100, Prabhakar wrote:

> Add support for the ADC found on the Renesas RZ/V2H(P) SoC, which shares
> the RZ/T2H ADC IP but differs in channel count, sampling, calibration and
> resolution support.
>
> The RZ/V2H(P) ADC provides 8 channels, has a fixed conversion time of
> 20 ADCLK cycles, does not support calibration, and supports selectable
> 12-bit and 8-bit conversion resolution.
>
> Expose the fixed sampling frequency as a read-only attribute and allow
> the conversion resolution to be changed through the scale attribute.
> Use extended scan types so the reported scan type follows the selected
> resolution, and prevent resolution changes while buffered capture is
> active.

...

> help
> Say yes here to build support for the ADC found in Renesas
> - RZ/T2H / RZ/N2H SoCs.
> + RZ/T2H / RZ/N2H (and similar SoCs).

This wording is good for the summary above, but here please list what the
similar SoCs are. Something like

in Renesas SoCs:
- RZ/N2H
- RZ/T2H
- ...specify "similar SoCs" here...

> To compile this driver as a module, choose M here: the
> module will be called rzt2h_adc.

...

> +static int rzt2h_adc_write_scale(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan,
> + int val, int val2)
> +{
> + struct rzt2h_adc *adc = iio_priv(indio_dev);
> + unsigned int i;
> + u64 scale;
> + u32 rem;
> +
> + if (!(adc->chip_info->features & RZT2H_ADC_FEATURE_RES_SELECT))
> + return -EINVAL;
> +
> + for (i = 0; i < chan->num_ext_scan_type; i++) {
> + scale = (u64)RZT2H_ADC_VREF_MV * NANO >>
> + chan->ext_scan_type[i].realbits;
> + if (div_u64_rem(scale, NANO, &rem) == val && rem == val2)
> + break;
> + }

> +

Blank line here is not needed.

> + if (i == chan->num_ext_scan_type)
> + return -EINVAL;
> +
> + /* The scan type changes with the resolution. */
> + IIO_DEV_ACQUIRE_DIRECT_MODE(indio_dev, claim);
> + if (IIO_DEV_ACQUIRE_FAILED(claim))
> + return -EBUSY;
> +
> + adc->resolution = i;
> +
> + return 0;
> +}

...

> + case IIO_CHAN_INFO_SCALE:
> + *vals = rzv2h_adc_scale_avail;
> + *type = IIO_VAL_FRACTIONAL_LOG2;
> + *length = ARRAY_SIZE(rzv2h_adc_scale_avail);

Check if array_size.h is included.

> + return IIO_AVAIL_LIST;

--
With Best Regards,
Andy Shevchenko