diff options
author | Ludovic Tancerel <ludovic.tancerel@maplehightech.com> | 2015-10-01 17:13:41 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-10-11 12:21:21 +0300 |
commit | 1b75ce658775c9131ea6689ffadcde2663983b6c (patch) | |
tree | f62794af0230b78a085c8ee74bccb03ebad68a2b | |
parent | 64a70c6502111a2d5bd1dd5eddfa33039aa897b7 (diff) | |
download | linux-1b75ce658775c9131ea6689ffadcde2663983b6c.tar.xz |
Add ms8607 meas-spec driver support
Support for MS8607 temperature, pressure & humidity sensor.
This part is using functions from MS5637 for temperature and pressure
and HTU21 for humidity
Signed-off-by: Ludovic Tancerel <ludovic.tancerel@maplehightech.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-iio-meas-spec | 1 | ||||
-rw-r--r-- | drivers/iio/humidity/Kconfig | 2 | ||||
-rw-r--r-- | drivers/iio/humidity/htu21.c | 33 | ||||
-rw-r--r-- | drivers/iio/pressure/Kconfig | 2 | ||||
-rw-r--r-- | drivers/iio/pressure/ms5637.c | 6 |
5 files changed, 40 insertions, 4 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-iio-meas-spec b/Documentation/ABI/testing/sysfs-bus-iio-meas-spec index 6d47e548eee5..1a6265e92e2f 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio-meas-spec +++ b/Documentation/ABI/testing/sysfs-bus-iio-meas-spec @@ -5,3 +5,4 @@ Description: Reading returns either '1' or '0'. '1' means that the battery level supplied to sensor is below 2.25V. This ABI is available for tsys02d, htu21, ms8607 + This ABI is available for htu21, ms8607 diff --git a/drivers/iio/humidity/Kconfig b/drivers/iio/humidity/Kconfig index a7e5ee51e021..6a23698d347c 100644 --- a/drivers/iio/humidity/Kconfig +++ b/drivers/iio/humidity/Kconfig @@ -29,6 +29,8 @@ config HTU21 help If you say yes here you get support for the Measurement Specialties HTU21 humidity and temperature sensor. + This driver is also used for MS8607 temperature, pressure & humidity + sensor This driver can also be built as a module. If so, the module will be called htu21. diff --git a/drivers/iio/humidity/htu21.c b/drivers/iio/humidity/htu21.c index b7f8d0520dde..d1636a74980e 100644 --- a/drivers/iio/humidity/htu21.c +++ b/drivers/iio/humidity/htu21.c @@ -1,6 +1,7 @@ /* * htu21.c - Support for Measurement-Specialties * htu21 temperature & humidity sensor + * and humidity part of MS8607 sensor * * Copyright (c) 2014 Measurement-Specialties * @@ -10,6 +11,8 @@ * * Datasheet: * http://www.meas-spec.com/downloads/HTU21D.pdf + * Datasheet: + * http://www.meas-spec.com/downloads/MS8607-02BA01.pdf */ #include <linux/init.h> @@ -24,6 +27,11 @@ #define HTU21_RESET 0xFE +enum { + HTU21, + MS8607 +}; + static const int htu21_samp_freq[4] = { 20, 40, 70, 120 }; /* String copy of the above const for readability purpose */ static const char htu21_show_samp_freq[] = "20 40 70 120"; @@ -106,6 +114,18 @@ static const struct iio_chan_spec htu21_channels[] = { } }; +/* + * Meas Spec recommendation is to not read temperature + * on this driver part for MS8607 + */ +static const struct iio_chan_spec ms8607_channels[] = { + { + .type = IIO_HUMIDITYRELATIVE, + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_PROCESSED), + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), + } +}; + static ssize_t htu21_show_battery_low(struct device *dev, struct device_attribute *attr, char *buf) { @@ -188,8 +208,14 @@ static int htu21_probe(struct i2c_client *client, indio_dev->name = id->name; indio_dev->dev.parent = &client->dev; indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->channels = htu21_channels; - indio_dev->num_channels = ARRAY_SIZE(htu21_channels); + + if (id->driver_data == MS8607) { + indio_dev->channels = ms8607_channels; + indio_dev->num_channels = ARRAY_SIZE(ms8607_channels); + } else { + indio_dev->channels = htu21_channels; + indio_dev->num_channels = ARRAY_SIZE(htu21_channels); + } i2c_set_clientdata(client, indio_dev); @@ -206,7 +232,8 @@ static int htu21_probe(struct i2c_client *client, } static const struct i2c_device_id htu21_id[] = { - {"htu21", 0}, + {"htu21", HTU21}, + {"ms8607-humidity", MS8607}, {} }; diff --git a/drivers/iio/pressure/Kconfig b/drivers/iio/pressure/Kconfig index 9282ec4319fc..6f2e7c9ac23e 100644 --- a/drivers/iio/pressure/Kconfig +++ b/drivers/iio/pressure/Kconfig @@ -86,6 +86,8 @@ config MS5637 help If you say yes here you get support for the Measurement Specialties MS5637 pressure and temperature sensor. + This driver is also used for MS8607 temperature, pressure & humidity + sensor This driver can also be built as a module. If so, the module will be called ms5637. diff --git a/drivers/iio/pressure/ms5637.c b/drivers/iio/pressure/ms5637.c index e3ad9d39b966..e8d0e0da938d 100644 --- a/drivers/iio/pressure/ms5637.c +++ b/drivers/iio/pressure/ms5637.c @@ -1,5 +1,5 @@ /* - * ms5637.c - Support for Measurement-Specialties ms5637 + * ms5637.c - Support for Measurement-Specialties ms5637 and ms8607 * pressure & temperature sensor * * Copyright (c) 2015 Measurement-Specialties @@ -10,7 +10,10 @@ * * Datasheet: * http://www.meas-spec.com/downloads/MS5637-02BA03.pdf + * Datasheet: + * http://www.meas-spec.com/downloads/MS8607-02BA01.pdf */ + #include <linux/init.h> #include <linux/device.h> #include <linux/kernel.h> @@ -167,6 +170,7 @@ static int ms5637_probe(struct i2c_client *client, static const struct i2c_device_id ms5637_id[] = { {"ms5637", 0}, + {"ms8607-temppressure", 1}, {} }; |