Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7444a72e authored by Michael Buesch's avatar Michael Buesch Committed by Linus Torvalds
Browse files

gpiolib: allow user-selection



This patch adds functionality to the gpio-lib subsystem to make it
possible to enable the gpio-lib code even if the architecture code didn't
request to get it built in.

The archtitecture code does still need to implement the gpiolib accessor
functions in its asm/gpio.h file.  This patch adds the implementations for
x86 and PPC.

With these changes it is possible to run generic GPIO expansion cards on
every architecture that implements the trivial wrapper functions.  Support
for more architectures can easily be added.

Signed-off-by: default avatarMichael Buesch <mb@bu3sch.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: David Brownell <david-b@pacbell.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Samuel Ortiz <sameo@openedhand.com>
Cc: Kumar Gala <galak@gate.crashing.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ff1d5c2f
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -389,11 +389,21 @@ either NULL or the label associated with that GPIO when it was requested.

Platform Support
----------------
To support this framework, a platform's Kconfig will "select HAVE_GPIO_LIB"
To support this framework, a platform's Kconfig will "select" either
ARCH_REQUIRE_GPIOLIB or ARCH_WANT_OPTIONAL_GPIOLIB
and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines
three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep().
They may also want to provide a custom value for ARCH_NR_GPIOS.

ARCH_REQUIRE_GPIOLIB means that the gpio-lib code will always get compiled
into the kernel on that architecture.

ARCH_WANT_OPTIONAL_GPIOLIB means the gpio-lib code defaults to off and the user
can enable it and build it into the kernel optionally.

If neither of these options are selected, the platform does not support
GPIOs through GPIO-lib and the code cannot be enabled by the user.

Trivial implementations of those functions can directly use framework
code, which always dispatches through the gpio_chip:

+4 −4
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ config ARCH_EP93XX
	select GENERIC_GPIO
	select HAVE_CLK
	select HAVE_CLK
	select HAVE_GPIO_LIB
	select ARCH_REQUIRE_GPIOLIB
	help
	  This enables support for the Cirrus EP93xx series of CPUs.

@@ -447,7 +447,7 @@ config ARCH_PXA
	select ARCH_MTD_XIP
	select GENERIC_GPIO
	select HAVE_CLK
	select HAVE_GPIO_LIB
	select ARCH_REQUIRE_GPIOLIB
	select GENERIC_TIME
	select GENERIC_CLOCKEVENTS
	select TICK_ONESHOT
@@ -479,7 +479,7 @@ config ARCH_SA1100
	select GENERIC_CLOCKEVENTS
	select HAVE_CLK
	select TICK_ONESHOT
	select HAVE_GPIO_LIB
	select ARCH_REQUIRE_GPIOLIB
	help
	  Support for StrongARM 11x0 based boards.

@@ -522,7 +522,7 @@ config ARCH_OMAP
	bool "TI OMAP"
	select GENERIC_GPIO
	select HAVE_CLK
	select HAVE_GPIO_LIB
	select ARCH_REQUIRE_GPIOLIB
	select GENERIC_TIME
	select GENERIC_CLOCKEVENTS
	help
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ config PLATFORM_AT32AP
	select SUBARCH_AVR32B
	select MMU
	select PERFORMANCE_COUNTERS
	select HAVE_GPIO_LIB
	select ARCH_REQUIRE_GPIOLIB
	select GENERIC_ALLOCATOR

#
+1 −1
Original line number Diff line number Diff line
@@ -713,7 +713,7 @@ config CSRC_SB1250

config GPIO_TXX9
	select GENERIC_GPIO
	select HAVE_GPIO_LIB
	select ARCH_REQUIRE_GPIOLIB
	bool

config CFE
+1 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ config PPC
	default y
	select HAVE_DYNAMIC_FTRACE
	select HAVE_FTRACE
	select ARCH_WANT_OPTIONAL_GPIOLIB
	select HAVE_IDE
	select HAVE_IOREMAP_PROT
	select HAVE_EFFICIENT_UNALIGNED_ACCESS
Loading