[PATCH v5 0/8] Migrate i8255 GPIO drivers to regmap API

From: William Breathitt Gray
Date: Tue Dec 27 2022 - 09:32:48 EST


Changes in v5:
- Add REGMAP_MMIO Kconfig selection for GPIO_104_DIO_48E,
GPIO_104_IDI_48, and GPIO_GPIO_MM
- Replace magic number 0x3 with GENMASK(1, 0) to make intent clear in
the dio48e_handle_mask_sync() function
- Write (instead of read) to clear interrupts on unmask; although the
datasheet lists the respective register as read/write, all other
references state that this should be a write operation to 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 mostly 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.

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 (8):
gpio: regmap: Always set gpio_chip get_direction
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/gpio/Kconfig | 8 +-
drivers/gpio/gpio-104-dio-48e.c | 398 +++++++++++---------------------
drivers/gpio/gpio-104-idi-48.c | 336 +++++++++------------------
drivers/gpio/gpio-gpio-mm.c | 154 +++---------
drivers/gpio/gpio-i8255.c | 320 +++++++------------------
drivers/gpio/gpio-i8255.h | 54 ++---
drivers/gpio/gpio-regmap.c | 7 +-
7 files changed, 390 insertions(+), 887 deletions(-)


base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2
--
2.38.1