Devicetree
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Matti Vaittinen" <matti.vaittinen@fi.rohmeurope.com>,
	"Matti Vaittinen" <matti.vaittinen@linux.dev>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] bd79703: Support ROHM BD7971x DACs
Date: Fri, 4 Dec 2026 07:58:30 +0200	[thread overview]
Message-ID: <5a147154-c37e-4438-86b6-2e4639781f4e@gmail.com> (raw)
In-Reply-To: <axGiSc4pD_tm0lv-@ashevche-desk.local>

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! ~~

      reply	other threads:[~2026-12-04  5:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 13:38 [PATCH 0/4] Support ROHM BD7971x family of DACs Matti Vaittinen
2026-12-02 13:38 ` [PATCH 1/4] dt-bindings: iio: bd79703: Fix VFS explanation Matti Vaittinen
2026-12-02 13:38 ` [PATCH 2/4] dt-bindings: iio: dac: Add ROHM BD7971x Matti Vaittinen
2026-12-02 18:05   ` Conor Dooley
2026-12-03  6:54     ` Matti Vaittinen
2026-12-03  8:35       ` Conor Dooley
2026-12-03  9:03         ` Matti Vaittinen
2026-12-03 12:10         ` Matti Vaittinen
2026-12-03 16:36           ` Conor Dooley
2026-12-04  5:52             ` Matti Vaittinen
2026-12-02 13:39 ` [PATCH 3/4] iio: dac: rohm-bd79703: Avoid copying chip-data Matti Vaittinen
2026-12-03 17:10   ` Andy Shevchenko
2026-12-02 13:39 ` [PATCH 4/4] bd79703: Support ROHM BD7971x DACs Matti Vaittinen
2026-12-03 17:09   ` Andy Shevchenko
2026-12-04  5:58     ` Matti Vaittinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a147154-c37e-4438-86b6-2e4639781f4e@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=matti.vaittinen@linux.dev \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox