[PATCH 15/49] regmap-irq: Change the behavior of mask_writeonly
Andy Shevchenko
andy.shevchenko at gmail.com
Tue Jun 21 02:29:23 PDT 2022
On Mon, Jun 20, 2022 at 10:08 PM Aidan MacDonald
<aidanmacdonald.0x0 at gmail.com> wrote:
>
> No drivers currently use mask_writeonly, and in its current form
> it seems a bit misleading. When set, mask registers will be
> updated with regmap_write_bits() instead of regmap_update_bits(),
> but regmap_write_bits() still does a read-modify-write under the
> hood. It's not a write-only operation.
>
> Performing a simple regmap_write() is probably more useful, since
> it can be used for chips that have separate set & clear registers
> for controlling mask bits. Such registers are normally volatile
> and read as 0, so avoiding a register read minimizes bus traffic.
Reading your explanations and the code, I would rather think about
fixing the regmap_write_bits() to be writeonly op.
Otherwise it's unclear what's the difference between
regmap_write_bits() vs. regmap_update_bits().
...
> if (d->chip->mask_writeonly)
> - return regmap_write_bits(d->map, reg, mask, val);
> + return regmap_write(d->map, reg, val & mask);
> else
> return regmap_update_bits(d->map, reg, mask, val);
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list