All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@cam.ac.uk>,
	linux-iio@vger.kernel.org, drivers@analog.com
Subject: Re: [PATCH 05/11] staging:iio: Fix adis16209 channel offsets and scales
Date: Thu, 18 Oct 2012 10:09:55 +0100	[thread overview]
Message-ID: <507FC763.4020709@kernel.org> (raw)
In-Reply-To: <1350293734-21951-5-git-send-email-lars@metafoo.de>

On 10/15/2012 10:35 AM, Lars-Peter Clausen wrote:
> Most of the channel offsets and scales in the adis16209 are incorrect:
> 	* Temperature scale is of by a factor of 1000
> 	* Voltage scale is of by a factor of 1000
> 	* Temperature offset is completely wrong
> 	* Rotational position scale is missing
> 
> This patch fixes these issues. Also use the IIO_G_TO_M_S_2 macro for the
> acceleration scale since this makes it much easier to compare it with the value
> given in the datasheet.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Applied to fixes-togreg branch of iio.git
> ---
>  drivers/staging/iio/accel/adis16209_core.c |   18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c
> index b7333bf..7ee974b 100644
> --- a/drivers/staging/iio/accel/adis16209_core.c
> +++ b/drivers/staging/iio/accel/adis16209_core.c
> @@ -343,28 +343,29 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
>  		case IIO_VOLTAGE:
>  			*val = 0;
>  			if (chan->channel == 0)
> -				*val2 = 305180;
> +				*val2 = 305180; /* 0.30518 mV */
>  			else
> -				*val2 = 610500;
> +				*val2 = 610500; /* 0.6105 mV */
>  			return IIO_VAL_INT_PLUS_MICRO;
>  		case IIO_TEMP:
> -			*val = 0;
> -			*val2 = -470000;
> +			*val = -470; /* -0.47 C */
> +			*val2 = 0;
>  			return IIO_VAL_INT_PLUS_MICRO;
>  		case IIO_ACCEL:
>  			*val = 0;
> -			*val2 = 2394;
> -			return IIO_VAL_INT_PLUS_MICRO;
> +			*val2 = IIO_G_TO_M_S_2(244140); /* 0.244140 mg */
> +			return IIO_VAL_INT_PLUS_NANO;
>  		case IIO_INCLI:
> +		case IIO_ROT:
>  			*val = 0;
> -			*val2 = 436;
> +			*val2 = 25000; /* 0.025 degree */
>  			return IIO_VAL_INT_PLUS_MICRO;
>  		default:
>  			return -EINVAL;
>  		}
>  		break;
>  	case IIO_CHAN_INFO_OFFSET:
> -		*val = 25;
> +		*val = 25000 / -470 - 0x4FE; /* 25 C = 0x4FE */
>  		return IIO_VAL_INT;
>  	case IIO_CHAN_INFO_CALIBBIAS:
>  		switch (chan->type) {
> @@ -491,6 +492,7 @@ static const struct iio_chan_spec adis16209_channels[] = {
>  		.modified = 1,
>  		.channel2 = IIO_MOD_X,
>  		.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT,
> +		IIO_CHAN_INFO_SCALE_SHARED_BIT,
>  		.address = rot,
>  		.scan_index = ADIS16209_SCAN_ROT,
>  		.scan_type = {
> 

  reply	other threads:[~2012-10-19  5:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15  9:35 [PATCH 01/11] iio: Add some helper macros for unit conversion Lars-Peter Clausen
2012-10-15  9:35 ` [PATCH 02/11] staging:iio: Fix adis16201 channel offsets and scales Lars-Peter Clausen
2012-10-18  9:06   ` Jonathan Cameron
2012-10-15  9:35 ` [PATCH 03/11] staging:iio: Fix adis16203 " Lars-Peter Clausen
2012-10-18  9:07   ` Jonathan Cameron
2012-10-15  9:35 ` [PATCH 04/11] " Lars-Peter Clausen
2012-10-15  9:42   ` Lars-Peter Clausen
2012-10-18  9:07     ` Jonathan Cameron
2012-10-15  9:35 ` [PATCH 05/11] staging:iio: Fix adis16209 " Lars-Peter Clausen
2012-10-18  9:09   ` Jonathan Cameron [this message]
2012-10-15  9:35 ` [PATCH 06/11] staging:iio: Fix adis16220 " Lars-Peter Clausen
2012-10-15  9:35 ` [PATCH 07/11] staging:iio: Fix adis16240 " Lars-Peter Clausen
2012-10-15  9:35 ` [PATCH 08/11] staging:iio: Fix adis16260 " Lars-Peter Clausen
2012-10-15  9:35 ` [PATCH 09/11] staging:iio: Fix adis16400 " Lars-Peter Clausen
2012-10-15  9:35 ` [PATCH 10/11] staging:iio:adis16400: Report correct temperature scale and offset Lars-Peter Clausen
2012-10-15  9:35 ` [PATCH 11/11] staging:iio:adis16400: Fixup adis16336 temp channel attributes Lars-Peter Clausen
2012-10-18  8:57 ` [PATCH 01/11] iio: Add some helper macros for unit conversion 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=507FC763.4020709@kernel.org \
    --to=jic23@kernel.org \
    --cc=drivers@analog.com \
    --cc=jic23@cam.ac.uk \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /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 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.