Re: [PATCH v2 2/2] iio: dac: dac8163: Add driver for DAC8163

Lukas <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <amYVZtbxu4fjhBkx@berta-MS-7693>
On Wed, Jul 08, 2026 at 09:58:13PM +0600, Siratul Islam wrote:
> > +
> > +	const struct reg_default reg_defaults[] = {
> > +		{
> > +			.reg = CMD_SET(CMD_WRITE_UPDATE, 0),
> > +			.def = info->default_output_reg,
> > +		},
> > +		{
> > +			.reg = CMD_SET(CMD_WRITE_UPDATE, 1),
> > +			.def = info->default_output_reg,
> > +		},
> > +	};
> > +
> > +	const struct regmap_config regmap_config = {
> > +		.reg_bits = 8,
> > +		.val_bits = 16,
> > +
> > +		.max_register = CMD_REF << 3,
> > +		.cache_type = REGCACHE_MAPLE,
> > +
> > +		.volatile_reg = dac8163_reg_false,
> > +
> > +		.reg_defaults = reg_defaults,
> > +		.num_reg_defaults = ARRAY_SIZE(reg_defaults),
> > +	};
> Why are these defined inside probe? Should be defined outside the function.

The default values after reset are different for the compatible devices
(0 for the dacxxx2 devices and mid-scale for the dacxxx3 devices).
So these are runtime dependent. The alternative would be to have two
regmap_configs for the two device types and add these to the chip_info.
Or do you have another suggestion?

Best regards

Lukas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.