[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <cover.1668129763.git.william.gray@linaro.org>
Date: Thu, 10 Nov 2022 20:55:49 -0500
From: William Breathitt Gray <william.gray@...aro.org>
To: linus.walleij@...aro.org, brgl@...ev.pl
Cc: andriy.shevchenko@...ux.intel.com, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org, michael@...le.cc, broonie@...nel.org,
William Breathitt Gray <william.gray@...aro.org>
Subject: [PATCH v2 0/4] Migrate i8255 GPIO drivers to regmap API
Changes in v2:
- Leveraged gpio_regmap to support GPIO functionality in 104-idi-48
driver and i8255 library
- Leveraged regmap_irq to support IRQ functionality in 104-idi-48 and
104-dio-48e drivers
- Removed i8255 dependency from 104-idi-48; simpler to just use
gpio_regmap directly in this case
- Adjust gpio_regmap to always set gpio_chip get_direction
- Introduce handle_mask_sync() callback to regmap_irq API
- i8255 library is simplified to a registration function, a
configuration structure, and a helper macro
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 (4):
gpio: regmap: Always set gpio_chip get_direction
regmap-irq: Add handle_mask_sync() callback
gpio: 104-idi-48: Migrate to regmap API
gpio: i8255: Migrate to regmap API
drivers/base/regmap/regmap-irq.c | 44 +++-
drivers/gpio/Kconfig | 5 +-
drivers/gpio/gpio-104-dio-48e.c | 397 ++++++++++------------------
drivers/gpio/gpio-104-idi-48.c | 329 ++++++++----------------
drivers/gpio/gpio-gpio-mm.c | 151 ++---------
drivers/gpio/gpio-i8255.c | 429 ++++++++++---------------------
drivers/gpio/gpio-i8255.h | 80 +++---
drivers/gpio/gpio-regmap.c | 7 +-
include/linux/regmap.h | 5 +
9 files changed, 483 insertions(+), 964 deletions(-)
rewrite drivers/gpio/gpio-i8255.c (89%)
rewrite drivers/gpio/gpio-i8255.h (89%)
base-commit: 8dab99c9eab3162bfb4326c35579a3388dbf68f2
--
2.38.1
Powered by blists - more mailing lists