Skip to contentSkip to conversation

pmbus: associate PMBUS_SKIP_STATUS_CHECK with

PATCH Applied Xiaoting Liu 4 participants 11 messages Jan 10, 2019 – Jan 17, 2019 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v3 1/4 pmbus: associate PMBUS_SKIP_STATUS_CHECK with

Current code compares device name with name in i2c_device_id to decide whether PMBUS_SKIP_STATUS_CHECK should be set in pmbus_platform_data, which makes adding new devices with PMBUS_SKIP_STATUS_CHECK should also modify code in pmbus_probe().

This patch adds pmbus_device_info to save pages and flags. Its pointer is put in driver_data of i2c_device_id, which makes adding new device more straightforward.

---
v3:
Remove an empty line.
---
v2:
Move struct pmbus_device_info definition location from pmbus.h to pmbus.c. Change struct name from default_pmbus_info to pmbus_info_one. Change struct name from pmbus_info to pmbus_info_zero.
Replace struct name dps460_pmbus_info and sgd009_pmbus_info with pmbus_info_one_skip.

---
 drivers/hwmon/pmbus/pmbus.c | 54 +++++++++++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 22 deletions(-)
drivers/hwmon/pmbus/pmbus.c +32 -22
index 7688dab32f6e..ef845a1310fa 100644
@@ -28,6 +28,11 @@
 #include <linux/pmbus.h>
 #include "pmbus.h"
 
+struct pmbus_device_info {
+	int pages;
+	u32 flags;
+};
+
 /*
  * Find sensor groups and status registers on each page.
  */
@@ -172,13 +177,14 @@ static int pmbus_probe(struct i2c_client *client,
 	struct pmbus_driver_info *info;
 	struct pmbus_platform_data *pdata = NULL;
 	struct device *dev = &client->dev;
+	struct pmbus_device_info *device_info;
 
 	info = devm_kzalloc(dev, sizeof(struct pmbus_driver_info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
-	if (!strcmp(id->name, "dps460") || !strcmp(id->name, "dps800") ||
-	    !strcmp(id->name, "sgd009")) {
+	device_info = (struct pmbus_device_info *)id->driver_data;
+	if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) {
 		pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data),
 				     GFP_KERNEL);
 		if (!pdata)
@@ -187,36 +193,40 @@ static int pmbus_probe(struct i2c_client *client,
 		pdata->flags = PMBUS_SKIP_STATUS_CHECK;
 	}
 
-	info->pages = id->driver_data;
+	info->pages = device_info->pages;
 	info->identify = pmbus_identify;
 	dev->platform_data = pdata;
 
 	return pmbus_do_probe(client, id, info);
 }
 
+static const struct pmbus_device_info pmbus_info_one = {1, 0};
+static const struct pmbus_device_info pmbus_info_zero = {0, 0};
+static const struct pmbus_device_info pmbus_info_one_skip = {
+				1, PMBUS_SKIP_STATUS_CHECK};
 /*
  * Use driver_data to set the number of pages supported by the chip.
  */
 static const struct i2c_device_id pmbus_id[] = {
-	{"adp4000", 1},
-	{"bmr453", 1},
-	{"bmr454", 1},
-	{"dps460", 1},
-	{"dps800", 1},
-	{"mdt040", 1},
-	{"ncp4200", 1},
-	{"ncp4208", 1},
-	{"pdt003", 1},
-	{"pdt006", 1},
-	{"pdt012", 1},
-	{"pmbus", 0},
-	{"sgd009", 1},
-	{"tps40400", 1},
-	{"tps544b20", 1},
-	{"tps544b25", 1},
-	{"tps544c20", 1},
-	{"tps544c25", 1},
-	{"udt020", 1},
+	{"adp4000", (kernel_ulong_t)&pmbus_info_one},
+	{"bmr453", (kernel_ulong_t)&pmbus_info_one},
+	{"bmr454", (kernel_ulong_t)&pmbus_info_one},
+	{"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
+	{"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
+	{"mdt040", (kernel_ulong_t)&pmbus_info_one},
+	{"ncp4200", (kernel_ulong_t)&pmbus_info_one},
+	{"ncp4208", (kernel_ulong_t)&pmbus_info_one},
+	{"pdt003", (kernel_ulong_t)&pmbus_info_one},
+	{"pdt006", (kernel_ulong_t)&pmbus_info_one},
+	{"pdt012", (kernel_ulong_t)&pmbus_info_one},
+	{"pmbus", (kernel_ulong_t)&pmbus_info_zero},
+	{"sgd009", (kernel_ulong_t)&pmbus_info_one_skip},
+	{"tps40400", (kernel_ulong_t)&pmbus_info_one},
+	{"tps544b20", (kernel_ulong_t)&pmbus_info_one},
+	{"tps544b25", (kernel_ulong_t)&pmbus_info_one},
+	{"tps544c20", (kernel_ulong_t)&pmbus_info_one},
+	{"tps544c25", (kernel_ulong_t)&pmbus_info_one},
+	{"udt020", (kernel_ulong_t)&pmbus_info_one},
 	{}
 };
 
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v3 2/4 dt-bindings: hwmon: add dps650ab documentation

In reply to a message not in the archive

Bindings for Delta Electronics DPS-650-AB power supply.

---
v3:
Change patch commit message.
Add vendor delta to the compatible property.
---
v2:
Change the patch subject.

---
 Documentation/devicetree/bindings/hwmon/dps650ab.txt | 11 +++++++++++
 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/hwmon/dps650ab.txt new file +11 -0
new file mode 100644
index 000000000000..32d89e4f4956
@@ -0,0 +1,11 @@
+Bindings for Delta Electronics DPS-650-AB power supply
+
+Required properties:
+- compatible : "delta,dps650ab"
+- reg        : I2C address, one of 0x58, 0x59.
+
+Example:
+	dps650ab@58 {
+		    compatible = "delta,dps650ab";
+		    reg = <0x58>;
+	};
Signature · 1 line
1.8.3.1
maintainer
#3 lore raw

Re: [PATCH v3 2/4] dt-bindings: hwmon: add dps650ab documentation

Quoted 3 lines · Xiaoting Liu

Bindings for Delta Electronics DPS-650-AB power supply.

Waiting for DT maintainer Ack to apply. Note that you did not copy [email protected]. As a result, it _may_ get lost since
https://patchwork.kernel.org/project/linux-hwmon/list/ is my primary means to track hwmon patches, and it isn't there.
If I don't the patch after the Ack, please resend and remember to include the hwmon mailing list.

Thanks,
Guenter

Quoted 31 lines

---
v3:
Change patch commit message.
Add vendor delta to the compatible property.
---
v2:
Change the patch subject.

---
 Documentation/devicetree/bindings/hwmon/dps650ab.txt | 11 +++++++++++
 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/hwmon/dps650ab.txt new file +11 -0
new file mode 100644
index 000000000000..32d89e4f4956
@@ -0,0 +1,11 @@
+Bindings for Delta Electronics DPS-650-AB power supply
+
+Required properties:
+- compatible : "delta,dps650ab"
+- reg        : I2C address, one of 0x58, 0x59.
+
+Example:
+	dps650ab@58 {
+		    compatible = "delta,dps650ab";
+		    reg = <0x58>;
+	};
Signature · 1 line
1.8.3.1
#4 lore raw

Re: [PATCH v3 2/4] dt-bindings: hwmon: add dps650ab documentation

Quoted 11 lines · Guenter Roeck
Quoted 3 lines · Xiaoting Liu

Bindings for Delta Electronics DPS-650-AB power supply.

Waiting for DT maintainer Ack to apply. Note that you did not copy [email protected]. As a result, it _may_ get lost since
https://patchwork.kernel.org/project/linux-hwmon/list/ is my primary means to track hwmon patches, and it isn't there.
If I don't the patch after the Ack, please resend and remember to include the hwmon mailing list.

Quoted 2 lines

Thanks,
Guenter

Thanks for your kindly reminder! I will loop [email protected]

when I resend the patch.

Xiaoting

Quoted 31 lines
Quoted 31 lines

---
v3:
Change patch commit message.
Add vendor delta to the compatible property.
---
v2:
Change the patch subject.

---
 Documentation/devicetree/bindings/hwmon/dps650ab.txt | 11 +++++++++++
 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/hwmon/dps650ab.txt new file +11 -0
new file mode 100644
index 000000000000..32d89e4f4956
@@ -0,0 +1,11 @@
+Bindings for Delta Electronics DPS-650-AB power supply
+
+Required properties:
+- compatible : "delta,dps650ab"
+- reg        : I2C address, one of 0x58, 0x59.
+
+Example:
+	dps650ab@58 {
+		    compatible = "delta,dps650ab";
+		    reg = <0x58>;
+	};
Signature · 1 line
1.8.3.1
maintainer Reviewed-by on v3 2/4
#5 lore raw

Re: [PATCH v3 2/4] dt-bindings: hwmon: add dps650ab documentation

In reply to Xiaoting Liu
Quoted 10 lines · Xiaoting Liu

Bindings for Delta Electronics DPS-650-AB power supply.

---
v3:
Change patch commit message.
Add vendor delta to the compatible property.
---
v2:
Change the patch subject.

Quoted 4 lines
---
 Documentation/devicetree/bindings/hwmon/dps650ab.txt | 11 +++++++++++
 1 file changed, 11 insertions(+)
maintainer Applied
#6 lore raw

Re: [PATCH v3 2/4] dt-bindings: hwmon: add dps650ab documentation

In reply to Xiaoting Liu
Quoted 3 lines · Xiaoting Liu

Bindings for Delta Electronics DPS-650-AB power supply.

Applied to hwmon-next.

Thanks,
Guenter

Quoted 31 lines

---
v3:
Change patch commit message.
Add vendor delta to the compatible property.
---
v2:
Change the patch subject.

---
 Documentation/devicetree/bindings/hwmon/dps650ab.txt | 11 +++++++++++
 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/hwmon/dps650ab.txt new file +11 -0
new file mode 100644
index 000000000000..32d89e4f4956
@@ -0,0 +1,11 @@
+Bindings for Delta Electronics DPS-650-AB power supply
+
+Required properties:
+- compatible : "delta,dps650ab"
+- reg        : I2C address, one of 0x58, 0x59.
+
+Example:
+	dps650ab@58 {
+		    compatible = "delta,dps650ab";
+		    reg = <0x58>;
+	};
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v3 3/4 ARM: dts: dps650ab: add power supply

In reply to a message not in the archive

Add Delta Electronics power supply DPS-650-AB.

---
v3:
Modify patch subject and commit message.
Add delta to compatible property.
---
v2:
No change.

---
 arch/arm/boot/dts/aspeed-bmc-arm-stardragon4800-rep2.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/aspeed-bmc-arm-stardragon4800-rep2.dts +10 -0
index bdfd8c9f3a7c..521afbea2c5b 100644
@@ -173,6 +173,16 @@
 			};
 		};
 	};
+
+	dps650ab at 58 {
+		compatible = "delta,dps650ab";
+		reg = <0x58>;
+	};
+
+	dps650ab at 59 {
+		compatible = "delta,dps650ab";
+		reg = <0x59>;
+	};
 };
 
 &i2c9 {
Signature · 1 line
1.8.3.1
maintainer
#8 lore raw

Re: [PATCH v3 3/4] ARM: dts: dps650ab: add power supply

Quoted 11 lines · Xiaoting Liu

Add Delta Electronics power supply DPS-650-AB.

---
v3:
Modify patch subject and commit message.
Add delta to compatible property.
---
v2:
No change.

I tweaked the commit message to mention the board you were applying to. Applied to the aspeed tree for 5.1.

Thanks,

Joel

#9 lore raw

PATCH v3 4/4 hwmon: (pmbus) add support for DPS-650AB

In reply to a message not in the archive

Provide support for PSU DPS-650AB from Delta Electronics, INC.

---
v3:
No change.
---
v2:
Change the patch subject and commit message.
Drop dps650ab.c file.
Replace struct name dps650ab_pmbus_info with pmbus_info_one_skip.

---
 drivers/hwmon/pmbus/pmbus.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/pmbus/pmbus.c +1 -0
index ef845a1310fa..e648ed8d926a 100644
@@ -212,6 +212,7 @@ static int pmbus_probe(struct i2c_client *client,
 	{"bmr453", (kernel_ulong_t)&pmbus_info_one},
 	{"bmr454", (kernel_ulong_t)&pmbus_info_one},
 	{"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
+	{"dps650ab", (kernel_ulong_t)&pmbus_info_one_skip},
 	{"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
 	{"mdt040", (kernel_ulong_t)&pmbus_info_one},
 	{"ncp4200", (kernel_ulong_t)&pmbus_info_one},
Signature · 1 line
1.8.3.1
maintainer Applied
#10 lore raw

Re: [PATCH v3 4/4] hwmon: (pmbus) add support for DPS-650AB

Quoted 3 lines · Xiaoting Liu

Provide support for PSU DPS-650AB from Delta Electronics, INC.

Applied to hwmon-next.

Thanks,
Guenter

Quoted 27 lines

---
v3:
No change.
---
v2:
Change the patch subject and commit message.
Drop dps650ab.c file.
Replace struct name dps650ab_pmbus_info with pmbus_info_one_skip.

---
 drivers/hwmon/pmbus/pmbus.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/pmbus/pmbus.c +1 -0
index ef845a1310fa..e648ed8d926a 100644
@@ -212,6 +212,7 @@ static int pmbus_probe(struct i2c_client *client,
 	{"bmr453", (kernel_ulong_t)&pmbus_info_one},
 	{"bmr454", (kernel_ulong_t)&pmbus_info_one},
 	{"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
+	{"dps650ab", (kernel_ulong_t)&pmbus_info_one_skip},
 	{"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
 	{"mdt040", (kernel_ulong_t)&pmbus_info_one},
 	{"ncp4200", (kernel_ulong_t)&pmbus_info_one},
Signature · 1 line
1.8.3.1
#11 lore raw

Re: [PATCH v3 4/4] hwmon: (pmbus) add support for DPS-650AB

Quoted 8 lines · Guenter Roeck
Quoted 3 lines · Xiaoting Liu

Provide support for PSU DPS-650AB from Delta Electronics, INC.

Applied to hwmon-next.

Thanks,
Guenter

Thanks for your reply!

Xiaoting

Quoted 27 lines
Quoted 27 lines

---
v3:
No change.
---
v2:
Change the patch subject and commit message.
Drop dps650ab.c file.
Replace struct name dps650ab_pmbus_info with pmbus_info_one_skip.

---
 drivers/hwmon/pmbus/pmbus.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/pmbus/pmbus.c +1 -0
index ef845a1310fa..e648ed8d926a 100644
@@ -212,6 +212,7 @@ static int pmbus_probe(struct i2c_client *client,
 	{"bmr453", (kernel_ulong_t)&pmbus_info_one},
 	{"bmr454", (kernel_ulong_t)&pmbus_info_one},
 	{"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
+	{"dps650ab", (kernel_ulong_t)&pmbus_info_one_skip},
 	{"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
 	{"mdt040", (kernel_ulong_t)&pmbus_info_one},
 	{"ncp4200", (kernel_ulong_t)&pmbus_info_one},
Signature · 1 line
1.8.3.1