From: Stefan Popa <stefan.popa@analog.com>
To: <jic23@kernel.org>
Cc: <Michael.Hennerich@analog.com>, <knaack.h@gmx.de>,
<lars@metafoo.de>, <pmeerw@pmeerw.net>,
<gregkh@linuxfoundation.org>, <linux-kernel@vger.kernel.org>,
<linux-iio@vger.kernel.org>, <stefan.popa@analog.com>
Subject: [PATCH 2/4] iio: frequency: adf4371: Add support for ADF4372 PLL
Date: Mon, 24 Jun 2019 18:12:12 +0300 [thread overview]
Message-ID: <1561389132-26182-1-git-send-email-stefan.popa@analog.com> (raw)
The ADF4372 is part of the same family with ADF4371, the main difference
is that it has only 3 channels instead of 4, as the frequency quadrupler
is missing. As a result, the ADF4372 allows frequencies from 62.5 MHz to
16 GHz to be generated.
Datasheet:
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/adf4372.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
---
drivers/iio/frequency/Kconfig | 6 +++---
drivers/iio/frequency/adf4371.c | 31 ++++++++++++++++++++++++++++---
2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/frequency/Kconfig b/drivers/iio/frequency/Kconfig
index e4a921f..353914b 100644
--- a/drivers/iio/frequency/Kconfig
+++ b/drivers/iio/frequency/Kconfig
@@ -39,12 +39,12 @@ config ADF4350
module will be called adf4350.
config ADF4371
- tristate "Analog Devices ADF4371 Wideband Synthesizer"
+ tristate "Analog Devices ADF4371/ADF4372 Wideband Synthesizers"
depends on SPI
select REGMAP_SPI
help
- Say yes here to build support for Analog Devices ADF4371
- Wideband Synthesizer. The driver provides direct access via sysfs.
+ Say yes here to build support for Analog Devices ADF4371 and ADF4372
+ Wideband Synthesizers. The driver provides direct access via sysfs.
To compile this driver as a module, choose M here: the
module will be called adf4371.
diff --git a/drivers/iio/frequency/adf4371.c b/drivers/iio/frequency/adf4371.c
index d8c414b..f874219 100644
--- a/drivers/iio/frequency/adf4371.c
+++ b/drivers/iio/frequency/adf4371.c
@@ -87,6 +87,11 @@ enum {
ADF4371_CH_RF32
};
+enum adf4371_variant {
+ ADF4371,
+ ADF4372
+};
+
struct adf4371_pwrdown {
unsigned int reg;
unsigned int bit;
@@ -140,6 +145,11 @@ static const struct regmap_config adf4371_regmap_config = {
.read_flag_mask = BIT(7),
};
+struct adf4371_chip_info {
+ unsigned int num_channels;
+ const struct iio_chan_spec *channels;
+};
+
struct adf4371_state {
struct spi_device *spi;
struct regmap *regmap;
@@ -152,6 +162,7 @@ struct adf4371_state {
* writes.
*/
struct mutex lock;
+ const struct adf4371_chip_info *chip_info;
unsigned long clkin_freq;
unsigned long fpfd;
unsigned int integer;
@@ -429,6 +440,17 @@ static const struct iio_chan_spec adf4371_chan[] = {
ADF4371_CHANNEL(ADF4371_CH_RF32),
};
+static const struct adf4371_chip_info adf4371_chip_info[] = {
+ [ADF4371] = {
+ .channels = adf4371_chan,
+ .num_channels = 4,
+ },
+ [ADF4372] = {
+ .channels = adf4371_chan,
+ .num_channels = 3,
+ }
+};
+
static int adf4371_reg_access(struct iio_dev *indio_dev,
unsigned int reg,
unsigned int writeval,
@@ -537,12 +559,13 @@ static int adf4371_probe(struct spi_device *spi)
st->regmap = regmap;
mutex_init(&st->lock);
+ st->chip_info = &adf4371_chip_info[id->driver_data];
indio_dev->dev.parent = &spi->dev;
indio_dev->name = id->name;
indio_dev->info = &adf4371_info;
indio_dev->modes = INDIO_DIRECT_MODE;
- indio_dev->channels = adf4371_chan;
- indio_dev->num_channels = ARRAY_SIZE(adf4371_chan);
+ indio_dev->channels = st->chip_info->channels;
+ indio_dev->num_channels = st->chip_info->num_channels;
st->clkin = devm_clk_get(&spi->dev, "clkin");
if (IS_ERR(st->clkin))
@@ -568,13 +591,15 @@ static int adf4371_probe(struct spi_device *spi)
}
static const struct spi_device_id adf4371_id_table[] = {
- { "adf4371", 0 },
+ { "adf4371", ADF4371 },
+ { "adf4372", ADF4372 },
{}
};
MODULE_DEVICE_TABLE(spi, adf4371_id_table);
static const struct of_device_id adf4371_of_match[] = {
{ .compatible = "adi,adf4371" },
+ { .compatible = "adi,adf4372" },
{ },
};
MODULE_DEVICE_TABLE(of, adf4371_of_match);
--
2.7.4
next reply other threads:[~2019-06-24 18:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 15:12 Stefan Popa [this message]
2019-06-26 19:43 ` [PATCH 2/4] iio: frequency: adf4371: Add support for ADF4372 PLL 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=1561389132-26182-1-git-send-email-stefan.popa@analog.com \
--to=stefan.popa@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=gregkh@linuxfoundation.org \
--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=pmeerw@pmeerw.net \
/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;
as well as URLs for NNTP newsgroup(s).