[v3,0/9] Migrate i8255 GPIO drivers to regmap API

Message ID cover.1669100542.git.william.gray@linaro.org
Headers
Series Migrate i8255 GPIO drivers to regmap API |

Message

William Breathitt Gray Nov. 22, 2022, 7:10 a.m. UTC
  Changes in v3:
 - Changed handle_mask_sync description to show range using a more
   typical mathematical notation ('[' changed to ')')
 - Split addition of new i8255 library regmap interface and removal of
   old i8255 library interface to separate patches
 - Split migration of 104-dio-48e, 104-idi-48, and gpio-mm modules to
   regmap-irq, gpio-regmap, and new i8255 library interface to separate
   patches
 - Simplified logic in dio48e_handle_mask_sync(); the previous version
   separated the conditional evaluations from the if statements which
   made it more complicated than it needed to be
 - Removed initial interrupt clearing in dio48e_probe(); superfluous
   because clear_on_unmask is set to true so the interrupts will be
   cleared anyway later.
 - Replace IDI48_IRQ_REG with IDI48_IRQ_STATUS and IDI48_IRQ_ENABLE to
   make the intent of this register clear

The regmap API supports IO port accessors so we can take advantage of
regmap abstractions rather than handling access to the device registers
directly in the driver. The 104-dio-48e and gpio-mm modules depend on
the i8255 library and are thus updated accordingly.

The 104-IDI-48 is hardwired as an input-only device. Because the i8255
control registers are not exposed on the 104-IDI-48, the i8255 library
doesn't provide much benefit here. In this case it's simpler to utilize
the gpio_regmap API directly, so this patch series does such and removes
the i8255 library dependency from the 104-idi-48 module.

The first patch in this series adjusts gpio_regmap to always set
gpio_chip get_direction. This patch is larger independent of the rest of
the patches in the series and can be picked up separately if desired.
I'm including it here because it allows the input-only 104-idi-48 driver
to continue reporting offset directions after migrating to gpio_regmap.

A handle_mask_sync() callback is introduced for the regmap_irq API. This
is used by the 104-dio-48e driver to handle its enable/disable interrupt
functionality. The 104-DIO-48E has a single register to handle
enabling/disabling interrupts: a write of any value to this register
enables interrupts, while any read disables interrupts.

By leveraging the gpio_regmap API, the i8255 library is reduced to
simply a devm_i8255_regmap_register() function, a configuration
structure struct i8255_regmap_config, and a helper macro
i8255_volatile_regmap_range() provided to simplify volatile PPI register
hinting for the regmap.

The regmap_irq API is leveraged by the 104-idi-48 and 104-dio-48e
modules to support their IRQ functionality. Do their respective regmap
configurations need use_hwlock set to true in this case, or is adequate
locking already handled by the regmap_irq API?

William Breathitt Gray (9):
  gpio: regmap: Always set gpio_chip get_direction
  regmap-irq: Add handle_mask_sync() callback
  gpio: 104-dio-48e: Migrate to the regmap-irq API
  gpio: 104-idi-48: Migrate to the regmap-irq API
  gpio: 104-idi-48: Migrate to gpio-regmap API
  gpio: i8255: Migrate to gpio-regmap API
  gpio: 104-dio-48e: Migrate to regmap API
  gpio: gpio-mm: Migrate to regmap API
  gpio: i8255: Remove unused legacy interface

 drivers/base/regmap/regmap-irq.c |  44 +++-
 drivers/gpio/Kconfig             |   5 +-
 drivers/gpio/gpio-104-dio-48e.c  | 395 ++++++++++---------------------
 drivers/gpio/gpio-104-idi-48.c   | 325 ++++++++-----------------
 drivers/gpio/gpio-gpio-mm.c      | 153 +++---------
 drivers/gpio/gpio-i8255.c        | 320 +++++++------------------
 drivers/gpio/gpio-i8255.h        |  54 ++---
 drivers/gpio/gpio-regmap.c       |   7 +-
 include/linux/regmap.h           |   5 +
 9 files changed, 412 insertions(+), 896 deletions(-)


base-commit: 3687a82b1db1c827cc4b367e3efde3235f68d9f6
  

Comments

Mark Brown Dec. 9, 2022, 6:59 p.m. UTC | #1
On Tue, 22 Nov 2022 02:10:57 -0500, William Breathitt Gray wrote:
> Changes in v3:
>  - Changed handle_mask_sync description to show range using a more
>    typical mathematical notation ('[' changed to ')')
>  - Split addition of new i8255 library regmap interface and removal of
>    old i8255 library interface to separate patches
>  - Split migration of 104-dio-48e, 104-idi-48, and gpio-mm modules to
>    regmap-irq, gpio-regmap, and new i8255 library interface to separate
>    patches
>  - Simplified logic in dio48e_handle_mask_sync(); the previous version
>    separated the conditional evaluations from the if statements which
>    made it more complicated than it needed to be
>  - Removed initial interrupt clearing in dio48e_probe(); superfluous
>    because clear_on_unmask is set to true so the interrupts will be
>    cleared anyway later.
>  - Replace IDI48_IRQ_REG with IDI48_IRQ_STATUS and IDI48_IRQ_ENABLE to
>    make the intent of this register clear
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[2/9] regmap-irq: Add handle_mask_sync() callback
      commit: 69af4bcaa08d06fd4d788a7f7193fb3c40ac6aba

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark