Re: [PATCH 4/4] bd79703: Support ROHM BD7971x DACs

From: Jonathan Cameron

Date: Sat Dec 05 2026 - 19:21:24 EST


On Wed, 2 Dec 2026 15:39:21 +0200
Matti Vaittinen <matti.vaittinen@xxxxxxxxx> wrote:

> From: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
>
> The BD7971x are logically similar to BD7970x. Main difference is the
> amount of bits in DAC-word. The BD7970x had 8-bit DAC whereas the
> BD7971x use 10-bit DAC word.
>
> The SPI data format differs. The BD7971x requires two least significant
> bits to be zeroes, and carries the DAC word in following 10 bits. The
> channel number is in highest 4 bits.
>
> Add support for the BD7971x family of DACs.
>
> Signed-off-by: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
Trivial stuff only inline.

Thanks,

Jonathan

> ---
> drivers/iio/dac/rohm-bd79703.c | 91 ++++++++++++++++++++++++++++++++--
> 1 file changed, 87 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/dac/rohm-bd79703.c b/drivers/iio/dac/rohm-bd79703.c
> index b6508e1e1c4f..32f283714852 100644
> --- a/drivers/iio/dac/rohm-bd79703.c
> +++ b/drivers/iio/dac/rohm-bd79703.c
> @@ -17,6 +17,8 @@
> #define BD79703_DAC_BITS 8
> #define BD79703_REG_OUT_ALL GENMASK(2, 0)
>
> +#define BD7971X_DAC_BITS 10
> +
> /*
> * The BD79703 uses 12-bit SPI commands. First four bits (high bits) define
> * channel(s) which are operated on, and also the mode. The mode can be to set
> @@ -38,11 +40,27 @@ static const struct regmap_config bd79703_regmap_config = {
> .cache_type = REGCACHE_MAPLE,
> };
>
> +/* The BD7971X uses 16-bit data transfers. Four high bits define the channel

/*
* The BD...

> + * and following 10 bits define the DAC word. Two last bits must be zero.
> + *
> + * Let's try having the 4 channel-bits as an address and following bits as data
> + */
>

> +/*
> + * The BD7971[0,3] have same amount of channels as BD7970[0,3]. Also the SPI

same number of channels

(ever so slightly clearer English).


> + * command number for 'set DAC and output fir channel N' is same, although
> + * bits where the value is placed differ. We can still use the same channel
> + * config and only provide a different regmap config.
> + */
> +static const struct bd7970x_chip_data bd79710_chip_data = {
> + .name = "bd79710",
> + .regmap_conf = &bd7971x_regmap_config,
> + .channels = bd79700_channels,
> + .num_channels = ARRAY_SIZE(bd79700_channels),
> + .num_vfs_chan = 0,
> + .num_bits = BD7971X_DAC_BITS,
> + .l_shift = 2,
> +};