All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: linux-iio@vger.kernel.org, s.nawrocki@samsun.com,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH 1/2] iio: lps331ap: Fix wrong in_pressure_scale output value
Date: Tue, 16 Jul 2013 08:51:40 +0100	[thread overview]
Message-ID: <51E4FB8C.1000609@kernel.org> (raw)
In-Reply-To: <1372760003-32090-2-git-send-email-j.anaszewski@samsung.com>

On 07/02/2013 11:13 AM, Jacek Anaszewski wrote:
> This patch fixes improper in_pressure_scale output that is
> returned by the lps331ap barometer sensor driver. According
> to the documentation the pressure after applying the scale has to
> be expressed in kilopascal units. With erroneous implementation
> the scale value larger by two orders of magnitude is returned -
> 2441410 instead of 24414.
> 
> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Applied to the fixes-togreg branch of iio.git

Patch 2 doesn't want to go in as a fix so I may end up holding that
one for a while until I can apply it without a whole pile of merge
conflicts.

Jonathan
> ---
>  drivers/iio/pressure/st_pressure_core.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index aacea2a..89eb40a 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -28,7 +28,9 @@
>  #include <linux/iio/common/st_sensors.h>
>  #include "st_pressure.h"
>  
> -#define ST_PRESS_MBAR_TO_KPASCAL(x)		(x * 10)
> +#define ST_PRESS_LSB_PER_MBAR			4096UL
> +#define ST_PRESS_KPASCAL_NANO_SCALE		(100000000UL / \
> +						 ST_PRESS_LSB_PER_MBAR)
>  #define ST_PRESS_NUMBER_DATA_CHANNELS		1
>  
>  /* DEFAULT VALUE FOR SENSORS */
> @@ -51,8 +53,8 @@
>  #define ST_PRESS_1_FS_ADDR			0x23
>  #define ST_PRESS_1_FS_MASK			0x30
>  #define ST_PRESS_1_FS_AVL_1260_VAL		0x00
> -#define ST_PRESS_1_FS_AVL_1260_GAIN		ST_PRESS_MBAR_TO_KPASCAL(244141)
>  #define ST_PRESS_1_FS_AVL_TEMP_GAIN		2083000
> +#define ST_PRESS_1_FS_AVL_1260_GAIN		ST_PRESS_KPASCAL_NANO_SCALE
>  #define ST_PRESS_1_BDU_ADDR			0x20
>  #define ST_PRESS_1_BDU_MASK			0x04
>  #define ST_PRESS_1_DRDY_IRQ_ADDR		0x22
> 

  reply	other threads:[~2013-07-16  7:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 10:13 [PATCH 0/2] Fix erroneous pressure scaling for the lps331ap driver Jacek Anaszewski
2013-07-02 10:13 ` [PATCH 1/2] iio: lps331ap: Fix wrong in_pressure_scale output value Jacek Anaszewski
2013-07-16  7:51   ` Jonathan Cameron [this message]
2013-07-02 10:13 ` [PATCH 2/2] iio: lps331ap: Modify in_temp_scale calculation way Jacek Anaszewski
2013-08-03 18:01   ` Jonathan Cameron
2013-07-02 11:06 ` [PATCH 0/2] Fix erroneous pressure scaling for the lps331ap driver Jacek Anaszewski
2013-07-13 13:35   ` 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=51E4FB8C.1000609@kernel.org \
    --to=jic23@kernel.org \
    --cc=j.anaszewski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=s.nawrocki@samsun.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 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.