summaryrefslogtreecommitdiff
path: root/drivers/rtc
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/rtc
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 'drivers/rtc')
-rw-r--r--drivers/rtc/sandbox_rtc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/rtc/sandbox_rtc.c b/drivers/rtc/sandbox_rtc.c
index 77065e49c7..852770a49c 100644
--- a/drivers/rtc/sandbox_rtc.c
+++ b/drivers/rtc/sandbox_rtc.c
@@ -9,6 +9,7 @@
#include <i2c.h>
#include <rtc.h>
#include <asm/rtc.h>
+#include <dm/acpi.h>
#define REG_COUNT 0x80
@@ -67,6 +68,17 @@ static int sandbox_rtc_write8(struct udevice *dev, unsigned int reg, int val)
return dm_i2c_reg_write(dev, reg, val);
}
+#if CONFIG_IS_ENABLED(ACPIGEN)
+static int sandbox_rtc_get_name(const struct udevice *dev, char *out_name)
+{
+ return acpi_copy_name(out_name, "RTCC");
+}
+
+struct acpi_ops sandbox_rtc_acpi_ops = {
+ .get_name = sandbox_rtc_get_name,
+};
+#endif
+
static const struct rtc_ops sandbox_rtc_ops = {
.get = sandbox_rtc_get,
.set = sandbox_rtc_set,
@@ -85,4 +97,5 @@ U_BOOT_DRIVER(rtc_sandbox) = {
.id = UCLASS_RTC,
.of_match = sandbox_rtc_ids,
.ops = &sandbox_rtc_ops,
+ ACPI_OPS_PTR(&sandbox_rtc_acpi_ops)
};