summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/device/device.h2
-rw-r--r--src/include/device/gpio.h20
-rw-r--r--src/include/device/path.h7
3 files changed, 29 insertions, 0 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 786a640f39..d83cfe4075 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -16,6 +16,7 @@ struct smbus_bus_operations;
struct pnp_mode_ops;
struct spi_bus_operations;
struct usb_bus_operations;
+struct gpio_operations;
/* Chip operations */
struct chip_operations {
@@ -62,6 +63,7 @@ struct device_operations {
const struct spi_bus_operations *ops_spi_bus;
const struct smbus_bus_operations *ops_smbus_bus;
const struct pnp_mode_ops *ops_pnp_mode;
+ const struct gpio_operations *ops_gpio;
};
/**
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__ */
diff --git a/src/include/device/path.h b/src/include/device/path.h
index 5690badc4c..0cdb997726 100644
--- a/src/include/device/path.h
+++ b/src/include/device/path.h
@@ -21,6 +21,7 @@ enum device_path_type {
DEVICE_PATH_MMIO,
DEVICE_PATH_ESPI,
DEVICE_PATH_LPC,
+ DEVICE_PATH_GPIO,
/*
* When adding path types to this table, please also update the
@@ -46,6 +47,7 @@ enum device_path_type {
"DEVICE_PATH_MMIO", \
"DEVICE_PATH_ESPI", \
"DEVICE_PATH_LPC", \
+ "DEVICE_PATH_GPIO", \
}
struct domain_path {
@@ -116,6 +118,10 @@ struct lpc_path {
uintptr_t addr;
};
+struct gpio_path {
+ unsigned int id;
+};
+
struct device_path {
enum device_path_type type;
union {
@@ -134,6 +140,7 @@ struct device_path {
struct mmio_path mmio;
struct espi_path espi;
struct lpc_path lpc;
+ struct gpio_path gpio;
};
};