From: Michael Auchter <michael.auchter@ni.com>
To: Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Stefan Popa <stefan.popa@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Michael Auchter <michael.auchter@ni.com>,
linux-pm@vger.kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] iio: dac: ad5686: add support for AD5338R
Date: Wed, 18 Mar 2020 10:34:32 -0500 [thread overview]
Message-ID: <20200318153434.62833-1-michael.auchter@ni.com> (raw)
The AD5338R is a 10-bit DAC with 2 outputs and an internal 2.5V
reference (enabled by default). The register configuration is nearly
identical to the AD5696R DAC that's already supported by this driver,
with the channel selection bits being the only thing different.
Signed-off-by: Michael Auchter <michael.auchter@ni.com>
---
drivers/iio/dac/ad5686.c | 13 +++++++++++++
drivers/iio/dac/ad5686.h | 1 +
drivers/iio/dac/ad5696-i2c.c | 1 +
3 files changed, 15 insertions(+)
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index e06b29c565b9..bbcac0e44837 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -210,6 +210,12 @@ static struct iio_chan_spec name[] = { \
AD5868_CHANNEL(0, 0, bits, _shift), \
}
+#define DECLARE_AD5338R_CHANNELS(name, bits, _shift) \
+static struct iio_chan_spec name[] = { \
+ AD5868_CHANNEL(0, 1, bits, _shift), \
+ AD5868_CHANNEL(1, 8, bits, _shift), \
+}
+
#define DECLARE_AD5686_CHANNELS(name, bits, _shift) \
static struct iio_chan_spec name[] = { \
AD5868_CHANNEL(0, 1, bits, _shift), \
@@ -262,6 +268,7 @@ DECLARE_AD5686_CHANNELS(ad5686_channels, 16, 0);
DECLARE_AD5693_CHANNELS(ad5693_channels, 16, 0);
DECLARE_AD5693_CHANNELS(ad5692r_channels, 14, 2);
DECLARE_AD5693_CHANNELS(ad5691r_channels, 12, 4);
+DECLARE_AD5338R_CHANNELS(ad5338r_channels, 10, 6);
static const struct ad5686_chip_info ad5686_chip_info_tbl[] = {
[ID_AD5310R] = {
@@ -413,6 +420,12 @@ static const struct ad5686_chip_info ad5686_chip_info_tbl[] = {
.num_channels = 4,
.regmap_type = AD5686_REGMAP,
},
+ [ID_AD5338R] = {
+ .channels = ad5338r_channels,
+ .int_vref_mv = 2500,
+ .num_channels = 2,
+ .regmap_type = AD5686_REGMAP,
+ },
};
int ad5686_probe(struct device *dev,
diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
index 70a779939ddb..02eb196fcf0f 100644
--- a/drivers/iio/dac/ad5686.h
+++ b/drivers/iio/dac/ad5686.h
@@ -77,6 +77,7 @@ enum ad5686_supported_device_ids {
ID_AD5695R,
ID_AD5696,
ID_AD5696R,
+ ID_AD5338R,
};
enum ad5686_regmap_type {
diff --git a/drivers/iio/dac/ad5696-i2c.c b/drivers/iio/dac/ad5696-i2c.c
index ccf794caef43..f100a5fe4219 100644
--- a/drivers/iio/dac/ad5696-i2c.c
+++ b/drivers/iio/dac/ad5696-i2c.c
@@ -83,6 +83,7 @@ static const struct i2c_device_id ad5686_i2c_id[] = {
{"ad5695r", ID_AD5695R},
{"ad5696", ID_AD5696},
{"ad5696r", ID_AD5696R},
+ {"ad5338r", ID_AD5338R},
{}
};
MODULE_DEVICE_TABLE(i2c, ad5686_i2c_id);
--
2.24.1
next reply other threads:[~2020-03-18 15:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 15:34 Michael Auchter [this message]
2020-03-18 15:34 ` [PATCH 2/3] iio: dac: ad5686: add of_match_table Michael Auchter
2020-03-18 17:33 ` Lars-Peter Clausen
2020-03-22 0:33 ` Andy Shevchenko
2020-03-18 15:34 ` [PATCH 3/3] dt-bindings: iio: dac: ad5686: add binding Michael Auchter
2020-03-19 17:12 ` Rob Herring
2020-03-18 17:30 ` [PATCH 1/3] iio: dac: ad5686: add support for AD5338R Lars-Peter Clausen
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=20200318153434.62833-1-michael.auchter@ni.com \
--to=michael.auchter@ni.com \
--cc=Michael.Hennerich@analog.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=stefan.popa@analog.com \
/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