summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-06-14 09:29:53 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-06-14 09:29:53 +0200
commit4a62a18d33e39f00d717c4aa314697dca924cf3f (patch)
treeffb4af6c18d67754af46bb2b1abe71764415c4ff /include
parentb1eff2cc397fa99630fe8779b511b5715ec39c07 (diff)
parenta762345c7c331cf0c80819ab2fc368f3cec0a4e9 (diff)
downloadbarebox-4a62a18d33e39f00d717c4aa314697dca924cf3f.tar.gz
barebox-4a62a18d33e39f00d717c4aa314697dca924cf3f.tar.xz
Merge branch 'for-next/gpio'
Diffstat (limited to 'include')
-rw-r--r--include/gpio.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h
index 7b3f512b19..56aae22236 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -6,6 +6,11 @@ void gpio_set_value(unsigned gpio, int value);
int gpio_get_value(unsigned gpio);
int gpio_direction_output(unsigned gpio, int value);
int gpio_direction_input(unsigned gpio);
+
+void gpio_set_active(unsigned gpio, bool state);
+int gpio_is_active(unsigned gpio);
+int gpio_direction_active(unsigned gpio, bool state);
+
#else
static inline void gpio_set_value(unsigned gpio, int value)
{
@@ -22,6 +27,18 @@ static inline int gpio_direction_input(unsigned gpio)
{
return -EINVAL;
}
+
+static inline void gpio_set_active(unsigned gpio, int value)
+{
+}
+static inline int gpio_is_active(unsigned gpio)
+{
+ return 0;
+}
+static inline int gpio_direction_active(unsigned gpio, int value)
+{
+ return -EINVAL;
+}
#endif
#define ARCH_NR_GPIOS 256
@@ -45,6 +62,14 @@ static inline int gpio_is_valid(int gpio)
#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
+#define GPIOF_LOGICAL BIT(2)
+#define GPIOF_ACTIVE_HIGH GPIOF_LOGICAL
+#define GPIOF_ACTIVE_LOW (BIT(3) | GPIOF_LOGICAL)
+#define GPIOF_INIT_INACTIVE GPIOF_LOGICAL
+#define GPIOF_INIT_ACTIVE (GPIOF_LOGICAL | GPIOF_INIT_HIGH)
+#define GPIOF_OUT_INIT_ACTIVE (GPIOF_DIR_OUT | GPIOF_INIT_ACTIVE)
+#define GPIOF_OUT_INIT_INACTIVE (GPIOF_DIR_OUT | GPIOF_INIT_INACTIVE)
+
/**
* struct gpio - a structure describing a GPIO with configuration
* @gpio: the GPIO number