diff options
Diffstat (limited to 'drivers/iio/chemical')
-rw-r--r-- | drivers/iio/chemical/Makefile | 2 | ||||
-rw-r--r-- | drivers/iio/chemical/atlas-sensor.c (renamed from drivers/iio/chemical/atlas-ph-sensor.c) | 24 |
2 files changed, 18 insertions, 8 deletions
diff --git a/drivers/iio/chemical/Makefile b/drivers/iio/chemical/Makefile index f97270bc4034..33d3a595dda9 100644 --- a/drivers/iio/chemical/Makefile +++ b/drivers/iio/chemical/Makefile @@ -4,7 +4,7 @@ # # When adding new entries keep the list in alphabetical order -obj-$(CONFIG_ATLAS_PH_SENSOR) += atlas-ph-sensor.o +obj-$(CONFIG_ATLAS_PH_SENSOR) += atlas-sensor.o obj-$(CONFIG_BME680) += bme680_core.o obj-$(CONFIG_BME680_I2C) += bme680_i2c.o obj-$(CONFIG_BME680_SPI) += bme680_spi.o diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-sensor.c index 6c175eb1c7a7..2f0a6fed2589 100644 --- a/drivers/iio/chemical/atlas-ph-sensor.c +++ b/drivers/iio/chemical/atlas-sensor.c @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * atlas-ph-sensor.c - Support for Atlas Scientific OEM pH-SM sensor + * atlas-sensor.c - Support for Atlas Scientific OEM SM sensors * - * Copyright (C) 2015-2018 Matt Ranostay + * Copyright (C) 2015-2019 Konsulko Group * Author: Matt Ranostay <matt.ranostay@konsulko.com> */ @@ -14,7 +14,6 @@ #include <linux/err.h> #include <linux/irq.h> #include <linux/irq_work.h> -#include <linux/gpio.h> #include <linux/i2c.h> #include <linux/of_device.h> #include <linux/regmap.h> @@ -25,8 +24,8 @@ #include <linux/iio/triggered_buffer.h> #include <linux/pm_runtime.h> -#define ATLAS_REGMAP_NAME "atlas_ph_regmap" -#define ATLAS_DRV_NAME "atlas_ph" +#define ATLAS_REGMAP_NAME "atlas_regmap" +#define ATLAS_DRV_NAME "atlas" #define ATLAS_REG_DEV_TYPE 0x00 #define ATLAS_REG_DEV_VERSION 0x01 @@ -87,6 +86,16 @@ static const struct regmap_config atlas_regmap_config = { .val_bits = 8, }; +static int atlas_buffer_num_channels(const struct iio_chan_spec *spec) +{ + int idx = 0; + + for (; spec->type != IIO_TIMESTAMP; spec++) + idx++; + + return idx; +}; + static const struct iio_chan_spec atlas_ph_channels[] = { { .type = IIO_PH, @@ -355,11 +364,12 @@ static irqreturn_t atlas_trigger_handler(int irq, void *private) struct iio_poll_func *pf = private; struct iio_dev *indio_dev = pf->indio_dev; struct atlas_data *data = iio_priv(indio_dev); + int channels = atlas_buffer_num_channels(data->chip->channels); int ret; ret = regmap_bulk_read(data->regmap, data->chip->data_reg, (u8 *) &data->buffer, - sizeof(__be32) * (data->chip->num_channels - 2)); + sizeof(__be32) * channels); if (!ret) iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, @@ -681,5 +691,5 @@ static struct i2c_driver atlas_driver = { module_i2c_driver(atlas_driver); MODULE_AUTHOR("Matt Ranostay <matt.ranostay@konsulko.com>"); -MODULE_DESCRIPTION("Atlas Scientific pH-SM sensor"); +MODULE_DESCRIPTION("Atlas Scientific SM sensors"); MODULE_LICENSE("GPL"); |