diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-17 16:28:29 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-17 16:28:29 -0400 |
| commit | d7a5417b89470d353118a451630ed71f119f58b8 (patch) | |
| tree | 4894c50b30f80e4f0084299e85f7b0cc126e2af8 | |
| parent | f2c7c76c5d0a443053e94adb9f0918fa2fb85c3a (diff) | |
| parent | 0c75376fa3950b9875559dd79f73c36a5498a969 (diff) | |
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
| -rw-r--r-- | drivers/counter/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 2 | ||||
| -rw-r--r-- | drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 25 | ||||
| -rw-r--r-- | drivers/iio/temperature/mlx90632.c | 9 | ||||
| -rw-r--r-- | drivers/staging/iio/addac/adt7316.c | 3 | ||||
| -rw-r--r-- | drivers/staging/iio/cdc/ad7150.c | 19 |
6 files changed, 40 insertions, 19 deletions
diff --git a/drivers/counter/Kconfig b/drivers/counter/Kconfig index 138ecd8a8fbd..2967d0a9ff91 100644 --- a/drivers/counter/Kconfig +++ b/drivers/counter/Kconfig | |||
| @@ -51,6 +51,7 @@ config STM32_LPTIMER_CNT | |||
| 51 | 51 | ||
| 52 | config FTM_QUADDEC | 52 | config FTM_QUADDEC |
| 53 | tristate "Flex Timer Module Quadrature decoder driver" | 53 | tristate "Flex Timer Module Quadrature decoder driver" |
| 54 | depends on HAS_IOMEM && OF | ||
| 54 | help | 55 | help |
| 55 | Select this option to enable the Flex Timer Quadrature decoder | 56 | Select this option to enable the Flex Timer Quadrature decoder |
| 56 | driver. | 57 | driver. |
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h index 72f72056b328..5e461f0e759c 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | |||
| @@ -270,6 +270,7 @@ struct st_lsm6dsx_sensor { | |||
| 270 | * @conf_lock: Mutex to prevent concurrent FIFO configuration update. | 270 | * @conf_lock: Mutex to prevent concurrent FIFO configuration update. |
| 271 | * @page_lock: Mutex to prevent concurrent memory page configuration. | 271 | * @page_lock: Mutex to prevent concurrent memory page configuration. |
| 272 | * @fifo_mode: FIFO operating mode supported by the device. | 272 | * @fifo_mode: FIFO operating mode supported by the device. |
| 273 | * @suspend_mask: Suspended sensor bitmask. | ||
| 273 | * @enable_mask: Enabled sensor bitmask. | 274 | * @enable_mask: Enabled sensor bitmask. |
| 274 | * @ts_sip: Total number of timestamp samples in a given pattern. | 275 | * @ts_sip: Total number of timestamp samples in a given pattern. |
| 275 | * @sip: Total number of samples (acc/gyro/ts) in a given pattern. | 276 | * @sip: Total number of samples (acc/gyro/ts) in a given pattern. |
| @@ -287,6 +288,7 @@ struct st_lsm6dsx_hw { | |||
| 287 | struct mutex page_lock; | 288 | struct mutex page_lock; |
| 288 | 289 | ||
| 289 | enum st_lsm6dsx_fifo_mode fifo_mode; | 290 | enum st_lsm6dsx_fifo_mode fifo_mode; |
| 291 | u8 suspend_mask; | ||
| 290 | u8 enable_mask; | 292 | u8 enable_mask; |
| 291 | u8 ts_sip; | 293 | u8 ts_sip; |
| 292 | u8 sip; | 294 | u8 sip; |
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index b6edc9886d1e..fd95d924a996 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | |||
| @@ -1109,8 +1109,6 @@ static int __maybe_unused st_lsm6dsx_suspend(struct device *dev) | |||
| 1109 | { | 1109 | { |
| 1110 | struct st_lsm6dsx_hw *hw = dev_get_drvdata(dev); | 1110 | struct st_lsm6dsx_hw *hw = dev_get_drvdata(dev); |
| 1111 | struct st_lsm6dsx_sensor *sensor; | 1111 | struct st_lsm6dsx_sensor *sensor; |
| 1112 | const struct st_lsm6dsx_reg *reg; | ||
| 1113 | unsigned int data; | ||
| 1114 | int i, err = 0; | 1112 | int i, err = 0; |
| 1115 | 1113 | ||
| 1116 | for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) { | 1114 | for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) { |
| @@ -1121,12 +1119,16 @@ static int __maybe_unused st_lsm6dsx_suspend(struct device *dev) | |||
| 1121 | if (!(hw->enable_mask & BIT(sensor->id))) | 1119 | if (!(hw->enable_mask & BIT(sensor->id))) |
| 1122 | continue; | 1120 | continue; |
| 1123 | 1121 | ||
| 1124 | reg = &st_lsm6dsx_odr_table[sensor->id].reg; | 1122 | if (sensor->id == ST_LSM6DSX_ID_EXT0 || |
| 1125 | data = ST_LSM6DSX_SHIFT_VAL(0, reg->mask); | 1123 | sensor->id == ST_LSM6DSX_ID_EXT1 || |
| 1126 | err = st_lsm6dsx_update_bits_locked(hw, reg->addr, reg->mask, | 1124 | sensor->id == ST_LSM6DSX_ID_EXT2) |
| 1127 | data); | 1125 | err = st_lsm6dsx_shub_set_enable(sensor, false); |
| 1126 | else | ||
| 1127 | err = st_lsm6dsx_sensor_set_enable(sensor, false); | ||
| 1128 | if (err < 0) | 1128 | if (err < 0) |
| 1129 | return err; | 1129 | return err; |
| 1130 | |||
| 1131 | hw->suspend_mask |= BIT(sensor->id); | ||
| 1130 | } | 1132 | } |
| 1131 | 1133 | ||
| 1132 | if (hw->fifo_mode != ST_LSM6DSX_FIFO_BYPASS) | 1134 | if (hw->fifo_mode != ST_LSM6DSX_FIFO_BYPASS) |
| @@ -1146,12 +1148,19 @@ static int __maybe_unused st_lsm6dsx_resume(struct device *dev) | |||
| 1146 | continue; | 1148 | continue; |
| 1147 | 1149 | ||
| 1148 | sensor = iio_priv(hw->iio_devs[i]); | 1150 | sensor = iio_priv(hw->iio_devs[i]); |
| 1149 | if (!(hw->enable_mask & BIT(sensor->id))) | 1151 | if (!(hw->suspend_mask & BIT(sensor->id))) |
| 1150 | continue; | 1152 | continue; |
| 1151 | 1153 | ||
| 1152 | err = st_lsm6dsx_set_odr(sensor, sensor->odr); | 1154 | if (sensor->id == ST_LSM6DSX_ID_EXT0 || |
| 1155 | sensor->id == ST_LSM6DSX_ID_EXT1 || | ||
| 1156 | sensor->id == ST_LSM6DSX_ID_EXT2) | ||
| 1157 | err = st_lsm6dsx_shub_set_enable(sensor, true); | ||
| 1158 | else | ||
| 1159 | err = st_lsm6dsx_sensor_set_enable(sensor, true); | ||
| 1153 | if (err < 0) | 1160 | if (err < 0) |
| 1154 | return err; | 1161 | return err; |
| 1162 | |||
| 1163 | hw->suspend_mask &= ~BIT(sensor->id); | ||
| 1155 | } | 1164 | } |
| 1156 | 1165 | ||
| 1157 | if (hw->enable_mask) | 1166 | if (hw->enable_mask) |
diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c index be03be719efe..eaca6ba06864 100644 --- a/drivers/iio/temperature/mlx90632.c +++ b/drivers/iio/temperature/mlx90632.c | |||
| @@ -81,6 +81,8 @@ | |||
| 81 | /* Magic constants */ | 81 | /* Magic constants */ |
| 82 | #define MLX90632_ID_MEDICAL 0x0105 /* EEPROM DSPv5 Medical device id */ | 82 | #define MLX90632_ID_MEDICAL 0x0105 /* EEPROM DSPv5 Medical device id */ |
| 83 | #define MLX90632_ID_CONSUMER 0x0205 /* EEPROM DSPv5 Consumer device id */ | 83 | #define MLX90632_ID_CONSUMER 0x0205 /* EEPROM DSPv5 Consumer device id */ |
| 84 | #define MLX90632_DSP_VERSION 5 /* DSP version */ | ||
| 85 | #define MLX90632_DSP_MASK GENMASK(7, 0) /* DSP version in EE_VERSION */ | ||
| 84 | #define MLX90632_RESET_CMD 0x0006 /* Reset sensor (address or global) */ | 86 | #define MLX90632_RESET_CMD 0x0006 /* Reset sensor (address or global) */ |
| 85 | #define MLX90632_REF_12 12LL /**< ResCtrlRef value of Ch 1 or Ch 2 */ | 87 | #define MLX90632_REF_12 12LL /**< ResCtrlRef value of Ch 1 or Ch 2 */ |
| 86 | #define MLX90632_REF_3 12LL /**< ResCtrlRef value of Channel 3 */ | 88 | #define MLX90632_REF_3 12LL /**< ResCtrlRef value of Channel 3 */ |
| @@ -667,10 +669,13 @@ static int mlx90632_probe(struct i2c_client *client, | |||
| 667 | } else if (read == MLX90632_ID_CONSUMER) { | 669 | } else if (read == MLX90632_ID_CONSUMER) { |
| 668 | dev_dbg(&client->dev, | 670 | dev_dbg(&client->dev, |
| 669 | "Detected Consumer EEPROM calibration %x\n", read); | 671 | "Detected Consumer EEPROM calibration %x\n", read); |
| 672 | } else if ((read & MLX90632_DSP_MASK) == MLX90632_DSP_VERSION) { | ||
| 673 | dev_dbg(&client->dev, | ||
| 674 | "Detected Unknown EEPROM calibration %x\n", read); | ||
| 670 | } else { | 675 | } else { |
| 671 | dev_err(&client->dev, | 676 | dev_err(&client->dev, |
| 672 | "EEPROM version mismatch %x (expected %x or %x)\n", | 677 | "Wrong DSP version %x (expected %x)\n", |
| 673 | read, MLX90632_ID_CONSUMER, MLX90632_ID_MEDICAL); | 678 | read, MLX90632_DSP_VERSION); |
| 674 | return -EPROTONOSUPPORT; | 679 | return -EPROTONOSUPPORT; |
| 675 | } | 680 | } |
| 676 | 681 | ||
diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c index b6a65ee8d558..dc8c25ddb97e 100644 --- a/drivers/staging/iio/addac/adt7316.c +++ b/drivers/staging/iio/addac/adt7316.c | |||
| @@ -6,7 +6,8 @@ | |||
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
| 9 | #include <linux/gpio.h> | 9 | #include <linux/gpio/consumer.h> |
| 10 | #include <linux/irq.h> | ||
| 10 | #include <linux/workqueue.h> | 11 | #include <linux/workqueue.h> |
| 11 | #include <linux/device.h> | 12 | #include <linux/device.h> |
| 12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c index dd7fcab8e19e..e075244c602b 100644 --- a/drivers/staging/iio/cdc/ad7150.c +++ b/drivers/staging/iio/cdc/ad7150.c | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | * Copyright 2010-2011 Analog Devices Inc. | 5 | * Copyright 2010-2011 Analog Devices Inc. |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <linux/bitfield.h> | ||
| 8 | #include <linux/interrupt.h> | 9 | #include <linux/interrupt.h> |
| 9 | #include <linux/device.h> | 10 | #include <linux/device.h> |
| 10 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
| @@ -130,7 +131,7 @@ static int ad7150_read_event_config(struct iio_dev *indio_dev, | |||
| 130 | { | 131 | { |
| 131 | int ret; | 132 | int ret; |
| 132 | u8 threshtype; | 133 | u8 threshtype; |
| 133 | bool adaptive; | 134 | bool thrfixed; |
| 134 | struct ad7150_chip_info *chip = iio_priv(indio_dev); | 135 | struct ad7150_chip_info *chip = iio_priv(indio_dev); |
| 135 | 136 | ||
| 136 | ret = i2c_smbus_read_byte_data(chip->client, AD7150_CFG); | 137 | 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, | |||
| 138 | return ret; | 139 | return ret; |
| 139 | 140 | ||
| 140 | threshtype = (ret >> 5) & 0x03; | 141 | threshtype = (ret >> 5) & 0x03; |
| 141 | adaptive = !!(ret & 0x80); | 142 | |
| 143 | /*check if threshold mode is fixed or adaptive*/ | ||
| 144 | thrfixed = FIELD_GET(AD7150_CFG_FIX, ret); | ||
| 142 | 145 | ||
| 143 | switch (type) { | 146 | switch (type) { |
| 144 | case IIO_EV_TYPE_MAG_ADAPTIVE: | 147 | case IIO_EV_TYPE_MAG_ADAPTIVE: |
| 145 | if (dir == IIO_EV_DIR_RISING) | 148 | if (dir == IIO_EV_DIR_RISING) |
| 146 | return adaptive && (threshtype == 0x1); | 149 | return !thrfixed && (threshtype == 0x1); |
| 147 | return adaptive && (threshtype == 0x0); | 150 | return !thrfixed && (threshtype == 0x0); |
| 148 | case IIO_EV_TYPE_THRESH_ADAPTIVE: | 151 | case IIO_EV_TYPE_THRESH_ADAPTIVE: |
| 149 | if (dir == IIO_EV_DIR_RISING) | 152 | if (dir == IIO_EV_DIR_RISING) |
| 150 | return adaptive && (threshtype == 0x3); | 153 | return !thrfixed && (threshtype == 0x3); |
| 151 | return adaptive && (threshtype == 0x2); | 154 | return !thrfixed && (threshtype == 0x2); |
| 152 | case IIO_EV_TYPE_THRESH: | 155 | case IIO_EV_TYPE_THRESH: |
| 153 | if (dir == IIO_EV_DIR_RISING) | 156 | if (dir == IIO_EV_DIR_RISING) |
| 154 | return !adaptive && (threshtype == 0x1); | 157 | return thrfixed && (threshtype == 0x1); |
| 155 | return !adaptive && (threshtype == 0x0); | 158 | return thrfixed && (threshtype == 0x0); |
| 156 | default: | 159 | default: |
| 157 | break; | 160 | break; |
| 158 | } | 161 | } |
