From: Shreeya Patel <shreeya.patel23498@gmail.com> To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, daniel.baluta@gmail.com Cc: Shreeya Patel <shreeya.patel23498@gmail.com> Subject: [PATCH 5/6] Staging: iio: adis16209: Add some informatic comments Date: Fri, 2 Mar 2018 19:02:48 +0530 [thread overview] Message-ID: <11a9db0dda77749c865e864c81924c0ec578dd86.1519995673.git.shreeya.patel23498@gmail.com> (raw) In-Reply-To: <cover.1519995673.git.shreeya.patel23498@gmail.com> 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. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> --- 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. + */ *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. */ *val = 25000 / -470 - 0x4FE; return IIO_VAL_INT; case IIO_CHAN_INFO_CALIBBIAS: -- 2.7.4 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
WARNING: multiple messages have this Message-ID (diff)
From: Shreeya Patel <shreeya.patel23498@gmail.com> To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, daniel.baluta@gmail.com Cc: Shreeya Patel <shreeya.patel23498@gmail.com> Subject: [PATCH 5/6] Staging: iio: adis16209: Add some informatic comments Date: Fri, 2 Mar 2018 19:02:48 +0530 [thread overview] Message-ID: <11a9db0dda77749c865e864c81924c0ec578dd86.1519995673.git.shreeya.patel23498@gmail.com> (raw) In-Reply-To: <cover.1519995673.git.shreeya.patel23498@gmail.com> 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. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> --- 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. + */ *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. */ *val = 25000 / -470 - 0x4FE; return IIO_VAL_INT; case IIO_CHAN_INFO_CALIBBIAS: -- 2.7.4
next prev parent reply other threads:[~2018-03-02 13:32 UTC|newest] Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-02 13:16 [PATCH 0/6] adis16209 driver cleanup Shreeya Patel 2018-03-02 13:16 ` Shreeya Patel 2018-03-02 13:19 ` [PATCH 1/6] Staging: iio: adis16209: Arrange headers in alphabetical order Shreeya Patel 2018-03-02 13:19 ` Shreeya Patel 2018-03-03 15:39 ` Jonathan Cameron 2018-03-02 13:23 ` [PATCH 2/6] Staging: iio: adis16209: Change the definition name Shreeya Patel 2018-03-02 13:23 ` Shreeya Patel 2018-03-03 15:40 ` Jonathan Cameron 2018-03-03 15:40 ` Jonathan Cameron 2018-03-02 13:25 ` [PATCH 3/6] Staging: iio: adis16209: Add _REG postfix for registers Shreeya Patel 2018-03-02 13:25 ` Shreeya Patel 2018-03-03 15:42 ` Jonathan Cameron 2018-03-03 15:42 ` Jonathan Cameron 2018-03-02 13:28 ` [PATCH 4/6] Staging: iio: adis16209: Remove unnecessary comments and group the definitions Shreeya Patel 2018-03-02 13:28 ` Shreeya Patel 2018-03-03 15:57 ` Jonathan Cameron 2018-03-03 15:57 ` Jonathan Cameron 2018-03-02 13:32 ` Shreeya Patel [this message] 2018-03-02 13:32 ` [PATCH 5/6] Staging: iio: adis16209: Add some informatic comments Shreeya Patel 2018-03-03 16:01 ` Jonathan Cameron 2018-03-03 16:01 ` Jonathan Cameron 2018-03-03 15:33 ` Shreeya Patel 2018-03-02 13:34 ` [PATCH 6/6] Staging: iio: adis16209: Use sign_extend32 and adjust a switch statement Shreeya Patel 2018-03-02 13:34 ` Shreeya Patel 2018-03-03 16:05 ` Jonathan Cameron 2018-03-03 16:05 ` Jonathan Cameron 2018-03-03 15:37 ` Shreeya Patel 2018-03-03 16:16 ` Jonathan Cameron 2018-03-03 16:16 ` Jonathan Cameron
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=11a9db0dda77749c865e864c81924c0ec578dd86.1519995673.git.shreeya.patel23498@gmail.com \ --to=shreeya.patel23498@gmail.com \ --cc=Michael.Hennerich@analog.com \ --cc=daniel.baluta@gmail.com \ --cc=devel@driverdev.osuosl.org \ --cc=gregkh@linuxfoundation.org \ --cc=jic23@kernel.org \ --cc=knaack.h@gmx.de \ --cc=lars@metafoo.de \ --cc=linux-iio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=pmeerw@pmeerw.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.