Re: [PATCH 10/11] staging: iio: adc: ad7606: Move out of staging
Hi Stefan, I love your patch! Yet something to improve: [auto build test ERROR on iio/togreg] [cannot apply to v4.20-rc7] [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/Stefan-Popa/staging-iio-adc-ad7606-Simplify-the-Kconfing-menu/20181216-132154 base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg config: um-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=um All errors (new ones prefixed by >>): >> ERROR: "devm_ioremap_resource" [drivers/iio/adc/ad7606_par.ko] undefined! --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
Re: [PATCH 10/11] staging: iio: adc: ad7606: Move out of staging
On Thu, 13 Dec 2018 14:46:22 +0200 Stefan Popa wrote: > Move ad7606 ADC driver out of staging and into the mainline. > > Signed-off-by: Stefan Popa Other than the things already mentioned in earlier patches, looks good to me. Thanks Jonathan > --- > MAINTAINERS | 7 + > drivers/iio/adc/Kconfig | 28 ++ > drivers/iio/adc/Makefile | 3 + > drivers/iio/adc/ad7606.c | 588 > +++ > drivers/iio/adc/ad7606.h | 99 ++ > drivers/iio/adc/ad7606_par.c | 105 +++ > drivers/iio/adc/ad7606_spi.c | 82 + > drivers/staging/iio/adc/Kconfig | 28 -- > drivers/staging/iio/adc/Makefile | 4 - > drivers/staging/iio/adc/ad7606.c | 588 > --- > drivers/staging/iio/adc/ad7606.h | 99 -- > drivers/staging/iio/adc/ad7606_par.c | 105 --- > drivers/staging/iio/adc/ad7606_spi.c | 82 - > 13 files changed, 912 insertions(+), 906 deletions(-) > create mode 100644 drivers/iio/adc/ad7606.c > create mode 100644 drivers/iio/adc/ad7606.h > create mode 100644 drivers/iio/adc/ad7606_par.c > create mode 100644 drivers/iio/adc/ad7606_spi.c > delete mode 100644 drivers/staging/iio/adc/ad7606.c > delete mode 100644 drivers/staging/iio/adc/ad7606.h > delete mode 100644 drivers/staging/iio/adc/ad7606_par.c > delete mode 100644 drivers/staging/iio/adc/ad7606_spi.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index d904229..7256ce6 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -853,6 +853,13 @@ S: Supported > F: drivers/iio/adc/ad7124.c > F: Documentation/devicetree/bindings/iio/adc/adi,ad7124.txt > > +ANALOG DEVICES INC AD7606 DRIVER > +M: Stefan Popa > +L: linux-...@vger.kernel.org > +W: http://ez.analog.com/community/linux-device-drivers > +S: Supported > +F: drivers/iio/adc/ad7606.c > + > ANALOG DEVICES INC AD9389B DRIVER > M: Hans Verkuil > L: linux-me...@vger.kernel.org > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > index da9644b..9c0b50b 100644 > --- a/drivers/iio/adc/Kconfig > +++ b/drivers/iio/adc/Kconfig > @@ -69,6 +69,34 @@ config AD7476 > To compile this driver as a module, choose M here: the > module will be called ad7476. > > +config AD7606 > + tristate > + depends on GPIOLIB || COMPILE_TEST > + depends on HAS_IOMEM > + select IIO_BUFFER > + select IIO_TRIGGERED_BUFFER > + > +config AD7606_IFACE_PARALLEL > + tristate "Analog Devices AD7606 ADC driver with parallel interface > support" > + select AD7606 > + help > + Say yes here to build parallel interface support for Analog Devices: > + ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters > (ADC). > + > + To compile this driver as a module, choose M here: the > + module will be called ad7606_parallel. > + > +config AD7606_IFACE_SPI > + tristate "Analog Devices AD7606 ADC driver with spi interface support" > + depends on SPI > + select AD7606 > + help > + Say yes here to build spi interface support for Analog Devices: > + ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters > (ADC). > + > + To compile this driver as a module, choose M here: the > + module will be called ad7606_spi. > + > config AD7766 > tristate "Analog Devices AD7766/AD7767 ADC driver" > depends on SPI_MASTER > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > index 07df37f..ea50313 100644 > --- a/drivers/iio/adc/Makefile > +++ b/drivers/iio/adc/Makefile > @@ -11,6 +11,9 @@ obj-$(CONFIG_AD7291) += ad7291.o > obj-$(CONFIG_AD7298) += ad7298.o > obj-$(CONFIG_AD7923) += ad7923.o > obj-$(CONFIG_AD7476) += ad7476.o > +obj-$(CONFIG_AD7606_IFACE_PARALLEL) += ad7606_par.o > +obj-$(CONFIG_AD7606_IFACE_SPI) += ad7606_spi.o > +obj-$(CONFIG_AD7606) += ad7606.o > obj-$(CONFIG_AD7766) += ad7766.o > obj-$(CONFIG_AD7791) += ad7791.o > obj-$(CONFIG_AD7793) += ad7793.o > diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c > new file mode 100644 > index 000..5733760 > --- /dev/null > +++ b/drivers/iio/adc/ad7606.c > @@ -0,0 +1,588 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * AD7606 SPI ADC driver > + * > + * Copyright 2011 Analog Devices Inc. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "ad7606.h" > + > +/* > + * Scales are computed as 5000/32768 and 1/32768 respectively, > + * so that when applied to the raw values they provide mV values > + */ > +static const unsigned int scale_avail[2] = { > + 152588, 305176 > +}; > + > +static const unsigned int ad7606_oversampling_avail[7] = { > + 1, 2, 4, 8, 16, 32, 64, > +}; > + > +static
[PATCH 10/11] staging: iio: adc: ad7606: Move out of staging
Move ad7606 ADC driver out of staging and into the mainline. Signed-off-by: Stefan Popa --- MAINTAINERS | 7 + drivers/iio/adc/Kconfig | 28 ++ drivers/iio/adc/Makefile | 3 + drivers/iio/adc/ad7606.c | 588 +++ drivers/iio/adc/ad7606.h | 99 ++ drivers/iio/adc/ad7606_par.c | 105 +++ drivers/iio/adc/ad7606_spi.c | 82 + drivers/staging/iio/adc/Kconfig | 28 -- drivers/staging/iio/adc/Makefile | 4 - drivers/staging/iio/adc/ad7606.c | 588 --- drivers/staging/iio/adc/ad7606.h | 99 -- drivers/staging/iio/adc/ad7606_par.c | 105 --- drivers/staging/iio/adc/ad7606_spi.c | 82 - 13 files changed, 912 insertions(+), 906 deletions(-) create mode 100644 drivers/iio/adc/ad7606.c create mode 100644 drivers/iio/adc/ad7606.h create mode 100644 drivers/iio/adc/ad7606_par.c create mode 100644 drivers/iio/adc/ad7606_spi.c delete mode 100644 drivers/staging/iio/adc/ad7606.c delete mode 100644 drivers/staging/iio/adc/ad7606.h delete mode 100644 drivers/staging/iio/adc/ad7606_par.c delete mode 100644 drivers/staging/iio/adc/ad7606_spi.c diff --git a/MAINTAINERS b/MAINTAINERS index d904229..7256ce6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -853,6 +853,13 @@ S: Supported F: drivers/iio/adc/ad7124.c F: Documentation/devicetree/bindings/iio/adc/adi,ad7124.txt +ANALOG DEVICES INC AD7606 DRIVER +M: Stefan Popa +L: linux-...@vger.kernel.org +W: http://ez.analog.com/community/linux-device-drivers +S: Supported +F: drivers/iio/adc/ad7606.c + ANALOG DEVICES INC AD9389B DRIVER M: Hans Verkuil L: linux-me...@vger.kernel.org diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index da9644b..9c0b50b 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -69,6 +69,34 @@ config AD7476 To compile this driver as a module, choose M here: the module will be called ad7476. +config AD7606 + tristate + depends on GPIOLIB || COMPILE_TEST + depends on HAS_IOMEM + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + +config AD7606_IFACE_PARALLEL + tristate "Analog Devices AD7606 ADC driver with parallel interface support" + select AD7606 + help + Say yes here to build parallel interface support for Analog Devices: + ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). + + To compile this driver as a module, choose M here: the + module will be called ad7606_parallel. + +config AD7606_IFACE_SPI + tristate "Analog Devices AD7606 ADC driver with spi interface support" + depends on SPI + select AD7606 + help + Say yes here to build spi interface support for Analog Devices: + ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). + + To compile this driver as a module, choose M here: the + module will be called ad7606_spi. + config AD7766 tristate "Analog Devices AD7766/AD7767 ADC driver" depends on SPI_MASTER diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 07df37f..ea50313 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -11,6 +11,9 @@ obj-$(CONFIG_AD7291) += ad7291.o obj-$(CONFIG_AD7298) += ad7298.o obj-$(CONFIG_AD7923) += ad7923.o obj-$(CONFIG_AD7476) += ad7476.o +obj-$(CONFIG_AD7606_IFACE_PARALLEL) += ad7606_par.o +obj-$(CONFIG_AD7606_IFACE_SPI) += ad7606_spi.o +obj-$(CONFIG_AD7606) += ad7606.o obj-$(CONFIG_AD7766) += ad7766.o obj-$(CONFIG_AD7791) += ad7791.o obj-$(CONFIG_AD7793) += ad7793.o diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c new file mode 100644 index 000..5733760 --- /dev/null +++ b/drivers/iio/adc/ad7606.c @@ -0,0 +1,588 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * AD7606 SPI ADC driver + * + * Copyright 2011 Analog Devices Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "ad7606.h" + +/* + * Scales are computed as 5000/32768 and 1/32768 respectively, + * so that when applied to the raw values they provide mV values + */ +static const unsigned int scale_avail[2] = { + 152588, 305176 +}; + +static const unsigned int ad7606_oversampling_avail[7] = { + 1, 2, 4, 8, 16, 32, 64, +}; + +static int ad7606_reset(struct ad7606_state *st) +{ + if (st->gpio_reset) { + gpiod_set_value(st->gpio_reset, 1); + ndelay(100); /* t_reset >= 100ns */ + gpiod_set_value(st->gpio_reset, 0); + return 0; + } + + return -ENODEV; +} + +static int ad7606_read_samples(struct ad7606_state *st) +{ + unsigned int num =