From: Jonathan Cameron <jic23@kernel.org>
To: Matt Ranostay <mranostay@gmail.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: hdc100x: correct IIO_CHAN_INFO_OFFSET value
Date: Sun, 27 Sep 2015 14:29:52 +0100 [thread overview]
Message-ID: <5607EF50.6020102@kernel.org> (raw)
In-Reply-To: <1443334737-3772-1-git-send-email-mranostay@gmail.com>
On 27/09/15 07:18, Matt Ranostay wrote:
> Previous offset wasn't applied in the correct order and invalid.
> This patchset fixes this issue, and also has the correct scale value
> applied to the offset.
>
> Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Oops, missed that.
Given it's provided in the datasheet as effectively a fractional value
would val = -40000, val2 = 65536 and type = IIO_FRACTIONAL not be cleaner
and give the same answer?
Speaking of which, for the scale are we loosing any precision by shifting
the bottom of the fraction right 2 rather than the top left 2 which would have
the same result?
Jonathan
> ---
> drivers/iio/humidity/hdc100x.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c
> index 2824578..a7f61e8 100644
> --- a/drivers/iio/humidity/hdc100x.c
> +++ b/drivers/iio/humidity/hdc100x.c
> @@ -221,8 +221,9 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev,
> }
> break;
> case IIO_CHAN_INFO_OFFSET:
> - *val = -40;
> - return IIO_VAL_INT;
> + *val = -3971;
> + *val2 = 879096;
> + return IIO_VAL_INT_PLUS_MICRO;
> default:
> return -EINVAL;
> }
>
next prev parent reply other threads:[~2015-09-27 13:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-27 6:18 [PATCH] iio: hdc100x: correct IIO_CHAN_INFO_OFFSET value Matt Ranostay
2015-09-27 13:29 ` Jonathan Cameron [this message]
2015-09-27 22:35 ` Matt Ranostay
2015-09-28 9:08 ` Jonathan Cameron
2015-09-29 4:19 ` Matt Ranostay
2015-09-29 6:21 ` Matt Ranostay
2015-09-29 17:30 ` Jonathan Cameron
2015-09-29 17:33 ` Jonathan Cameron
2015-10-05 5:57 ` Matt Ranostay
2015-10-11 12:53 ` 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=5607EF50.6020102@kernel.org \
--to=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=mranostay@gmail.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;
as well as URLs for NNTP newsgroup(s).