Skip to contentSkip to conversation

iio: frequency: adrf6780: add support for ADRF6780

PATCH Superseded Antoniu Miclaus 2 participants 3 messages Jul 15, 2021 – Jul 16, 2021

Subsystems (4)

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Antoniu Miclaus

author maintainer
#0 lore raw

PATCH v5 1/2 iio: frequency: adrf6780: add support for ADRF6780

The ADRF6780 is a silicon germanium (SiGe) design, wideband, microwave upconverter optimized for point to point microwave radio designs operating in the 5.9 GHz to 23.6 GHz frequency range.

Datasheet:
https://www.analog.com/media/en/technical-documentation/data-sheets/ADRF6780.pdf

---
changes in v5:
- drop depends on OF
- include linux/mod_devicetable.h
- use FIELD_GET/FIELD_PREP inline
- use dma safe buffers
- use get_unaligned_be24() and put_unaligned_be24() where needed
- use if (ret) instead of if (ret < 0)
- remove locked version of adrf6780_spi_update_bits
- add adrf6780_read_voltage_raw
- use switch statements for IIO_MOD
- other minor fixes

 drivers/iio/frequency/Kconfig    |  12 +
 drivers/iio/frequency/Makefile   |   1 +
 drivers/iio/frequency/adrf6780.c | 474 +++++++++++++++++++++++++++++++
 3 files changed, 487 insertions(+)
 create mode 100644 drivers/iio/frequency/adrf6780.c
drivers/iio/frequency/Kconfig +12 -0
index 240b81502512..2c9e0559e8a4 100644
@@ -49,5 +49,17 @@ config ADF4371
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called adf4371.
+
+config ADRF6780
+        tristate "Analog Devices ADRF6780 Microwave Upconverter"
+        depends on SPI
+        depends on COMMON_CLK
+        help
+          Say yes here to build support for Analog Devices ADRF6780
+          5.9 GHz to 23.6 GHz, Wideband, Microwave Upconverter.
+
+          To compile this driver as a module, choose M here: the
+          module will be called adrf6780.
+
 endmenu
 endmenu
drivers/iio/frequency/Makefile +1 -0
index 518b1e50caef..ae3136c79202 100644
@@ -7,3 +7,4 @@
 obj-$(CONFIG_AD9523) += ad9523.o
 obj-$(CONFIG_ADF4350) += adf4350.o
 obj-$(CONFIG_ADF4371) += adf4371.o
+obj-$(CONFIG_ADRF6780) += adrf6780.o
drivers/iio/frequency/adrf6780.c new file +474 -0

474 lines not on this page · raw message

Signature · 1 line
2.32.0
author maintainer
#1 lore raw

PATCH v5 2/2 dt-bindings: iio: frequency: add adrf6780 doc

Add device tree bindings for the ADRF6780 Upconverter.

---
 .../bindings/iio/frequency/adi,adrf6780.yaml  | 119 ++++++++++++++++++
 1 file changed, 119 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/frequency/adi,adrf6780.yaml
Documentation/devicetree/bindings/iio/frequency/adi,adrf6780.yaml new file +119 -0
new file mode 100644
index 000000000000..65cb3bee4aca
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/frequency/adi,adrf6780.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ADRF6780 Microwave Upconverter
+
+maintainers:
+  - Antoniu Miclaus <[email protected]>
+
+description: |
+   Wideband, microwave upconverter optimized for point to point microwave
+   radio designs operating in the 5.9 GHz to 23.6 GHz frequency range.
+
+   https://www.analog.com/en/products/adrf6780.html
+
+properties:
+  compatible:
+    enum:
+      - adi,adrf6780
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 1000000
+
+  clocks:
+    description:
+      Definition of the external clock.
+    minItems: 1
+
+  clock-names:
+    items:
+      - const: lo_in
+
+  clock-output-names:
+    maxItems: 1
+
+  adi,vga-buff-en:
+    description:
+      VGA Buffer Enable.
+    type: boolean
+
+  adi,lo-buff-en:
+    description:
+      LO Buffer Enable.
+    type: boolean
+
+  adi,if-mode-en:
+    description:
+      IF Mode Enable.
+    type: boolean
+
+  adi,iq-mode-en:
+    description:
+      IQ Mode Enable.
+    type: boolean
+
+  adi,lo-x2-en:
+    description:
+      LO x2 Enable.
+    type: boolean
+
+  adi,lo-ppf-en:
+    description:
+      LO x1 Enable.
+    type: boolean
+
+  adi,lo-en:
+    description:
+      LO Enable.
+    type: boolean
+
+  adi,uc-bias-en:
+    description:
+      UC Bias Enable.
+    type: boolean
+
+  adi,lo-sideband:
+    description:
+      Switch to the Other LO Sideband.
+    type: boolean
+
+  adi,vdet-out-en:
+    description:
+      VDET Output Select Enable.
+    type: boolean
+
+  '#clock-cells':
+    const: 0
+
+dependencies:
+  adi,lo-x2-en: [ "adi,lo-en" ]
+  adi,lo-ppf-en: [ "adi,lo-en" ]
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      adrf6780@0 {
+        compatible = "adi,adrf6780";
+        reg = <0>;
+        spi-max-frequency = <1000000>;
+        clocks = <&adrf6780_lo>;
+        clock-names = "lo_in";
+      };
+    };
+...
Signature · 1 line
2.32.0
#2 lore raw
In reply to Antoniu Miclaus
Thank you for the patch! Perhaps something to improve:

Hi Antoniu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on linux/master linus/master v5.14-rc1 next-20210715] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Antoniu-Miclaus/iio-frequency-adrf6780-add-support-for-ADRF6780/20210715-194501
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: arm64-randconfig-r026-20210716 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d5b08761f944d5b9822d582378333cc4b36a0a7)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/50ec72e90468dea68ad72e14023fdf58d5eb0885
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Antoniu-Miclaus/iio-frequency-adrf6780-add-support-for-ADRF6780/20210715-194501 git checkout 50ec72e90468dea68ad72e14023fdf58d5eb0885
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/iio/frequency/adrf6780.c:189:40: warning: variable 'data' is uninitialized when used here [-Wuninitialized]
                   ret = adrf6780_read_voltage_raw(dev, data);
                                                        ^~~~
   drivers/iio/frequency/adrf6780.c:184:19: note: initialize the variable 'data' to silence this warning
           unsigned int data;
                            ^
                             = 0

1 warning generated.

vim +/data +189 drivers/iio/frequency/adrf6780.c

178
179 static int adrf6780_read_raw(struct iio_dev *indio_dev,
180 struct iio_chan_spec const *chan,
181 int *val, int *val2, long info)
182 {
183 struct adrf6780_dev *dev = iio_priv(indio_dev);
184 unsigned int data;
185 int ret;
186
187 switch (info) {
188 case IIO_CHAN_INFO_RAW:

 > 189			ret = adrf6780_read_voltage_raw(dev, data);

190 if (ret)
191 return ret;
192
193 *val = data & ADRF6780_ADC_VALUE_MSK;
194
195 return IIO_VAL_INT;
196
197 case IIO_CHAN_INFO_SCALE:
198 ret = adrf6780_spi_read(dev, ADRF6780_REG_LINEARIZE, &data);
199 if (ret)
200 return ret;
201
202 *val = data & ADRF6780_RDAC_LINEARIZE_MSK;
203
204 return IIO_VAL_INT;
205 case IIO_CHAN_INFO_PHASE:
206 ret = adrf6780_spi_read(dev, ADRF6780_REG_LO_PATH, &data);
207 if (ret)
208 return ret;
209
210 switch (chan->channel2) {
211 case IIO_MOD_I:
212 *val = data & ADRF6780_I_PATH_PHASE_ACCURACY_MSK;
213
214 return IIO_VAL_INT;
215 case IIO_MOD_Q:
216 *val = FIELD_GET(ADRF6780_Q_PATH_PHASE_ACCURACY_MSK, data);
217
218 return IIO_VAL_INT;
219 default:
220 return -EINVAL;
221 }
222 default:
223 return -EINVAL;
224 }
225 }
226

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org