mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 21:33:00 +00:00
Second set of IIO fixes for the 5.2 cycle.
* ad7150 - sense of bit for controlling adaptive vs fixed threshold was flipped. * adt7316 - Fix a build issue due to wrong headers for gpio usage. * lsm6dsx - correctly suspend / resume i2c slaves when the host goes to sleep. * mlx90632 - relax a compatability check to allow for newer devices. Also one counters fix * counter/ftm-quaddec - missing dependencies in Kconfig. -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl0H5PURHGppYzIzQGtl cm5lbC5vcmcACgkQVIU0mcT0Foh7bhAAqF/VG9KhIioY4ov5U+Exh5OGzirhTLKC TyuK4fnSHO9avql1lTAc9b/tt2tBdE4f0vel6CSP+1GlbwfG01AYUu+ZW7j/GkgT D09o4IH1TspqH5nIc2JunZwYqPJG2v7Fis9IMtS13eTJ+csf9EhVCuIf8tnaPwyM /OH7t3JdSqxtsxHECEsZhl5IDrqZKyQI3+7MtlpcnuQpNjrrwxey4B54csZamUH8 nhefM7CtI+roaT+Ydp5oNpvpVXhNH54rVKwEkJfeuhiuviHoO7SgUF59u4vp9JYa 5dVo+T8+b2gsAt1w4jDCNDALTrFYL1d4XCyHuW+ZvpTGfb99E0g2QRStuBJp0Nyn 9s9K05KTdcHi3HBUxx+pKh7MDUBzKSm5T5euq4ZHRUKF3vjfBhsoN4iVh31IHa53 Nv28vnnxUd7RXHZonoi9wIT0zoDSY1IvpNGtwJaOjBJNcUjtDQivV2KqqvvvSfj0 g7KswaUB5icRR/mtL4Jj2j0voD2e+mMXgknRmHJthXKBKzs4lQHFPqI1rZQy8DRg 2YCi5zJNPBmf7hNbMqyt5YEkflZST3zzOUBRxdju4w3lwKZl6+bQd5B82ET6DZSr n99WXsGcdck/JEWomUhGb5uTbS2LAgsVLIXJTDzgzwQqE4Vp7FFYIHDNeTJx43Cm bEvNn0cT6a8= =2i3G -----END PGP SIGNATURE----- Merge tag 'iio-fixes-for-5.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus Jonathan writes: Second set of IIO fixes for the 5.2 cycle. * ad7150 - sense of bit for controlling adaptive vs fixed threshold was flipped. * adt7316 - Fix a build issue due to wrong headers for gpio usage. * lsm6dsx - correctly suspend / resume i2c slaves when the host goes to sleep. * mlx90632 - relax a compatability check to allow for newer devices. Also one counters fix * counter/ftm-quaddec - missing dependencies in Kconfig. * tag 'iio-fixes-for-5.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: counter/ftm-quaddec: Add missing dependencies in Kconfig staging: iio: adt7316: Fix build errors when GPIOLIB is not set iio: temperature: mlx90632 Relax the compatibility check iio: imu: st_lsm6dsx: fix PM support for st_lsm6dsx i2c controller staging:iio:ad7150: fix threshold mode config bit
This commit is contained in:
commit
d7a5417b89
@ -51,6 +51,7 @@ config STM32_LPTIMER_CNT
|
||||
|
||||
config FTM_QUADDEC
|
||||
tristate "Flex Timer Module Quadrature decoder driver"
|
||||
depends on HAS_IOMEM && OF
|
||||
help
|
||||
Select this option to enable the Flex Timer Quadrature decoder
|
||||
driver.
|
||||
|
@ -270,6 +270,7 @@ struct st_lsm6dsx_sensor {
|
||||
* @conf_lock: Mutex to prevent concurrent FIFO configuration update.
|
||||
* @page_lock: Mutex to prevent concurrent memory page configuration.
|
||||
* @fifo_mode: FIFO operating mode supported by the device.
|
||||
* @suspend_mask: Suspended sensor bitmask.
|
||||
* @enable_mask: Enabled sensor bitmask.
|
||||
* @ts_sip: Total number of timestamp samples in a given pattern.
|
||||
* @sip: Total number of samples (acc/gyro/ts) in a given pattern.
|
||||
@ -287,6 +288,7 @@ struct st_lsm6dsx_hw {
|
||||
struct mutex page_lock;
|
||||
|
||||
enum st_lsm6dsx_fifo_mode fifo_mode;
|
||||
u8 suspend_mask;
|
||||
u8 enable_mask;
|
||||
u8 ts_sip;
|
||||
u8 sip;
|
||||
|
@ -1109,8 +1109,6 @@ static int __maybe_unused st_lsm6dsx_suspend(struct device *dev)
|
||||
{
|
||||
struct st_lsm6dsx_hw *hw = dev_get_drvdata(dev);
|
||||
struct st_lsm6dsx_sensor *sensor;
|
||||
const struct st_lsm6dsx_reg *reg;
|
||||
unsigned int data;
|
||||
int i, err = 0;
|
||||
|
||||
for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) {
|
||||
@ -1121,12 +1119,16 @@ static int __maybe_unused st_lsm6dsx_suspend(struct device *dev)
|
||||
if (!(hw->enable_mask & BIT(sensor->id)))
|
||||
continue;
|
||||
|
||||
reg = &st_lsm6dsx_odr_table[sensor->id].reg;
|
||||
data = ST_LSM6DSX_SHIFT_VAL(0, reg->mask);
|
||||
err = st_lsm6dsx_update_bits_locked(hw, reg->addr, reg->mask,
|
||||
data);
|
||||
if (sensor->id == ST_LSM6DSX_ID_EXT0 ||
|
||||
sensor->id == ST_LSM6DSX_ID_EXT1 ||
|
||||
sensor->id == ST_LSM6DSX_ID_EXT2)
|
||||
err = st_lsm6dsx_shub_set_enable(sensor, false);
|
||||
else
|
||||
err = st_lsm6dsx_sensor_set_enable(sensor, false);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
hw->suspend_mask |= BIT(sensor->id);
|
||||
}
|
||||
|
||||
if (hw->fifo_mode != ST_LSM6DSX_FIFO_BYPASS)
|
||||
@ -1146,12 +1148,19 @@ static int __maybe_unused st_lsm6dsx_resume(struct device *dev)
|
||||
continue;
|
||||
|
||||
sensor = iio_priv(hw->iio_devs[i]);
|
||||
if (!(hw->enable_mask & BIT(sensor->id)))
|
||||
if (!(hw->suspend_mask & BIT(sensor->id)))
|
||||
continue;
|
||||
|
||||
err = st_lsm6dsx_set_odr(sensor, sensor->odr);
|
||||
if (sensor->id == ST_LSM6DSX_ID_EXT0 ||
|
||||
sensor->id == ST_LSM6DSX_ID_EXT1 ||
|
||||
sensor->id == ST_LSM6DSX_ID_EXT2)
|
||||
err = st_lsm6dsx_shub_set_enable(sensor, true);
|
||||
else
|
||||
err = st_lsm6dsx_sensor_set_enable(sensor, true);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
hw->suspend_mask &= ~BIT(sensor->id);
|
||||
}
|
||||
|
||||
if (hw->enable_mask)
|
||||
|
@ -81,6 +81,8 @@
|
||||
/* Magic constants */
|
||||
#define MLX90632_ID_MEDICAL 0x0105 /* EEPROM DSPv5 Medical device id */
|
||||
#define MLX90632_ID_CONSUMER 0x0205 /* EEPROM DSPv5 Consumer device id */
|
||||
#define MLX90632_DSP_VERSION 5 /* DSP version */
|
||||
#define MLX90632_DSP_MASK GENMASK(7, 0) /* DSP version in EE_VERSION */
|
||||
#define MLX90632_RESET_CMD 0x0006 /* Reset sensor (address or global) */
|
||||
#define MLX90632_REF_12 12LL /**< ResCtrlRef value of Ch 1 or Ch 2 */
|
||||
#define MLX90632_REF_3 12LL /**< ResCtrlRef value of Channel 3 */
|
||||
@ -667,10 +669,13 @@ static int mlx90632_probe(struct i2c_client *client,
|
||||
} else if (read == MLX90632_ID_CONSUMER) {
|
||||
dev_dbg(&client->dev,
|
||||
"Detected Consumer EEPROM calibration %x\n", read);
|
||||
} else if ((read & MLX90632_DSP_MASK) == MLX90632_DSP_VERSION) {
|
||||
dev_dbg(&client->dev,
|
||||
"Detected Unknown EEPROM calibration %x\n", read);
|
||||
} else {
|
||||
dev_err(&client->dev,
|
||||
"EEPROM version mismatch %x (expected %x or %x)\n",
|
||||
read, MLX90632_ID_CONSUMER, MLX90632_ID_MEDICAL);
|
||||
"Wrong DSP version %x (expected %x)\n",
|
||||
read, MLX90632_DSP_VERSION);
|
||||
return -EPROTONOSUPPORT;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,8 @@
|
||||
*/
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
|
@ -5,6 +5,7 @@
|
||||
* Copyright 2010-2011 Analog Devices Inc.
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
@ -130,7 +131,7 @@ static int ad7150_read_event_config(struct iio_dev *indio_dev,
|
||||
{
|
||||
int ret;
|
||||
u8 threshtype;
|
||||
bool adaptive;
|
||||
bool thrfixed;
|
||||
struct ad7150_chip_info *chip = iio_priv(indio_dev);
|
||||
|
||||
ret = i2c_smbus_read_byte_data(chip->client, AD7150_CFG);
|
||||
@ -138,21 +139,23 @@ static int ad7150_read_event_config(struct iio_dev *indio_dev,
|
||||
return ret;
|
||||
|
||||
threshtype = (ret >> 5) & 0x03;
|
||||
adaptive = !!(ret & 0x80);
|
||||
|
||||
/*check if threshold mode is fixed or adaptive*/
|
||||
thrfixed = FIELD_GET(AD7150_CFG_FIX, ret);
|
||||
|
||||
switch (type) {
|
||||
case IIO_EV_TYPE_MAG_ADAPTIVE:
|
||||
if (dir == IIO_EV_DIR_RISING)
|
||||
return adaptive && (threshtype == 0x1);
|
||||
return adaptive && (threshtype == 0x0);
|
||||
return !thrfixed && (threshtype == 0x1);
|
||||
return !thrfixed && (threshtype == 0x0);
|
||||
case IIO_EV_TYPE_THRESH_ADAPTIVE:
|
||||
if (dir == IIO_EV_DIR_RISING)
|
||||
return adaptive && (threshtype == 0x3);
|
||||
return adaptive && (threshtype == 0x2);
|
||||
return !thrfixed && (threshtype == 0x3);
|
||||
return !thrfixed && (threshtype == 0x2);
|
||||
case IIO_EV_TYPE_THRESH:
|
||||
if (dir == IIO_EV_DIR_RISING)
|
||||
return !adaptive && (threshtype == 0x1);
|
||||
return !adaptive && (threshtype == 0x0);
|
||||
return thrfixed && (threshtype == 0x1);
|
||||
return thrfixed && (threshtype == 0x0);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user