Skip to contentSkip to conversation

Use basic_mmio_gpio to implement a generic gpio chip

RFC PATCH Superseded Jamie Iles 1 participant 4 messages May 4, 2011 GPIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jamie Iles

author
#0 lore raw

cover Use basic_mmio_gpio to implement a generic gpio chip

This series is based on my earlier set of GPIO patches[1] to extend the basic_mmio_driver to be used as a library to implement a more generic gpio chip as initially implemented by Anton Vorontsov[2].

I've modified Anton's patch slightly to allow the bgpio_chip to be embedded into another structure and converted two drivers over - bt8xxgpio and langwell. bt8xxgpio seems to play nicely, but langwell not so much as it didn't previously use a gpio_chip per bank but it is a nice illustration.

Note that this is the same set of patches as attached in "Re: [PATCHv3 0/7]
gpio: extend basic_mmio_gpio for different controllers" but reposted as a set of patches for convenience.

1. http://article.gmane.org/gmane.linux.kernel/1124700
2. http://lkml.org/lkml/2011/4/19/401

Jamie Iles (3):
basic_mmio_gpio: split into a gpio library and platform device gpio/bt8xxgpio: convert to use basic_mmio_gpio library gpio/langwell: convert to use basic_mmio_gpio library

 drivers/gpio/Kconfig            |    8 +
 drivers/gpio/Makefile           |    1 +
 drivers/gpio/basic_mmio_gpio.c  |  317 +++++++++++++++++++++------------------
 drivers/gpio/bt8xxgpio.c        |  119 +++------------
 drivers/gpio/langwell_gpio.c    |  253 +++++++++++++++----------------
 include/linux/basic_mmio_gpio.h |   55 +++++++
 6 files changed, 381 insertions(+), 372 deletions(-)
Signature · 1 line
1.7.4.4
author
#1 lore raw

RFC PATCH 1/3 basic_mmio_gpio: split into a gpio library and platform device

Allow GPIO_BASIC_MMIO_CORE to be used to provide an accessor library for implementing GPIO drivers whilst abstracting the register access detail. Based on a patch from Anton Vorontsov[1] and adapted to allow bgpio_chip to be embedded in another structure.

1. https://lkml.org/lkml/2011/4/19/401

---
 drivers/gpio/Kconfig            |    6 +
 drivers/gpio/Makefile           |    1 +
 drivers/gpio/basic_mmio_gpio.c  |  317 +++++++++++++++++++++------------------
 include/linux/basic_mmio_gpio.h |   55 +++++++
 4 files changed, 231 insertions(+), 148 deletions(-)
drivers/gpio/Kconfig +6 -0
index b7fac15..ca16a30 100644
@@ -70,8 +70,14 @@ config GPIO_MAX730X
 
 comment "Memory mapped GPIO drivers:"
 
+config GPIO_BASIC_MMIO_CORE
+	tristate
+	help
+	  Provides core functionality for basic memory-mapped GPIO controllers.
+
 config GPIO_BASIC_MMIO
 	tristate "Basic memory-mapped GPIO controllers support"
+	select GPIO_BASIC_MMIO_CORE
 	help
 	  Say yes here to support basic memory-mapped GPIO controllers.
 
drivers/gpio/Makefile +1 -0
index cfbdef1..91a295d 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_GPIOLIB)		+= gpiolib.o
 
 obj-$(CONFIG_GPIO_ADP5520)	+= adp5520-gpio.o
 obj-$(CONFIG_GPIO_ADP5588)	+= adp5588-gpio.o
+obj-$(CONFIG_GPIO_BASIC_MMIO_CORE)	+= basic_mmio_gpio.o
 obj-$(CONFIG_GPIO_BASIC_MMIO)	+= basic_mmio_gpio.o
 obj-$(CONFIG_GPIO_LANGWELL)	+= langwell_gpio.o
 obj-$(CONFIG_GPIO_MAX730X)	+= max730x.o
drivers/gpio/basic_mmio_gpio.c +169 -148

411 lines not on this page · raw message

include/linux/basic_mmio_gpio.h +55 -0

64 lines not on this page · raw message

Signature · 1 line
1.7.4.4
author
#2 lore raw

RFC PATCH 2/3 gpio/bt8xxgpio: convert to use basic_mmio_gpio library

In reply to Jamie Iles

Use the basic_mmio_gpio library for the register accesses. The driver itself is now only concerned with PCI and hardware initialisation.

---
 drivers/gpio/Kconfig     |    1 +
 drivers/gpio/bt8xxgpio.c |  119 ++++++++++------------------------------------
 2 files changed, 26 insertions(+), 94 deletions(-)
drivers/gpio/Kconfig +1 -0
index ca16a30..898cdb2 100644
@@ -332,6 +332,7 @@ config GPIO_CS5535
 config GPIO_BT8XX
 	tristate "BT8XX GPIO abuser"
 	depends on PCI && VIDEO_BT848=n
+	select GPIO_BASIC_MMIO_CORE
 	help
 	  The BT8xx frame grabber chip has 24 GPIO pins than can be abused
 	  as a cheap PCI GPIO card.
drivers/gpio/bt8xxgpio.c +25 -94

169 lines not on this page · raw message

Signature · 1 line
1.7.4.4
author
#3 lore raw

RFC PATCH 3/3 gpio/langwell: convert to use basic_mmio_gpio library

In reply to Jamie Iles

Use the basic_mmio_gpio library for register accessors. The driver is now only concerned with hardware initialisation and interrupts.

---
 drivers/gpio/Kconfig         |    1 +
 drivers/gpio/langwell_gpio.c |  253 ++++++++++++++++++++---------------------
 2 files changed, 124 insertions(+), 130 deletions(-)
drivers/gpio/Kconfig +1 -0
index 898cdb2..a0e3370 100644
@@ -349,6 +349,7 @@ config GPIO_BT8XX
 config GPIO_LANGWELL
 	bool "Intel Langwell/Penwell GPIO support"
 	depends on PCI && X86
+	select GPIO_BASIC_MMIO_CORE
 	help
 	  Say Y here to support Intel Langwell/Penwell GPIO.
 
drivers/gpio/langwell_gpio.c +123 -130

342 lines not on this page · raw message

Signature · 1 line
1.7.4.4