On Mon, Jun 20, 2022 at 10:07 PM Aidan MacDonald aidanmacdonald.0x0@gmail.com wrote:
Hi Mark,
Here's a bunch of cleanups for regmap-irq focused on simplifying the API and generalizing it a bit. It's broken up into three refactors, focusing on one area at a time.
Patches 01 and 02 are straightforward bugfixes, independent of the rest of the series. Neither of the bugs are triggered by in-tree drivers but they might be worth picking up early anyhow.
Patches 03-13 clean up everything related to configuring IRQ types.
Patches 14-45 deal with mask/unmask registers. First, make unmask registers behave more intuitively and usefully, and get rid of the mask_invert flag in favor of describing inverted mask registers as unmask registers. Second, make the mask_writeonly flag more useful and enable it for two chips where it makes sense.
Patches 46-49 refactor sub_irq_reg() as a get_irq_reg() callback, and use that to eliminate the not_fixed_stride flag.
The approach I used when refactoring is pretty simple: (1) introduce new functionality in regmap-irq, (2) convert the drivers, and (3) remove any old code. Nothing should break in the middle.
The patches can be re-ordered to some extent if that's preferable, but it's best to add get_irq_reg() last to avoid having to think about how it interacts with features that'll be removed anyway.
I can't test most of the devices affected by this series so a lot of the code is only build tested. I've tested on real hardware with my AXP192 patchset[1], although it only provides limited code coverage.
qcom-pm8008 in particular deserves careful testing - it used all of the features touched by the refactors and required the most changes. Other drivers only required trivial changes but there are three of them worth mentioning: wcd943x, wcd9335, and wcd938x. They have suspicious looking IRQ type definitions and I'm pretty sure aren't working properly, but I can't fix them myself. The refactor shouldn't affect their behavior so how / when / if they get fixed shouldn't be much of an issue.
Oh, and I added the 'mask_writeonly' flag and volatile ranges to the stpmic1 driver based on its datasheet[2] as a small optimization. It's probably fine but testing would be a good idea.
Cool series, thanks for cleaning this up!