From: David Lechner <dlechner@baylibre.com>
To: "Janani Sunil" <janani.sunil@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"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>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
Janani Sunil <jan.sun97@gmail.com>
Subject: Re: [PATCH v2 2/3] iio: dac: Add AD5529R DAC driver support
Date: Sat, 16 May 2026 14:35:09 -0500 [thread overview]
Message-ID: <2f74e76e-b066-40ac-9cb4-c75137c9825d@baylibre.com> (raw)
In-Reply-To: <20260508-ad5529r-driver-v2-2-e315441685d7@analog.com>
On 5/8/26 6:55 AM, Janani Sunil wrote:
> Add support for AD5529R 16-channel, 12/16 bit Digital to Analog Converter
>
...
> +#define AD5529R_DAC_CHANNEL(chan, bits) { \
> + .type = IIO_VOLTAGE, \
> + .indexed = 1, \
> + .output = 1, \
> + .channel = (chan), \
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> + BIT(IIO_CHAN_INFO_SCALE), \
> + .scan_type = { \
> + .sign = 'u', \
This field has a new name `.format`.
> + .realbits = (bits), \
> + .storagebits = 16, \
> + }, \
> +}
> +static struct regmap *ad5529r_get_regmap(struct ad5529r_state *st, unsigned int reg)
> +{
> + if (reg <= AD5529R_8BIT_REG_MAX)
> + return st->regmap_8bit;
> +
> + return st->regmap_16bit;
> +}
Another way we have done this is make custom read/write functions for the
regmap itself so that we don't have to have two regmaps.
> +
> +static int ad5529r_debugfs_reg_read(struct ad5529r_state *st, unsigned int reg,
> + unsigned int *val)
> +{
> + return regmap_read(ad5529r_get_regmap(st, reg), reg, val);
> +}
> +
> +static int ad5529r_debugfs_reg_write(struct ad5529r_state *st, unsigned int reg,
> + unsigned int val)
> +{
> + return regmap_write(ad5529r_get_regmap(st, reg), reg, val);
> +}
Would be more logical to move these closer to the struct that
references them.
(I snipped a bunch of functions here)
> +
> +static int ad5529r_reg_access(struct iio_dev *indio_dev,
> + unsigned int reg,
> + unsigned int writeval,
> + unsigned int *readval)
> +{
> + struct ad5529r_state *st = iio_priv(indio_dev);
> +
> + if (!readval)
Might as well swap these and avoid the !.
> + return ad5529r_debugfs_reg_write(st, reg, writeval);
> +
> + return ad5529r_debugfs_reg_read(st, reg, readval);
> +}
> +
next prev parent reply other threads:[~2026-05-16 19:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 11:55 [PATCH v2 0/3] iio: dac: Add support for AD5529R DAC Janani Sunil
2026-05-08 11:55 ` [PATCH v2 1/3] dt-bindings: iio: dac: Add AD5529R Janani Sunil
2026-05-08 12:48 ` Jonathan Cameron
2026-05-08 13:08 ` Jonathan Cameron
2026-05-19 6:59 ` Janani Sunil
2026-05-08 13:50 ` Rodrigo Alencar
2026-05-08 13:57 ` Nuno Sá
2026-05-16 19:25 ` David Lechner
2026-05-19 7:13 ` Janani Sunil
2026-05-20 9:41 ` Jonathan Cameron
2026-05-19 6:55 ` Janani Sunil
2026-05-08 11:55 ` [PATCH v2 2/3] iio: dac: Add AD5529R DAC driver support Janani Sunil
2026-05-08 13:30 ` Jonathan Cameron
2026-05-19 7:07 ` Janani Sunil
2026-05-08 20:55 ` sashiko-bot
2026-05-16 19:35 ` David Lechner [this message]
2026-05-19 7:11 ` Janani Sunil
2026-05-08 11:55 ` [PATCH v2 3/3] Documentation: iio: Add AD5529R Documentation Janani Sunil
2026-05-08 13:00 ` Jonathan Cameron
2026-05-19 6:49 ` Janani Sunil
2026-05-08 12:36 ` [PATCH v2 0/3] iio: dac: Add support for AD5529R DAC Jonathan Cameron
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=2f74e76e-b066-40ac-9cb4-c75137c9825d@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=jan.sun97@gmail.com \
--cc=janani.sunil@analog.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.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