Skip to contentSkip to conversation

Introduce the ACCES IDIO-16 GPIO library module

PATCH Applied William Breathitt Gray 3 participants 7 messages Sep 18, 2022 – Oct 25, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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.

[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

Signature · 1 line
2.37.3
#1 lore raw

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
index 8a5012ba6ff9..93938b0bdb91 100644
@@ -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
index ed9e71d6713e..551351e11365 100644
@@ -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
index b67e29d348cf..15abf88c167b 100644
@@ -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
#2 lore raw

Re: [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_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.

---

Queued, thanks!

Bart

#3 lore raw

PATCH v2 2/3 gpio: 104-idio-16: Utilize the idio-16 GPIO library

In reply to William Breathitt Gray

The 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
index 551351e11365..48846ee476e2 100644
@@ -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
#4 lore raw

PATCH v2 3/3 gpio: pci-idio-16: Utilize the idio-16 GPIO library

In reply to William Breathitt Gray

The 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
index 48846ee476e2..8b90bff7b198 100644
@@ -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
#5 lore raw
In reply to William Breathitt Gray
Quoted 51 lines · William Breathitt Gray

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

#6 lore raw
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