From: Himanshu Jha <himanshujha199640@gmail.com>
To: jic23@kernel.org
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
dpfrey@gmail.com, mike.looijmans@topic.nl,
Himanshu Jha <himanshujha199640@gmail.com>
Subject: [PATCH] iio: chemical: bme680: Fix pressure and humidity ABI mismatch
Date: Thu, 8 Aug 2019 21:13:50 +0530 [thread overview]
Message-ID: <20190808154350.9693-1-himanshujha199640@gmail.com> (raw)
Standard ABI for reporting pressure is kilopascal and for
relative humidity it is millipercent.
What: /sys/bus/iio/devices/iio:deviceX/in_pressureY_input
What: /sys/bus/iio/devices/iio:deviceX/in_pressure_input
KernelVersion: 3.8
Contact: linux-iio@vger.kernel.org
Description:
Scaled pressure measurement from channel Y, in kilopascal.
What: /sys/bus/iio/devices/iio:deviceX/in_humidityrelative_input
KernelVersion: 3.14
Contact: linux-iio@vger.kernel.org
Description:
Scaled humidity measurement in milli percent.
Currently pressure is reported in hectopascal(hPa) and relative humidity
in percent. Hence fix this ABI mismatch conforming to the standard ABI.
Fixes: 1b3bd8592780 ("iio: chemical: Add support for Bosch BME680 sensor")
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
While cleaning this mess I wonder about the gas channel and there
exists no `in_resistance_input` in standard ABI :-(
We only have:
What: /sys/bus/iio/devices/iio:deviceX/in_resistance_raw
What: /sys/bus/iio/devices/iio:deviceX/in_resistanceX_raw
What: /sys/bus/iio/devices/iio:deviceX/out_resistance_raw
What: /sys/bus/iio/devices/iio:deviceX/out_resistanceX_raw
KernelVersion: 4.3
Contact: linux-iio@vger.kernel.org
Description:
Raw (unscaled no offset etc.) resistance reading that can be processed
into an ohm value.
The sensor outputs processed value which is reported as is.
So, does it need a new ABI ?
drivers/iio/chemical/bme680_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
index ccde4c65ff93..28cc96d1e3c8 100644
--- a/drivers/iio/chemical/bme680_core.c
+++ b/drivers/iio/chemical/bme680_core.c
@@ -670,7 +670,7 @@ static int bme680_read_press(struct bme680_data *data,
}
*val = bme680_compensate_press(data, adc_press);
- *val2 = 100;
+ *val2 = 1000;
return IIO_VAL_FRACTIONAL;
}
@@ -704,7 +704,7 @@ static int bme680_read_humid(struct bme680_data *data,
comp_humidity = bme680_compensate_humid(data, adc_humidity);
*val = comp_humidity;
- *val2 = 1000;
+ *val2 = 1000000;
return IIO_VAL_FRACTIONAL;
}
--
2.17.1
next reply other threads:[~2019-08-08 15:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 15:43 Himanshu Jha [this message]
2019-08-11 8:32 ` 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=20190808154350.9693-1-himanshujha199640@gmail.com \
--to=himanshujha199640@gmail.com \
--cc=dpfrey@gmail.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.looijmans@topic.nl \
--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
all inboxes | Powered by JetHome®