linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
To: broonie@kernel.org
Cc: agross@kernel.org, bjorn.andersson@linaro.org,
	srinivas.kandagatla@linaro.org, bgoswami@codeaurora.org,
	gregkh@linuxfoundation.org, rafael@kernel.org,
	cw00.choi@samsung.com, krzysztof.kozlowski@linaro.org,
	b.zolnierkie@samsung.com, myungjoo.ham@samsung.com,
	michael@walle.cc, linus.walleij@linaro.org, brgl@bgdev.pl,
	tglx@linutronix.de, maz@kernel.org, lee.jones@linaro.org,
	mani@kernel.org, cristian.ciocaltea@gmail.com, wens@csie.org,
	tharvey@gateworks.com, rjones@gateworks.com,
	mazziesaccount@gmail.com, orsonzhai@gmail.com,
	baolin.wang7@gmail.com, zhang.lyra@gmail.com,
	jernej.skrabec@gmail.com, samuel@sholland.org,
	lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-actions@lists.infradead.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, alsa-devel@alsa-project.org
Subject: [PATCH 00/49] regmap-irq cleanups and refactoring
Date: Mon, 20 Jun 2022 21:05:55 +0100	[thread overview]
Message-ID: <20220620200644.1961936-1-aidanmacdonald.0x0@gmail.com> (raw)

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.

[1]: https://lore.kernel.org/linux-iio/20220618214009.2178567-1-aidanmacdonald.0x0@gmailcom/
[2]: https://www.st.com/resource/en/datasheet/stpmic1.pdf

Aidan MacDonald (49):
  regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips
  regmap-irq: Fix offset/index mismatch in read_sub_irq_data()
  regmap-irq: Remove an unnecessary restriction on type_in_mask
  regmap-irq: Introduce config registers for irq types
  mfd: qcom-pm8008: Convert irq chip to config regs
  mfd: wcd934x: Convert irq chip to config regs
  sound: soc: codecs: wcd9335: Convert irq chip to config regs
  sound: soc: codecs: wcd938x: Remove spurious type_base from irq chip
  mfd: max77650: Remove useless type_invert flag
  regmap-irq: Remove virtual registers support
  regmap-irq: Remove old type register support, refactor
  regmap-irq: Remove unused type_reg_stride field
  regmap-irq: Remove unused type_invert flag
  regmap-irq: Do not use regmap_irq_update_bits() for wake regs
  regmap-irq: Change the behavior of mask_writeonly
  regmap-irq: Rename regmap_irq_update_bits()
  regmap-irq: Add broken_mask_unmask flag
  mfd: qcom-pm8008: Add broken_mask_unmask irq chip flag
  mfd: stpmic1: Add broken_mask_unmask irq chip flag
  regmap-irq: Fix inverted handling of unmask registers
  mfd: tps65090: replace irqchip mask_invert with unmask_base
  mfd: sun4i-gpadc: replace irqchip mask_invert with unmask_base
  mfd: sprd-sc27xx-spi: replace irqchip mask_invert with unmask_base
  mfd: rt5033: replace irqchip mask_invert with unmask_base
  mfd: rohm-bd71828: replace irqchip mask_invert with unmask_base
  mfd: rn5t618: replace irqchip mask_invert with unmask_base
  mfd: gateworks-gsc: replace irqchip mask_invert with unmask_base
  mfd: axp20x: replace irqchip mask_invert with unmask_base
  mfd: atc260x: replace irqchip mask_invert with unmask_base
  mfd: 88pm800: replace irqchip mask_invert with unmask_base
  mfd: max14577: replace irqchip mask_invert with unmask_base
  mfd: max77693: replace irqchip mask_invert with unmask_base
  mfd: rohm-bd718x7: drop useless mask_invert flag on irqchip
  mfd: max77843: drop useless mask_invert flag on irqchip
  extcon: max77843: replace irqchip mask_invert with unmask_base
  extcon: sm5502: drop useless mask_invert flag on irqchip
  extcon: rt8973a: drop useless mask_invert flag on irqchip
  irqchip: sl28cpld: replace irqchip mask_invert with unmask_base
  gpio: sl28cpld: replace irqchip mask_invert with unmask_base
  mfd: stpmic1: Fix broken mask/unmask in irq chip
  mfd: stpmic1: Enable mask_writeonly flag for irq chip
  mfd: qcom-pm8008: Fix broken mask/unmask in irq chip
  mfd: qcom-pm8008: Enable mask_writeonly flag for irq chip
  regmap-irq: Remove broken_mask_unmask flag
  regmap-irq: Remove mask_invert flag
  regmap-irq: Refactor checks for status bulk read support
  regmap-irq: Add get_irq_reg() callback
  mfd: qcom-pm8008: Use get_irq_reg() for irq chip
  regmap-irq: Remove not_fixed_stride flag

 drivers/base/regmap/regmap-irq.c | 457 ++++++++++++++-----------------
 drivers/extcon/extcon-max77843.c |   3 +-
 drivers/extcon/extcon-rt8973a.c  |   1 -
 drivers/extcon/extcon-sm5502.c   |   2 -
 drivers/gpio/gpio-sl28cpld.c     |   3 +-
 drivers/irqchip/irq-sl28cpld.c   |   3 +-
 drivers/mfd/88pm800.c            |   3 +-
 drivers/mfd/atc260x-core.c       |   6 +-
 drivers/mfd/axp20x.c             |  21 +-
 drivers/mfd/gateworks-gsc.c      |   3 +-
 drivers/mfd/max14577.c           |   7 +-
 drivers/mfd/max77650.c           |   1 -
 drivers/mfd/max77693.c           |   6 +-
 drivers/mfd/max77843.c           |   1 -
 drivers/mfd/qcom-pm8008.c        | 131 ++++-----
 drivers/mfd/rn5t618.c            |   3 +-
 drivers/mfd/rohm-bd71828.c       |   6 +-
 drivers/mfd/rohm-bd718x7.c       |   1 -
 drivers/mfd/rt5033.c             |   3 +-
 drivers/mfd/sprd-sc27xx-spi.c    |   3 +-
 drivers/mfd/stpmic1.c            |   7 +-
 drivers/mfd/sun4i-gpadc.c        |   3 +-
 drivers/mfd/tps65090.c           |   3 +-
 drivers/mfd/wcd934x.c            |  11 +-
 include/linux/regmap.h           |  59 ++--
 sound/soc/codecs/wcd9335.c       |  10 +-
 sound/soc/codecs/wcd938x.c       |   1 -
 27 files changed, 332 insertions(+), 426 deletions(-)

-- 
2.35.1


             reply	other threads:[~2022-06-20 20:06 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 20:05 Aidan MacDonald [this message]
2022-06-20 20:05 ` [PATCH 01/49] regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips Aidan MacDonald
2022-06-20 20:05 ` [PATCH 02/49] regmap-irq: Fix offset/index mismatch in read_sub_irq_data() Aidan MacDonald
2022-06-23  9:03   ` Matti Vaittinen
2022-06-23 23:29   ` Guru Das Srinagesh
2022-06-20 20:05 ` [PATCH 03/49] regmap-irq: Remove an unnecessary restriction on type_in_mask Aidan MacDonald
2022-06-20 20:05 ` [PATCH 04/49] regmap-irq: Introduce config registers for irq types Aidan MacDonald
2022-06-21  9:22   ` Andy Shevchenko
2022-06-20 20:06 ` [PATCH 05/49] mfd: qcom-pm8008: Convert irq chip to config regs Aidan MacDonald
2022-06-20 20:06 ` [PATCH 06/49] mfd: wcd934x: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 07/49] sound: soc: codecs: wcd9335: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 08/49] sound: soc: codecs: wcd938x: Remove spurious type_base from irq chip Aidan MacDonald
2022-06-20 20:06 ` [PATCH 09/49] mfd: max77650: Remove useless type_invert flag Aidan MacDonald
2022-06-20 20:06 ` [PATCH 10/49] regmap-irq: Remove virtual registers support Aidan MacDonald
2022-06-20 20:06 ` [PATCH 11/49] regmap-irq: Remove old type register support, refactor Aidan MacDonald
2022-06-20 20:06 ` [PATCH 12/49] regmap-irq: Remove unused type_reg_stride field Aidan MacDonald
2022-06-20 20:06 ` [PATCH 13/49] regmap-irq: Remove unused type_invert flag Aidan MacDonald
2022-06-20 20:06 ` [PATCH 14/49] regmap-irq: Do not use regmap_irq_update_bits() for wake regs Aidan MacDonald
2022-06-20 20:06 ` [PATCH 15/49] regmap-irq: Change the behavior of mask_writeonly Aidan MacDonald
2022-06-21  9:29   ` Andy Shevchenko
2022-06-21 21:13     ` Aidan MacDonald
     [not found]       ` <CAHp75VfoMKo9-_OTF1AAC0KyNJOb5qvYPTgHxmkYwOfTJFSLkg@mail.gmail.com>
2022-06-23 20:54         ` Aidan MacDonald
2022-06-20 20:06 ` [PATCH 16/49] regmap-irq: Rename regmap_irq_update_bits() Aidan MacDonald
2022-06-20 20:06 ` [PATCH 17/49] regmap-irq: Add broken_mask_unmask flag Aidan MacDonald
2022-06-21  9:33   ` Andy Shevchenko
2022-06-21 21:07     ` Aidan MacDonald
2022-06-20 20:06 ` [PATCH 18/49] mfd: qcom-pm8008: Add broken_mask_unmask irq chip flag Aidan MacDonald
2022-06-21  9:35   ` Andy Shevchenko
2022-06-24  0:03     ` Guru Das Srinagesh
2022-06-20 20:06 ` [PATCH 19/49] mfd: stpmic1: " Aidan MacDonald
2022-06-21  9:35   ` Andy Shevchenko
2022-06-20 20:06 ` [PATCH 20/49] regmap-irq: Fix inverted handling of unmask registers Aidan MacDonald
2022-06-21  9:40   ` Andy Shevchenko
2022-06-24  0:21   ` Guru Das Srinagesh
2022-06-20 20:06 ` [PATCH 21/49] mfd: tps65090: replace irqchip mask_invert with unmask_base Aidan MacDonald
2022-06-20 20:06 ` [PATCH 22/49] mfd: sun4i-gpadc: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 23/49] mfd: sprd-sc27xx-spi: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 24/49] mfd: rt5033: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 25/49] mfd: rohm-bd71828: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 26/49] mfd: rn5t618: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 27/49] mfd: gateworks-gsc: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 28/49] mfd: axp20x: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 29/49] mfd: atc260x: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 30/49] mfd: 88pm800: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 31/49] mfd: max14577: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 32/49] mfd: max77693: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 33/49] mfd: rohm-bd718x7: drop useless mask_invert flag on irqchip Aidan MacDonald
2022-06-23  9:09   ` Vaittinen, Matti
2022-06-20 20:06 ` [PATCH 34/49] mfd: max77843: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 35/49] extcon: max77843: replace irqchip mask_invert with unmask_base Aidan MacDonald
2022-06-20 20:06 ` [PATCH 36/49] extcon: sm5502: drop useless mask_invert flag on irqchip Aidan MacDonald
2022-06-20 20:06 ` [PATCH 37/49] extcon: rt8973a: " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 38/49] irqchip: sl28cpld: replace irqchip mask_invert with unmask_base Aidan MacDonald
2022-06-20 20:06 ` [PATCH 39/49] gpio: " Aidan MacDonald
2022-06-21  9:42   ` Andy Shevchenko
2022-06-23  6:33   ` Michael Walle
2022-06-20 20:06 ` [PATCH 40/49] mfd: stpmic1: Fix broken mask/unmask in irq chip Aidan MacDonald
2022-06-20 20:06 ` [PATCH 41/49] mfd: stpmic1: Enable mask_writeonly flag for " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 42/49] mfd: qcom-pm8008: Fix broken mask/unmask in " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 43/49] mfd: qcom-pm8008: Enable mask_writeonly flag for " Aidan MacDonald
2022-06-20 20:06 ` [PATCH 44/49] regmap-irq: Remove broken_mask_unmask flag Aidan MacDonald
2022-06-20 20:06 ` [PATCH 45/49] regmap-irq: Remove mask_invert flag Aidan MacDonald
2022-06-20 20:06 ` [PATCH 46/49] regmap-irq: Refactor checks for status bulk read support Aidan MacDonald
2022-06-21  9:45   ` Andy Shevchenko
2022-06-20 20:06 ` [PATCH 47/49] regmap-irq: Add get_irq_reg() callback Aidan MacDonald
2022-06-21  9:51   ` Andy Shevchenko
2022-06-20 20:06 ` [PATCH 48/49] mfd: qcom-pm8008: Use get_irq_reg() for irq chip Aidan MacDonald
2022-06-20 20:06 ` [PATCH 49/49] regmap-irq: Remove not_fixed_stride flag Aidan MacDonald
2022-06-21  9:25 ` [PATCH 00/49] regmap-irq cleanups and refactoring Andy Shevchenko
2022-06-21 17:08 ` Mark Brown
2022-06-21 21:04   ` Aidan MacDonald
2022-06-23 13:18     ` Mark Brown
2022-06-22 15:16 ` (subset) " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220620200644.1961936-1-aidanmacdonald.0x0@gmail.com \
    --to=aidanmacdonald.0x0@gmail.com \
    --cc=agross@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=baolin.wang7@gmail.com \
    --cc=bgoswami@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=cristian.ciocaltea@gmail.com \
    --cc=cw00.choi@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-actions@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mani@kernel.org \
    --cc=maz@kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=michael@walle.cc \
    --cc=myungjoo.ham@samsung.com \
    --cc=orsonzhai@gmail.com \
    --cc=perex@perex.cz \
    --cc=rafael@kernel.org \
    --cc=rjones@gateworks.com \
    --cc=samuel@sholland.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tglx@linutronix.de \
    --cc=tharvey@gateworks.com \
    --cc=tiwai@suse.com \
    --cc=wens@csie.org \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).