[PATCH v2 2/3] rtc: rx6110: add ACPI bindings to I2C

From: Claudius Heine
Date: Thu Nov 12 2020 - 08:08:17 EST


From: Johannes Hahn <johannes-hahn@xxxxxxxxxxx>

This allows the RX6110 driver to be automatically assigned to the right
device on the I2C bus.

Signed-off-by: Johannes Hahn <johannes-hahn@xxxxxxxxxxx>
Signed-off-by: Claudius Heine <ch@xxxxxxx>
Signed-off-by: Henning Schild <henning.schild@xxxxxxxxxxx>
---
drivers/rtc/rtc-rx6110.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/rtc/rtc-rx6110.c b/drivers/rtc/rtc-rx6110.c
index 1e6e9b19c81c..2fc9e8c2eeeb 100644
--- a/drivers/rtc/rtc-rx6110.c
+++ b/drivers/rtc/rtc-rx6110.c
@@ -13,6 +13,7 @@
#include <linux/of_gpio.h>
#include <linux/regmap.h>
#include <linux/rtc.h>
+#include <linux/acpi.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/spi/spi.h>
@@ -449,6 +450,14 @@ static int rx6110_i2c_probe(struct i2c_client *client,
return rx6110_probe(rx6110, &client->dev);
}

+#ifdef CONFIG_ACPI
+static const struct acpi_device_id rx6110_i2c_acpi_match[] = {
+ { "RX6110SA", },
+ { },
+};
+MODULE_DEVICE_TABLE(acpi, rx6110_i2c_acpi_match);
+#endif
+
static const struct i2c_device_id rx6110_i2c_id[] = {
{ "rx6110", 0 },
{ }
@@ -458,6 +467,9 @@ MODULE_DEVICE_TABLE(i2c, rx6110_i2c_id);
static struct i2c_driver rx6110_i2c_driver = {
.driver = {
.name = RX6110_DRIVER_NAME,
+#ifdef CONFIG_ACPI
+ .acpi_match_table = ACPI_PTR(rx6110_i2c_acpi_match),
+#endif
},
.probe = rx6110_i2c_probe,
.id_table = rx6110_i2c_id,
--
2.20.1