From: Himanshu Jha <himanshujha199640@gmail.com>
To: jic23@kernel.org, linux-iio@vger.kernel.org
Cc: lars@metafoo.de, pmeerw@pmeerw.net, daniel.baluta@gmail.com,
Himanshu Jha <himanshujha199640@gmail.com>
Subject: [RFC 0/3] Bosch BME680 Driver
Date: Thu, 21 Jun 2018 12:04:34 +0530 [thread overview]
Message-ID: <1529562877-9357-1-git-send-email-himanshujha199640@gmail.com> (raw)
GSoC'2018 Project: https://summerofcode.withgoogle.com/projects/#6691473790074880
Mentor: Daniel Baluta
BME680 is a 4-in-1 sensor with temperature, pressure, humidity & gas sensor
with I2C and SPI interface support.
The sensor has various calibration parameters[1] to be used with raw adc data
in the compensation functions[2] to evaluate the correct compensated reading.
These calibration parameters are are programmed into the devices’ non-volatile
memory (NVM) during production and cannot be altered by the customer. So, we
are required to read those parameters once(suitably at probe) and use it
in the compensation functions.
But now the problem arises that these compensation functions, calibration
parameters, their addresses are *not* provided in the datasheet and instead
provided by Bosch Sensortec in their Github API[3]. The Github API has a LICENSE
file[4] around 40 lines which I presume kernel community won't entertain.
Therefore, we contacted Bosch Sensortec thrice 2 weeks ago and got no response
so far. We stated all the problems relating to Lincensing & missing calibration
info from the datasheet. I got to know about these missing information from the
Github API and also looking at the various sensors supplied by the company
such as BMP280, BME280 etc.
After using their compensation function in my driver I get correct readings.
But we can't simply use these function without their permission!
For instance:
I got a temperature reading of:
3254
and if this sensor has a similar resolution as that of BMP280 which 0.01 degC
then it is absolutely correct.
3254 * 0.01 = 32.54 degC
This 0.01 degC resolution was mentioned in the BMP280 datasheet but
there is no such information in the BME680 datasheet nor in the Github API.
This is what I have assumed since after testing pressure & humidity also
revealed similar readings and there is some possibilty that they could
have same output resolution as they belong to the same family of sensors.
For now I have placed the sensor in the IMU but this is not an IMU and there
is no such sensor(4-in-1) in the whole IIO subsystem. So, where should it
be placed ?
Would it be worthwhile to create a new subdirectory "environmental" since
it is a environmental sensor ?
The sensor also has an IIR filter to remove short term fluctuations from
the temperature and pressure readings. It has various filter coefficients
and I have chosen the middle valued coefficient(15) from the table for now.
What filter coefficient is most appropriate for the device ?
Again, I asked this question too from Bosch since they discuss all these
optimal selection of filter in "3.4 Filter selection" Pg 14 BMP280.
I have used regmap API and therefore we don't need the LSB address
of data registers as we only care about the MSB address of the data register
and regmap_bulk_read() handles everything fine.
So, would it be worthwhile to add these LSB macros definition too ?
They certainly will never be used!
For now, this series doesn't include any of the copyrighted code from
Bosch and I have just added them as a dummy function.
I have mentioned more detailed summary in my blog[5] and would love
any feedback on it.
If anyone has contacts to Bosch Sensortec GmbH then please let me
know.
[1] https://github.com/BoschSensortec/BME680_driver/blob/313a58a9c57ad86c8df06c98521579c6cb695999/bme680_defs.h#L410
[2] https://github.com/BoschSensortec/BME680_driver/blob/master/bme680.c#L876
[3] https://github.com/BoschSensortec/BME680_driver
[4] https://github.com/BoschSensortec/BME680_driver/blob/master/LICENSE
[5] https://himanshujha199640.wordpress.com/2018/06/14/0x01bme680-temperature-channel/
Himanshu Jha (3):
iio: imu: bme680: Add initial support for Bosch BME680
iio: imu: bme680: Add temperaure, pressure & humidity channels
iio: imu: bme680: Add ACPI support
drivers/iio/imu/Kconfig | 1 +
drivers/iio/imu/Makefile | 1 +
drivers/iio/imu/bme680/Kconfig | 32 +++
drivers/iio/imu/bme680/Makefile | 6 +
drivers/iio/imu/bme680/bme680.h | 11 +
drivers/iio/imu/bme680/bme680_core.c | 542 +++++++++++++++++++++++++++++++++++
drivers/iio/imu/bme680/bme680_i2c.c | 62 ++++
drivers/iio/imu/bme680/bme680_spi.c | 49 ++++
8 files changed, 704 insertions(+)
create mode 100644 drivers/iio/imu/bme680/Kconfig
create mode 100644 drivers/iio/imu/bme680/Makefile
create mode 100644 drivers/iio/imu/bme680/bme680.h
create mode 100644 drivers/iio/imu/bme680/bme680_core.c
create mode 100644 drivers/iio/imu/bme680/bme680_i2c.c
create mode 100644 drivers/iio/imu/bme680/bme680_spi.c
--
2.7.4
next reply other threads:[~2018-06-21 6:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-21 6:34 Himanshu Jha [this message]
2018-06-21 6:34 ` [RFC 1/3] iio: imu: bme680: Add initial support for Bosch BME680 Himanshu Jha
2018-06-21 13:23 ` Jonathan Cameron
2018-06-21 6:34 ` [RFC 2/3] iio: imu: bme680: Add temperaure, pressure & humidity channels Himanshu Jha
2018-06-22 13:42 ` Jonathan Cameron
2018-06-22 14:24 ` Himanshu Jha
2018-06-21 6:34 ` [RFC 3/3] iio: imu: bme680: Add ACPI support Himanshu Jha
2018-06-22 13:44 ` Jonathan Cameron
2018-06-25 7:40 ` Daniel Baluta
2018-06-25 10:06 ` Jonathan Cameron
2018-06-29 13:02 ` Daniel Baluta
2018-06-30 17:48 ` Jonathan Cameron
2018-06-22 6:38 ` [RFC 0/3] Bosch BME680 Driver Matt Ranostay
2018-06-22 9:04 ` Himanshu Jha
2018-06-22 14:24 ` Matt Ranostay
2018-06-22 14:01 ` Jonathan Cameron
2018-06-22 14:14 ` Himanshu Jha
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=1529562877-9357-1-git-send-email-himanshujha199640@gmail.com \
--to=himanshujha199640@gmail.com \
--cc=daniel.baluta@gmail.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--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).