mirror of
https://github.com/t2linux/kernel.git
synced 2026-08-16 05:22:11 -07:00
Merge tag 'iio-for-4.4b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: Second set of new drivers, functionality and cleanups for IIO in the 4.4 cycle. Core stuff * adjust resistance documentation to allow for output devices. New device support: * bmc150 - split the i2c driver up into a core and i2c_regmap part including regmap conversion. - add spi support. * mcp4531 digitial potentiometer driver. * Measurement Specialties set of drivers with a core library module providing common functionality. Note that the htu21 has a driver in hwmon, but the view from that side was that, given the range of devices the same silicon turns up in are not all typical hwmon material, that driver would be deprecated in favour of this new support. - ms8607 temperature, pressure and humidty sensor - ms5637 temperature and pressure sensor - htu21 temperature and humidity sensor - tsys02d temperature sensor - tsys01 temperature sensor Cleanups * tree wide. - squish cases where irq 0 is still considered valid. * apds9960 - sparse endian warning cleanups by making endianness explicit. * ad5504 - leave group naming to the core. * ad7746 - cleanup comment style. - drop an unnecessary bit of dev_info - add some appropriate uses of the BIT macro. * ad799x - leave group naming to the core. * hdc100x - introduced this cycle,. - fix a wrong offset value. * lidar - add missing MODULE_DEVICE_TABLE for dt. * max1363 - leave sysfs group naming to the core. * m62332 got the Harmut treatment and as ever he found a 'few' bits the rest of us had missed! - Share scale and offset attributes across channels. - Shutdown the device on driver remove - Use ARRAY_SIZE rather than a hard coded count for channels. - Return more directly in the write_raw callback dropping a local variable along the way. - a few style issues - move to reading the regulator voltage for each use allowing for dynamic regulators. This is a common feature across drivers so we might end up with more fixes throughout the tree for this. * mlx96014 - introduced this cycle. - fixed up a spot of error handling. * vz89x - introduced this cycle. - work around a hardware quirk.
This commit is contained in:
@@ -1474,8 +1474,20 @@ Description:
|
||||
|
||||
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.
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/heater_enable
|
||||
KernelVersion: 4.1.0
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
'1' (enable) or '0' (disable) specifying the enable
|
||||
of heater function. Same reading values apply
|
||||
This ABI is especially applicable for humidity sensors
|
||||
to heatup the device and get rid of any condensation
|
||||
in some humidity environment
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
What: /sys/bus/iio/devices/iio:deviceX/battery_low
|
||||
KernelVersion: 4.1.0
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
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
|
||||
@@ -6682,6 +6682,12 @@ W: http://linuxtv.org
|
||||
S: Maintained
|
||||
F: drivers/media/radio/radio-maxiradio*
|
||||
|
||||
MCP4531 MICROCHIP DIGITAL POTENTIOMETER DRIVER
|
||||
M: Peter Rosin <peda@axentia.se>
|
||||
L: linux-iio@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/iio/potentiometer/mcp4531.c
|
||||
|
||||
MEDIA DRIVERS FOR RENESAS - VSP1
|
||||
M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
||||
L: linux-media@vger.kernel.org
|
||||
|
||||
@@ -60,6 +60,7 @@ source "drivers/iio/orientation/Kconfig"
|
||||
if IIO_TRIGGER
|
||||
source "drivers/iio/trigger/Kconfig"
|
||||
endif #IIO_TRIGGER
|
||||
source "drivers/iio/potentiometer/Kconfig"
|
||||
source "drivers/iio/pressure/Kconfig"
|
||||
source "drivers/iio/proximity/Kconfig"
|
||||
source "drivers/iio/temperature/Kconfig"
|
||||
|
||||
@@ -23,6 +23,7 @@ obj-y += imu/
|
||||
obj-y += light/
|
||||
obj-y += magnetometer/
|
||||
obj-y += orientation/
|
||||
obj-y += potentiometer/
|
||||
obj-y += pressure/
|
||||
obj-y += proximity/
|
||||
obj-y += temperature/
|
||||
|
||||
@@ -19,19 +19,27 @@ config BMA180
|
||||
|
||||
config BMC150_ACCEL
|
||||
tristate "Bosch BMC150 Accelerometer Driver"
|
||||
depends on I2C
|
||||
select IIO_BUFFER
|
||||
select IIO_TRIGGERED_BUFFER
|
||||
select REGMAP
|
||||
select BMC150_ACCEL_I2C if I2C
|
||||
select BMC150_ACCEL_SPI if SPI
|
||||
help
|
||||
Say yes here to build support for the following Bosch accelerometers:
|
||||
BMC150, BMI055, BMA250E, BMA222E, BMA255, BMA280.
|
||||
|
||||
Currently this only supports the device via an i2c interface.
|
||||
|
||||
This is a combo module with both accelerometer and magnetometer.
|
||||
This driver is only implementing accelerometer part, which has
|
||||
its own address and register map.
|
||||
|
||||
config BMC150_ACCEL_I2C
|
||||
tristate
|
||||
select REGMAP_I2C
|
||||
|
||||
config BMC150_ACCEL_SPI
|
||||
tristate
|
||||
select REGMAP_SPI
|
||||
|
||||
config HID_SENSOR_ACCEL_3D
|
||||
depends on HID_SENSOR_HUB
|
||||
select IIO_BUFFER
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
|
||||
# When adding new entries keep the list in alphabetical order
|
||||
obj-$(CONFIG_BMA180) += bma180.o
|
||||
obj-$(CONFIG_BMC150_ACCEL) += bmc150-accel.o
|
||||
obj-$(CONFIG_BMC150_ACCEL) += bmc150-accel-core.o
|
||||
obj-$(CONFIG_BMC150_ACCEL_I2C) += bmc150-accel-i2c.o
|
||||
obj-$(CONFIG_BMC150_ACCEL_SPI) += bmc150-accel-spi.o
|
||||
obj-$(CONFIG_HID_SENSOR_ACCEL_3D) += hid-sensor-accel-3d.o
|
||||
obj-$(CONFIG_KXCJK1013) += kxcjk-1013.o
|
||||
obj-$(CONFIG_KXSD9) += kxsd9.o
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 3-axis accelerometer driver supporting following I2C Bosch-Sensortec chips:
|
||||
* - BMC150
|
||||
* - BMI055
|
||||
* - BMA255
|
||||
* - BMA250E
|
||||
* - BMA222E
|
||||
* - BMA280
|
||||
*
|
||||
* Copyright (c) 2014, Intel Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include "bmc150-accel.h"
|
||||
|
||||
static const struct regmap_config bmc150_i2c_regmap_conf = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
};
|
||||
|
||||
static int bmc150_accel_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct regmap *regmap;
|
||||
const char *name = NULL;
|
||||
bool block_supported =
|
||||
i2c_check_functionality(client->adapter, I2C_FUNC_I2C) ||
|
||||
i2c_check_functionality(client->adapter,
|
||||
I2C_FUNC_SMBUS_READ_I2C_BLOCK);
|
||||
|
||||
regmap = devm_regmap_init_i2c(client, &bmc150_i2c_regmap_conf);
|
||||
if (IS_ERR(regmap)) {
|
||||
dev_err(&client->dev, "Failed to initialize i2c regmap\n");
|
||||
return PTR_ERR(regmap);
|
||||
}
|
||||
|
||||
if (id)
|
||||
name = id->name;
|
||||
|
||||
return bmc150_accel_core_probe(&client->dev, regmap, client->irq, name,
|
||||
block_supported);
|
||||
}
|
||||
|
||||
static int bmc150_accel_remove(struct i2c_client *client)
|
||||
{
|
||||
return bmc150_accel_core_remove(&client->dev);
|
||||
}
|
||||
|
||||
static const struct acpi_device_id bmc150_accel_acpi_match[] = {
|
||||
{"BSBA0150", bmc150},
|
||||
{"BMC150A", bmc150},
|
||||
{"BMI055A", bmi055},
|
||||
{"BMA0255", bma255},
|
||||
{"BMA250E", bma250e},
|
||||
{"BMA222E", bma222e},
|
||||
{"BMA0280", bma280},
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match);
|
||||
|
||||
static const struct i2c_device_id bmc150_accel_id[] = {
|
||||
{"bmc150_accel", bmc150},
|
||||
{"bmi055_accel", bmi055},
|
||||
{"bma255", bma255},
|
||||
{"bma250e", bma250e},
|
||||
{"bma222e", bma222e},
|
||||
{"bma280", bma280},
|
||||
{}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(i2c, bmc150_accel_id);
|
||||
|
||||
static struct i2c_driver bmc150_accel_driver = {
|
||||
.driver = {
|
||||
.name = "bmc150_accel_i2c",
|
||||
.acpi_match_table = ACPI_PTR(bmc150_accel_acpi_match),
|
||||
.pm = &bmc150_accel_pm_ops,
|
||||
},
|
||||
.probe = bmc150_accel_probe,
|
||||
.remove = bmc150_accel_remove,
|
||||
.id_table = bmc150_accel_id,
|
||||
};
|
||||
module_i2c_driver(bmc150_accel_driver);
|
||||
|
||||
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_DESCRIPTION("BMC150 I2C accelerometer driver");
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 3-axis accelerometer driver supporting SPI Bosch-Sensortec accelerometer chip
|
||||
* Copyright © 2015 Pengutronix, Markus Pargmann <mpa@pengutronix.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
#include "bmc150-accel.h"
|
||||
|
||||
static const struct regmap_config bmc150_spi_regmap_conf = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.max_register = 0x3f,
|
||||
};
|
||||
|
||||
static int bmc150_accel_probe(struct spi_device *spi)
|
||||
{
|
||||
struct regmap *regmap;
|
||||
const struct spi_device_id *id = spi_get_device_id(spi);
|
||||
|
||||
regmap = devm_regmap_init_spi(spi, &bmc150_spi_regmap_conf);
|
||||
if (IS_ERR(regmap)) {
|
||||
dev_err(&spi->dev, "Failed to initialize spi regmap\n");
|
||||
return PTR_ERR(regmap);
|
||||
}
|
||||
|
||||
return bmc150_accel_core_probe(&spi->dev, regmap, spi->irq, id->name,
|
||||
true);
|
||||
}
|
||||
|
||||
static int bmc150_accel_remove(struct spi_device *spi)
|
||||
{
|
||||
return bmc150_accel_core_remove(&spi->dev);
|
||||
}
|
||||
|
||||
static const struct acpi_device_id bmc150_accel_acpi_match[] = {
|
||||
{"BSBA0150", bmc150},
|
||||
{"BMC150A", bmc150},
|
||||
{"BMI055A", bmi055},
|
||||
{"BMA0255", bma255},
|
||||
{"BMA250E", bma250e},
|
||||
{"BMA222E", bma222e},
|
||||
{"BMA0280", bma280},
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match);
|
||||
|
||||
static const struct spi_device_id bmc150_accel_id[] = {
|
||||
{"bmc150_accel", bmc150},
|
||||
{"bmi055_accel", bmi055},
|
||||
{"bma255", bma255},
|
||||
{"bma250e", bma250e},
|
||||
{"bma222e", bma222e},
|
||||
{"bma280", bma280},
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, bmc150_accel_id);
|
||||
|
||||
static struct spi_driver bmc150_accel_driver = {
|
||||
.driver = {
|
||||
.name = "bmc150_accel_spi",
|
||||
.acpi_match_table = ACPI_PTR(bmc150_accel_acpi_match),
|
||||
.pm = &bmc150_accel_pm_ops,
|
||||
},
|
||||
.probe = bmc150_accel_probe,
|
||||
.remove = bmc150_accel_remove,
|
||||
.id_table = bmc150_accel_id,
|
||||
};
|
||||
module_spi_driver(bmc150_accel_driver);
|
||||
|
||||
MODULE_AUTHOR("Markus Pargmann <mpa@pengutronix.de>");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_DESCRIPTION("BMC150 SPI accelerometer driver");
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef _BMC150_ACCEL_H_
|
||||
#define _BMC150_ACCEL_H_
|
||||
|
||||
struct regmap;
|
||||
|
||||
enum {
|
||||
bmc150,
|
||||
bmi055,
|
||||
bma255,
|
||||
bma250e,
|
||||
bma222e,
|
||||
bma280,
|
||||
};
|
||||
|
||||
int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
|
||||
const char *name, bool block_supported);
|
||||
int bmc150_accel_core_remove(struct device *dev);
|
||||
extern const struct dev_pm_ops bmc150_accel_pm_ops;
|
||||
|
||||
#endif /* _BMC150_ACCEL_H_ */
|
||||
@@ -1162,35 +1162,6 @@ static const char *kxcjk1013_match_acpi_device(struct device *dev,
|
||||
return dev_name(dev);
|
||||
}
|
||||
|
||||
static int kxcjk1013_gpio_probe(struct i2c_client *client,
|
||||
struct kxcjk1013_data *data)
|
||||
{
|
||||
struct device *dev;
|
||||
struct gpio_desc *gpio;
|
||||
int ret;
|
||||
|
||||
if (!client)
|
||||
return -EINVAL;
|
||||
|
||||
if (data->is_smo8500_device)
|
||||
return -ENOTSUPP;
|
||||
|
||||
dev = &client->dev;
|
||||
|
||||
/* data ready gpio interrupt pin */
|
||||
gpio = devm_gpiod_get_index(dev, "kxcjk1013_int", 0, GPIOD_IN);
|
||||
if (IS_ERR(gpio)) {
|
||||
dev_err(dev, "acpi gpio get index failed\n");
|
||||
return PTR_ERR(gpio);
|
||||
}
|
||||
|
||||
ret = gpiod_to_irq(gpio);
|
||||
|
||||
dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int kxcjk1013_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
@@ -1237,10 +1208,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->info = &kxcjk1013_info;
|
||||
|
||||
if (client->irq < 0)
|
||||
client->irq = kxcjk1013_gpio_probe(client, data);
|
||||
|
||||
if (client->irq > 0) {
|
||||
if (client->irq > 0 && !data->is_smo8500_device) {
|
||||
ret = devm_request_threaded_irq(&client->dev, client->irq,
|
||||
kxcjk1013_data_rdy_trig_poll,
|
||||
kxcjk1013_event_handler,
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#define MMA9553_DRV_NAME "mma9553"
|
||||
#define MMA9553_IRQ_NAME "mma9553_event"
|
||||
#define MMA9553_GPIO_NAME "mma9553_int"
|
||||
|
||||
/* Pedometer configuration registers (R/W) */
|
||||
#define MMA9553_REG_CONF_SLEEPMIN 0x00
|
||||
@@ -1073,31 +1072,6 @@ static irqreturn_t mma9553_event_handler(int irq, void *private)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int mma9553_gpio_probe(struct i2c_client *client)
|
||||
{
|
||||
struct device *dev;
|
||||
struct gpio_desc *gpio;
|
||||
int ret;
|
||||
|
||||
if (!client)
|
||||
return -EINVAL;
|
||||
|
||||
dev = &client->dev;
|
||||
|
||||
/* data ready GPIO interrupt pin */
|
||||
gpio = devm_gpiod_get_index(dev, MMA9553_GPIO_NAME, 0, GPIOD_IN);
|
||||
if (IS_ERR(gpio)) {
|
||||
dev_err(dev, "ACPI GPIO get index failed\n");
|
||||
return PTR_ERR(gpio);
|
||||
}
|
||||
|
||||
ret = gpiod_to_irq(gpio);
|
||||
|
||||
dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const char *mma9553_match_acpi_device(struct device *dev)
|
||||
{
|
||||
const struct acpi_device_id *id;
|
||||
@@ -1146,9 +1120,6 @@ static int mma9553_probe(struct i2c_client *client,
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->info = &mma9553_info;
|
||||
|
||||
if (client->irq < 0)
|
||||
client->irq = mma9553_gpio_probe(client);
|
||||
|
||||
if (client->irq > 0) {
|
||||
ret = devm_request_threaded_irq(&client->dev, client->irq,
|
||||
mma9553_irq_handler,
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#define STK8312_ALL_CHANNEL_SIZE 3
|
||||
|
||||
#define STK8312_DRIVER_NAME "stk8312"
|
||||
#define STK8312_GPIO "stk8312_gpio"
|
||||
#define STK8312_IRQ_NAME "stk8312_event"
|
||||
|
||||
/*
|
||||
@@ -504,30 +503,6 @@ static const struct iio_buffer_setup_ops stk8312_buffer_setup_ops = {
|
||||
.postdisable = stk8312_buffer_postdisable,
|
||||
};
|
||||
|
||||
static int stk8312_gpio_probe(struct i2c_client *client)
|
||||
{
|
||||
struct device *dev;
|
||||
struct gpio_desc *gpio;
|
||||
int ret;
|
||||
|
||||
if (!client)
|
||||
return -EINVAL;
|
||||
|
||||
dev = &client->dev;
|
||||
|
||||
/* data ready gpio interrupt pin */
|
||||
gpio = devm_gpiod_get_index(dev, STK8312_GPIO, 0, GPIOD_IN);
|
||||
if (IS_ERR(gpio)) {
|
||||
dev_err(dev, "acpi gpio get index failed\n");
|
||||
return PTR_ERR(gpio);
|
||||
}
|
||||
|
||||
ret = gpiod_to_irq(gpio);
|
||||
dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int stk8312_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
@@ -569,10 +544,7 @@ static int stk8312_probe(struct i2c_client *client,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (client->irq < 0)
|
||||
client->irq = stk8312_gpio_probe(client);
|
||||
|
||||
if (client->irq >= 0) {
|
||||
if (client->irq > 0) {
|
||||
ret = devm_request_threaded_irq(&client->dev, client->irq,
|
||||
stk8312_data_rdy_trig_poll,
|
||||
NULL,
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#define STK8BA50_ALL_CHANNEL_SIZE 6
|
||||
|
||||
#define STK8BA50_DRIVER_NAME "stk8ba50"
|
||||
#define STK8BA50_GPIO "stk8ba50_gpio"
|
||||
#define STK8BA50_IRQ_NAME "stk8ba50_event"
|
||||
|
||||
#define STK8BA50_SCALE_AVAIL "0.0384 0.0767 0.1534 0.3069"
|
||||
@@ -388,30 +387,6 @@ static const struct iio_buffer_setup_ops stk8ba50_buffer_setup_ops = {
|
||||
.postdisable = stk8ba50_buffer_postdisable,
|
||||
};
|
||||
|
||||
static int stk8ba50_gpio_probe(struct i2c_client *client)
|
||||
{
|
||||
struct device *dev;
|
||||
struct gpio_desc *gpio;
|
||||
int ret;
|
||||
|
||||
if (!client)
|
||||
return -EINVAL;
|
||||
|
||||
dev = &client->dev;
|
||||
|
||||
/* data ready gpio interrupt pin */
|
||||
gpio = devm_gpiod_get_index(dev, STK8BA50_GPIO, 0, GPIOD_IN);
|
||||
if (IS_ERR(gpio)) {
|
||||
dev_err(dev, "acpi gpio get index failed\n");
|
||||
return PTR_ERR(gpio);
|
||||
}
|
||||
|
||||
ret = gpiod_to_irq(gpio);
|
||||
dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int stk8ba50_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
@@ -465,10 +440,7 @@ static int stk8ba50_probe(struct i2c_client *client,
|
||||
goto err_power_off;
|
||||
}
|
||||
|
||||
if (client->irq < 0)
|
||||
client->irq = stk8ba50_gpio_probe(client);
|
||||
|
||||
if (client->irq >= 0) {
|
||||
if (client->irq > 0) {
|
||||
ret = devm_request_threaded_irq(&client->dev, client->irq,
|
||||
stk8ba50_data_rdy_trig_poll,
|
||||
NULL,
|
||||
|
||||
@@ -528,7 +528,6 @@ static struct attribute *ad799x_event_attributes[] = {
|
||||
|
||||
static struct attribute_group ad799x_event_attrs_group = {
|
||||
.attrs = ad799x_event_attributes,
|
||||
.name = "events",
|
||||
};
|
||||
|
||||
static const struct iio_info ad7991_info = {
|
||||
|
||||
@@ -1007,7 +1007,6 @@ static struct attribute *max1363_event_attributes[] = {
|
||||
|
||||
static struct attribute_group max1363_event_attribute_group = {
|
||||
.attrs = max1363_event_attributes,
|
||||
.name = "events",
|
||||
};
|
||||
|
||||
static int max1363_update_scan_mode(struct iio_dev *indio_dev,
|
||||
|
||||
@@ -85,6 +85,21 @@ static const struct attribute_group vz89x_attrs_group = {
|
||||
.attrs = vz89x_attributes,
|
||||
};
|
||||
|
||||
/*
|
||||
* Chipset sometime updates in the middle of a reading causing it to reset the
|
||||
* data pointer, and causing invalid reading of previous data.
|
||||
* We can check for this by reading MSB of the resistance reading that is
|
||||
* always zero, and by also confirming the VOC_short isn't zero.
|
||||
*/
|
||||
|
||||
static int vz89x_measurement_is_valid(struct vz89x_data *data)
|
||||
{
|
||||
if (data->buffer[VZ89X_VOC_SHORT_IDX] == 0)
|
||||
return 1;
|
||||
|
||||
return !!(data->buffer[VZ89X_REG_MEASUREMENT_SIZE - 1] > 0);
|
||||
}
|
||||
|
||||
static int vz89x_get_measurement(struct vz89x_data *data)
|
||||
{
|
||||
int ret;
|
||||
@@ -106,6 +121,10 @@ static int vz89x_get_measurement(struct vz89x_data *data)
|
||||
data->buffer[i] = ret;
|
||||
}
|
||||
|
||||
ret = vz89x_measurement_is_valid(data);
|
||||
if (ret)
|
||||
return -EAGAIN;
|
||||
|
||||
data->last_update = jiffies;
|
||||
|
||||
return 0;
|
||||
@@ -113,9 +132,9 @@ static int vz89x_get_measurement(struct vz89x_data *data)
|
||||
|
||||
static int vz89x_get_resistance_reading(struct vz89x_data *data)
|
||||
{
|
||||
u8 *buf = &data->buffer[VZ89X_VOC_TVOC_IDX];
|
||||
u8 *buf = &data->buffer[VZ89X_VOC_RESISTANCE_IDX];
|
||||
|
||||
return buf[0] | (buf[1] << 8) | (buf[2] << 16);
|
||||
return buf[0] | (buf[1] << 8);
|
||||
}
|
||||
|
||||
static int vz89x_read_raw(struct iio_dev *indio_dev,
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
#
|
||||
|
||||
source "drivers/iio/common/hid-sensors/Kconfig"
|
||||
source "drivers/iio/common/ms_sensors/Kconfig"
|
||||
source "drivers/iio/common/ssp_sensors/Kconfig"
|
||||
source "drivers/iio/common/st_sensors/Kconfig"
|
||||
|
||||
@@ -8,5 +8,6 @@
|
||||
|
||||
# When adding new entries keep the list in alphabetical order
|
||||
obj-y += hid-sensors/
|
||||
obj-y += ms_sensors/
|
||||
obj-y += ssp_sensors/
|
||||
obj-y += st_sensors/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user