From: "Vianney le Clément de Saint-Marcq" <vianney.leclement@essensium.com>
To: linux-iio@vger.kernel.org, Peter Meerwald <pmeerw@pmeerw.net>
Cc: "Vianney le Clément de Saint-Marcq"
<vianney.leclement@essensium.com>,
"Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
Subject: [PATCH 7/7] iio: mlx90614: Provide raw IR value for object channels
Date: Wed, 25 Feb 2015 16:55:12 +0100 [thread overview]
Message-ID: <1424879712-28304-8-git-send-email-vianney.leclement@essensium.com> (raw)
In-Reply-To: <1424879712-28304-1-git-send-email-vianney.leclement@essensium.com>
The unit and interpretation of the raw IR value is unspecified.
Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
This patch is a RFC. The raw IR value could be used to implement custom
signal processing in userspace if sampled at a high enough rate. Not
sure whether it is relevant for mainline though.
---
drivers/iio/temperature/mlx90614.c | 40 ++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c
index 49c517a..b3771c5 100644
--- a/drivers/iio/temperature/mlx90614.c
+++ b/drivers/iio/temperature/mlx90614.c
@@ -214,6 +214,36 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev,
}
}
+static ssize_t mlx90614_read_raw_ir(struct iio_dev *indio_dev,
+ uintptr_t priv,
+ struct iio_chan_spec const *channel,
+ char *buf)
+{
+ struct mlx90614_data *data = iio_priv(indio_dev);
+ u8 cmd;
+ s32 ret;
+
+ switch (channel->channel) {
+ case 0:
+ cmd = MLX90614_RAW1;
+ break;
+ case 1:
+ cmd = MLX90614_RAW2;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ mlx90614_power_get(data, true);
+ ret = i2c_smbus_read_word_data(data->client, cmd);
+ mlx90614_power_put(data);
+
+ if (ret < 0)
+ return ret;
+
+ return scnprintf(buf, PAGE_SIZE, "0x%04x\n", ret);
+}
+
static ssize_t mlx90614_show_emissivity(struct device *dev,
struct device_attribute *devattr,
char *buf)
@@ -318,6 +348,14 @@ out:
return count;
}
+static const struct iio_chan_spec_ext_info mlx90614_channel_obj_ext[] = {
+ {
+ .name = "raw_ir",
+ .read = mlx90614_read_raw_ir,
+ },
+ { }
+};
+
static const struct iio_chan_spec mlx90614_channels[] = {
{
.type = IIO_TEMP,
@@ -336,6 +374,7 @@ static const struct iio_chan_spec mlx90614_channels[] = {
BIT(IIO_CHAN_INFO_PROCESSED),
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
BIT(IIO_CHAN_INFO_SCALE),
+ .ext_info = mlx90614_channel_obj_ext,
},
{
.type = IIO_TEMP,
@@ -358,6 +397,7 @@ static const struct iio_chan_spec mlx90614_channels[] = {
BIT(IIO_CHAN_INFO_PROCESSED),
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
BIT(IIO_CHAN_INFO_SCALE),
+ .ext_info = mlx90614_channel_obj_ext,
},
};
--
2.3.0
prev parent reply other threads:[~2015-02-25 15:55 UTC|newest]
Thread overview: 23+ 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 ` [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
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-03-09 15:39 ` Jonathan Cameron
2015-03-09 15:42 ` Jonathan Cameron
2015-03-09 16:43 ` Wolfram Sang
2015-03-12 10:30 ` Jonathan Cameron
2015-02-25 15:55 ` Vianney le Clément de Saint-Marcq [this message]
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=1424879712-28304-8-git-send-email-vianney.leclement@essensium.com \
--to=vianney.leclement@essensium.com \
--cc=arnout@mind.be \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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).