summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHao Yu <haoyufine@gmail.com>2026-02-23 20:38:53 +0300
committerGuenter Roeck <linux@roeck-us.net>2026-03-31 05:45:04 +0300
commitf88aac547b628e28e75d0c8bed51c6773a34cc72 (patch)
tree6db66f53137bf6d47b8276ff010e8d9d26bcba51
parent9c9f86da4a03e2072be8c28cb3346563dc117a3f (diff)
downloadlinux-f88aac547b628e28e75d0c8bed51c6773a34cc72.tar.xz
hwmon: (aht10) add device tree ID matching
Add of_device_id table to allow the driver to be matched via Device Tree. This is required for supporting the AHT10/20/DHT20 sensors on platforms using DT. Signed-off-by: Hao Yu <haoyufine@gmail.com> Link: https://lore.kernel.org/r/20260223173853.30617-3-haoyufine@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/aht10.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/hwmon/aht10.c b/drivers/hwmon/aht10.c
index 4ce019d2cc80..66955395d058 100644
--- a/drivers/hwmon/aht10.c
+++ b/drivers/hwmon/aht10.c
@@ -62,6 +62,15 @@ static const struct i2c_device_id aht10_id[] = {
};
MODULE_DEVICE_TABLE(i2c, aht10_id);
+static const struct of_device_id aht10_of_match[] = {
+ { .compatible = "aosong,aht10", .data = (void *)aht10 },
+ { .compatible = "aosong,aht20", .data = (void *)aht20 },
+ { .compatible = "aosong,dht20", .data = (void *)dht20 },
+ {}
+};
+
+MODULE_DEVICE_TABLE(of, aht10_of_match);
+
/**
* struct aht10_data - All the data required to operate an AHT10/AHT20 chip
* @client: the i2c client associated with the AHT10/AHT20
@@ -377,6 +386,7 @@ static int aht10_probe(struct i2c_client *client)
static struct i2c_driver aht10_driver = {
.driver = {
.name = "aht10",
+ .of_match_table = aht10_of_match,
},
.probe = aht10_probe,
.id_table = aht10_id,