Re: [PATCH 5/6] Staging: iio: adis16209: Add some informatic comments

From: Shreeya Patel
Date: Sat Mar 03 2018 - 11:10:04 EST


On Sat, 2018-03-03 at 16:01 +0000, Jonathan Cameron wrote:
> On Fri,ÂÂ2 Mar 2018 19:02:48 +0530
> Shreeya Patel <shreeya.patel23498@xxxxxxxxx> wrote:
>
> >
> > Some of the register names does not make it's puporse
> > very clear and hence, add some comments for more
> > information.
> > Also there are certain unit based comments which are not
> > providing sufficient information, so expand those comments.
> Ah - serves me right for not reading on before commenting on the
> previous
> patch.ÂÂIt would have been preferable to have merged at least some of
> this
> in there as they needed to be read together.
>
> One comment in here doesn't quite cover everything I think should
> be explained.
>
> Please fix that and merge this down with the previous patch
> (interactive rebase and marking it as a fixup makes this easy).
>
> Thanks,
>
> Jonathan
>
> >
> >
> > Signed-off-by: Shreeya Patel <shreeya.patel23498@xxxxxxxxx>
> > ---
> > Âdrivers/staging/iio/accel/adis16209.c | 21 ++++++++++++++++++---
> > Â1 file changed, 18 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/iio/accel/adis16209.c
> > b/drivers/staging/iio/accel/adis16209.c
> > index d2d1254..7363fd0 100644
> > --- a/drivers/staging/iio/accel/adis16209.c
> > +++ b/drivers/staging/iio/accel/adis16209.c
> > @@ -27,13 +27,18 @@
> > Â#define ADIS16209_SUPPLY_OUT_REG 0x02
> > Â#define ADIS16209_XACCL_OUT_REG 0x04
> > Â#define ADIS16209_YACCL_OUT_REG 0x06
> > +/* Output, auxiliary ADC */
> > Â#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
> > Â#define ADIS16209_ROT_OUT_REG 0x10
> > Â
> > -/* Calibration Register Definitions */
> > +/* 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
> > @@ -155,19 +160,29 @@ static int adis16209_read_raw(struct iio_dev
> > *indio_dev,
> > Â *val2 = 0;
> > Â return IIO_VAL_INT_PLUS_MICRO;
> > Â case IIO_ACCEL:
> > + /*
> > + Â* IIO base unit for sensitivity of
> > accelerometer
> > + Â* is milligram.
> > + Â* 1 LSB represents 0.244 milligrams.
> Not miligrams. Milli g where 1 g is the 'standard' acceleration due
> to gravity.

Ah!!
Should have used my common sense here :(
Sorry for such mistake.

>
> >
> > + Â*/
> > Â *val = 0;
> > - *val2 = IIO_G_TO_M_S_2(244140); /*
> > 0.244140 mg */
> > + *val2 = IIO_G_TO_M_S_2(244140);
> > Â return IIO_VAL_INT_PLUS_NANO;
> > Â case IIO_INCLI:
> > Â case IIO_ROT:
> > + /*
> > + Â* IIO base units for rotation are
> > degrees.
> > + Â* 1 LSB represents 0.025 milli degrees.
> > + Â*/
> > Â *val = 0;
> > - *val2 = 25000; /* 0.025 degree */
> > + *val2 = 25000;
> > Â return IIO_VAL_INT_PLUS_MICRO;
> > Â default:
> > Â return -EINVAL;
> > Â }
> > Â break;
> > Â case IIO_CHAN_INFO_OFFSET:
> > + /* TEMP_OUT_REG has a scale factor of -0.47
> > degrees celcius. */
> This doesn't explain the magic 0x4FE so that needs doing as well.
>
> >
> > Â *val = 25000 / -470 - 0x4FE;
> > Â return IIO_VAL_INT;
> > Â case IIO_CHAN_INFO_CALIBBIAS: