Re: [PATCH v2 2/3] iio: dac: Add AD5529R DAC driver support
From: Janani Sunil
Date: Tue May 19 2026 - 03:12:09 EST
On 5/16/26 21:35, David Lechner wrote:
On 5/8/26 6:55 AM, Janani Sunil wrote:
Add support for AD5529R 16-channel, 12/16 bit Digital to Analog Converter...
+ .realbits = (bits), \Another way we have done this is make custom read/write functions for the
+ .storagebits = 16, \
+ }, \
+}
+static struct regmap *ad5529r_get_regmap(struct ad5529r_state *st, unsigned int reg)
+{
+ if (reg <= AD5529R_8BIT_REG_MAX)
+ return st->regmap_8bit;
+
+ return st->regmap_16bit;
+}
regmap itself so that we don't have to have two regmaps.
Dual regmap approach was chosen here because:
1) It leverages regmap's val_bits validation and endianness for 16 bit registers, rather than
implementing them manually.
2) The two distinct register banks- 8 bit and 16 bit map naturally to the separate regmap configs
3) Each regmap has a focused rd_table/wr_table ranges matching the hardware, rather than a complex unified table
The routing overhead is just an address comparison, similar to what custom functions would need, but with automatic validation
and endianness handling
Best Regards,
Janani Sunil