summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-04-15 14:01:50 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-04-15 14:01:50 +0200
commita9450309bb51ff3d7159db85b6b40be20eaba962 (patch)
treecb86068501d9c3ce153ae92e3fc7b6655831a0f3 /include
parent7d20416fa9a1d05838bc52b307d689cc13002506 (diff)
parentb11b738ed1b1e05a20680451b9fae52530645acb (diff)
downloadbarebox-a9450309bb51ff3d7159db85b6b40be20eaba962.tar.gz
barebox-a9450309bb51ff3d7159db85b6b40be20eaba962.tar.xz
Merge branch 'for-next/gpio'
Diffstat (limited to 'include')
-rw-r--r--include/gpiod.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/gpiod.h b/include/gpiod.h
new file mode 100644
index 0000000000..c8b2cd47a3
--- /dev/null
+++ b/include/gpiod.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __GPIOD_H_
+#define __GPIOD_H_
+
+#include <gpio.h>
+#include <of_gpio.h>
+
+/**
+ * Optional flags that can be passed to one of gpiod_* to configure direction
+ * and output value. These values cannot be OR'd.
+ */
+enum gpiod_flags {
+ GPIOD_ASIS = 0,
+ GPIOD_IN = GPIOF_IN,
+ /*
+ * To change this later to a different logic level (i.e. taking
+ * active low into account), use gpio_direction_active()
+ */
+ GPIOD_OUT_LOW = GPIOF_OUT_INIT_INACTIVE,
+ GPIOD_OUT_HIGH = GPIOF_OUT_INIT_ACTIVE,
+};
+
+/* returned gpio descriptor can be passed to any normal gpio_* function */
+int gpiod_get(struct device_d *dev, const char *_con_id, enum gpiod_flags flags);
+
+#endif