From: Jonathan Cameron <jic23@kernel.org>
To: "Vianney le Clément de Saint-Marcq"
<vianney.leclement@essensium.com>,
linux-iio@vger.kernel.org, "Peter Meerwald" <pmeerw@pmeerw.net>
Cc: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
Subject: Re: [PATCH 3/7] iio: mlx90614: Add processed temperature output
Date: Mon, 09 Mar 2015 15:08:56 +0000 [thread overview]
Message-ID: <54FDB788.3050009@kernel.org> (raw)
In-Reply-To: <1424879712-28304-4-git-send-email-vianney.leclement@essensium.com>
On 25/02/15 15:55, Vianney le Clément de Saint-Marcq wrote:
> Provide processed temperature in milli-Celsius through the
> in_temp_*_input interface.
Why? It's trivial for userspace to do the conversion, so
why provide the additional interface? As a rule we don't provide
both as in general these sensors are wrapped up in a library that can
do the work more efficiently in userspace when needed.
J
>
> Also correct the formula in the comment as 1/20 = 0.05 instead of 0.02.
>
> Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com>
> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
> drivers/iio/temperature/mlx90614.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c
> index a2e3aa6..d5b41fd 100644
> --- a/drivers/iio/temperature/mlx90614.c
> +++ b/drivers/iio/temperature/mlx90614.c
> @@ -2,6 +2,7 @@
> * mlx90614.c - Support for Melexis MLX90614 contactless IR temperature sensor
> *
> * Copyright (c) 2014 Peter Meerwald <pmeerw@pmeerw.net>
> + * Copyright (c) 2015 Essensium NV
> *
> * This file is subject to the terms and conditions of version 2 of
> * the GNU General Public License. See the file COPYING in the main
> @@ -62,7 +63,8 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev,
> s32 ret;
>
> switch (mask) {
> - case IIO_CHAN_INFO_RAW: /* 0.02K / LSB */
> + case IIO_CHAN_INFO_RAW: /* 0.05K / LSB */
> + case IIO_CHAN_INFO_PROCESSED:
> switch (channel->channel2) {
> case IIO_MOD_TEMP_AMBIENT:
> ret = i2c_smbus_read_word_data(data->client,
> @@ -79,7 +81,14 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev,
> default:
> return -EINVAL;
> }
> - *val = ret;
> + switch (mask) {
> + case IIO_CHAN_INFO_RAW:
> + *val = ret;
> + break;
> + case IIO_CHAN_INFO_PROCESSED:
> + *val = ret * 20 - 273150;
> + break;
> + }
> return IIO_VAL_INT;
> case IIO_CHAN_INFO_OFFSET:
> *val = 13657;
> @@ -98,7 +107,8 @@ static const struct iio_chan_spec mlx90614_channels[] = {
> .type = IIO_TEMP,
> .modified = 1,
> .channel2 = IIO_MOD_TEMP_AMBIENT,
> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> + BIT(IIO_CHAN_INFO_PROCESSED),
> .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
> BIT(IIO_CHAN_INFO_SCALE),
> },
> @@ -106,7 +116,8 @@ static const struct iio_chan_spec mlx90614_channels[] = {
> .type = IIO_TEMP,
> .modified = 1,
> .channel2 = IIO_MOD_TEMP_OBJECT,
> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> + BIT(IIO_CHAN_INFO_PROCESSED),
> .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
> BIT(IIO_CHAN_INFO_SCALE),
> },
> @@ -170,5 +181,6 @@ static struct i2c_driver mlx90614_driver = {
> module_i2c_driver(mlx90614_driver);
>
> MODULE_AUTHOR("Peter Meerwald <pmeerw@pmeerw.net>");
> +MODULE_AUTHOR("Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com>");
> MODULE_DESCRIPTION("Melexis MLX90614 contactless IR temperature sensor driver");
> MODULE_LICENSE("GPL");
>
next prev parent reply other threads:[~2015-03-09 15:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 15:55 [PATCH 0/7] iio: mlx90614 enhancements Vianney le Clément de Saint-Marcq
2015-02-25 15:55 ` Vianney le Clément de Saint-Marcq
2015-02-25 15:55 ` [PATCH 1/7] iio: mlx90614: Refactor register symbols Vianney le Clément de Saint-Marcq
2015-03-09 15:02 ` Jonathan Cameron
2015-02-25 15:55 ` [PATCH 2/7] iio: mlx90614: Add symbols for accessible registers Vianney le Clément de Saint-Marcq
2015-02-25 15:55 ` [PATCH 3/7] iio: mlx90614: Add processed temperature output Vianney le Clément de Saint-Marcq
2015-03-09 15:08 ` Jonathan Cameron [this message]
2015-03-09 19:27 ` Vianney le Clément
2015-02-25 15:55 ` [PATCH 4/7] iio: mlx90614: Support devices with dual IR sensor Vianney le Clément de Saint-Marcq
2015-03-09 15:18 ` Jonathan Cameron
2015-03-09 19:35 ` Vianney le Clément
2015-02-25 15:55 ` [PATCH 5/7] iio: mlx90614: Allow tuning EEPROM configuration Vianney le Clément de Saint-Marcq
2015-03-09 15:35 ` Jonathan Cameron
2015-03-09 15:41 ` Jonathan Cameron
2015-03-09 16:45 ` Wolfram Sang
2015-03-09 17:02 ` Jonathan Cameron
2015-03-09 17:15 ` Wolfram Sang
2015-03-09 19:52 ` Vianney le Clément
2015-02-25 15:55 ` [PATCH 6/7] iio: mlx90614: Add power management Vianney le Clément de Saint-Marcq
2015-02-25 15:55 ` Vianney le Clément de Saint-Marcq
[not found] ` <1424879712-28304-7-git-send-email-vianney.leclement-buIOx9BAs4sybS5Ee8rs3A@public.gmane.org>
2015-03-09 15:39 ` Jonathan Cameron
2015-03-09 15:39 ` Jonathan Cameron
[not found] ` <54FDBEB7.8030403-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-03-09 15:42 ` Jonathan Cameron
2015-03-09 15:42 ` Jonathan Cameron
2015-03-09 16:43 ` Wolfram Sang
2015-03-09 16:43 ` Wolfram Sang
2015-03-12 10:30 ` Jonathan Cameron
2015-03-12 10:30 ` Jonathan Cameron
2015-02-25 15:55 ` [PATCH 7/7] iio: mlx90614: Provide raw IR value for object channels Vianney le Clément de Saint-Marcq
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=54FDB788.3050009@kernel.org \
--to=jic23@kernel.org \
--cc=arnout@mind.be \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=vianney.leclement@essensium.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.