[<prev] [next>] [day] [month] [year] [list]
Message-ID: <DB4PR10MB6261E4DD4C96EB70787BAEDF9229A@DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM>
Date: Mon, 3 Jul 2023 22:08:17 +0800
From: JuenKit Yip <JuenKit_Yip@...mail.com>
To: jdelvare@...e.com, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
linux@...ck-us.net
Cc: linux-hwmon@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, JuenKit Yip <JuenKit_Yip@...mail.com>
Subject: [PATCH v3 2/3] hwmon: (sht3x) add devicetree support
add "compatible" property for supporting devicetree
Signed-off-by: JuenKit Yip <JuenKit_Yip@...mail.com>
---
v3:
- fix wildcards problem
drivers/hwmon/sht3x.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c
index 79657910b79e..bb8586233adc 100644
--- a/drivers/hwmon/sht3x.c
+++ b/drivers/hwmon/sht3x.c
@@ -911,8 +911,23 @@ static int sht3x_probe(struct i2c_client *client)
return PTR_ERR_OR_ZERO(hwmon_dev);
}
+/* devicetree ID table */
+static const struct of_device_id sht3x_of_match[] = {
+ { .compatible = "sensirion,sht30" },
+ { .compatible = "sensirion,sht31" },
+ { .compatible = "sensirion,sht35" },
+ { .compatible = "sensirion,sts30" },
+ { .compatible = "sensirion,sts31" },
+ { .compatible = "sensirion,sts35" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, sht3x_of_match);
+
static struct i2c_driver sht3x_i2c_driver = {
- .driver.name = "sht3x",
+ .driver = {
+ .name = "sht3x",
+ .of_match_table = sht3x_of_match,
+ },
.probe = sht3x_probe,
.id_table = sht3x_ids,
};
--
2.39.2
Powered by blists - more mailing lists