public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Hao Yu <haoyufine@gmail.com>
To: linux@roeck-us.net, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org
Cc: jcdra1@gmail.com, akhilesh@ee.iitb.ac.in,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Hao Yu <haoyufine@gmail.com>
Subject: [PATCH v2 3/3] hwmon: (aht10) Add Device Tree support
Date: Mon, 23 Feb 2026 01:03:32 +0800	[thread overview]
Message-ID: <20260222170332.1616-4-haoyufine@gmail.com> (raw)
In-Reply-To: <20260222170332.1616-1-haoyufine@gmail.com>

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@gmail.com>
---
 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


      parent reply	other threads:[~2026-02-22 17:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-22 17:03 [PATCH v2 0/3] Add AHT20 sensor bindings and fix driver initialization Hao Yu
2026-02-22 17:03 ` [PATCH v2 1/3] dt-bindings: hwmon: add aosong,aht10 family Hao Yu
2026-02-23 10:32   ` Krzysztof Kozlowski
2026-02-22 17:03 ` [PATCH v2 2/3] hwmon: (aht10) Fix initialization commands for AHT20 Hao Yu
2026-02-22 18:33   ` Guenter Roeck
2026-02-22 17:03 ` Hao Yu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260222170332.1616-4-haoyufine@gmail.com \
    --to=haoyufine@gmail.com \
    --cc=akhilesh@ee.iitb.ac.in \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jcdra1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox