History

Merge tag 'regmap-fix-v5.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap

Pull regmap fixes from Mark Brown: "Two sets of fixes - one for things that were missed with the support for custom bulk I/O operations introduced in the last merge window, and another for some long standing issues with regmap-irq which affect a fairly small subset of devices" * tag 'regmap-fix-v5.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap-irq: Fix offset/index mismatch in read_sub_irq_data() regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips regmap: Wire up regmap_config provided bulk write in missed functions regmap: Make regmap_noinc_read() return -ENOTSUPP if map->read isn't set regmap: Re-introduce bulk read support check in regmap_bulk_read()

Linus Torvalds committed 4 years ago

Commit 7bc83542 parents bc3b897 3f050102 files · +13 −10Browse files

Unified · Split

2 files
  1. drivers/base/regmap/regmap-irq.c +5 −3
  2. drivers/base/regmap/regmap.c +8 −7
drivers/base/regmap/regmap-irq.c+5−3
@@ -252,6 +252,7 @@ static void regmap_irq_enable(struct irq_data *data) · 251 unmodified lines
252 struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data);252 struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data);
253 struct regmap *map = d->map;253 struct regmap *map = d->map;
254 const struct regmap_irq *irq_data = irq_to_regmap_irq(d, data->hwirq);254 const struct regmap_irq *irq_data = irq_to_regmap_irq(d, data->hwirq);
255 unsigned int reg = irq_data->reg_offset / map->reg_stride;
255 unsigned int mask, type;256 unsigned int mask, type;
256 257
257 type = irq_data->type.type_falling_val | irq_data->type.type_rising_val;258 type = irq_data->type.type_falling_val | irq_data->type.type_rising_val;
@@ -268,14 +269,14 @@ static void regmap_irq_enable(struct irq_data *data) · 10 unmodified lines
268 * at the corresponding offset in regmap_irq_set_type().269 * at the corresponding offset in regmap_irq_set_type().
269 */270 */
270 if (d->chip->type_in_mask && type)271 if (d->chip->type_in_mask && type)
271 mask = d->type_buf[irq_data->reg_offset / map->reg_stride];272 mask = d->type_buf[reg] & irq_data->mask;
272 else273 else
273 mask = irq_data->mask;274 mask = irq_data->mask;
274 275
275 if (d->chip->clear_on_unmask)276 if (d->chip->clear_on_unmask)
276 d->clear_status = true;277 d->clear_status = true;
277 278
278 d->mask_buf[irq_data->reg_offset / map->reg_stride] &= ~mask;279 d->mask_buf[reg] &= ~mask;
279}280}
280 281
281static void regmap_irq_disable(struct irq_data *data)282static void regmap_irq_disable(struct irq_data *data)
@@ -386,6 +387,7 @@ static inline int read_sub_irq_data(struct regmap_irq_chip_data *data, · 104 unmodified lines
386 subreg = &chip->sub_reg_offsets[b];387 subreg = &chip->sub_reg_offsets[b];
387 for (i = 0; i < subreg->num_regs; i++) {388 for (i = 0; i < subreg->num_regs; i++) {
388 unsigned int offset = subreg->offset[i];389 unsigned int offset = subreg->offset[i];
390 unsigned int index = offset / map->reg_stride;
389 391
390 if (chip->not_fixed_stride)392 if (chip->not_fixed_stride)
391 ret = regmap_read(map,393 ret = regmap_read(map,
@@ -394,7 +396,7 @@ static inline int read_sub_irq_data(struct regmap_irq_chip_data *data, · 2 unmodified lines
394 else396 else
395 ret = regmap_read(map,397 ret = regmap_read(map,
396 chip->status_base + offset,398 chip->status_base + offset,
397 &data->status_buf[offset]);399 &data->status_buf[index]);
398 400
399 if (ret)401 if (ret)
400 break;402 break;
drivers/base/regmap/regmap.c+8−7
@@ -1880,8 +1880,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, · 1879 unmodified lines
1880 */1880 */
1881bool regmap_can_raw_write(struct regmap *map)1881bool regmap_can_raw_write(struct regmap *map)
1882{1882{
1883 return map->bus && map->bus->write && map->format.format_val &&1883 return map->write && map->format.format_val && map->format.format_reg;
1884 map->format.format_reg;
1885}1884}
1886EXPORT_SYMBOL_GPL(regmap_can_raw_write);1885EXPORT_SYMBOL_GPL(regmap_can_raw_write);
1887 1886
@@ -2155,10 +2154,9 @@ int regmap_noinc_write(struct regmap *map, unsigned int reg, · 267 unmodified lines
2155 size_t write_len;2154 size_t write_len;
2156 int ret;2155 int ret;
2157 2156
2158 if (!map->bus)2157 if (!map->write)
2159 return -EINVAL;
2160 if (!map->bus->write)
2161 return -ENOTSUPP;2158 return -ENOTSUPP;
2159
2162 if (val_len % map->format.val_bytes)2160 if (val_len % map->format.val_bytes)
2163 return -EINVAL;2161 return -EINVAL;
2164 if (!IS_ALIGNED(reg, map->reg_stride))2162 if (!IS_ALIGNED(reg, map->reg_stride))
@@ -2278,7 +2276,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, · 113 unmodified lines
2278 * Some devices don't support bulk write, for them we have a series of2276 * Some devices don't support bulk write, for them we have a series of
2279 * single write operations.2277 * single write operations.
2280 */2278 */
2281 if (!map->bus || !map->format.parse_inplace) {2279 if (!map->write || !map->format.parse_inplace) {
2282 map->lock(map->lock_arg);2280 map->lock(map->lock_arg);
2283 for (i = 0; i < val_count; i++) {2281 for (i = 0; i < val_count; i++) {
2284 unsigned int ival;2282 unsigned int ival;
@@ -2904,6 +2902,9 @@ int regmap_noinc_read(struct regmap *map, unsigned int reg, · 619 unmodified lines
2904 size_t read_len;2902 size_t read_len;
2905 int ret;2903 int ret;
2906 2904
2905 if (!map->read)
2906 return -ENOTSUPP;
2907
2907 if (val_len % map->format.val_bytes)2908 if (val_len % map->format.val_bytes)
2908 return -EINVAL;2909 return -EINVAL;
2909 if (!IS_ALIGNED(reg, map->reg_stride))2910 if (!IS_ALIGNED(reg, map->reg_stride))
@@ -3017,7 +3018,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, · 107 unmodified lines
3017 if (val_count == 0)3018 if (val_count == 0)
3018 return -EINVAL;3019 return -EINVAL;
3019 3020
3020 if (map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) {3021 if (map->read && map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) {
3021 ret = regmap_raw_read(map, reg, val, val_bytes * val_count);3022 ret = regmap_raw_read(map, reg, val, val_bytes * val_count);
3022 if (ret != 0)3023 if (ret != 0)
3023 return ret;3024 return ret;