[PATCH v2 3/3] hwmon: (aht10) Add Device Tree support
From: Hao Yu
Date: Sun Feb 22 2026 - 12:05:09 EST
Add support for Device Tree probing by adding an of_match_table. This
allows the driver to be used with aosong,aht10, aosong,aht20, and
aosong,dht20 compatible strings in device tree files.
Signed-off-by: Hao Yu <haoyufine@xxxxxxxxx>
---
drivers/hwmon/aht10.c | 10 ++++++++++
1 file changed, 10 insertions(+)
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,
--
2.34.1