[PATCH v2 2/2] iio: adc: add Axiado SARADC driver
Andy Shevchenko
andriy.shevchenko at intel.com
Thu Jun 11 12:41:33 PDT 2026
On Thu, Jun 11, 2026 at 02:37:44AM -0700, Petar Stepanovic wrote:
> Add support for the SARADC controller found on Axiado AX3000 and
> AX3005 SoCs.
>
> The driver supports single-shot voltage reads through the IIO
> subsystem. The number of available input channels is selected from
> the SoC match data, allowing AX3000 and AX3005 variants to use the
> same driver.
Tried to not overlap Jonathan's review.
...
> +struct axiado_saradc {
> + void __iomem *regs;
> + struct clk *clk;
> + unsigned long clk_rate;
> + int vref_uV;
> + struct mutex lock; /* Serializes ADC conversions. */
> +};
Is `pahole` satisfied with the chosen layout?
...
> +static int axiado_saradc_read_raw(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan, int *val,
> + int *val2, long mask)
> +{
> + struct axiado_saradc *info = iio_priv(indio_dev);
> + int ret;
> +
> + switch (mask) {
> + case IIO_CHAN_INFO_RAW:
> + ret = axiado_saradc_conversion(info, chan, val);
> + return ret ? ret : IIO_VAL_INT;
Better to use plain if.
if (ret)
return ret;
return IIO_VAL_INT;
> + case IIO_CHAN_INFO_SCALE:
> + *val = info->vref_uV / 1000;
1000 --> (MICRO / MILLI) ?
(yes, with parentheses)
> + *val2 = AX_RESOLUTION_BITS;
> + return IIO_VAL_FRACTIONAL_LOG2;
> +
> + default:
> + return -EINVAL;
> + }
> +}
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list