From: Peter Meerwald <pmeerw@pmeerw.net>
To: linux-iio@vger.kernel.org
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Subject: [PATCH 3/5] iio:magnetometer:mag3110: Scale factor missing for temperature
Date: Fri, 10 Jan 2014 22:59:21 +0100 [thread overview]
Message-ID: <1389391163-9622-3-git-send-email-pmeerw@pmeerw.net> (raw)
In-Reply-To: <1389391163-9622-1-git-send-email-pmeerw@pmeerw.net>
temperature is reported in milli-Celsius
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/iio/magnetometer/mag3110.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
index f66955f..02e4f97 100644
--- a/drivers/iio/magnetometer/mag3110.c
+++ b/drivers/iio/magnetometer/mag3110.c
@@ -183,8 +183,17 @@ static int mag3110_read_raw(struct iio_dev *indio_dev,
return -EINVAL;
}
case IIO_CHAN_INFO_SCALE:
- *val = 0;
- *val2 = 1000;
+ switch (chan->type) {
+ case IIO_MAGN:
+ *val = 0;
+ *val2 = 1000;
+ return IIO_VAL_INT_PLUS_MICRO;
+ case IIO_TEMP:
+ *val = 1000;
+ return IIO_VAL_INT;
+ default:
+ return -EINVAL;
+ }
return IIO_VAL_INT_PLUS_MICRO;
case IIO_CHAN_INFO_SAMP_FREQ:
i = data->ctrl_reg1 >> MAG3110_CTRL_DR_SHIFT;
@@ -270,7 +279,8 @@ static const struct iio_chan_spec mag3110_channels[] = {
MAG3110_CHANNEL(Z, 2),
{
.type = IIO_TEMP,
- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
+ BIT(IIO_CHAN_INFO_SCALE),
.scan_index = 3,
.scan_type = {
.sign = 's',
--
1.8.3.2
next prev parent reply other threads:[~2014-01-10 21:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-10 21:59 [PATCH 1/5] iio:magnetometer:mag3110: Report busy in _read_raw() / write_raw() when buffer is enabled Peter Meerwald
2014-01-10 21:59 ` [PATCH 2/5] iio:magnetometer:mag3110: Fix output of decimal digits in show_int_plus_micros() Peter Meerwald
2014-01-11 12:14 ` Jonathan Cameron
2014-01-10 21:59 ` Peter Meerwald [this message]
2014-01-11 16:08 ` [PATCH 3/5] iio:magnetometer:mag3110: Scale factor missing for temperature Jonathan Cameron
2014-01-10 21:59 ` [PATCH 4/5] iio:magnetometer:mag3110: Fix initialization of ctrl_reg1 Peter Meerwald
2014-01-11 16:09 ` Jonathan Cameron
2014-01-10 21:59 ` [PATCH 5/5] iio:magnetometer:mag3110: Enable user offset calibration Peter Meerwald
2014-01-11 16:10 ` Jonathan Cameron
2014-01-11 12:07 ` [PATCH 1/5] iio:magnetometer:mag3110: Report busy in _read_raw() / write_raw() when buffer is enabled Jonathan Cameron
2014-01-11 12:13 ` 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=1389391163-9622-3-git-send-email-pmeerw@pmeerw.net \
--to=pmeerw@pmeerw.net \
--cc=linux-iio@vger.kernel.org \
/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).