mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 04:42:12 +00:00
f55be1bf52
The <mach/gpio.h> file is included from upper directories and deal with generic GPIO and gpiolib stuff. Break out the platform and driver specific defines and functions into its own header file. Cc: Eric Miao <eric.y.miao@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
31 lines
690 B
C
31 lines
690 B
C
#ifndef __PLAT_GPIO_H
|
|
#define __PLAT_GPIO_H
|
|
|
|
#define __ARM_GPIOLIB_COMPLEX
|
|
|
|
/* The individual machine provides register offsets and NR_BUILTIN_GPIO */
|
|
#include <mach/gpio-pxa.h>
|
|
|
|
static inline int gpio_get_value(unsigned gpio)
|
|
{
|
|
if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO))
|
|
return GPLR(gpio) & GPIO_bit(gpio);
|
|
else
|
|
return __gpio_get_value(gpio);
|
|
}
|
|
|
|
static inline void gpio_set_value(unsigned gpio, int value)
|
|
{
|
|
if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) {
|
|
if (value)
|
|
GPSR(gpio) = GPIO_bit(gpio);
|
|
else
|
|
GPCR(gpio) = GPIO_bit(gpio);
|
|
} else
|
|
__gpio_set_value(gpio, value);
|
|
}
|
|
|
|
#define gpio_cansleep __gpio_cansleep
|
|
|
|
#endif /* __PLAT_GPIO_H */
|