Re: [PATCH v2] Staging: iio: adis16209: Move adis16209 driver out of staging

2018-03-18 Thread Jonathan Cameron
On Sun, 18 Mar 2018 15:18:44 +0530
Shreeya Patel  wrote:

> On 10 March 2018 21:27:31 GMT+05:30, Jonathan Cameron 
> 
> Hi Jonathan
> 
> >On Sat, 10 Mar 2018 15:50:23 +0530
> >Shreeya Patel  wrote:
> >  
> >> Move the adis16209 driver out of staging directory and merge to the
> >> mainline IIO subsystem.
> >> 
> >> Signed-off-by: Shreeya Patel   
> >As this has a clear dependency on the previous patch, please put them
> >in the same series for the next version.  That way I won't miss one!
> >
> >This also doesn't actually seem to have all the patches in place.
> >The sign extend one is definitely missing for some reason.
> >
> >One question on the ABI choice of X for the rotation axis.
> >I think the logical choice is actually Z but would like to know what
> >you and others think.
> >
> >All existing users of IIO_ROT (outside staging) have been magnetometer
> >where we don't have an axis, but rather a magnetic reference frame or
> >a quaternion output which includes all the axes.
> >
> >Jonathan
> >  
> >> ---
> >> 
> >> Changes in v2
> >>   -Re-send the patch after having some cleanups in the
> >> file included in this patch.
> >> 
> >>  drivers/iio/accel/Kconfig |  12 ++
> >>  drivers/iio/accel/Makefile|   1 +
> >>  drivers/iio/accel/adis16209.c | 329  
> >++  
> >>  drivers/staging/iio/accel/Kconfig |  12 --
> >>  drivers/staging/iio/accel/Makefile|   1 -
> >>  drivers/staging/iio/accel/adis16209.c | 329  
> >--  
> >>  6 files changed, 342 insertions(+), 342 deletions(-)
> >>  create mode 100644 drivers/iio/accel/adis16209.c
> >>  delete mode 100644 drivers/staging/iio/accel/adis16209.c
> >> 
> >> diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> >> index c6d9517..f95f43c 100644
> >> --- a/drivers/iio/accel/Kconfig
> >> +++ b/drivers/iio/accel/Kconfig
> >> @@ -5,6 +5,18 @@
> >>  
> >>  menu "Accelerometers"
> >>  
> >> +config ADIS16209
> >> +tristate "Analog Devices ADIS16209 Dual-Axis Digital  
> >Inclinometer and Accelerometer"  
> >> +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 adis16209  
> >dual-axis digital inclinometer  
> >> +  and accelerometer.
> >> +
> >> +  To compile this driver as a module, say M here: the module  
> >will be  
> >> +  called adis16209.
> >> +
> >>  config ADXL345
> >>tristate
> >>  
> >> diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile
> >> index 368aedb..40861b9 100644
> >> --- a/drivers/iio/accel/Makefile
> >> +++ b/drivers/iio/accel/Makefile
> >> @@ -4,6 +4,7 @@
> >>  #
> >>  
> >>  # When adding new entries keep the list in alphabetical order
> >> +obj-$(CONFIG_ADIS16209) += adis16209.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/adis16209.c  
> >b/drivers/iio/accel/adis16209.c  
> >> new file mode 100644
> >> index 000..ed2e89f
> >> --- /dev/null
> >> +++ b/drivers/iio/accel/adis16209.c
> >> @@ -0,0 +1,329 @@
> >> +/*
> >> + * ADIS16209 Dual-Axis Digital Inclinometer and Accelerometer
> >> + *
> >> + * Copyright 2010 Analog Devices Inc.
> >> + *
> >> + * Licensed under the GPL-2 or later.
> >> + */
> >> +
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +
> >> +#define ADIS16209_STARTUP_DELAY_MS220
> >> +#define ADIS16209_FLASH_CNT_REG   0x00
> >> +
> >> +/* Data Output Register Definitions */
> >> +#define ADIS16209_SUPPLY_OUT_REG  0x02
> >> +#define ADIS16209_XACCL_OUT_REG   0x04
> >> +#define ADIS16209_YACCL_OUT_REG   0x06
> >> +/* Output, auxiliary ADC input */
> >> +#define ADIS16209_AUX_ADC_REG 0x08
> >> +/* Output, temperature */
> >> +#define ADIS16209_TEMP_OUT_REG0x0A
> >> +/* Output, +/- 90 degrees X-axis inclination */
> >> +#define ADIS16209_XINCL_OUT_REG   0x0C
> >> +#define ADIS16209_YINCL_OUT_REG   0x0E
> >> +/* Output, +/-180 vertical rotational position */
> >> +#define ADIS16209_ROT_OUT_REG 0x10
> >> +
> >> +/*
> >> + * Calibration Register Definitions.
> >> + * Acceleration, inclination or rotation offset null.
> >> + */
> >> +#define ADIS16209_XACCL_NULL_REG  0x12
> >> +#define ADIS16209_YACCL_NULL_REG  0x14
> >> +#define ADIS16209_XINCL_NULL_REG  0x16
> >> +#define ADIS16209_YINCL_NULL_REG  0x18
> >> +#define ADIS16209_ROT_NULL_REG0x1A
> >> +
> >> +/* Alarm Register Definitions */
> >> +#define ADIS16209_ALM_MAG1_REG

Re: [PATCH v2] Staging: iio: adis16209: Move adis16209 driver out of staging

2018-03-18 Thread Shreeya Patel


On 10 March 2018 21:27:31 GMT+05:30, Jonathan Cameron 

Hi Jonathan

>On Sat, 10 Mar 2018 15:50:23 +0530
>Shreeya Patel  wrote:
>
>> Move the adis16209 driver out of staging directory and merge to the
>> mainline IIO subsystem.
>> 
>> Signed-off-by: Shreeya Patel 
>As this has a clear dependency on the previous patch, please put them
>in the same series for the next version.  That way I won't miss one!
>
>This also doesn't actually seem to have all the patches in place.
>The sign extend one is definitely missing for some reason.
>
>One question on the ABI choice of X for the rotation axis.
>I think the logical choice is actually Z but would like to know what
>you and others think.
>
>All existing users of IIO_ROT (outside staging) have been magnetometer
>where we don't have an axis, but rather a magnetic reference frame or
>a quaternion output which includes all the axes.
>
>Jonathan
>
>> ---
>> 
>> Changes in v2
>>   -Re-send the patch after having some cleanups in the
>> file included in this patch.
>> 
>>  drivers/iio/accel/Kconfig |  12 ++
>>  drivers/iio/accel/Makefile|   1 +
>>  drivers/iio/accel/adis16209.c | 329
>++
>>  drivers/staging/iio/accel/Kconfig |  12 --
>>  drivers/staging/iio/accel/Makefile|   1 -
>>  drivers/staging/iio/accel/adis16209.c | 329
>--
>>  6 files changed, 342 insertions(+), 342 deletions(-)
>>  create mode 100644 drivers/iio/accel/adis16209.c
>>  delete mode 100644 drivers/staging/iio/accel/adis16209.c
>> 
>> diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
>> index c6d9517..f95f43c 100644
>> --- a/drivers/iio/accel/Kconfig
>> +++ b/drivers/iio/accel/Kconfig
>> @@ -5,6 +5,18 @@
>>  
>>  menu "Accelerometers"
>>  
>> +config ADIS16209
>> +tristate "Analog Devices ADIS16209 Dual-Axis Digital
>Inclinometer and Accelerometer"
>> +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 adis16209
>dual-axis digital inclinometer
>> +  and accelerometer.
>> +
>> +  To compile this driver as a module, say M here: the module
>will be
>> +  called adis16209.
>> +
>>  config ADXL345
>>  tristate
>>  
>> diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile
>> index 368aedb..40861b9 100644
>> --- a/drivers/iio/accel/Makefile
>> +++ b/drivers/iio/accel/Makefile
>> @@ -4,6 +4,7 @@
>>  #
>>  
>>  # When adding new entries keep the list in alphabetical order
>> +obj-$(CONFIG_ADIS16209) += adis16209.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/adis16209.c
>b/drivers/iio/accel/adis16209.c
>> new file mode 100644
>> index 000..ed2e89f
>> --- /dev/null
>> +++ b/drivers/iio/accel/adis16209.c
>> @@ -0,0 +1,329 @@
>> +/*
>> + * ADIS16209 Dual-Axis Digital Inclinometer and Accelerometer
>> + *
>> + * Copyright 2010 Analog Devices Inc.
>> + *
>> + * Licensed under the GPL-2 or later.
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#define ADIS16209_STARTUP_DELAY_MS  220
>> +#define ADIS16209_FLASH_CNT_REG 0x00
>> +
>> +/* Data Output Register Definitions */
>> +#define ADIS16209_SUPPLY_OUT_REG0x02
>> +#define ADIS16209_XACCL_OUT_REG 0x04
>> +#define ADIS16209_YACCL_OUT_REG 0x06
>> +/* Output, auxiliary ADC input */
>> +#define ADIS16209_AUX_ADC_REG   0x08
>> +/* Output, temperature */
>> +#define ADIS16209_TEMP_OUT_REG  0x0A
>> +/* Output, +/- 90 degrees X-axis inclination */
>> +#define ADIS16209_XINCL_OUT_REG 0x0C
>> +#define ADIS16209_YINCL_OUT_REG 0x0E
>> +/* Output, +/-180 vertical rotational position */
>> +#define ADIS16209_ROT_OUT_REG   0x10
>> +
>> +/*
>> + * Calibration Register Definitions.
>> + * Acceleration, inclination or rotation offset null.
>> + */
>> +#define ADIS16209_XACCL_NULL_REG0x12
>> +#define ADIS16209_YACCL_NULL_REG0x14
>> +#define ADIS16209_XINCL_NULL_REG0x16
>> +#define ADIS16209_YINCL_NULL_REG0x18
>> +#define ADIS16209_ROT_NULL_REG  0x1A
>> +
>> +/* Alarm Register Definitions */
>> +#define ADIS16209_ALM_MAG1_REG  0x20
>> +#define ADIS16209_ALM_MAG2_REG  0x22
>> +#define ADIS16209_ALM_SMPL1_REG 0x24
>> +#define ADIS16209_ALM_SMPL2_REG 0x26
>> +#define ADIS16209_ALM_CTRL_REG  0x28

I see that these alarm registers are not being used anywhere in the driver and 
yet we have it's declaration. 
Is it the left out work that will be done in 

Re: [PATCH v2] Staging: iio: adis16209: Move adis16209 driver out of staging

2018-03-17 Thread Jonathan Cameron
On Fri, 16 Mar 2018 02:33:49 +0530
Shreeya Patel  wrote:

> On 16 March 2018 00:31:53 GMT+05:30, Shreeya Patel 
>  wrote:
> >On Sat, 2018-03-10 at 15:57 +, Jonathan Cameron wrote:
> >
> >Hi Jonathan,
> >  
> >> On Sat, 10 Mar 2018 15:50:23 +0530
> >> Shreeya Patel  wrote:
> >>   
> >> > 
> >> > Move the adis16209 driver out of staging directory and merge to the
> >> > mainline IIO subsystem.
> >> > 
> >> > Signed-off-by: Shreeya Patel   
> >> As this has a clear dependency on the previous patch, please put them
> >> in the same series for the next version.  That way I won't miss one!
> >> 
> >> This also doesn't actually seem to have all the patches in place.
> >> The sign extend one is definitely missing for some reason.
> >> 
> >> One question on the ABI choice of X for the rotation axis.
> >> I think the logical choice is actually Z but would like to know what
> >> you and others think.
> >> 
> >> All existing users of IIO_ROT (outside staging) have been
> >> magnetometer
> >> where we don't have an axis, but rather a magnetic reference frame or
> >> a quaternion output which includes all the axes.
> >> 
> >> Jonathan
> >>   
> >> > 
> >> > ---
> >> > 
> >> > Changes in v2
> >> >   -Re-send the patch after having some cleanups in the
> >> > file included in this patch.
> >> > 
> >> >  drivers/iio/accel/Kconfig |  12 ++
> >> >  drivers/iio/accel/Makefile|   1 +
> >> >  drivers/iio/accel/adis16209.c | 329
> >> > ++
> >> >  drivers/staging/iio/accel/Kconfig |  12 --
> >> >  drivers/staging/iio/accel/Makefile|   1 -
> >> >  drivers/staging/iio/accel/adis16209.c | 329 --
> >> > 
> >> >  6 files changed, 342 insertions(+), 342 deletions(-)
> >> >  create mode 100644 drivers/iio/accel/adis16209.c
> >> >  delete mode 100644 drivers/staging/iio/accel/adis16209.c
> >> > 
> >> > diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> >> > index c6d9517..f95f43c 100644
> >> > --- a/drivers/iio/accel/Kconfig
> >> > +++ b/drivers/iio/accel/Kconfig
> >> > @@ -5,6 +5,18 @@
> >> >  
> >> >  menu "Accelerometers"
> >> >  
> >> > +config ADIS16209
> >> > +tristate "Analog Devices ADIS16209 Dual-Axis Digital
> >> > Inclinometer and Accelerometer"
> >> > +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 adis16209
> >> > dual-axis digital inclinometer
> >> > +  and accelerometer.
> >> > +
> >> > +  To compile this driver as a module, say M here: the
> >> > module will be
> >> > +  called adis16209.
> >> > +
> >> >  config ADXL345
> >> >  tristate
> >> >  
> >> > diff --git a/drivers/iio/accel/Makefile
> >> > b/drivers/iio/accel/Makefile
> >> > index 368aedb..40861b9 100644
> >> > --- a/drivers/iio/accel/Makefile
> >> > +++ b/drivers/iio/accel/Makefile
> >> > @@ -4,6 +4,7 @@
> >> >  #
> >> >  
> >> >  # When adding new entries keep the list in alphabetical order
> >> > +obj-$(CONFIG_ADIS16209) += adis16209.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/adis16209.c
> >> > b/drivers/iio/accel/adis16209.c
> >> > new file mode 100644
> >> > index 000..ed2e89f
> >> > --- /dev/null
> >> > +++ b/drivers/iio/accel/adis16209.c
> >> > @@ -0,0 +1,329 @@
> >> > +/*
> >> > + * ADIS16209 Dual-Axis Digital Inclinometer and Accelerometer
> >> > + *
> >> > + * Copyright 2010 Analog Devices Inc.
> >> > + *
> >> > + * Licensed under the GPL-2 or later.
> >> > + */
> >> > +
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +#include 
> >> > +
> >> > +#define ADIS16209_STARTUP_DELAY_MS  220
> >> > +#define ADIS16209_FLASH_CNT_REG 0x00
> >> > +
> >> > +/* Data Output Register Definitions */
> >> > +#define ADIS16209_SUPPLY_OUT_REG0x02
> >> > +#define ADIS16209_XACCL_OUT_REG 0x04
> >> > +#define ADIS16209_YACCL_OUT_REG 0x06
> >> > +/* Output, auxiliary ADC input */
> >> > +#define ADIS16209_AUX_ADC_REG   0x08
> >> > +/* Output, temperature */
> >> > +#define ADIS16209_TEMP_OUT_REG  0x0A
> >> > +/* Output, +/- 90 degrees X-axis inclination */
> >> > +#define ADIS16209_XINCL_OUT_REG 0x0C
> >> > +#define ADIS16209_YINCL_OUT_REG 0x0E
> >> > +/* Output, +/-180 vertical rotational position */
> >> > +#define ADIS16209_ROT_OUT_REG   0x10
> >> > +
> >> > +/*
> >> > + * Calibration Register Definitions.
> >> > + * Acceleration, inclination or rotation 

Re: [PATCH v2] Staging: iio: adis16209: Move adis16209 driver out of staging

2018-03-15 Thread Shreeya Patel


On 16 March 2018 00:31:53 GMT+05:30, Shreeya Patel 
 wrote:
>On Sat, 2018-03-10 at 15:57 +, Jonathan Cameron wrote:
>
>Hi Jonathan,
>
>> On Sat, 10 Mar 2018 15:50:23 +0530
>> Shreeya Patel  wrote:
>> 
>> > 
>> > Move the adis16209 driver out of staging directory and merge to the
>> > mainline IIO subsystem.
>> > 
>> > Signed-off-by: Shreeya Patel 
>> As this has a clear dependency on the previous patch, please put them
>> in the same series for the next version.  That way I won't miss one!
>> 
>> This also doesn't actually seem to have all the patches in place.
>> The sign extend one is definitely missing for some reason.
>> 
>> One question on the ABI choice of X for the rotation axis.
>> I think the logical choice is actually Z but would like to know what
>> you and others think.
>> 
>> All existing users of IIO_ROT (outside staging) have been
>> magnetometer
>> where we don't have an axis, but rather a magnetic reference frame or
>> a quaternion output which includes all the axes.
>> 
>> Jonathan
>> 
>> > 
>> > ---
>> > 
>> > Changes in v2
>> >   -Re-send the patch after having some cleanups in the
>> > file included in this patch.
>> > 
>> >  drivers/iio/accel/Kconfig |  12 ++
>> >  drivers/iio/accel/Makefile|   1 +
>> >  drivers/iio/accel/adis16209.c | 329
>> > ++
>> >  drivers/staging/iio/accel/Kconfig |  12 --
>> >  drivers/staging/iio/accel/Makefile|   1 -
>> >  drivers/staging/iio/accel/adis16209.c | 329 --
>> > 
>> >  6 files changed, 342 insertions(+), 342 deletions(-)
>> >  create mode 100644 drivers/iio/accel/adis16209.c
>> >  delete mode 100644 drivers/staging/iio/accel/adis16209.c
>> > 
>> > diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
>> > index c6d9517..f95f43c 100644
>> > --- a/drivers/iio/accel/Kconfig
>> > +++ b/drivers/iio/accel/Kconfig
>> > @@ -5,6 +5,18 @@
>> >  
>> >  menu "Accelerometers"
>> >  
>> > +config ADIS16209
>> > +tristate "Analog Devices ADIS16209 Dual-Axis Digital
>> > Inclinometer and Accelerometer"
>> > +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 adis16209
>> > dual-axis digital inclinometer
>> > +  and accelerometer.
>> > +
>> > +  To compile this driver as a module, say M here: the
>> > module will be
>> > +  called adis16209.
>> > +
>> >  config ADXL345
>> >    tristate
>> >  
>> > diff --git a/drivers/iio/accel/Makefile
>> > b/drivers/iio/accel/Makefile
>> > index 368aedb..40861b9 100644
>> > --- a/drivers/iio/accel/Makefile
>> > +++ b/drivers/iio/accel/Makefile
>> > @@ -4,6 +4,7 @@
>> >  #
>> >  
>> >  # When adding new entries keep the list in alphabetical order
>> > +obj-$(CONFIG_ADIS16209) += adis16209.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/adis16209.c
>> > b/drivers/iio/accel/adis16209.c
>> > new file mode 100644
>> > index 000..ed2e89f
>> > --- /dev/null
>> > +++ b/drivers/iio/accel/adis16209.c
>> > @@ -0,0 +1,329 @@
>> > +/*
>> > + * ADIS16209 Dual-Axis Digital Inclinometer and Accelerometer
>> > + *
>> > + * Copyright 2010 Analog Devices Inc.
>> > + *
>> > + * Licensed under the GPL-2 or later.
>> > + */
>> > +
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +
>> > +#define ADIS16209_STARTUP_DELAY_MS220
>> > +#define ADIS16209_FLASH_CNT_REG   0x00
>> > +
>> > +/* Data Output Register Definitions */
>> > +#define ADIS16209_SUPPLY_OUT_REG  0x02
>> > +#define ADIS16209_XACCL_OUT_REG   0x04
>> > +#define ADIS16209_YACCL_OUT_REG   0x06
>> > +/* Output, auxiliary ADC input */
>> > +#define ADIS16209_AUX_ADC_REG 0x08
>> > +/* Output, temperature */
>> > +#define ADIS16209_TEMP_OUT_REG0x0A
>> > +/* Output, +/- 90 degrees X-axis inclination */
>> > +#define ADIS16209_XINCL_OUT_REG   0x0C
>> > +#define ADIS16209_YINCL_OUT_REG   0x0E
>> > +/* Output, +/-180 vertical rotational position */
>> > +#define ADIS16209_ROT_OUT_REG 0x10
>> > +
>> > +/*
>> > + * Calibration Register Definitions.
>> > + * Acceleration, inclination or rotation offset null.
>> > + */
>> > +#define ADIS16209_XACCL_NULL_REG  0x12
>> > +#define ADIS16209_YACCL_NULL_REG  0x14
>> > +#define ADIS16209_XINCL_NULL_REG  0x16
>> > +#define ADIS16209_YINCL_NULL_REG  0x18
>> > +#define ADIS16209_ROT_NULL_REG0x1A
>> > +
>> > +/* Alarm Register Definitions */
>> > +#define ADIS16209_ALM_MAG1_REG0x20
>> > 

Re: [PATCH v2] Staging: iio: adis16209: Move adis16209 driver out of staging

2018-03-10 Thread Jonathan Cameron
On Sat, 10 Mar 2018 15:50:23 +0530
Shreeya Patel  wrote:

> Move the adis16209 driver out of staging directory and merge to the
> mainline IIO subsystem.
> 
> Signed-off-by: Shreeya Patel 
As this has a clear dependency on the previous patch, please put them
in the same series for the next version.  That way I won't miss one!

This also doesn't actually seem to have all the patches in place.
The sign extend one is definitely missing for some reason.

One question on the ABI choice of X for the rotation axis.
I think the logical choice is actually Z but would like to know what
you and others think.

All existing users of IIO_ROT (outside staging) have been magnetometer
where we don't have an axis, but rather a magnetic reference frame or
a quaternion output which includes all the axes.

Jonathan

> ---
> 
> Changes in v2
>   -Re-send the patch after having some cleanups in the
> file included in this patch.
> 
>  drivers/iio/accel/Kconfig |  12 ++
>  drivers/iio/accel/Makefile|   1 +
>  drivers/iio/accel/adis16209.c | 329 
> ++
>  drivers/staging/iio/accel/Kconfig |  12 --
>  drivers/staging/iio/accel/Makefile|   1 -
>  drivers/staging/iio/accel/adis16209.c | 329 
> --
>  6 files changed, 342 insertions(+), 342 deletions(-)
>  create mode 100644 drivers/iio/accel/adis16209.c
>  delete mode 100644 drivers/staging/iio/accel/adis16209.c
> 
> diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> index c6d9517..f95f43c 100644
> --- a/drivers/iio/accel/Kconfig
> +++ b/drivers/iio/accel/Kconfig
> @@ -5,6 +5,18 @@
>  
>  menu "Accelerometers"
>  
> +config ADIS16209
> +tristate "Analog Devices ADIS16209 Dual-Axis Digital Inclinometer 
> and Accelerometer"
> +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 adis16209 dual-axis 
> digital inclinometer
> +  and accelerometer.
> +
> +  To compile this driver as a module, say M here: the module will be
> +  called adis16209.
> +
>  config ADXL345
>   tristate
>  
> diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile
> index 368aedb..40861b9 100644
> --- a/drivers/iio/accel/Makefile
> +++ b/drivers/iio/accel/Makefile
> @@ -4,6 +4,7 @@
>  #
>  
>  # When adding new entries keep the list in alphabetical order
> +obj-$(CONFIG_ADIS16209) += adis16209.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/adis16209.c b/drivers/iio/accel/adis16209.c
> new file mode 100644
> index 000..ed2e89f
> --- /dev/null
> +++ b/drivers/iio/accel/adis16209.c
> @@ -0,0 +1,329 @@
> +/*
> + * ADIS16209 Dual-Axis Digital Inclinometer and Accelerometer
> + *
> + * Copyright 2010 Analog Devices Inc.
> + *
> + * Licensed under the GPL-2 or later.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define ADIS16209_STARTUP_DELAY_MS   220
> +#define ADIS16209_FLASH_CNT_REG  0x00
> +
> +/* Data Output Register Definitions */
> +#define ADIS16209_SUPPLY_OUT_REG 0x02
> +#define ADIS16209_XACCL_OUT_REG  0x04
> +#define ADIS16209_YACCL_OUT_REG  0x06
> +/* Output, auxiliary ADC input */
> +#define ADIS16209_AUX_ADC_REG0x08
> +/* Output, temperature */
> +#define ADIS16209_TEMP_OUT_REG   0x0A
> +/* Output, +/- 90 degrees X-axis inclination */
> +#define ADIS16209_XINCL_OUT_REG  0x0C
> +#define ADIS16209_YINCL_OUT_REG  0x0E
> +/* Output, +/-180 vertical rotational position */
> +#define ADIS16209_ROT_OUT_REG0x10
> +
> +/*
> + * Calibration Register Definitions.
> + * Acceleration, inclination or rotation offset null.
> + */
> +#define ADIS16209_XACCL_NULL_REG 0x12
> +#define ADIS16209_YACCL_NULL_REG 0x14
> +#define ADIS16209_XINCL_NULL_REG 0x16
> +#define ADIS16209_YINCL_NULL_REG 0x18
> +#define ADIS16209_ROT_NULL_REG   0x1A
> +
> +/* Alarm Register Definitions */
> +#define ADIS16209_ALM_MAG1_REG   0x20
> +#define ADIS16209_ALM_MAG2_REG   0x22
> +#define ADIS16209_ALM_SMPL1_REG  0x24
> +#define ADIS16209_ALM_SMPL2_REG  0x26
> +#define ADIS16209_ALM_CTRL_REG   0x28
> +
> +#define ADIS16209_AUX_DAC_REG0x30
> +#define ADIS16209_GPIO_CTRL_REG  0x32
> +#define ADIS16209_SMPL_PRD_REG   0x36
> +#define ADIS16209_AVG_CNT_REG0x38
> +#define ADIS16209_SLP_CNT_REG0x3A
> +
> +#define ADIS16209_MSC_CTRL_REG   0x34
> +#define