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

David Lechner dlechner at baylibre.com
Sat Jun 27 16:07:49 PDT 2026


On 6/22/26 2:47 AM, Petar Stepanovic wrote:
> Add support for the SARADC controller found on Axiado AX3000 and
> AX3005 SoCs.
> 

...

> +#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.

> +	}
> +
> +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.

> +};
> +
> +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.

> +}



More information about the linux-arm-kernel mailing list