dt-bindings: iio: frequency: add adf4377 doc
Antoniu Miclaus
maintainerPATCH v3 1/2 dt-bindings: iio: frequency: add adf4377 doc
Add device tree bindings for the ADF4377 driver.
---
no changes in v3.
.../bindings/iio/frequency/adi,adf4377.yaml | 92 +++++++++++++++++++ MAINTAINERS | 8 ++ 2 files changed, 100 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/frequency/adi,adf4377.yaml
Documentation/devicetree/bindings/iio/frequency/adi,adf4377.yaml new file +92 -0
@@ -0,0 +1,92 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/frequency/adi,adf4377.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ADF4377 Microwave Wideband Synthesizer with Integrated VCO + +maintainers: + - Antoniu Miclaus <[email protected]> + - Dragos Bogdan <[email protected]> + +description: | + The ADF4377 is a high performance, ultralow jitter, dual output integer-N + phased locked loop (PLL) with integrated voltage controlled oscillator (VCO) + ideally suited for data converter and mixed signal front end (MxFE) clock + applications. + + https://www.analog.com/en/products/adf4377.html + +properties: + compatible: + enum: + - adi,adf4377 + - adi,adf4378 + + reg: + maxItems: 1 + + spi-max-frequency: + maximum: 10000000 + + clocks: + maxItems: 1 + + clock-names: + description: + External clock that provides reference input frequency. + items: + - const: ref_in + + chip-enable-gpios: + description: + GPIO that controls the Chip Enable Pin. + maxItems: 1 + + clk1-enable-gpios: + description: + GPIO that controls the Enable Clock 1 Output Buffer Pin. + maxItems: 1 + + clk2-enable-gpios: + description: + GPIO that controls the Enable Clock 2 Output Buffer Pin. + maxItems: 1 + + adi,muxout-select: + description: + On chip multiplexer output selection. + high_z - MUXOUT Pin set to high-Z. + lock_detect - MUXOUT Pin set to lock detector output. + muxout_low - MUXOUT Pin set to low. + f_div_rclk_2 - MUXOUT Pin set to fDIV_RCLK/2. + f_div_nclk_2 - MUXOUT Pin set to fDIV_NCLK/2. + muxout_high - MUXOUT Pin set to high. + enum: [high_z, lock_detect, muxout_low, f_div_rclk_2, f_div_nclk_2, muxout_high] + +required: + - compatible + - reg + - clocks + - clock-names + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + frequency@0 { + compatible = "adi,adf4377"; + reg = <0>; + spi-max-frequency = <10000000>; + clocks = <&adf4377_ref_in>; + clock-names = "ref_in"; + }; + }; +...
MAINTAINERS +8 -0
@@ -1189,6 +1189,14 @@ W: https://ez.analog.com/linux-software-drivers F: Documentation/devicetree/bindings/iio/amplifiers/adi,ada4250.yaml F: drivers/iio/amplifiers/ada4250.c +ANALOG DEVICES INC ADF4377 DRIVER +M: Antoniu Miclaus <[email protected]> +L: [email protected] +S: Supported +W: https://ez.analog.com/linux-software-drivers +F: Documentation/devicetree/bindings/iio/frequency/adi,adf4377.yaml +F: drivers/iio/frequency/adf4377.c + ANALOG DEVICES INC ADGS1408 DRIVER M: Mircea Caprioru <[email protected]> S: Supported
Signature · 1 line
2.38.1
Antoniu Miclaus
maintainerPATCH v3 2/2 iio: frequency: adf4377: add support for ADF4377
The ADF4377 is a high performance, ultralow jitter, dual output integer-N phased locked loop (PLL) with integrated voltage controlled oscillator (VCO) ideally suited for data converter and mixed signal front end (MxFE) clock applications.
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/adf4377.pdf
---
changes in v3:
- add register name/value for the macro definitions
- use __aligned(IIO_DMA_MINALIGN)
- add extra spacing for reg_sequence structure
- check frequency value before reg writes in adf4377_set_freq function
- remove ternary operators inside adf4377_write and adf4377_read
- remove comma after null terminator
drivers/iio/frequency/Kconfig | 10 + drivers/iio/frequency/Makefile | 1 + drivers/iio/frequency/adf4377.c | 994 ++++++++++++++++++++++++++++++++ 3 files changed, 1005 insertions(+) create mode 100644 drivers/iio/frequency/adf4377.c
drivers/iio/frequency/Kconfig +10 -0
@@ -50,6 +50,16 @@ config ADF4371 To compile this driver as a module, choose M here: the module will be called adf4371. +config ADF4377 + tristate "Analog Devices ADF4377 Microwave Wideband Synthesizer" + depends on SPI && COMMON_CLK + help + Say yes here to build support for Analog Devices ADF4377 Microwave + Wideband Synthesizer. + + To compile this driver as a module, choose M here: the + module will be called adf4377. + config ADMV1013 tristate "Analog Devices ADMV1013 Microwave Upconverter" depends on SPI && COMMON_CLK
drivers/iio/frequency/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_AD9523) += ad9523.o obj-$(CONFIG_ADF4350) += adf4350.o obj-$(CONFIG_ADF4371) += adf4371.o +obj-$(CONFIG_ADF4377) += adf4377.o obj-$(CONFIG_ADMV1013) += admv1013.o obj-$(CONFIG_ADMV1014) += admv1014.o obj-$(CONFIG_ADMV4420) += admv4420.o
drivers/iio/frequency/adf4377.c new file +994 -0
994 lines not on this page · raw message
Signature · 1 line
2.38.1
RE: [PATCH v3 2/2] iio: frequency: adf4377: add support for ADF4377
Quoted 98 lines
From: Antoniu Miclaus <[email protected]>
Sent: Tuesday, November 15, 2022 12:01 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: Miclaus, Antoniu <[email protected]>
Subject: [PATCH v3 2/2] iio: frequency: adf4377: add support for ADF4377[External]
The ADF4377 is a high performance, ultralow jitter, dual output integer-N phased locked loop (PLL) with integrated voltage controlled oscillator (VCO) ideally suited for data converter and mixed signal front end (MxFE) clock applications.
Datasheet: https://www.analog.com/media/en/technical-
documentation/data-sheets/adf4377.pdfSigned-off-by Antoniu Miclaus <[email protected]>---
changes in v3:
- add register name/value for the macro definitions
- use__aligned(IIO_DMA_MINALIGN)
- add extra spacing forreg_sequencestructure
- check frequency value before reg writes inadf4377_set_freqfunction
- remove ternary operators insideadf4377_writeandadf4377_read
- remove comma after null terminatordrivers/iio/frequency/Kconfig | 10 + drivers/iio/frequency/Makefile | 1 + drivers/iio/frequency/adf4377.c | 994 ++++++++++++++++++++++++++++++++ 3 files changed, 1005 insertions(+) create mode 100644 drivers/iio/frequency/adf4377.cdrivers/iio/frequency/Kconfig +5
-0@@ -50,6 +50,16 @@ config ADF4371 To compile this driver as a module, choose M here: the module will be called adf4371. +config ADF4377 + tristate "Analog Devices ADF4377 Microwave Wideband Synthesizer" + depends on SPI && COMMON_CLK + help + Say yes here to build support for Analog Devices ADF4377Microwave
drivers/iio/frequency/Kconfig +5
-0+ Wideband Synthesizer. + + To compile this driver as a module, choose M here: the + module will be called adf4377. + config ADMV1013 tristate "Analog Devices ADMV1013 Microwave Upconverter" depends on SPI && COMMON_CLKdrivers/iio/frequency/Makefile +1
-0@@ -7,6 +7,7 @@ obj-$(CONFIG_AD9523) += ad9523.o obj-$(CONFIG_ADF4350) += adf4350.o obj-$(CONFIG_ADF4371) += adf4371.o +obj-$(CONFIG_ADF4377) += adf4377.o obj-$(CONFIG_ADMV1013) += admv1013.o obj-$(CONFIG_ADMV1014) += admv1014.o obj-$(CONFIG_ADMV4420) += admv4420.odrivers/iio/frequency/adf4377.c new file +24
-0@@ -0,0 +1,994 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* ADF4377 driver +* +* Copyright 2022 Analog Devices Inc. +*/ + +#include <linux/bitfield.h> +#include <linux/bits.h> +#include <linux/clk.h> +#include <linux/clkdev.h> +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/gpio/consumer.h> +#include <linux/module.h> +#include <linux/notifier.h> +#include <linux/property.h> +#include <linux/spi/spi.h> +#include <linux/iio/iio.h> +#include <linux/regmap.h> +#include <linux/units.h> + +#include <asm/unaligned.h> +
...
Quoted 13 lines
drivers/iio/frequency/adf4377.c new file +4
-0+ +/* Specifications */ +#define ADF4377_SPI_READ_CMD BIT(7) +#define ADF4377_MAX_VCO_FREQ (12800ULL *
HZ_PER_MHZ)
+#defineADF4377_MIN_VCO_FREQ(6400ULL *HZ_PER_MHZ)
+#defineADF4377_MAX_REFIN_FREQ(1000 *HZ_PER_MHZ)drivers/iio/frequency/adf4377.c new file +4
-0+#define ADF4377_MIN_REFIN_FREQ (10 * HZ_PER_MHZ) +#define ADF4377_MAX_FREQ_PFD (500 * HZ_PER_MHZ) +#define ADF4377_MIN_FREQ_PFD (3 * HZ_PER_MHZ) +#define ADF4377_MAX_CLKPN_FREQ
Quoted 1 line
ADF4377_MAX_VCO_FREQ
Well, I think we are more than fine in using s64 :). Anyways, as the write side is still a bit weird, let's stay with extended attr.
...
Quoted 24 lines
drivers/iio/frequency/adf4377.c new file +17
-0+static int adf4377_get_freq (struct adf4377_state *st,u64 *freq) +{ +unsigned int ref_div_factor, n_int; +u64 clkin_freq; +int ret; + +mutex_lock (&st->lock); + ret =regmap_read (st->regmap,0x12 , &ref_div_factor); +if (ret) + goto exit; + + ret =regmap_bulk_read (st->regmap,0x10 , st->buf,sizeof (st->buf)); +if (ret) + goto exit; + + clkin_freq =clk_get_rate (st->clkin); + ref_div_factor = FIELD_GET(ADF4377_0012_R_DIV_MSK,
ref_div_factor);drivers/iio/frequency/adf4377.c new file +1
-0+ n_int = FIELD_GET(ADF4377_0010_N_INT_LSB_MSK |
ADF4377_0011_N_INT_MSB_MSK,drivers/iio/frequency/adf4377.c new file +4
-0+ get_unaligned_le16(&st->buf)); + + *freq =div_u64 (clkin_freq, ref_div_factor) * n_int; +exit:
drivers/iio/frequency/adf4377.c line 533
Quoted 10 lines
drivers/iio/frequency/adf4377.c new file +10
-0+mutex_unlock (&st->lock); + +return ret; +} + +static int adf4377_set_freq (struct adf4377_state *st,u64 freq) +{ +unsigned int read_val; +u64 f_vco; +int ret;
Could initialize ret to -EINVAL and save one line of code :)...
Anyways...