Introduce the ACCES IDIO-16 GPIO library module
Subsystems (4)
v2 cover Introduce the ACCES IDIO-16 GPIO library module
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.
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
Signature · 1 line
2.37.3
PATCH v2 1/3 gpio: idio-16: Introduce the ACCES IDIO-16 GPIO library 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.
--- MAINTAINERS | 7 ++ drivers/gpio/Kconfig | 9 +++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-idio-16.c | 146 ++++++++++++++++++++++++++++++++++++ drivers/gpio/gpio-idio-16.h | 71 ++++++++++++++++++ 5 files changed, 234 insertions(+) create mode 100644 drivers/gpio/gpio-idio-16.c create mode 100644 drivers/gpio/gpio-idio-16.h
MAINTAINERS +7 -0
@@ -312,6 +312,13 @@ L: [email protected] S: Maintained F: drivers/counter/104-quad-8.c +ACCES IDIO-16 GPIO LIBRARY +M: William Breathitt Gray <[email protected]> +L: [email protected] +S: Maintained +F: drivers/gpio/gpio-idio-16.c +F: drivers/gpio/gpio-idio-16.h + ACCES PCI-IDIO-16 GPIO DRIVER M: William Breathitt Gray <[email protected]> L: [email protected]
drivers/gpio/Kconfig +9 -0
@@ -109,6 +109,15 @@ config GPIO_REGMAP config GPIO_MAX730X tristate +config GPIO_IDIO_16 + tristate + help + Enables support for the idio-16 library functions. The idio-16 library + provides functions to facilitate communication with devices within the + ACCES IDIO-16 family such as the 104-IDIO-16 and the PCI-IDIO-16. + + If built as a module its name will be gpio-idio-16. + menu "Memory mapped GPIO drivers" depends on HAS_IOMEM
drivers/gpio/Makefile +1 -0
@@ -69,6 +69,7 @@ obj-$(CONFIG_GPIO_HLWD) += gpio-hlwd.o obj-$(CONFIG_HTC_EGPIO) += gpio-htc-egpio.o obj-$(CONFIG_GPIO_I8255) += gpio-i8255.o obj-$(CONFIG_GPIO_ICH) += gpio-ich.o +obj-$(CONFIG_GPIO_IDIO_16) += gpio-idio-16.o obj-$(CONFIG_GPIO_IDT3243X) += gpio-idt3243x.o obj-$(CONFIG_GPIO_IMX_SCU) += gpio-imx-scu.o obj-$(CONFIG_GPIO_IOP) += gpio-iop.o
drivers/gpio/gpio-idio-16.c new file +146 -0
146 lines not on this page · raw message
drivers/gpio/gpio-idio-16.h new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.37.3
Bartosz Golaszewski
AppliedRe: [PATCH v2 1/3] gpio: idio-16: Introduce the ACCES IDIO-16 GPIO library module
Quoted 5 lines · William Breathitt Gray
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.
Quoted 7 lines
A
CONFIG_GPIO_IDIO_16Kconfigoption is introduced by this patch. Modules wanting access to these idio-16 library functions should select thisKconfigoption and import theGPIO_IDIO_16symbol namespace.Cc Andy Shevchenko <[email protected]>Signed-off-by William Breathitt Gray <[email protected]>---
Queued, thanks!
Bart
PATCH v2 2/3 gpio: 104-idio-16: Utilize the idio-16 GPIO library
In reply to William Breathitt GrayThe ACCES 104-IDIO-16 device is part of the ACCES IDIO-16 family, so the idio-16 GPIO library module is selected and utilized to consolidate code.
--- drivers/gpio/Kconfig | 1 + drivers/gpio/gpio-104-idio-16.c | 88 ++++++--------------------------- 2 files changed, 17 insertions(+), 72 deletions(-)
drivers/gpio/Kconfig +1 -0
@@ -866,6 +866,7 @@ config GPIO_104_IDIO_16 depends on PC104 select ISA_BUS_API select GPIOLIB_IRQCHIP + select GPIO_IDIO_16 help Enables GPIO support for the ACCES 104-IDIO-16 family (104-IDIO-16, 104-IDIO-16E, 104-IDO-16, 104-IDIO-8, 104-IDIO-8E, 104-IDO-8). The
drivers/gpio/gpio-104-idio-16.c +16 -72
158 lines not on this page · raw message
Signature · 1 line
2.37.3
PATCH v2 3/3 gpio: pci-idio-16: Utilize the idio-16 GPIO library
In reply to William Breathitt GrayThe ACCES PCI-IDIO-16 device is part of the ACCES IDIO-16 family, so the idio-16 GPIO library module is selected and utilized to consolidate code.
--- drivers/gpio/Kconfig | 1 + drivers/gpio/gpio-pci-idio-16.c | 119 ++++---------------------------- 2 files changed, 14 insertions(+), 106 deletions(-)
drivers/gpio/Kconfig +1 -0
@@ -1585,6 +1585,7 @@ config GPIO_PCH config GPIO_PCI_IDIO_16 tristate "ACCES PCI-IDIO-16 GPIO support" select GPIOLIB_IRQCHIP + select GPIO_IDIO_16 help Enables GPIO support for the ACCES PCI-IDIO-16. An interrupt is generated when any of the inputs change state (low to high or high to
drivers/gpio/gpio-pci-idio-16.c +13 -106
185 lines not on this page · raw message
Signature · 1 line
2.37.3
Quoted 51 lines · William Breathitt Gray
Changes in v2:
- Added offset check for last byte of inputs inidio_16_get()for robustness
- Replaced hardcoded '16' withIDIO_16_NOUTconstant in idio_16_get*()
- RenamedIDIO_16namespace toGPIO_IDIO_16; adjusted 104-idio-16 and pci-idio-16 drivers accordingly
- UtilizedDEFAULT_SYMBOL_NAMESPACEto simplify namespace exports
- Refactored callbacks to utilize cached output states;idio_16_get()callback now requires structidio_16_statestate; adjusted 104-idio-16 and pci-idio-16 drivers accordingly
- Movedbitmap_fill()to afteridio_16_state_init()inidio_16_probe()to prevent clobberingout_stateif the implementation ofidio_16_state_initchanges in the future
- Adjusted offset checks inidio_16_set()andidio_16_get_direction()to ">=IDIO_16_NOUT" for consistency
- Utilized__assign_bit()inidio_16_set()
- Refactored idio_16_*_multiple() callbacks to utilizebitmap_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_16Kconfigoption is introduced by this patch. Modules wanting access to these idio-16 library functions should select thisKconfigoption and import theGPIO_IDIO_16symbol namespace.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 libraryMAINTAINERS | 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
Quoted 4 lines
base-commit:
d9e7f0e320516c660d6f33e6c16a3d99970eb14e--
2.37.3
This series looks good to me, Andy do you have any objections? Otherwise, I'll queue it soon.
Bartosz
Quoted 5 lines · Bartosz Golaszewski
On Sun, Sep 18, 2022 at 9:54 PM William Breathitt Gray <[email protected]> wrote:
This series looks good to me, Andy do you have any objections? Otherwise, I'll queue it soon.
Nope. If anything, we can fix iteratively later on. Thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko