Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'staging-5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/IIO/counter fixes from Greg KH:
"Here are some small driver bugfixes for some staging/iio/counter
drivers.

Staging and IIO have been lumped together for a while, as those
subsystems cross the areas a log, and counter is used by IIO, so
that's why they are all in one pull request here.

These are small fixes for reported issues in some iio drivers, the
erofs filesystem, and a build issue for counter code.

All have been in linux-next with no reported issues"

* tag 'staging-5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
staging: erofs: add requirements field in superblock
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

+71 -22
+1
drivers/counter/Kconfig
··· 51 51 52 52 config FTM_QUADDEC 53 53 tristate "Flex Timer Module Quadrature decoder driver" 54 + depends on HAS_IOMEM && OF 54 55 help 55 56 Select this option to enable the Flex Timer Quadrature decoder 56 57 driver.
+2
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
··· 270 270 * @conf_lock: Mutex to prevent concurrent FIFO configuration update. 271 271 * @page_lock: Mutex to prevent concurrent memory page configuration. 272 272 * @fifo_mode: FIFO operating mode supported by the device. 273 + * @suspend_mask: Suspended sensor bitmask. 273 274 * @enable_mask: Enabled sensor bitmask. 274 275 * @ts_sip: Total number of timestamp samples in a given pattern. 275 276 * @sip: Total number of samples (acc/gyro/ts) in a given pattern. ··· 288 287 struct mutex page_lock; 289 288 290 289 enum st_lsm6dsx_fifo_mode fifo_mode; 290 + u8 suspend_mask; 291 291 u8 enable_mask; 292 292 u8 ts_sip; 293 293 u8 sip;
+17 -8
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
··· 1109 1109 { 1110 1110 struct st_lsm6dsx_hw *hw = dev_get_drvdata(dev); 1111 1111 struct st_lsm6dsx_sensor *sensor; 1112 - const struct st_lsm6dsx_reg *reg; 1113 - unsigned int data; 1114 1112 int i, err = 0; 1115 1113 1116 1114 for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) { ··· 1119 1121 if (!(hw->enable_mask & BIT(sensor->id))) 1120 1122 continue; 1121 1123 1122 - reg = &st_lsm6dsx_odr_table[sensor->id].reg; 1123 - data = ST_LSM6DSX_SHIFT_VAL(0, reg->mask); 1124 - err = st_lsm6dsx_update_bits_locked(hw, reg->addr, reg->mask, 1125 - data); 1124 + if (sensor->id == ST_LSM6DSX_ID_EXT0 || 1125 + sensor->id == ST_LSM6DSX_ID_EXT1 || 1126 + sensor->id == ST_LSM6DSX_ID_EXT2) 1127 + err = st_lsm6dsx_shub_set_enable(sensor, false); 1128 + else 1129 + err = st_lsm6dsx_sensor_set_enable(sensor, false); 1126 1130 if (err < 0) 1127 1131 return err; 1132 + 1133 + hw->suspend_mask |= BIT(sensor->id); 1128 1134 } 1129 1135 1130 1136 if (hw->fifo_mode != ST_LSM6DSX_FIFO_BYPASS) ··· 1148 1146 continue; 1149 1147 1150 1148 sensor = iio_priv(hw->iio_devs[i]); 1151 - if (!(hw->enable_mask & BIT(sensor->id))) 1149 + if (!(hw->suspend_mask & BIT(sensor->id))) 1152 1150 continue; 1153 1151 1154 - err = st_lsm6dsx_set_odr(sensor, sensor->odr); 1152 + if (sensor->id == ST_LSM6DSX_ID_EXT0 || 1153 + sensor->id == ST_LSM6DSX_ID_EXT1 || 1154 + sensor->id == ST_LSM6DSX_ID_EXT2) 1155 + err = st_lsm6dsx_shub_set_enable(sensor, true); 1156 + else 1157 + err = st_lsm6dsx_sensor_set_enable(sensor, true); 1155 1158 if (err < 0) 1156 1159 return err; 1160 + 1161 + hw->suspend_mask &= ~BIT(sensor->id); 1157 1162 } 1158 1163 1159 1164 if (hw->enable_mask)
+7 -2
drivers/iio/temperature/mlx90632.c
··· 81 81 /* Magic constants */ 82 82 #define MLX90632_ID_MEDICAL 0x0105 /* EEPROM DSPv5 Medical device id */ 83 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 86 #define MLX90632_RESET_CMD 0x0006 /* Reset sensor (address or global) */ 85 87 #define MLX90632_REF_12 12LL /**< ResCtrlRef value of Ch 1 or Ch 2 */ 86 88 #define MLX90632_REF_3 12LL /**< ResCtrlRef value of Channel 3 */ ··· 669 667 } else if (read == MLX90632_ID_CONSUMER) { 670 668 dev_dbg(&client->dev, 671 669 "Detected Consumer EEPROM calibration %x\n", read); 670 + } else if ((read & MLX90632_DSP_MASK) == MLX90632_DSP_VERSION) { 671 + dev_dbg(&client->dev, 672 + "Detected Unknown EEPROM calibration %x\n", read); 672 673 } else { 673 674 dev_err(&client->dev, 674 - "EEPROM version mismatch %x (expected %x or %x)\n", 675 - read, MLX90632_ID_CONSUMER, MLX90632_ID_MEDICAL); 675 + "Wrong DSP version %x (expected %x)\n", 676 + read, MLX90632_DSP_VERSION); 676 677 return -EPROTONOSUPPORT; 677 678 } 678 679
+10 -3
drivers/staging/erofs/erofs_fs.h
··· 17 17 #define EROFS_SUPER_MAGIC_V1 0xE0F5E1E2 18 18 #define EROFS_SUPER_OFFSET 1024 19 19 20 + /* 21 + * Any bits that aren't in EROFS_ALL_REQUIREMENTS should be 22 + * incompatible with this kernel version. 23 + */ 24 + #define EROFS_ALL_REQUIREMENTS 0 25 + 20 26 struct erofs_super_block { 21 27 /* 0 */__le32 magic; /* in the little endian */ 22 28 /* 4 */__le32 checksum; /* crc32c(super_block) */ 23 - /* 8 */__le32 features; 29 + /* 8 */__le32 features; /* (aka. feature_compat) */ 24 30 /* 12 */__u8 blkszbits; /* support block_size == PAGE_SIZE only */ 25 31 /* 13 */__u8 reserved; 26 32 ··· 40 34 /* 44 */__le32 xattr_blkaddr; 41 35 /* 48 */__u8 uuid[16]; /* 128-bit uuid for volume */ 42 36 /* 64 */__u8 volume_name[16]; /* volume name */ 37 + /* 80 */__le32 requirements; /* (aka. feature_incompat) */ 43 38 44 - /* 80 */__u8 reserved2[48]; /* 128 bytes */ 45 - } __packed; 39 + /* 84 */__u8 reserved2[44]; 40 + } __packed; /* 128 bytes */ 46 41 47 42 /* 48 43 * erofs inode data mapping:
+2
drivers/staging/erofs/internal.h
··· 115 115 116 116 u8 uuid[16]; /* 128-bit uuid for volume */ 117 117 u8 volume_name[16]; /* volume name */ 118 + u32 requirements; 119 + 118 120 char *dev_name; 119 121 120 122 unsigned int mount_opt;
+19
drivers/staging/erofs/super.c
··· 71 71 kmem_cache_free(erofs_inode_cachep, vi); 72 72 } 73 73 74 + static bool check_layout_compatibility(struct super_block *sb, 75 + struct erofs_super_block *layout) 76 + { 77 + const unsigned int requirements = le32_to_cpu(layout->requirements); 78 + 79 + EROFS_SB(sb)->requirements = requirements; 80 + 81 + /* check if current kernel meets all mandatory requirements */ 82 + if (requirements & (~EROFS_ALL_REQUIREMENTS)) { 83 + errln("unidentified requirements %x, please upgrade kernel version", 84 + requirements & ~EROFS_ALL_REQUIREMENTS); 85 + return false; 86 + } 87 + return true; 88 + } 89 + 74 90 static int superblock_read(struct super_block *sb) 75 91 { 76 92 struct erofs_sb_info *sbi; ··· 119 103 1 << blkszbits); 120 104 goto out; 121 105 } 106 + 107 + if (!check_layout_compatibility(sb, layout)) 108 + goto out; 122 109 123 110 sbi->blocks = le32_to_cpu(layout->blocks); 124 111 sbi->meta_blkaddr = le32_to_cpu(layout->meta_blkaddr);
+2 -1
drivers/staging/iio/addac/adt7316.c
··· 6 6 */ 7 7 8 8 #include <linux/interrupt.h> 9 - #include <linux/gpio.h> 9 + #include <linux/gpio/consumer.h> 10 + #include <linux/irq.h> 10 11 #include <linux/workqueue.h> 11 12 #include <linux/device.h> 12 13 #include <linux/kernel.h>
+11 -8
drivers/staging/iio/cdc/ad7150.c
··· 5 5 * Copyright 2010-2011 Analog Devices Inc. 6 6 */ 7 7 8 + #include <linux/bitfield.h> 8 9 #include <linux/interrupt.h> 9 10 #include <linux/device.h> 10 11 #include <linux/kernel.h> ··· 131 130 { 132 131 int ret; 133 132 u8 threshtype; 134 - bool adaptive; 133 + bool thrfixed; 135 134 struct ad7150_chip_info *chip = iio_priv(indio_dev); 136 135 137 136 ret = i2c_smbus_read_byte_data(chip->client, AD7150_CFG); ··· 139 138 return ret; 140 139 141 140 threshtype = (ret >> 5) & 0x03; 142 - adaptive = !!(ret & 0x80); 141 + 142 + /*check if threshold mode is fixed or adaptive*/ 143 + thrfixed = FIELD_GET(AD7150_CFG_FIX, ret); 143 144 144 145 switch (type) { 145 146 case IIO_EV_TYPE_MAG_ADAPTIVE: 146 147 if (dir == IIO_EV_DIR_RISING) 147 - return adaptive && (threshtype == 0x1); 148 - return adaptive && (threshtype == 0x0); 148 + return !thrfixed && (threshtype == 0x1); 149 + return !thrfixed && (threshtype == 0x0); 149 150 case IIO_EV_TYPE_THRESH_ADAPTIVE: 150 151 if (dir == IIO_EV_DIR_RISING) 151 - return adaptive && (threshtype == 0x3); 152 - return adaptive && (threshtype == 0x2); 152 + return !thrfixed && (threshtype == 0x3); 153 + return !thrfixed && (threshtype == 0x2); 153 154 case IIO_EV_TYPE_THRESH: 154 155 if (dir == IIO_EV_DIR_RISING) 155 - return !adaptive && (threshtype == 0x1); 156 - return !adaptive && (threshtype == 0x0); 156 + return thrfixed && (threshtype == 0x1); 157 + return thrfixed && (threshtype == 0x0); 157 158 default: 158 159 break; 159 160 }