[PATCH v3 2/2] iio: adc: add Axiado SARADC driver

Petar Stepanovic pstepanovic at axiado.com
Sun Jun 28 19:33:00 PDT 2026


On 6/28/2026 1:07 AM, David Lechner wrote:
>> +#define AX_SARADC_CH(_index, _id)                                       \
>> +     {                                                               \
>> +             .type = IIO_VOLTAGE,                                    \
>> +             .indexed = 1,                                           \
>> +             .channel = (_index),                                    \
>> +             .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),           \
>> +             .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),   \
>> +             .datasheet_name = (_id),                                \
> This could probably be:
>
>                 .datasheet_name = "adc" #_index,
>
> and avoid the need for _id.

Thanks for the review, David.
Yes, that makes sense. I will update this and remove the extra _id
argument.

>> +     }
>> +
>> +static const struct iio_chan_spec axiado_saradc_iio_channels[] = {
>> +     AX_SARADC_CH(0, "adc0"),   AX_SARADC_CH(1, "adc1"),
>> +     AX_SARADC_CH(2, "adc2"),   AX_SARADC_CH(3, "adc3"),
>> +     AX_SARADC_CH(4, "adc4"),   AX_SARADC_CH(5, "adc5"),
>> +     AX_SARADC_CH(6, "adc6"),   AX_SARADC_CH(7, "adc7"),
>> +     AX_SARADC_CH(8, "adc8"),   AX_SARADC_CH(9, "adc9"),
>> +     AX_SARADC_CH(10, "adc10"), AX_SARADC_CH(11, "adc11"),
>> +     AX_SARADC_CH(12, "adc12"), AX_SARADC_CH(13, "adc13"),
>> +     AX_SARADC_CH(14, "adc14"), AX_SARADC_CH(15, "adc15"),
> Two columns looks a bit odd.

I will also reformat the channel table to one entry per line.

>> +};
>> +
>> +static void axiado_saradc_disable(void *data)
>> +{
>> +     struct axiado_saradc *info = data;
>> +
>> +     writel(AX_SARADC_GLOBAL_CTRL_PD, info->regs + AX_SARADC_GLOBAL_CTRL_REG);
> People usual make read and write wrappers or use regmap to avoid having
> to write `info->regs + AX_SARADC_GLOBAL_CTRL_REG` so many times.

My understanding is that simple read/write wrappers are not always
preferred unless they provide additional value. Would switching the
driver to regmap be acceptable here to avoid repeating the base address
calculation?

Regards,
Petar




More information about the linux-arm-kernel mailing list