[PATCH v2 0/3] Introduce the ACCES IDIO-16 GPIO library module

William Breathitt Gray
2022-09-18T19:54:17Z

Changes in v2:
- Added offset check for last byte of inputs in idio_16_get() for
robustness
- Replaced hardcoded '16' with IDIO_16_NOUT constant in idio_16_get*()
- Renamed IDIO_16 namespace to GPIO_IDIO_16; adjusted 104-idio-16 and
pci-idio-16 drivers accordingly
- Utilized DEFAULT_SYMBOL_NAMESPACE to simplify namespace exports
- Refactored callbacks to utilize cached output states; idio_16_get()
callback now requires struct idio_16_state state; adjusted
104-idio-16 and pci-idio-16 drivers accordingly
- Moved bitmap_fill() to after idio_16_state_init() in idio_16_probe()
to prevent clobbering out_state if the implementation of
idio_16_state_init changes in the future
- Adjusted offset checks in idio_16_set() and idio_16_get_direction()
to ">= IDIO_16_NOUT" for consistency
- Utilized __assign_bit() in idio_16_set()
- Refactored idio_16_*_multiple() callbacks to utilize bitmap_replace()

In a similar vein as the Intel 8255 interface library module [0], the
ACCES IDIO-16 GPIO library module is introduced to consolidate much of
the shared code between the existing 104-IDIO-16 and PCI-IDIO-16 GPIO
drivers.

The idio-16 module exposes consumer library functions to facilitate
communication with devices within the ACCES IDIO-16 family such as the
104-IDIO-16 and the PCI-IDIO-16.

A CONFIG_GPIO_IDIO_16 Kconfig option is introduced by this patch.
Modules wanting access to these idio-16 library functions should select
this Kconfig option and import the GPIO_IDIO_16 symbol namespace.

[0] https://lore.kernel.org/all/d1a24895f2ea67f689c24c34a20ddb43cd7246af.1658324498.git.william.gray@linaro.org/

William Breathitt Gray (3):
gpio: idio-16: Introduce the ACCES IDIO-16 GPIO library module
gpio: 104-idio-16: Utilize the idio-16 GPIO library
gpio: pci-idio-16: Utilize the idio-16 GPIO library

MAINTAINERS | 7 ++
drivers/gpio/Kconfig | 11 +++
drivers/gpio/Makefile | 1 +
drivers/gpio/gpio-104-idio-16.c | 88 ++++---------------
drivers/gpio/gpio-idio-16.c | 146 ++++++++++++++++++++++++++++++++
drivers/gpio/gpio-idio-16.h | 71 ++++++++++++++++
drivers/gpio/gpio-pci-idio-16.c | 119 +++-----------------------
7 files changed, 265 insertions(+), 178 deletions(-)
create mode 100644 drivers/gpio/gpio-idio-16.c
create mode 100644 drivers/gpio/gpio-idio-16.h

base-commit: d9e7f0e320516c660d6f33e6c16a3d99970eb14e
--
2.37.3