summaryrefslogtreecommitdiff
path: root/src/include/device/gpio.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/device/gpio.h')
-rw-r--r--src/include/device/gpio.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/include/device/gpio.h b/src/include/device/gpio.h
new file mode 100644
index 0000000000..67975b3c45
--- /dev/null
+++ b/src/include/device/gpio.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __DEVICE_GPIO_H__
+#define __DEVICE_GPIO_H__
+
+#include <types.h>
+
+struct gpio_operations {
+ int (*get)(uint32_t gpio);
+ void (*set)(uint32_t gpio, int value);
+ void (*input_pulldown)(uint32_t gpio);
+ void (*input_pullup)(uint32_t gpio);
+ void (*input)(uint32_t gpio);
+ void (*output)(uint32_t gpio, int value);
+};
+
+/* Helper for getting gpio operations from a device */
+const struct gpio_operations *dev_get_gpio_ops(struct device *dev);
+
+#endif /* __DEVICE_GPIO_H__ */