[PATCH 3/3] hwmon: max31827: Compatible for adaq4224

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Compatible string "adi,adaq4224_temp" is accepted in device tree.
When this string is seen in the device tree, the name of the device
changes to "adaq4224_temp" and the default configuration of max31827
is loaded.

This modification was requested by the costumer, so that whenever one
analyzes the available devices, one can know for sure, that max31827 is
part of the adaq4224.

Signed-off-by: Daniel Matyas <daniel.matyas@xxxxxxxxxx>
---
 drivers/hwmon/max31827.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/max31827.c b/drivers/hwmon/max31827.c
index db93492193bd..c3500a5b2c29 100644
--- a/drivers/hwmon/max31827.c
+++ b/drivers/hwmon/max31827.c
@@ -48,7 +48,7 @@
 #define MAX31827_M_DGR_TO_16_BIT(x)	(((x) << 4) / 1000)
 #define MAX31827_DEVICE_ENABLE(x)	((x) ? 0xA : 0x0)
 
-enum chips { max31827 = 1, max31828, max31829 };
+enum chips { max31827 = 1, max31828, max31829, adaq4224_temp };
 
 enum max31827_cnv {
 	MAX31827_CNV_1_DIV_64_HZ = 1,
@@ -592,6 +592,7 @@ static const struct i2c_device_id max31827_i2c_ids[] = {
 	{ "max31827", max31827 },
 	{ "max31828", max31828 },
 	{ "max31829", max31829 },
+	{ "adaq4224_temp", adaq4224_temp },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, max31827_i2c_ids);
@@ -620,6 +621,9 @@ static int max31827_init_client(struct max31827_state *st)
 	res |= FIELD_PREP(MAX31827_CONFIGURATION_TIMEOUT_MASK, !prop);
 
 	type = (enum chips)(uintptr_t)device_get_match_data(dev);
+	if (type == adaq4224_temp) {
+		dev->driver->name = "adaq4224_temp";
+	}
 
 	if (fwnode_property_present(fwnode, "adi,alarm-pol")) {
 		ret = fwnode_property_read_u32(fwnode, "adi,alarm-pol", &data);
@@ -633,6 +637,7 @@ static int max31827_init_client(struct max31827_state *st)
 		 */
 		switch (type) {
 		case max31827:
+		case adaq4224_temp:
 		case max31828:
 			res |= FIELD_PREP(MAX31827_CONFIGURATION_ALRM_POL_MASK,
 					  MAX31827_ALRM_POL_LOW);
@@ -669,6 +674,7 @@ static int max31827_init_client(struct max31827_state *st)
 		 */
 		switch (type) {
 		case max31827:
+		case adaq4224_temp:
 			res |= FIELD_PREP(MAX31827_CONFIGURATION_FLT_Q_MASK,
 					  MAX31827_FLT_Q_1);
 			break;
@@ -750,6 +756,10 @@ static const struct of_device_id max31827_of_match[] = {
 		.compatible = "adi,max31829",
 		.data = (void *)max31829
 	},
+	{
+		.compatible = "adi,adaq4224_temp",
+		.data = (void *)adaq4224_temp
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, max31827_of_match);
-- 
2.34.1





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux