[PATCH v2] dt-bindings: iio: accel: add binding documentation for ADIS16240
This patch add device tree binding documentation for ADIS16240. Signed-off-by: Rodrigo Ribeiro Carvalho --- V2: - Remove true constant for spi-cpha and spi-cpol - Add description field for spi-cpha and spi-cpol - Add maxItems field for spi-cpha and spi-cpol .../bindings/iio/accel/adi,adis16240.yaml | 61 +++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml diff --git a/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml b/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml new file mode 100644 index ..4b1bd2419604 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml @@ -0,0 +1,61 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/accel/adi,adis16240.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ADIS16240 Programmable Impact Sensor and Recorder driver + +maintainers: + - Alexandru Ardelean + +description: | + ADIS16240 Programmable Impact Sensor and Recorder driver that supports + SPI interface. +https://www.analog.com/en/products/adis16240.html + +properties: + compatible: +enum: + - adi,adis16240 + + reg: +maxItems: 1 + + spi-cpha: +description: | + See Documentation/devicetree/bindings/spi/spi-controller.yaml +maxItems: 1 + + spi-cpol: | +description: | + See Documentation/devicetree/bindings/spi/spi-controller.yaml +maxItems: 1 + + interrupts: +maxItems: 1 + +required: + - compatible + - reg + - interrupts + +examples: + - | +#include +#include +spi0 { +#address-cells = <1>; +#size-cells = <0>; + +/* Example for a SPI device node */ +accelerometer@0 { +compatible = "adi,adis16240"; +reg = <0>; +spi-max-frequency = <250>; +spi-cpol; +spi-cpha; +interrupt-parent = <>; +interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; +}; +}; -- 2.23.0.rc1
Re: [PATCH 1/2] dt-bindings: iio: accel: add binding documentation for ADIS16240
Hi, Thanks for comments. I will send a v2. Em dom, 8 de set de 2019 às 07:52, Jonathan Cameron escreveu: > > On Mon, 2 Sep 2019 14:14:18 -0300 > Marcelo Schmitt wrote: > > > Hi Rodrigo, > > > > This dt doc looks overal fine IMHO. > > I would just add some inline comments about the cpha and cpol > > properties. > > > > On 09/01, Rodrigo Carvalho wrote: > > > This patch add device tree binding documentation for ADIS16240. > > > > > > Signed-off-by: Rodrigo Ribeiro Carvalho > > > --- > > > I have doubt about what maintainer I may to put in that documentation. I > > > put Alexandru as maintainer because he reviewed my last patch on this > > > driver, so I think that he is a good candidate. > > > .../bindings/iio/accel/adi,adis16240.yaml | 55 +++ > > > 1 file changed, 55 insertions(+) > > > create mode 100644 > > > Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml > > > > > > diff --git > > > a/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml > > > b/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml > > > new file mode 100644 > > > index ..08019b51611c > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml > > > @@ -0,0 +1,55 @@ > > > +# SPDX-License-Identifier: GPL-2.0 > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/iio/accel/adi,adis16240.yaml# > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: ADIS16240 Programmable Impact Sensor and Recorder driver > > > + > > > +maintainers: > > > + - Alexandru Ardelean > > > + > > > +description: | > > > + ADIS16240 Programmable Impact Sensor and Recorder driver that supports > > > + SPI interface. > > > +https://www.analog.com/en/products/adis16240.html > > > + > > > +properties: > > > + compatible: > > > +enum: > > > + - adi,adis16240 > > > + > > > + reg: > > > +maxItems: 1 > > > + > > > + spi-cpha: true > > > + > > > + spi-cpol: true > > Boolean properties don't require to be explicitly set. It would also be > > nice to add a description pointing to the spi-bus documentation. Like > > this: > > > > spi-cpha: > > description: | > > See Documentation/devicetree/bindings/spi/spi-bus.txt > > maxItems: 1 > > > > spi-cpol: > > description: | > > See Documentation/devicetree/bindings/spi/spi-bus.txt > > maxItems: 1 > > > > As far as I know, spi-cpol and spi-cpha stand for SPI chip polarity and > > SPI chip phase respectively. By default, it is assumed that SPI > > input/output data is available at uprising clock edges, however, some > > chips may work with different configuration (taking input data and/or > > push it out in falling edges). I'm not 100% sure but, from what I've > > seen on IIO, cpol is set to invert the input/output logic (making IO be > > taken on falling edges) while cpha is usually set when MISO valid out > > data is available on SCLK falling edge. If anyone has more comments > > about this please, add them here, I'm curious about it. :) > > > > They may well be constant for a given device (some will cope with > several combinations). So the binding should reflect if they 'must' > be set. > > Adding the cross reference is indeed nice. > > Jonathan > > > > + > > > + interrupts: > > > +maxItems: 1 > > > + > > > +required: > > > + - compatible > > > + - reg > > > + - interrupts > > > + > > > +examples: > > > + - | > > > +#include > > > +#include > > > +spi0 { > > > +#address-cells = <1>; > > > +#size-cells = <0>; > > > + > > > +/* Example for a SPI device node */ > > > +accelerometer@0 { > > > +compatible = "adi,adis16240"; > > > +reg = <0>; > > > +spi-max-frequency = <250>; > > > +spi-cpol; > > > +spi-cpha; > > > +interrupt-parent = <>; > > > +interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; > > > +}; > > > +}; > > > -- > > > 2.23.0.rc1 > > > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Kernel USP" group. > > > To unsubscribe from this group and stop receiving emails from it, send an > > > email to kernel-usp+unsubscr...@googlegroups.com. > > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/kernel-usp/20190902005938.7734-1-rodrigorsdc%40gmail.com. >
Re: [PATCH 2/2] staging: iio: accel: adis16240: move out of staging
Hi, Em seg, 9 de set de 2019 às 02:53, Ardelean, Alexandru escreveu: > > On Sun, 2019-09-08 at 12:09 +0100, Jonathan Cameron wrote: > > On Mon, 2 Sep 2019 13:26:02 + > > "Ardelean, Alexandru" wrote: > > > > > On Sun, 2019-09-01 at 21:59 -0300, Rodrigo Carvalho wrote: > > > > Move ADIS16240 driver from staging to mainline. > > > > > > > > The ADIS16240 is a fully integrated digital shock detection > > > > and recorder system. > > > > > > Hey, > > > > > > Comments inline. > > > > > > I'll probably take a look in the next days again. > > > There seem to be some ABI/sysfs attributes that need to be resolved > > > before moving this out of staging. > > > > Absolutely. It is a 'new' type of device so there are definitely some > > corners that need discussing before we move out of staging and commit > > to maintaining the ABI moving forwards. > > > > That is the real reason this driver was still in staging! No one > > had been through the process of proposing the ABI and responding to > > questions etc. > > > > The issue with impact sensors has always been that they don't really fit > > our normal model for buffers or triggers. > > > > So normally a trigger (if exposed in IIO) is used as one trigger > > causes 1 set of samples (so like a frame trigger for a camera). > > > > These devices tend to work in a mode where one trigger causes data > > to be captured for a period of time. In this part that's the event > > recorder function > > > > No one is realistically going to buy an impact sensor to just use it > > as an accelerometer which is what this driver is currently doing. > > I suppose we could just leave support in that form for now, but > > I'm no sure how much use it is to anyone. > > > > Analog Devices people, worth working out how to support the event > > recorder? For that someone needs to have hardware as it is complex > > to say the least! > > Worth it: yes. > But we don't have any resources to allocate for this [at this point in time]. > > > > > We could move it out but might be worth adding a comment somewhere > > saying this only really supports direct access to channels, and > > not the event recorder functionality. > > > > I guess, I would vote for leaving it in staging. > It's also a way to mark it as a > work-in-progress/not-done/still-needs-something kind of thing. > If we move it now, it gets the status of "everything-resolved" which is not > yet the case. > > Thanks for the insight/background info. > Much of it was discussed before my time. How about adis16203? Is it more simple to move this driver out of staging? > > > > Jonathan > > Alex > > > > > > > > > Signed-off-by: Rodrigo Ribeiro Carvalho > > > > --- > > > > drivers/iio/accel/Kconfig | 12 + > > > > drivers/iio/accel/Makefile| 1 + > > > > drivers/iio/accel/adis16240.c | 454 ++ > > > > drivers/staging/iio/accel/Kconfig | 12 - > > > > drivers/staging/iio/accel/Makefile| 1 - > > > > drivers/staging/iio/accel/adis16240.c | 454 -- > > > > 6 files changed, 467 insertions(+), 467 deletions(-) > > > > create mode 100644 drivers/iio/accel/adis16240.c > > > > delete mode 100644 drivers/staging/iio/accel/adis16240.c > > > > > > Looks like MAINTAINERS file also needs to be updated, also with the DT > > > bindings file. > > > I think checkpatch usually complains about these. > > > > > > > diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig > > > > index d4ef35aeb579..91fd8741c95f 100644 > > > > --- a/drivers/iio/accel/Kconfig > > > > +++ b/drivers/iio/accel/Kconfig > > > > @@ -30,6 +30,18 @@ config ADIS16209 > > > > To compile this driver as a module, say M here: the module will be > > > > called adis16209. > > > > > > > > +config ADIS16240 > > > > + tristate "Analog Devices ADIS16240 Programmable Impact Sensor and > > > > Recorder" > > > > + depends on SPI > > > > + select IIO_ADIS_LIB > > > > + select IIO_ADIS_LIB_BUFFER if IIO_BUFFER > > > > + help > > > > + Say Y here to build support for Analog Devices adis16240 > > > > programmable > > > > + impact Sensor and recorder.
[PATCH 2/2] staging: iio: accel: adis16240: move out of staging
Move ADIS16240 driver from staging to mainline. The ADIS16240 is a fully integrated digital shock detection and recorder system. Signed-off-by: Rodrigo Ribeiro Carvalho --- drivers/iio/accel/Kconfig | 12 + drivers/iio/accel/Makefile| 1 + drivers/iio/accel/adis16240.c | 454 ++ drivers/staging/iio/accel/Kconfig | 12 - drivers/staging/iio/accel/Makefile| 1 - drivers/staging/iio/accel/adis16240.c | 454 -- 6 files changed, 467 insertions(+), 467 deletions(-) create mode 100644 drivers/iio/accel/adis16240.c delete mode 100644 drivers/staging/iio/accel/adis16240.c diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index d4ef35aeb579..91fd8741c95f 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -30,6 +30,18 @@ config ADIS16209 To compile this driver as a module, say M here: the module will be called adis16209. +config ADIS16240 + tristate "Analog Devices ADIS16240 Programmable Impact Sensor and Recorder" + depends on SPI + select IIO_ADIS_LIB + select IIO_ADIS_LIB_BUFFER if IIO_BUFFER + help + Say Y here to build support for Analog Devices adis16240 programmable + impact Sensor and recorder. + + To compile this driver as a module, say M here: the module will be + called adis16240. + config ADXL345 tristate diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile index 56bd0215e0d4..f7e025a86dd9 100644 --- a/drivers/iio/accel/Makefile +++ b/drivers/iio/accel/Makefile @@ -6,6 +6,7 @@ # When adding new entries keep the list in alphabetical order obj-$(CONFIG_ADIS16201) += adis16201.o obj-$(CONFIG_ADIS16209) += adis16209.o +obj-$(CONFIG_ADIS16240) += adis16240.o obj-$(CONFIG_ADXL345) += adxl345_core.o obj-$(CONFIG_ADXL345_I2C) += adxl345_i2c.o obj-$(CONFIG_ADXL345_SPI) += adxl345_spi.o diff --git a/drivers/iio/accel/adis16240.c b/drivers/iio/accel/adis16240.c new file mode 100644 index ..82099db4bf0c --- /dev/null +++ b/drivers/iio/accel/adis16240.c @@ -0,0 +1,454 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * ADIS16240 Programmable Impact Sensor and Recorder driver + * + * Copyright 2010 Analog Devices Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define ADIS16240_STARTUP_DELAY220 /* ms */ + +/* Flash memory write count */ +#define ADIS16240_FLASH_CNT 0x00 + +/* Output, power supply */ +#define ADIS16240_SUPPLY_OUT 0x02 + +/* Output, x-axis accelerometer */ +#define ADIS16240_XACCL_OUT 0x04 + +/* Output, y-axis accelerometer */ +#define ADIS16240_YACCL_OUT 0x06 + +/* Output, z-axis accelerometer */ +#define ADIS16240_ZACCL_OUT 0x08 + +/* Output, auxiliary ADC input */ +#define ADIS16240_AUX_ADC0x0A + +/* Output, temperature */ +#define ADIS16240_TEMP_OUT 0x0C + +/* Output, x-axis acceleration peak */ +#define ADIS16240_XPEAK_OUT 0x0E + +/* Output, y-axis acceleration peak */ +#define ADIS16240_YPEAK_OUT 0x10 + +/* Output, z-axis acceleration peak */ +#define ADIS16240_ZPEAK_OUT 0x12 + +/* Output, sum-of-squares acceleration peak */ +#define ADIS16240_XYZPEAK_OUT0x14 + +/* Output, Capture Buffer 1, X and Y acceleration */ +#define ADIS16240_CAPT_BUF1 0x16 + +/* Output, Capture Buffer 2, Z acceleration */ +#define ADIS16240_CAPT_BUF2 0x18 + +/* Diagnostic, error flags */ +#define ADIS16240_DIAG_STAT 0x1A + +/* Diagnostic, event counter */ +#define ADIS16240_EVNT_CNTR 0x1C + +/* Diagnostic, check sum value from firmware test */ +#define ADIS16240_CHK_SUM0x1E + +/* Calibration, x-axis acceleration offset adjustment */ +#define ADIS16240_XACCL_OFF 0x20 + +/* Calibration, y-axis acceleration offset adjustment */ +#define ADIS16240_YACCL_OFF 0x22 + +/* Calibration, z-axis acceleration offset adjustment */ +#define ADIS16240_ZACCL_OFF 0x24 + +/* Clock, hour and minute */ +#define ADIS16240_CLK_TIME 0x2E + +/* Clock, month and day */ +#define ADIS16240_CLK_DATE 0x30 + +/* Clock, year */ +#define ADIS16240_CLK_YEAR 0x32 + +/* Wake-up setting, hour and minute */ +#define ADIS16240_WAKE_TIME 0x34 + +/* Wake-up setting, month and day */ +#define ADIS16240_WAKE_DATE 0x36 + +/* Alarm 1 amplitude threshold */ +#define ADIS16240_ALM_MAG1 0x38 + +/* Alarm 2 amplitude threshold */ +#define ADIS16240_ALM_MAG2 0x3A + +/* Alarm control */ +#define ADIS16240_ALM_CTRL 0x3C + +/* Capture, external trigger control */ +#define ADIS16240_XTRIG_CTRL 0x3E + +/* Capture, address pointer */ +#define ADIS16240_CAPT_PNTR 0x40 + +/* Capture, configuration and control */ +#define ADIS16240_CAPT_CTRL 0x42 + +/* General-purpose digital input/output control */ +#define
[PATCH 1/2] dt-bindings: iio: accel: add binding documentation for ADIS16240
This patch add device tree binding documentation for ADIS16240. Signed-off-by: Rodrigo Ribeiro Carvalho --- I have doubt about what maintainer I may to put in that documentation. I put Alexandru as maintainer because he reviewed my last patch on this driver, so I think that he is a good candidate. .../bindings/iio/accel/adi,adis16240.yaml | 55 +++ 1 file changed, 55 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml diff --git a/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml b/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml new file mode 100644 index ..08019b51611c --- /dev/null +++ b/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml @@ -0,0 +1,55 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/accel/adi,adis16240.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ADIS16240 Programmable Impact Sensor and Recorder driver + +maintainers: + - Alexandru Ardelean + +description: | + ADIS16240 Programmable Impact Sensor and Recorder driver that supports + SPI interface. +https://www.analog.com/en/products/adis16240.html + +properties: + compatible: +enum: + - adi,adis16240 + + reg: +maxItems: 1 + + spi-cpha: true + + spi-cpol: true + + interrupts: +maxItems: 1 + +required: + - compatible + - reg + - interrupts + +examples: + - | +#include +#include +spi0 { +#address-cells = <1>; +#size-cells = <0>; + +/* Example for a SPI device node */ +accelerometer@0 { +compatible = "adi,adis16240"; +reg = <0>; +spi-max-frequency = <250>; +spi-cpol; +spi-cpha; +interrupt-parent = <>; +interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; +}; +}; -- 2.23.0.rc1