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()
Unified · Split
| @@ -252,6 +252,7 @@ static void regmap_irq_enable(struct irq_data *data) · 251 unmodified lines | ||
| 252 | 252 | struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); |
| 253 | 253 | struct regmap *map = d->map; |
| 254 | 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 | 256 | unsigned int mask, type; |
| 256 | 257 | |
| 257 | 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 | 269 | * at the corresponding offset in regmap_irq_set_type(). |
| 269 | 270 | */ |
| 270 | 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 | 273 | else |
| 273 | 274 | mask = irq_data->mask; |
| 274 | 275 | |
| 275 | 276 | if (d->chip->clear_on_unmask) |
| 276 | 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 | |
| 281 | 282 | static 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 | 387 | subreg = &chip->sub_reg_offsets[b]; |
| 387 | 388 | for (i = 0; i < subreg->num_regs; i++) { |
| 388 | 389 | unsigned int offset = subreg->offset[i]; |
| 390 | + unsigned int index = offset / map->reg_stride; | |
| 389 | 391 | |
| 390 | 392 | if (chip->not_fixed_stride) |
| 391 | 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 | 396 | else |
| 395 | 397 | ret = regmap_read(map, |
| 396 | 398 | chip->status_base + offset, |
| 397 | − &data->status_buf[offset]); | |
| 399 | + &data->status_buf[index]); | |
| 398 | 400 | |
| 399 | 401 | if (ret) |
| 400 | 402 | break; |
| @@ -1880,8 +1880,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, · 1879 unmodified lines | ||
| 1880 | 1880 | */ |
| 1881 | 1881 | bool regmap_can_raw_write(struct regmap *map) |
| 1882 | 1882 | { |
| 1883 | − return map->bus && map->bus->write && map->format.format_val && | |
| 1884 | − map->format.format_reg; | |
| 1883 | + return map->write && map->format.format_val && map->format.format_reg; | |
| 1885 | 1884 | } |
| 1886 | 1885 | EXPORT_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 | 2154 | size_t write_len; |
| 2156 | 2155 | int ret; |
| 2157 | 2156 | |
| 2158 | − if (!map->bus) | |
| 2159 | − return -EINVAL; | |
| 2160 | − if (!map->bus->write) | |
| 2157 | + if (!map->write) | |
| 2161 | 2158 | return -ENOTSUPP; |
| 2159 | + | |
| 2162 | 2160 | if (val_len % map->format.val_bytes) |
| 2163 | 2161 | return -EINVAL; |
| 2164 | 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 | 2276 | * Some devices don't support bulk write, for them we have a series of |
| 2279 | 2277 | * single write operations. |
| 2280 | 2278 | */ |
| 2281 | − if (!map->bus || !map->format.parse_inplace) { | |
| 2279 | + if (!map->write || !map->format.parse_inplace) { | |
| 2282 | 2280 | map->lock(map->lock_arg); |
| 2283 | 2281 | for (i = 0; i < val_count; i++) { |
| 2284 | 2282 | unsigned int ival; |
| @@ -2904,6 +2902,9 @@ int regmap_noinc_read(struct regmap *map, unsigned int reg, · 619 unmodified lines | ||
| 2904 | 2902 | size_t read_len; |
| 2905 | 2903 | int ret; |
| 2906 | 2904 | |
| 2905 | + if (!map->read) | |
| 2906 | + return -ENOTSUPP; | |
| 2907 | + | |
| 2907 | 2908 | if (val_len % map->format.val_bytes) |
| 2908 | 2909 | return -EINVAL; |
| 2909 | 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 | 3018 | if (val_count == 0) |
| 3018 | 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 | 3022 | ret = regmap_raw_read(map, reg, val, val_bytes * val_count); |
| 3022 | 3023 | if (ret != 0) |
| 3023 | 3024 | return ret; |