linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/8] Migrate i8255 GPIO drivers to regmap API
@ 2022-12-27 14:09 William Breathitt Gray
  2022-12-27 14:09 ` [PATCH v5 1/8] gpio: regmap: Always set gpio_chip get_direction William Breathitt Gray
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: William Breathitt Gray @ 2022-12-27 14:09 UTC (permalink / raw)
  To: linus.walleij, brgl
  Cc: andriy.shevchenko, linux-gpio, linux-kernel, michael,
	William Breathitt Gray

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-12-30 13:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-27 14:09 [PATCH v5 0/8] Migrate i8255 GPIO drivers to regmap API William Breathitt Gray
2022-12-27 14:09 ` [PATCH v5 1/8] gpio: regmap: Always set gpio_chip get_direction William Breathitt Gray
2022-12-27 14:09 ` [PATCH v5 2/8] gpio: 104-dio-48e: Migrate to the regmap-irq API William Breathitt Gray
2022-12-27 14:09 ` [PATCH v5 3/8] gpio: 104-idi-48: " William Breathitt Gray
2022-12-27 14:09 ` [PATCH v5 4/8] gpio: 104-idi-48: Migrate to gpio-regmap API William Breathitt Gray
2022-12-27 14:09 ` [PATCH v5 5/8] gpio: i8255: " William Breathitt Gray
2022-12-27 14:09 ` [PATCH v5 6/8] gpio: 104-dio-48e: Migrate to regmap API William Breathitt Gray
2022-12-27 14:09 ` [PATCH v5 7/8] gpio: gpio-mm: " William Breathitt Gray
2022-12-27 14:09 ` [PATCH v5 8/8] gpio: i8255: Remove unused legacy interface William Breathitt Gray
2022-12-30 13:07 ` [PATCH v5 0/8] Migrate i8255 GPIO drivers to regmap API Bartosz Golaszewski

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).