All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Matyas <daniel.matyas@analog.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Daniel Matyas <daniel.matyas@analog.com>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>, <linux-hwmon@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-doc@vger.kernel.org>
Subject: [PATCH 3/3] hwmon: max31827: Compatible for adaq4224
Date: Thu, 14 Dec 2023 16:36:47 +0200	[thread overview]
Message-ID: <20231214143648.175336-3-daniel.matyas@analog.com> (raw)
In-Reply-To: <20231214143648.175336-1-daniel.matyas@analog.com>

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


WARNING: multiple messages have this Message-ID (diff)
From: Daniel Matyas <daniel.matyas@analog.com>
Cc: Daniel Matyas <daniel.matyas@analog.com>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>, <linux-hwmon@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-doc@vger.kernel.org>
Subject: [PATCH 3/3] hwmon: max31827: Compatible for adaq4224
Date: Thu, 14 Dec 2023 16:36:47 +0200	[thread overview]
Message-ID: <20231214143648.175336-3-daniel.matyas@analog.com> (raw)
In-Reply-To: <20231214143648.175336-1-daniel.matyas@analog.com>

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


  parent reply	other threads:[~2023-12-14 14:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 14:36 [PATCH 1/3] hwmon: max31827: Add PEC support Daniel Matyas
2023-12-14 14:36 ` Daniel Matyas
2023-12-14 14:36 ` [PATCH 2/3] bindings: hwmon: Add adi,adaq4224_temp as compatible string Daniel Matyas
2023-12-14 14:36   ` Daniel Matyas
2023-12-14 15:15   ` Guenter Roeck
2023-12-14 15:39     ` Conor Dooley
2023-12-15  8:49   ` Krzysztof Kozlowski
2023-12-15 16:03     ` Guenter Roeck
2023-12-18  9:08       ` Matyas, Daniel
2023-12-18 17:22         ` Guenter Roeck
2023-12-19 16:47           ` Conor Dooley
2023-12-14 14:36 ` Daniel Matyas [this message]
2023-12-14 14:36   ` [PATCH 3/3] hwmon: max31827: Compatible for adaq4224 Daniel Matyas
2023-12-14 15:14   ` Guenter Roeck
2023-12-14 16:10 ` [PATCH 1/3] hwmon: max31827: Add PEC support Guenter Roeck
2023-12-15 20:28   ` Matyas, Daniel
2023-12-16  1:32     ` Guenter Roeck
2023-12-18  9:12       ` Matyas, Daniel
2023-12-18 16:18         ` Guenter Roeck
2023-12-18 14:55   ` Matyas, Daniel
2023-12-18 16:26     ` Guenter Roeck
     [not found]       ` <PH0PR03MB6771CF6A95CB576E534C225F8990A@PH0PR03MB6771.namprd03.prod.outlook.com>
2023-12-18 19:01         ` Guenter Roeck
2023-12-20  1:49           ` Matyas, Daniel
2024-01-08 17:42             ` Guenter Roeck

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=20231214143648.175336-3-daniel.matyas@analog.com \
    --to=daniel.matyas@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.