From: Jonathan Cameron <jic23@kernel.org>
To: Himanshu Jha <himanshujha199640@gmail.com>
Cc: devel@driverdev.osuosl.org, daniel.baluta@gmail.com,
lars@metafoo.de, Michael.Hennerich@analog.com,
linux-iio@vger.kernel.org, gregkh@linuxfoundation.org,
21cnbao@gmail.com, linux-kernel@vger.kernel.org,
pmeerw@pmeerw.net
Subject: Re: [PATCH v2 5/9] Staging: iio: accel: adis16201: Add comments about units in read_raw()
Date: Sun, 18 Mar 2018 08:32:21 +0000 [thread overview]
Message-ID: <20180318083221.513c18c0@archlinux> (raw)
In-Reply-To: <1521230786-18155-6-git-send-email-himanshujha199640@gmail.com>
On Sat, 17 Mar 2018 01:36:22 +0530
Himanshu Jha <himanshujha199640@gmail.com> wrote:
> Clarify the conversion and formation of resultant data in the
> adis16201_read_raw() with sufficient comments and remove the unnecessary
> comments.
>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
It is a little illogical to have comments for all but one of the channels, but
given we don't normally comment them unless they are 'odd', this is fine.
Applied, thanks
Jonathan
> ---
> v2:
> -clarify voltage base conversions.
>
> drivers/staging/iio/accel/adis16201.c | 27 ++++++++++++++++++---------
> 1 file changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/iio/accel/adis16201.c b/drivers/staging/iio/accel/adis16201.c
> index 8de3f27..97150ea 100644
> --- a/drivers/staging/iio/accel/adis16201.c
> +++ b/drivers/staging/iio/accel/adis16201.c
> @@ -120,31 +120,43 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
> switch (chan->type) {
> case IIO_VOLTAGE:
> if (chan->channel == 0) {
> + /* Voltage base units are mV hence 1.22 mV */
> *val = 1;
> - *val2 = 220000; /* 1.22 mV */
> + *val2 = 220000;
> } else {
> + /* Voltage base units are mV hence 0.61 mV */
> *val = 0;
> - *val2 = 610000; /* 0.610 mV */
> + *val2 = 610000;
> }
> return IIO_VAL_INT_PLUS_MICRO;
> case IIO_TEMP:
> - *val = -470; /* 0.47 C */
> + *val = -470;
> *val2 = 0;
> return IIO_VAL_INT_PLUS_MICRO;
> case IIO_ACCEL:
> + /*
> + * IIO base unit for sensitivity of accelerometer
> + * is milli g.
> + * 1 LSB represents 0.244 mg.
> + */
> *val = 0;
> - *val2 = IIO_G_TO_M_S_2(462400); /* 0.4624 mg */
> + *val2 = IIO_G_TO_M_S_2(462400);
> return IIO_VAL_INT_PLUS_NANO;
> case IIO_INCLI:
> *val = 0;
> - *val2 = 100000; /* 0.1 degree */
> + *val2 = 100000;
> return IIO_VAL_INT_PLUS_MICRO;
> default:
> return -EINVAL;
> }
> break;
> case IIO_CHAN_INFO_OFFSET:
> - *val = 25000 / -470 - 1278; /* 25 C = 1278 */
> + /*
> + * The raw ADC value is 1278 when the temperature
> + * is 25 degrees and the scale factor per milli
> + * degree celcius is -470.
> + */
> + *val = 25000 / -470 - 1278;
> return IIO_VAL_INT;
> case IIO_CHAN_INFO_CALIBBIAS:
> switch (chan->type) {
> @@ -252,13 +264,11 @@ static int adis16201_probe(struct spi_device *spi)
> struct adis *st;
> struct iio_dev *indio_dev;
>
> - /* setup the industrialio driver allocated elements */
> indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> if (!indio_dev)
> return -ENOMEM;
>
> st = iio_priv(indio_dev);
> - /* this is only used for removal purposes */
> spi_set_drvdata(spi, indio_dev);
>
> indio_dev->name = spi->dev.driver->name;
> @@ -277,7 +287,6 @@ static int adis16201_probe(struct spi_device *spi)
> if (ret)
> return ret;
>
> - /* Get the device into a sane initial state */
> ret = adis_initial_startup(st);
> if (ret)
> goto error_cleanup_buffer_trigger;
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2018-03-18 8:32 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-16 20:06 [PATCH v2 0/9] Staging: iio: accel: adis16201 driver cleanup Himanshu Jha
2018-03-16 20:06 ` [PATCH v2 1/9] Staging: iio: accel: adis16201: Rename few macro definitions Himanshu Jha
2018-03-18 8:19 ` Jonathan Cameron
2018-03-16 20:06 ` [PATCH v2 2/9] Staging: iio: accel: adis16201: Remove unnecessary comments Himanshu Jha
2018-03-18 8:22 ` Jonathan Cameron
2018-03-16 20:06 ` [PATCH v2 3/9] Staging: iio: accel: adis16201: Add _REG suffix to reisters Himanshu Jha
2018-03-18 8:24 ` Jonathan Cameron
2018-03-16 20:06 ` [PATCH v2 4/9] Staging: iio: accel: adis16201: Group register definitions Himanshu Jha
2018-03-18 8:29 ` Jonathan Cameron
2018-03-16 20:06 ` [PATCH v2 5/9] Staging: iio: accel: adis16201: Add comments about units in read_raw() Himanshu Jha
2018-03-18 8:32 ` Jonathan Cameron [this message]
2018-03-16 20:06 ` [PATCH v2 6/9] Staging: iio: accel: adis16201: Use sign_extend32 function Himanshu Jha
2018-03-18 8:33 ` Jonathan Cameron
2018-03-16 20:06 ` [PATCH v2 7/9] Staging: iio: accel: adis16201: Prefer reverse christmas tree ordering Himanshu Jha
2018-03-18 8:34 ` Jonathan Cameron
2018-03-16 20:06 ` [PATCH v2 8/9] Staging: iio: accel: adis16201: Adjust argument to match open parentheses Himanshu Jha
2018-03-18 8:35 ` Jonathan Cameron
2018-03-16 20:06 ` [PATCH v2 9/9] Staging: iio: accel: adis16201: Move adis16201 driver out of staging Himanshu Jha
2018-03-18 9:31 ` Jonathan Cameron
2018-03-22 19:12 ` [PATCH 1/4] Staging: iio: accel: adis16201: Remove unused headers Himanshu Jha
2018-03-22 19:12 ` [PATCH 2/4] Staging: iio: accel: adis16201: Use GENMASK Himanshu Jha
2018-03-24 14:16 ` Jonathan Cameron
2018-03-22 19:12 ` [PATCH 3/4] Staging: iio: accel: adis16201: Fix 80 character line limit Himanshu Jha
2018-03-24 14:16 ` Jonathan Cameron
2018-03-22 19:12 ` [PATCH 4/4] Staging: iio: accel: adis16201: Move adis16201 driver out of staging Himanshu Jha
2018-03-24 14:26 ` Jonathan Cameron
2018-03-23 13:32 ` [PATCH 1/4] Staging: iio: accel: adis16201: Remove unused headers Jonathan Cameron
2018-03-24 14:15 ` 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=20180318083221.513c18c0@archlinux \
--to=jic23@kernel.org \
--cc=21cnbao@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=daniel.baluta@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=himanshujha199640@gmail.com \
--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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).