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

From: Matti Vaittinen

Date: Fri Dec 04 2026 - 00:58:43 EST


On 03/12/2026 19:09, Andy Shevchenko wrote:
On Wed, Dec 02, 2026 at 03:39:21PM +0200, Matti Vaittinen wrote:

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.

Subject went wrong (w/o required prefix).

...

+/* The BD7971X uses 16-bit data transfers. Four high bits define the channel
+ * 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 multi-line comment style should follow this
* example. It's even inconsistent to the one used
* in the driver.
*/

...

struct bd79703_data *data = iio_priv(idev);
+ unsigned int tmp = val;

This signed->unsigned trick begs for a comment. It's quite easy to miss and
someone might introduce some issues due to that.

I was a bit unsure whether to do this or not. With the data-sizes these DACs use, this assignment shouldn't really be needed. Still, leaving shifting to be done with signed int felt a bit error prone, in case things change. If you agree the assignment to unsigned makes sense, then I suppose adding a comment is good idea.


Very valid points. Thanks Andy!

Yours,
-- Matti

--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductor
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~