From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Kim Seer Paller <kimseer.paller@analog.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux@analog.com, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 3/4] iio: dac: ad3530r: parameterize DAC resolution
Date: Mon, 17 Aug 2026 14:15:26 +0300 [thread overview]
Message-ID: <aoLtTlpc6HIyR_a2@ashevche-desk.local> (raw)
In-Reply-To: <20260817-iio-ad5710r-upstream-v3-3-3a4bf7b9c78b@analog.com>
On Mon, Aug 17, 2026 at 02:37:13PM +0800, Kim Seer Paller wrote:
> In preparation for adding the AD5710R/AD5711R, which support selectable
> 12-/16-bit resolution, add a per-chip resolution field and use it in the
> raw read/write and scale paths instead of assuming 16 bits. Drop
> AD3530R_REG_VAL_MASK and AD3530R_DAC_MAX_VAL, which hardcoded the 16-bit
> width and are now unused.
...
> case IIO_CHAN_INFO_RAW:
> - if (val < 0 || val > AD3530R_DAC_MAX_VAL)
> + if (val < 0 || val > (1 << st->chip_info->resolution) - 1)
if (val < 0 || val > (BIT(st->chip_info->resolution) - 1))
OR
if (val < 0 || val > GENMASK(st->chip_info->resolution - 1, 0))
One (GENMASK) works for 32, another (BIT) for 0. While it's tempting to use
BIT() for readability, the 0 is unlikely is correct, but 32 might be.
> return -EINVAL;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-17 11:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 6:37 [PATCH v3 0/4] Add support for AD5710R/AD5711R DAC Kim Seer Paller
2026-08-17 6:37 ` [PATCH v3 1/4] iio: ABI: Add DAC current powerdown attributes and 15kohm_to_gnd mode Kim Seer Paller
2026-08-17 6:43 ` sashiko-bot
2026-08-17 6:37 ` [PATCH v3 2/4] dt-bindings: iio: dac: add adi,ad5710r.yaml Kim Seer Paller
2026-08-17 6:45 ` sashiko-bot
2026-08-17 6:37 ` [PATCH v3 3/4] iio: dac: ad3530r: parameterize DAC resolution Kim Seer Paller
2026-08-17 11:15 ` Andy Shevchenko [this message]
2026-08-17 6:37 ` [PATCH v3 4/4] iio: dac: ad3530r: add support for AD5710R/AD5711R Kim Seer Paller
2026-08-17 6:52 ` sashiko-bot
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=aoLtTlpc6HIyR_a2@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=kimseer.paller@analog.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=nuno.sa@analog.com \
--cc=p.zabel@pengutronix.de \
--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