All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/9] Migrate i8255 GPIO drivers to regmap API
@ 2022-11-22  7:10 William Breathitt Gray
  2022-11-22  7:10 ` [PATCH v3 1/9] gpio: regmap: Always set gpio_chip get_direction William Breathitt Gray
                   ` (9 more replies)
  0 siblings, 10 replies; 28+ messages in thread
From: William Breathitt Gray @ 2022-11-22  7:10 UTC (permalink / raw)
  To: linus.walleij, brgl
  Cc: andriy.shevchenko, linux-gpio, linux-kernel, michael, broonie,
	William Breathitt Gray

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
-- 
2.38.1


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

end of thread, other threads:[~2022-12-09 18:59 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22  7:10 [PATCH v3 0/9] Migrate i8255 GPIO drivers to regmap API William Breathitt Gray
2022-11-22  7:10 ` [PATCH v3 1/9] gpio: regmap: Always set gpio_chip get_direction William Breathitt Gray
2022-11-22  7:10 ` [PATCH v3 2/9] regmap-irq: Add handle_mask_sync() callback William Breathitt Gray
2022-11-22  7:11 ` [PATCH v3 3/9] gpio: 104-dio-48e: Migrate to the regmap-irq API William Breathitt Gray
2022-11-23 15:01   ` Andy Shevchenko
2022-11-22 10:29     ` William Breathitt Gray
2022-11-27 18:31       ` Michael Walle
2022-11-27 22:00         ` William Breathitt Gray
2022-11-28  9:51           ` Andy Shevchenko
2022-11-28  9:56             ` Andy Shevchenko
2022-11-28 10:04               ` Andy Shevchenko
2022-11-28  9:41         ` Andy Shevchenko
2022-11-28  9:56           ` Michael Walle
2022-11-28 10:02             ` Andy Shevchenko
2022-11-22  7:11 ` [PATCH v3 4/9] gpio: 104-idi-48: " William Breathitt Gray
2022-11-23 17:28   ` Andy Shevchenko
2022-11-22  7:11 ` [PATCH v3 5/9] gpio: 104-idi-48: Migrate to gpio-regmap API William Breathitt Gray
2022-11-23 17:31   ` Andy Shevchenko
2022-11-22  7:11 ` [PATCH v3 6/9] gpio: i8255: " William Breathitt Gray
2022-11-23 17:42   ` Andy Shevchenko
2022-11-22 11:34     ` William Breathitt Gray
2022-11-22  7:11 ` [PATCH v3 7/9] gpio: 104-dio-48e: Migrate to regmap API William Breathitt Gray
2022-11-23 17:43   ` Andy Shevchenko
2022-11-22  7:11 ` [PATCH v3 8/9] gpio: gpio-mm: " William Breathitt Gray
2022-11-23 17:46   ` Andy Shevchenko
2022-11-22  7:11 ` [PATCH v3 9/9] gpio: i8255: Remove unused legacy interface William Breathitt Gray
2022-11-23 17:31   ` Andy Shevchenko
2022-12-09 18:59 ` (subset) [PATCH v3 0/9] Migrate i8255 GPIO drivers to regmap API Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.