Re: [PATCH v2 4/4] staging: iio: ad5933: move out of staging

2019-03-03 Thread kbuild test robot
Hi Marcelo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on iio/togreg]
[cannot apply to v5.0-rc8]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Marcelo-Schmitt/staging-iio-ad5933-move-out-of-staging/20190303-232039
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: xtensa-allyesconfig
compiler: xtensa-linux-gcc (GCC) 8.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
GCC_VERSION=8.2.0 make.cross ARCH=xtensa  allyesconfig
GCC_VERSION=8.2.0 make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

>> drivers/staging/iio/Kconfig:12: can't open file 
>> "drivers/staging/iio/impedance-analyzer/Kconfig"
   make[2]: *** [allyesconfig] Error 1
   make[1]: *** [allyesconfig] Error 2
   make: *** [sub-make] Error 2
--
>> drivers/staging/iio/Kconfig:12: can't open file 
>> "drivers/staging/iio/impedance-analyzer/Kconfig"
   make[2]: *** [oldconfig] Error 1
   make[1]: *** [oldconfig] Error 2
   make: *** [sub-make] Error 2
--
>> drivers/staging/iio/Kconfig:12: can't open file 
>> "drivers/staging/iio/impedance-analyzer/Kconfig"
   make[2]: *** [olddefconfig] Error 1
   make[1]: *** [olddefconfig] Error 2
   make: *** [sub-make] Error 2

vim +12 drivers/staging/iio/Kconfig

f94aa354d6 Michael Hennerich 2011-08-02 @12  source 
"drivers/staging/iio/impedance-analyzer/Kconfig"
09434ef7c2 Barry Song2010-10-27  13  source 
"drivers/staging/iio/meter/Kconfig"
f46d9f154a Graf Yang 2010-10-27  14  source 
"drivers/staging/iio/resolver/Kconfig"
7f3a1fb998 Jonathan Cameron  2009-08-18  15  

:: The code at line 12 was first introduced by commit
:: f94aa354d676532448e8e222e737fdd0755fc786 iio: impedance-analyzer: New 
driver for AD5933/4 Impedance Converter, Network Analyzer

:: TO: Michael Hennerich 
:: CC: Greg Kroah-Hartman 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


Re: [PATCH v2 4/4] staging: iio: ad5933: move out of staging

2019-03-03 Thread Jonathan Cameron
On Thu, 28 Feb 2019 23:53:31 -0300
Marcelo Schmitt  wrote:

> Move ad5933 impedance-analyzer driver from staging to mainline.
> 
> The ad5933 is a high precision impedance converter system solution that
> combines an on-board frequency generator with an analog-to-digital
> converter (ADC). This driver was designed to be compatible with both
> ad5933 and ad5934 chips.
> 
> Signed-off-by: Marcelo Schmitt 
Hi Marcelo.

There seems to still be substantial changes needed related to the ABI,
so I'm not going to review the final state until those are done.

Do you have one of these to test?  Or can we arrange for someone else
to test the result?

It's rather easy for complex rework like you are doing (or going to do) to
have side effects that review might not catch - so I'd definitely like
to know the end result has been tested on the actual hardware!

Thanks for those docs. I suspected they would throw up some 'interesting'
issues around the ABI. It tends to happen with these older drivers
because we hadn't finished fully refining the interfaces when Michael
was developing this!

Jonathan

> ---
>  drivers/iio/impedance-analyzer/Kconfig|  18 +
>  drivers/iio/impedance-analyzer/Makefile   |   5 +
>  drivers/iio/impedance-analyzer/ad5933.c   | 811 ++
>  .../staging/iio/impedance-analyzer/Kconfig|  18 -
>  .../staging/iio/impedance-analyzer/Makefile   |   5 -
>  .../staging/iio/impedance-analyzer/ad5933.c   | 811 --
>  6 files changed, 834 insertions(+), 834 deletions(-)
>  create mode 100644 drivers/iio/impedance-analyzer/Kconfig
>  create mode 100644 drivers/iio/impedance-analyzer/Makefile
>  create mode 100644 drivers/iio/impedance-analyzer/ad5933.c
>  delete mode 100644 drivers/staging/iio/impedance-analyzer/Kconfig
>  delete mode 100644 drivers/staging/iio/impedance-analyzer/Makefile
>  delete mode 100644 drivers/staging/iio/impedance-analyzer/ad5933.c
> 
> diff --git a/drivers/iio/impedance-analyzer/Kconfig 
> b/drivers/iio/impedance-analyzer/Kconfig
> new file mode 100644
> index ..b9a679cdd146
> --- /dev/null
> +++ b/drivers/iio/impedance-analyzer/Kconfig
> @@ -0,0 +1,18 @@
> +#
> +# Impedance Converter, Network Analyzer drivers
> +#
> +menu "Network Analyzer, Impedance Converters"
> +
> +config AD5933
> + tristate "Analog Devices AD5933, AD5934 driver"
> + depends on I2C
> + select IIO_BUFFER
> + select IIO_KFIFO_BUF
> + help
> +   Say yes here to build support for Analog Devices Impedance Converter,
> +   Network Analyzer, AD5933/4.
> +
> +   To compile this driver as a module, choose M here: the
> +   module will be called ad5933.
> +
> +endmenu
> diff --git a/drivers/iio/impedance-analyzer/Makefile 
> b/drivers/iio/impedance-analyzer/Makefile
> new file mode 100644
> index ..7604d786583e
> --- /dev/null
> +++ b/drivers/iio/impedance-analyzer/Makefile
> @@ -0,0 +1,5 @@
> +#
> +# Makefile for Impedance Converter, Network Analyzer drivers
> +#
> +
> +obj-$(CONFIG_AD5933) += ad5933.o
> diff --git a/drivers/iio/impedance-analyzer/ad5933.c 
> b/drivers/iio/impedance-analyzer/ad5933.c
> new file mode 100644
> index ..d75bdfbf93de
> --- /dev/null
> +++ b/drivers/iio/impedance-analyzer/ad5933.c
> @@ -0,0 +1,811 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * AD5933 AD5934 Impedance Converter, Network Analyzer
> + *
> + * Copyright 2011 Analog Devices Inc.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* AD5933/AD5934 Registers */
> +#define AD5933_REG_CONTROL_HB0x80/* R/W, 1 byte */
> +#define AD5933_REG_CONTROL_LB0x81/* R/W, 1 byte */
> +#define AD5933_REG_FREQ_START0x82/* R/W, 3 bytes */
> +#define AD5933_REG_FREQ_INC  0x85/* R/W, 3 bytes */
> +#define AD5933_REG_INC_NUM   0x88/* R/W, 2 bytes, 9 bit */
> +#define AD5933_REG_SETTLING_CYCLES   0x8A/* R/W, 2 bytes */
> +#define AD5933_REG_STATUS0x8F/* R, 1 byte */
> +#define AD5933_REG_TEMP_DATA 0x92/* R, 2 bytes*/
> +#define AD5933_REG_REAL_DATA 0x94/* R, 2 bytes*/
> +#define AD5933_REG_IMAG_DATA 0x96/* R, 2 bytes*/
> +
> +/* AD5933_REG_CONTROL_HB Bits */
> +#define AD5933_CTRL_INIT_START_FREQ  (0x1 << 4)
> +#define AD5933_CTRL_START_SWEEP  (0x2 << 4)
> +#define AD5933_CTRL_INC_FREQ (0x3 << 4)
> +#define AD5933_CTRL_REPEAT_FREQ  (0x4 << 4)
> +#define AD5933_CTRL_MEASURE_TEMP (0x9 << 4)
> +#define AD5933_CTRL_POWER_DOWN   (0xA << 4)
> +#define AD5933_CTRL_STANDBY  (0xB << 4)
> +
> +#define AD5933_CTRL_RANGE_2000mVpp   (0x0 << 1)
> +#define AD5933_CTRL_RANGE_200mVpp(0x1 << 1)
> +#define AD5933_CTRL_RANGE_400mVpp(0x2 << 1)
> +#define AD5933_CTRL_RANGE_1000mVpp   (0x3 <<

[PATCH v2 4/4] staging: iio: ad5933: move out of staging

2019-02-28 Thread Marcelo Schmitt
Move ad5933 impedance-analyzer driver from staging to mainline.

The ad5933 is a high precision impedance converter system solution that
combines an on-board frequency generator with an analog-to-digital
converter (ADC). This driver was designed to be compatible with both
ad5933 and ad5934 chips.

Signed-off-by: Marcelo Schmitt 
---
 drivers/iio/impedance-analyzer/Kconfig|  18 +
 drivers/iio/impedance-analyzer/Makefile   |   5 +
 drivers/iio/impedance-analyzer/ad5933.c   | 811 ++
 .../staging/iio/impedance-analyzer/Kconfig|  18 -
 .../staging/iio/impedance-analyzer/Makefile   |   5 -
 .../staging/iio/impedance-analyzer/ad5933.c   | 811 --
 6 files changed, 834 insertions(+), 834 deletions(-)
 create mode 100644 drivers/iio/impedance-analyzer/Kconfig
 create mode 100644 drivers/iio/impedance-analyzer/Makefile
 create mode 100644 drivers/iio/impedance-analyzer/ad5933.c
 delete mode 100644 drivers/staging/iio/impedance-analyzer/Kconfig
 delete mode 100644 drivers/staging/iio/impedance-analyzer/Makefile
 delete mode 100644 drivers/staging/iio/impedance-analyzer/ad5933.c

diff --git a/drivers/iio/impedance-analyzer/Kconfig 
b/drivers/iio/impedance-analyzer/Kconfig
new file mode 100644
index ..b9a679cdd146
--- /dev/null
+++ b/drivers/iio/impedance-analyzer/Kconfig
@@ -0,0 +1,18 @@
+#
+# Impedance Converter, Network Analyzer drivers
+#
+menu "Network Analyzer, Impedance Converters"
+
+config AD5933
+   tristate "Analog Devices AD5933, AD5934 driver"
+   depends on I2C
+   select IIO_BUFFER
+   select IIO_KFIFO_BUF
+   help
+ Say yes here to build support for Analog Devices Impedance Converter,
+ Network Analyzer, AD5933/4.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ad5933.
+
+endmenu
diff --git a/drivers/iio/impedance-analyzer/Makefile 
b/drivers/iio/impedance-analyzer/Makefile
new file mode 100644
index ..7604d786583e
--- /dev/null
+++ b/drivers/iio/impedance-analyzer/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for Impedance Converter, Network Analyzer drivers
+#
+
+obj-$(CONFIG_AD5933) += ad5933.o
diff --git a/drivers/iio/impedance-analyzer/ad5933.c 
b/drivers/iio/impedance-analyzer/ad5933.c
new file mode 100644
index ..d75bdfbf93de
--- /dev/null
+++ b/drivers/iio/impedance-analyzer/ad5933.c
@@ -0,0 +1,811 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * AD5933 AD5934 Impedance Converter, Network Analyzer
+ *
+ * Copyright 2011 Analog Devices Inc.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+/* AD5933/AD5934 Registers */
+#define AD5933_REG_CONTROL_HB  0x80/* R/W, 1 byte */
+#define AD5933_REG_CONTROL_LB  0x81/* R/W, 1 byte */
+#define AD5933_REG_FREQ_START  0x82/* R/W, 3 bytes */
+#define AD5933_REG_FREQ_INC0x85/* R/W, 3 bytes */
+#define AD5933_REG_INC_NUM 0x88/* R/W, 2 bytes, 9 bit */
+#define AD5933_REG_SETTLING_CYCLES 0x8A/* R/W, 2 bytes */
+#define AD5933_REG_STATUS  0x8F/* R, 1 byte */
+#define AD5933_REG_TEMP_DATA   0x92/* R, 2 bytes*/
+#define AD5933_REG_REAL_DATA   0x94/* R, 2 bytes*/
+#define AD5933_REG_IMAG_DATA   0x96/* R, 2 bytes*/
+
+/* AD5933_REG_CONTROL_HB Bits */
+#define AD5933_CTRL_INIT_START_FREQ(0x1 << 4)
+#define AD5933_CTRL_START_SWEEP(0x2 << 4)
+#define AD5933_CTRL_INC_FREQ   (0x3 << 4)
+#define AD5933_CTRL_REPEAT_FREQ(0x4 << 4)
+#define AD5933_CTRL_MEASURE_TEMP   (0x9 << 4)
+#define AD5933_CTRL_POWER_DOWN (0xA << 4)
+#define AD5933_CTRL_STANDBY(0xB << 4)
+
+#define AD5933_CTRL_RANGE_2000mVpp (0x0 << 1)
+#define AD5933_CTRL_RANGE_200mVpp  (0x1 << 1)
+#define AD5933_CTRL_RANGE_400mVpp  (0x2 << 1)
+#define AD5933_CTRL_RANGE_1000mVpp (0x3 << 1)
+#define AD5933_CTRL_RANGE(x)   ((x) << 1)
+
+#define AD5933_CTRL_PGA_GAIN_1 (0x1 << 0)
+#define AD5933_CTRL_PGA_GAIN_5 (0x0 << 0)
+
+/* AD5933_REG_CONTROL_LB Bits */
+#define AD5933_CTRL_RESET  (0x1 << 4)
+#define AD5933_CTRL_INT_SYSCLK (0x0 << 3)
+#define AD5933_CTRL_EXT_SYSCLK (0x1 << 3)
+
+/* AD5933_REG_STATUS Bits */
+#define AD5933_STAT_TEMP_VALID (0x1 << 0)
+#define AD5933_STAT_DATA_VALID (0x1 << 1)
+#define AD5933_STAT_SWEEP_DONE (0x1 << 2)
+
+/* I2C Block Commands */
+#define AD5933_I2C_BLOCK_WRITE 0xA0
+#define AD5933_I2C_BLOCK_READ  0xA1
+#define AD5933_I2C_ADDR_POINTER0xB0
+
+/* Device Specs */
+#define AD5933_INT_OSC_FREQ_Hz 16776000
+#define AD5933_MAX_OUTPUT_FREQ_Hz  10
+#define AD5933_MAX_RETRIES 100
+
+#define AD5933_OUT_RANGE   1
+#define AD5933_OUT_RANGE_AVAIL 2
+#defi