Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: michael.hennerich@analog.com
Cc: linux-iio@vger.kernel.org, drivers@analog.com,
	device-drivers-devel@blackfin.uclinux.org
Subject: Re: [PATCH 5/6] IIO: GYRO: ADXRS450: Fix sign issues, properly shift results and limit values
Date: Fri, 29 Apr 2011 13:14:30 +0100	[thread overview]
Message-ID: <4DBAABA6.8090807@cam.ac.uk> (raw)
In-Reply-To: <1304074721-18159-5-git-send-email-michael.hennerich@analog.com>

On 04/29/11 11:58, michael.hennerich@analog.com wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
> 
> RATE and QUADRATURE_CORRECTION data is formatted as a twos complement number,
> and therefore must be handled as type signed short.
> 
> TEMP result should be properly shifted.
> 
> Dynamic Null Correction is a 10-bit signed number.
> 
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
>  drivers/staging/iio/gyro/adxrs450_core.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/iio/gyro/adxrs450_core.c b/drivers/staging/iio/gyro/adxrs450_core.c
> index d73acff..e71b91c 100644
> --- a/drivers/staging/iio/gyro/adxrs450_core.c
> +++ b/drivers/staging/iio/gyro/adxrs450_core.c
> @@ -126,7 +126,7 @@ static int adxrs450_spi_write_reg_16(struct device *dev,
>   * @dev: device associated with child of actual iio_dev
>   * @val: somewhere to pass back the value read
>   **/
> -static int adxrs450_spi_sensor_data(struct device *dev, u16 *val)
> +static int adxrs450_spi_sensor_data(struct device *dev, s16 *val)
>  {
>  	struct spi_message msg;
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> @@ -217,7 +217,7 @@ static ssize_t adxrs450_read_temp(struct device *dev,
>  			&t);
>  	if (ret)
>  		return ret;
> -	return sprintf(buf, "%d\n", t);
> +	return sprintf(buf, "%d\n", t >> 7);
>  }
>  
>  static ssize_t adxrs450_read_quad(struct device *dev,
> @@ -225,7 +225,7 @@ static ssize_t adxrs450_read_quad(struct device *dev,
>  		char *buf)
>  {
>  	int ret;
> -	u16 t;
> +	s16 t;
>  	ret = adxrs450_spi_read_reg_16(dev,
>  			ADXRS450_QUAD1,
>  			&t);
> @@ -247,7 +247,7 @@ static ssize_t adxrs450_write_dnc(struct device *dev,
>  		goto error_ret;
>  	ret = adxrs450_spi_write_reg_16(dev,
>  			ADXRS450_DNC1,
> -			val);
> +			val & 0x3FF);
>  error_ret:
>  	return ret ? ret : len;
>  }
> @@ -257,7 +257,7 @@ static ssize_t adxrs450_read_sensor_data(struct device *dev,
>  		char *buf)
>  {
>  	int ret;
> -	u16 t;
> +	s16 t;
>  
>  	ret = adxrs450_spi_sensor_data(dev, &t);
>  	if (ret)


  reply	other threads:[~2011-04-29 12:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29 10:58 [PATCH 1/6] IIO: GYRO: ADXRS450: Don't issue two messages, use two transfers michael.hennerich
2011-04-29 10:58 ` [PATCH 2/6] IIO: GYRO: ADXRS450: Cleanup result extraction and update license notice michael.hennerich
2011-04-29 12:08   ` Jonathan Cameron
2011-04-29 10:58 ` [PATCH 3/6] IIO: GYRO: ADXRS450: Add missing parity bit generation michael.hennerich
2011-04-29 12:09   ` Jonathan Cameron
2011-04-29 10:58 ` [PATCH 4/6] IIO: GYRO: ADXRS450: enforce sequential transfer delay of at least 0.1ms michael.hennerich
2011-04-29 12:12   ` Jonathan Cameron
2011-04-29 10:58 ` [PATCH 5/6] IIO: GYRO: ADXRS450: Fix sign issues, properly shift results and limit values michael.hennerich
2011-04-29 12:14   ` Jonathan Cameron [this message]
2011-04-29 10:58 ` [PATCH 6/6] IIO: GYRO: ADXRS450: Don't exit probe, in case the power on default is not met michael.hennerich
2011-04-29 12:15   ` Jonathan Cameron
2011-04-29 12:05 ` [PATCH 1/6] IIO: GYRO: ADXRS450: Don't issue two messages, use two transfers Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2011-04-29 12:16 michael.hennerich
2011-04-29 12:17 ` [PATCH 5/6] IIO: GYRO: ADXRS450: Fix sign issues, properly shift results and limit values michael.hennerich

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=4DBAABA6.8090807@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=device-drivers-devel@blackfin.uclinux.org \
    --cc=drivers@analog.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    /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