-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gpiolib/arches: Centralise bolierplate asm/gpio.h
Rather than requiring architectures that use gpiolib but don't have any need to define anything custom to copy an asm/gpio.h provide a Kconfig symbol which architectures must select in order to include gpio.h and for other architectures just provide the trivial implementation directly. This makes it much easier to do gpiolib updates and is also a step towards making gpiolib APIs available on every architecture. For architectures with existing boilerplate code leave a stub header in place which warns on direct inclusion of asm/gpio.h and includes linux/gpio.h to catch code that's doing this. Direct inclusion of asm/gpio.h has long been deprecated. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Jonas Bonn <jonas@southpole.se> Acked-by: Tony Luck <tony.luck@intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
- Loading branch information
Mark Brown
authored and
Grant Likely
committed
May 12, 2012
1 parent
25cf250
commit 7563bbf
Showing
17 changed files
with
81 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,4 @@ | ||
/* | ||
* Generic GPIO API implementation for Alpha. | ||
* | ||
* A stright copy of that for PowerPC which was: | ||
* | ||
* Copyright (c) 2007-2008 MontaVista Software, Inc. | ||
* | ||
* Author: Anton Vorontsov <avorontsov@ru.mvista.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
#ifndef _ASM_ALPHA_GPIO_H | ||
#define _ASM_ALPHA_GPIO_H | ||
|
||
#include <linux/errno.h> | ||
#include <asm-generic/gpio.h> | ||
|
||
#ifdef CONFIG_GPIOLIB | ||
|
||
/* | ||
* We don't (yet) implement inlined/rapid versions for on-chip gpios. | ||
* Just call gpiolib. | ||
*/ | ||
static inline int gpio_get_value(unsigned int gpio) | ||
{ | ||
return __gpio_get_value(gpio); | ||
} | ||
|
||
static inline void gpio_set_value(unsigned int gpio, int value) | ||
{ | ||
__gpio_set_value(gpio, value); | ||
} | ||
|
||
static inline int gpio_cansleep(unsigned int gpio) | ||
{ | ||
return __gpio_cansleep(gpio); | ||
} | ||
|
||
static inline int gpio_to_irq(unsigned int gpio) | ||
{ | ||
return __gpio_to_irq(gpio); | ||
} | ||
|
||
static inline int irq_to_gpio(unsigned int irq) | ||
{ | ||
return -EINVAL; | ||
} | ||
|
||
#endif /* CONFIG_GPIOLIB */ | ||
|
||
#endif /* _ASM_ALPHA_GPIO_H */ | ||
#ifndef __LINUX_GPIO_H | ||
#warning Include linux/gpio.h instead of asm/gpio.h | ||
#include <linux/gpio.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,4 @@ | ||
/* | ||
* Generic GPIO API implementation for IA-64. | ||
* | ||
* A stright copy of that for PowerPC which was: | ||
* | ||
* Copyright (c) 2007-2008 MontaVista Software, Inc. | ||
* | ||
* Author: Anton Vorontsov <avorontsov@ru.mvista.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
#ifndef _ASM_IA64_GPIO_H | ||
#define _ASM_IA64_GPIO_H | ||
|
||
#include <linux/errno.h> | ||
#include <asm-generic/gpio.h> | ||
|
||
#ifdef CONFIG_GPIOLIB | ||
|
||
/* | ||
* We don't (yet) implement inlined/rapid versions for on-chip gpios. | ||
* Just call gpiolib. | ||
*/ | ||
static inline int gpio_get_value(unsigned int gpio) | ||
{ | ||
return __gpio_get_value(gpio); | ||
} | ||
|
||
static inline void gpio_set_value(unsigned int gpio, int value) | ||
{ | ||
__gpio_set_value(gpio, value); | ||
} | ||
|
||
static inline int gpio_cansleep(unsigned int gpio) | ||
{ | ||
return __gpio_cansleep(gpio); | ||
} | ||
|
||
static inline int gpio_to_irq(unsigned int gpio) | ||
{ | ||
return __gpio_to_irq(gpio); | ||
} | ||
|
||
static inline int irq_to_gpio(unsigned int irq) | ||
{ | ||
return -EINVAL; | ||
} | ||
|
||
#endif /* CONFIG_GPIOLIB */ | ||
|
||
#endif /* _ASM_IA64_GPIO_H */ | ||
#ifndef __LINUX_GPIO_H | ||
#warning Include linux/gpio.h instead of asm/gpio.h | ||
#include <linux/gpio.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,4 @@ | ||
/* | ||
* Generic GPIO API implementation for PowerPC. | ||
* | ||
* Copyright (c) 2007-2008 MontaVista Software, Inc. | ||
* | ||
* Author: Anton Vorontsov <avorontsov@ru.mvista.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
#ifndef _ASM_MICROBLAZE_GPIO_H | ||
#define _ASM_MICROBLAZE_GPIO_H | ||
|
||
#include <linux/errno.h> | ||
#include <asm-generic/gpio.h> | ||
|
||
#ifdef CONFIG_GPIOLIB | ||
|
||
/* | ||
* We don't (yet) implement inlined/rapid versions for on-chip gpios. | ||
* Just call gpiolib. | ||
*/ | ||
static inline int gpio_get_value(unsigned int gpio) | ||
{ | ||
return __gpio_get_value(gpio); | ||
} | ||
|
||
static inline void gpio_set_value(unsigned int gpio, int value) | ||
{ | ||
__gpio_set_value(gpio, value); | ||
} | ||
|
||
static inline int gpio_cansleep(unsigned int gpio) | ||
{ | ||
return __gpio_cansleep(gpio); | ||
} | ||
|
||
static inline int gpio_to_irq(unsigned int gpio) | ||
{ | ||
return __gpio_to_irq(gpio); | ||
} | ||
|
||
static inline int irq_to_gpio(unsigned int irq) | ||
{ | ||
return -EINVAL; | ||
} | ||
|
||
#endif /* CONFIG_GPIOLIB */ | ||
|
||
#endif /* _ASM_MICROBLAZE_GPIO_H */ | ||
#ifndef __LINUX_GPIO_H | ||
#warning Include linux/gpio.h instead of asm/gpio.h | ||
#include <linux/gpio.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,4 @@ | ||
/* | ||
* OpenRISC Linux | ||
* | ||
* Linux architectural port borrowing liberally from similar works of | ||
* others. All original copyrights apply as per the original source | ||
* declaration. | ||
* | ||
* OpenRISC implementation: | ||
* Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> | ||
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> | ||
* et al. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
#ifndef __ASM_OPENRISC_GPIO_H | ||
#define __ASM_OPENRISC_GPIO_H | ||
|
||
#include <linux/errno.h> | ||
#include <asm-generic/gpio.h> | ||
|
||
#ifdef CONFIG_GPIOLIB | ||
|
||
/* | ||
* OpenRISC (or1k) does not have on-chip GPIO's so there is not really | ||
* any standardized implementation that makes sense here. If passing | ||
* through gpiolib becomes a bottleneck then it may make sense, on a | ||
* case-by-case basis, to implement these inlined/rapid versions. | ||
* | ||
* Just call gpiolib. | ||
*/ | ||
static inline int gpio_get_value(unsigned int gpio) | ||
{ | ||
return __gpio_get_value(gpio); | ||
} | ||
|
||
static inline void gpio_set_value(unsigned int gpio, int value) | ||
{ | ||
__gpio_set_value(gpio, value); | ||
} | ||
|
||
static inline int gpio_cansleep(unsigned int gpio) | ||
{ | ||
return __gpio_cansleep(gpio); | ||
} | ||
|
||
/* | ||
* Not implemented, yet. | ||
*/ | ||
static inline int gpio_to_irq(unsigned int gpio) | ||
{ | ||
return -ENOSYS; | ||
} | ||
|
||
static inline int irq_to_gpio(unsigned int irq) | ||
{ | ||
return -EINVAL; | ||
} | ||
|
||
#endif /* CONFIG_GPIOLIB */ | ||
|
||
#endif /* __ASM_OPENRISC_GPIO_H */ | ||
#ifndef __LINUX_GPIO_H | ||
#warning Include linux/gpio.h instead of asm/gpio.h | ||
#include <linux/gpio.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,4 @@ | ||
/* | ||
* Generic GPIO API implementation for PowerPC. | ||
* | ||
* Copyright (c) 2007-2008 MontaVista Software, Inc. | ||
* | ||
* Author: Anton Vorontsov <avorontsov@ru.mvista.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
#ifndef __ASM_POWERPC_GPIO_H | ||
#define __ASM_POWERPC_GPIO_H | ||
|
||
#include <linux/errno.h> | ||
#include <asm-generic/gpio.h> | ||
|
||
#ifdef CONFIG_GPIOLIB | ||
|
||
/* | ||
* We don't (yet) implement inlined/rapid versions for on-chip gpios. | ||
* Just call gpiolib. | ||
*/ | ||
static inline int gpio_get_value(unsigned int gpio) | ||
{ | ||
return __gpio_get_value(gpio); | ||
} | ||
|
||
static inline void gpio_set_value(unsigned int gpio, int value) | ||
{ | ||
__gpio_set_value(gpio, value); | ||
} | ||
|
||
static inline int gpio_cansleep(unsigned int gpio) | ||
{ | ||
return __gpio_cansleep(gpio); | ||
} | ||
|
||
static inline int gpio_to_irq(unsigned int gpio) | ||
{ | ||
return __gpio_to_irq(gpio); | ||
} | ||
|
||
static inline int irq_to_gpio(unsigned int irq) | ||
{ | ||
return -EINVAL; | ||
} | ||
|
||
#endif /* CONFIG_GPIOLIB */ | ||
|
||
#endif /* __ASM_POWERPC_GPIO_H */ | ||
#ifndef __LINUX_GPIO_H | ||
#warning Include linux/gpio.h instead of asm/gpio.h | ||
#include <linux/gpio.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,4 @@ | ||
#ifndef __ASM_SPARC_GPIO_H | ||
#define __ASM_SPARC_GPIO_H | ||
|
||
#include <linux/errno.h> | ||
#include <asm-generic/gpio.h> | ||
|
||
#ifdef CONFIG_GPIOLIB | ||
|
||
static inline int gpio_get_value(unsigned int gpio) | ||
{ | ||
return __gpio_get_value(gpio); | ||
} | ||
|
||
static inline void gpio_set_value(unsigned int gpio, int value) | ||
{ | ||
__gpio_set_value(gpio, value); | ||
} | ||
|
||
static inline int gpio_cansleep(unsigned int gpio) | ||
{ | ||
return __gpio_cansleep(gpio); | ||
} | ||
|
||
static inline int gpio_to_irq(unsigned int gpio) | ||
{ | ||
return -ENOSYS; | ||
} | ||
|
||
static inline int irq_to_gpio(unsigned int irq) | ||
{ | ||
return -EINVAL; | ||
} | ||
|
||
#endif /* CONFIG_GPIOLIB */ | ||
|
||
#endif /* __ASM_SPARC_GPIO_H */ | ||
#ifndef __LINUX_GPIO_H | ||
#warning Include linux/gpio.h instead of asm/gpio.h | ||
#include <linux/gpio.h> | ||
#endif |
Oops, something went wrong.