summaryrefslogtreecommitdiff
path: root/include/acpi/acpi_device.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-07 13:11:48 -0600
committerBin Meng <bmeng.cn@gmail.com>2020-07-17 14:32:24 +0800
commit31e1787ec15e4a498e940e9ba24b625ca059a3b2 (patch)
tree46143d89aa1acaf4b2081384ea0540823cd096ca /include/acpi/acpi_device.h
parent4ebc940b39b6a43de9d1fa74653321cd6fdb4d3a (diff)
downloadu-boot-31e1787ec15e4a498e940e9ba24b625ca059a3b2.tar.gz
u-boot-31e1787ec15e4a498e940e9ba24b625ca059a3b2.tar.bz2
u-boot-31e1787ec15e4a498e940e9ba24b625ca059a3b2.zip
acpi: Support generation of I2C descriptor
Add a function to write a GPIO descriptor to the generated ACPI code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/acpi/acpi_device.h')
-rw-r--r--include/acpi/acpi_device.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/acpi/acpi_device.h b/include/acpi/acpi_device.h
index 67a242eb75..7a65dadbb2 100644
--- a/include/acpi/acpi_device.h
+++ b/include/acpi/acpi_device.h
@@ -9,6 +9,7 @@
#ifndef __ACPI_DEVICE_H
#define __ACPI_DEVICE_H
+#include <i2c.h>
#include <linux/bitops.h>
struct acpi_ctx;
@@ -183,6 +184,26 @@ struct acpi_gpio {
enum acpi_gpio_polarity polarity;
};
+/* ACPI Descriptors for Serial Bus interfaces */
+#define ACPI_SERIAL_BUS_TYPE_I2C 1
+#define ACPI_I2C_SERIAL_BUS_REVISION_ID 1 /* TODO: upgrade to 2 */
+#define ACPI_I2C_TYPE_SPECIFIC_REVISION_ID 1
+
+/**
+ * struct acpi_i2c - representation of an ACPI I2C device
+ *
+ * @address: 7-bit or 10-bit I2C address
+ * @mode_10bit: Which address size is used
+ * @speed: Bus speed in Hz
+ * @resource: Resource name for the I2C controller
+ */
+struct acpi_i2c {
+ u16 address;
+ enum i2c_address_mode mode_10bit;
+ enum i2c_speed_rate speed;
+ const char *resource;
+};
+
/**
* acpi_device_path() - Get the full path to an ACPI device
*
@@ -270,4 +291,16 @@ int acpi_device_write_gpio_desc(struct acpi_ctx *ctx,
int acpi_device_write_interrupt_or_gpio(struct acpi_ctx *ctx,
struct udevice *dev, const char *prop);
+/**
+ * acpi_device_write_i2c_dev() - Write an I2C device to ACPI
+ *
+ * This creates a I2cSerialBus descriptor for an I2C device, including
+ * information ACPI needs to use it.
+ *
+ * @ctx: ACPI context pointer
+ * @dev: I2C device to write
+ * @return I2C address of device if OK, -ve on error
+ */
+int acpi_device_write_i2c_dev(struct acpi_ctx *ctx, const struct udevice *dev);
+
#endif