summaryrefslogtreecommitdiff
path: root/drivers/i2c/sandbox_i2c.c
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 /drivers/i2c/sandbox_i2c.c
parent4ebc940b39b6a43de9d1fa74653321cd6fdb4d3a (diff)
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 'drivers/i2c/sandbox_i2c.c')
-rw-r--r--drivers/i2c/sandbox_i2c.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/i2c/sandbox_i2c.c b/drivers/i2c/sandbox_i2c.c
index f4ae2397a0..125026da90 100644
--- a/drivers/i2c/sandbox_i2c.c
+++ b/drivers/i2c/sandbox_i2c.c
@@ -11,6 +11,7 @@
#include <i2c.h>
#include <log.h>
#include <asm/test.h>
+#include <dm/acpi.h>
#include <dm/lists.h>
#include <dm/device-internal.h>
@@ -83,6 +84,15 @@ static int sandbox_i2c_xfer(struct udevice *bus, struct i2c_msg *msg,
return ops->xfer(emul, msg, nmsgs);
}
+static int sandbox_i2c_get_name(const struct udevice *dev, char *out_name)
+{
+ return acpi_copy_name(out_name, "SI2C");
+}
+
+struct acpi_ops sandbox_i2c_acpi_ops = {
+ .get_name = sandbox_i2c_get_name,
+};
+
static const struct dm_i2c_ops sandbox_i2c_ops = {
.xfer = sandbox_i2c_xfer,
};
@@ -98,4 +108,5 @@ U_BOOT_DRIVER(i2c_sandbox) = {
.of_match = sandbox_i2c_ids,
.ops = &sandbox_i2c_ops,
.priv_auto_alloc_size = sizeof(struct sandbox_i2c_priv),
+ ACPI_OPS_PTR(&sandbox_i2c_acpi_ops)
};