Re: [PATCH v4 08/17] iio: adc: ad7768-1: convert driver to use regmap
From: David Lechner
Date: Tue Apr 01 2025 - 12:33:36 EST
On 3/6/25 3:02 PM, Jonathan Santos wrote:
> Convert the AD7768-1 driver to use the regmap API for register
> access. This change simplifies and standardizes register interactions,
> reducing code duplication and improving maintainability.
>
> Create two regmap configurations, one for 8-bit register values and
> other for 24-bit register values.
>
> Since we are using regmap now, define the remaining registers from 0x32
> to 0x34.
>
> Signed-off-by: Jonathan Santos <Jonathan.Santos@xxxxxxxxxx>
> ---
Reviewed-by: David Lechner <dlechner@xxxxxxxxxxxx>
> +static const struct regmap_range ad7768_regmap_rd_ranges[] = {
> + regmap_reg_range(AD7768_REG_CHIP_TYPE, AD7768_REG_DIG_DIAG_ENABLE),
Technically, there are a few holes in here where registers are not defined
so we could split this up in to a few ranges to only include registers that
actually contain a useful value.
> + regmap_reg_range(AD7768_REG_MASTER_STATUS, AD7768_REG_COEFF_CONTROL),
> + regmap_reg_range(AD7768_REG_ACCESS_KEY, AD7768_REG_ACCESS_KEY),
> +};
>