linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply
@ 2023-03-22 11:46 Lakshmi Yadlapati
  2023-03-22 11:46 ` [PATCH v4 1/5] dt-bindings: vendor-prefixes: Add prefix for acbel Lakshmi Yadlapati
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Lakshmi Yadlapati @ 2023-03-22 11:46 UTC (permalink / raw)
  To: robh+dt, linux, jdelvare, krzysztof.kozlowski+dt, joel, andrew, eajames
  Cc: linux-kernel, linux-hwmon, devicetree, Lakshmi Yadlapati

Adding new acbel,fsg032 driver and documentation updates.

Changes since V3:
-Fixed trivial-devices.yaml 

Lakshmi Yadlapati (5):
  dt-bindings: vendor-prefixes: Add prefix for acbel
  dt-bindings: trivial-devices: Add acbel,fsg032
  hwmon: (pmbus/acbel-fsg032) Add Acbel power supply
  docs: hwmon: Add documentaion for acbel-fsg032 PSU
  ARM: dts: aspeed: p10bmc: Change power supply info

 .../devicetree/bindings/trivial-devices.yaml  |  2 +
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 Documentation/hwmon/acbel-fsg032.rst          | 80 ++++++++++++++++
 Documentation/hwmon/index.rst                 |  1 +
 arch/arm/boot/dts/aspeed-bmc-ibm-bonnell.dts  | 12 +--
 drivers/hwmon/pmbus/Kconfig                   |  9 ++
 drivers/hwmon/pmbus/Makefile                  |  1 +
 drivers/hwmon/pmbus/acbel-fsg032.c            | 96 +++++++++++++++++++
 8 files changed, 197 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/hwmon/acbel-fsg032.rst
 create mode 100644 drivers/hwmon/pmbus/acbel-fsg032.c

-- 
2.37.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4 1/5] dt-bindings: vendor-prefixes: Add prefix for acbel
  2023-03-22 11:46 [PATCH v4 0/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply Lakshmi Yadlapati
@ 2023-03-22 11:46 ` Lakshmi Yadlapati
  2023-03-22 11:48   ` Krzysztof Kozlowski
  2023-03-22 11:46 ` [PATCH v4 2/5] dt-bindings: trivial-devices: Add acbel,fsg032 Lakshmi Yadlapati
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Lakshmi Yadlapati @ 2023-03-22 11:46 UTC (permalink / raw)
  To: robh+dt, linux, jdelvare, krzysztof.kozlowski+dt, joel, andrew, eajames
  Cc: linux-kernel, linux-hwmon, devicetree, Lakshmi Yadlapati

Add a vendor prefix entry for acbel (https://www.acbel.com)

Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index ed64e06ecca4..9dbb8f69be65 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -37,6 +37,8 @@ patternProperties:
     description: Abracon Corporation
   "^abt,.*":
     description: ShenZhen Asia Better Technology Ltd.
+  "^acbel,.*":
+    description: Acbel Polytech Inc.
   "^acer,.*":
     description: Acer Inc.
   "^acme,.*":
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 2/5] dt-bindings: trivial-devices: Add acbel,fsg032
  2023-03-22 11:46 [PATCH v4 0/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply Lakshmi Yadlapati
  2023-03-22 11:46 ` [PATCH v4 1/5] dt-bindings: vendor-prefixes: Add prefix for acbel Lakshmi Yadlapati
@ 2023-03-22 11:46 ` Lakshmi Yadlapati
  2023-03-31 18:16   ` Rob Herring
  2023-03-22 11:46 ` [PATCH v4 3/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply Lakshmi Yadlapati
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Lakshmi Yadlapati @ 2023-03-22 11:46 UTC (permalink / raw)
  To: robh+dt, linux, jdelvare, krzysztof.kozlowski+dt, joel, andrew, eajames
  Cc: linux-kernel, linux-hwmon, devicetree, Lakshmi Yadlapati

Add new Acbel FSG032 power supply to trivial devices.

Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 6f482a254a1d..246863a9bc7e 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -29,6 +29,8 @@ properties:
   compatible:
     items:
       - enum:
+            # Acbel fsg032 power supply
+          - acbel,fsg032
             # SMBus/I2C Digital Temperature Sensor in 6-Pin SOT with SMBus Alert and Over Temperature Pin
           - ad,ad7414
             # ADM9240: Complete System Hardware Monitor for uProcessor-Based Systems
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 3/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply
  2023-03-22 11:46 [PATCH v4 0/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply Lakshmi Yadlapati
  2023-03-22 11:46 ` [PATCH v4 1/5] dt-bindings: vendor-prefixes: Add prefix for acbel Lakshmi Yadlapati
  2023-03-22 11:46 ` [PATCH v4 2/5] dt-bindings: trivial-devices: Add acbel,fsg032 Lakshmi Yadlapati
@ 2023-03-22 11:46 ` Lakshmi Yadlapati
  2023-04-08 15:36   ` Guenter Roeck
  2023-03-22 11:46 ` [PATCH v4 4/5] docs: hwmon: Add documentaion for acbel-fsg032 PSU Lakshmi Yadlapati
  2023-03-22 11:46 ` [PATCH v4 5/5] ARM: dts: aspeed: p10bmc: Change power supply info Lakshmi Yadlapati
  4 siblings, 1 reply; 10+ messages in thread
From: Lakshmi Yadlapati @ 2023-03-22 11:46 UTC (permalink / raw)
  To: robh+dt, linux, jdelvare, krzysztof.kozlowski+dt, joel, andrew, eajames
  Cc: linux-kernel, linux-hwmon, devicetree, Lakshmi Yadlapati

Add the driver to support ACBEL FSG032 power supply.

Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
---
 drivers/hwmon/pmbus/Kconfig        |  9 +++
 drivers/hwmon/pmbus/Makefile       |  1 +
 drivers/hwmon/pmbus/acbel-fsg032.c | 96 ++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+)
 create mode 100644 drivers/hwmon/pmbus/acbel-fsg032.c

diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 59d9a7430499..270b6336b76d 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -27,6 +27,15 @@ config SENSORS_PMBUS
 	  This driver can also be built as a module. If so, the module will
 	  be called pmbus.
 
+config SENSORS_ACBEL_FSG032
+	tristate "ACBEL FSG032 Power Supply"
+	help
+	  If you say yes here you get hardware monitoring support for the ACBEL
+	  FSG032 Power Supply.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called acbel-fsg032.
+
 config SENSORS_ADM1266
 	tristate "Analog Devices ADM1266 Sequencer"
 	select CRC8
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
index 3ae019916267..84ee960a6c2d 100644
--- a/drivers/hwmon/pmbus/Makefile
+++ b/drivers/hwmon/pmbus/Makefile
@@ -5,6 +5,7 @@
 
 obj-$(CONFIG_PMBUS)		+= pmbus_core.o
 obj-$(CONFIG_SENSORS_PMBUS)	+= pmbus.o
+obj-$(CONFIG_SENSORS_ACBEL_FSG032) += acbel-fsg032.o
 obj-$(CONFIG_SENSORS_ADM1266)	+= adm1266.o
 obj-$(CONFIG_SENSORS_ADM1275)	+= adm1275.o
 obj-$(CONFIG_SENSORS_BEL_PFE)	+= bel-pfe.o
diff --git a/drivers/hwmon/pmbus/acbel-fsg032.c b/drivers/hwmon/pmbus/acbel-fsg032.c
new file mode 100644
index 000000000000..7bfa0bf048db
--- /dev/null
+++ b/drivers/hwmon/pmbus/acbel-fsg032.c
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2023 IBM Corp.
+ */
+
+#include <linux/device.h>
+#include <linux/fs.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/pmbus.h>
+#include <linux/hwmon-sysfs.h>
+#include "pmbus.h"
+
+struct acbel_fsg032 {
+	struct i2c_client *client;
+};
+
+static const struct i2c_device_id acbel_fsg032_id[] = {
+	{ "acbel_fsg032" },
+	{}
+};
+
+static struct pmbus_driver_info acbel_fsg032_info = {
+	.pages = 1,
+	.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN |
+		   PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT | PMBUS_HAVE_POUT |
+		   PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 |
+		   PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_VOUT |
+		   PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_TEMP |
+		   PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_FAN12,
+};
+
+static int acbel_fsg032_probe(struct i2c_client *client)
+{
+	struct acbel_fsg032 *psu;
+	u8 buf[I2C_SMBUS_BLOCK_MAX + 1];
+	struct device *dev = &client->dev;
+	int rc;
+
+	rc = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
+	if (rc < 0) {
+		dev_err(dev, "Failed to read PMBUS_MFR_ID\n");
+		return rc;
+	}
+	if (strncmp(buf, "ACBEL", 5)) {
+		buf[rc] = '\0';
+		dev_err(dev, "Manufacturer '%s' not supported\n", buf);
+		return -ENODEV;
+	}
+
+	rc = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
+	if (rc < 0) {
+		dev_err(dev, "Failed to read PMBUS_MFR_MODEL\n");
+		return rc;
+	}
+
+	if (strncmp(buf, "FSG032", 6)) {
+		buf[rc] = '\0';
+		dev_err(dev, "Model '%s' not supported\n", buf);
+		return -ENODEV;
+	}
+
+	rc = pmbus_do_probe(client, &acbel_fsg032_info);
+	if (rc)
+		return rc;
+	/*
+         * Don't fail the probe if there isn't enough memory for debugfs.
+         */
+	psu = devm_kzalloc(&client->dev, sizeof(*psu), GFP_KERNEL);
+	if (!psu)
+		return 0;
+
+	return 0;
+}
+
+static const struct of_device_id acbel_fsg032_of_match[] = {
+	{ .compatible = "acbel,fsg032" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, acbel_fsg032_of_match);
+
+static struct i2c_driver acbel_fsg032_driver = {
+	.driver = {
+		.name = "acbel-fsg032",
+		.of_match_table = acbel_fsg032_of_match,
+	},
+	.probe_new = acbel_fsg032_probe,
+	.id_table = acbel_fsg032_id,
+};
+
+module_i2c_driver(acbel_fsg032_driver);
+
+MODULE_AUTHOR("Lakshmi Yadlapati");
+MODULE_DESCRIPTION("PMBus driver for AcBel Power System power supplies");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PMBUS);
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 4/5] docs: hwmon: Add documentaion for acbel-fsg032 PSU
  2023-03-22 11:46 [PATCH v4 0/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply Lakshmi Yadlapati
                   ` (2 preceding siblings ...)
  2023-03-22 11:46 ` [PATCH v4 3/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply Lakshmi Yadlapati
@ 2023-03-22 11:46 ` Lakshmi Yadlapati
  2023-03-22 11:46 ` [PATCH v4 5/5] ARM: dts: aspeed: p10bmc: Change power supply info Lakshmi Yadlapati
  4 siblings, 0 replies; 10+ messages in thread
From: Lakshmi Yadlapati @ 2023-03-22 11:46 UTC (permalink / raw)
  To: robh+dt, linux, jdelvare, krzysztof.kozlowski+dt, joel, andrew, eajames
  Cc: linux-kernel, linux-hwmon, devicetree, Lakshmi Yadlapati

Add documentation changes for acbel-fsg032 psu

Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
---
 Documentation/hwmon/acbel-fsg032.rst | 80 ++++++++++++++++++++++++++++
 Documentation/hwmon/index.rst        |  1 +
 2 files changed, 81 insertions(+)
 create mode 100644 Documentation/hwmon/acbel-fsg032.rst

diff --git a/Documentation/hwmon/acbel-fsg032.rst b/Documentation/hwmon/acbel-fsg032.rst
new file mode 100644
index 000000000000..f1684b95e103
--- /dev/null
+++ b/Documentation/hwmon/acbel-fsg032.rst
@@ -0,0 +1,80 @@
+Kernel driver acbel-fsg032
+==========================
+
+Supported chips:
+
+  * ACBEL FSG032-00xG power supply.
+
+Author: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
+
+Description
+-----------
+
+This driver supports ACBEL FSG032-00xG Power Supply. This driver
+is a client to the core PMBus driver.
+
+Usage Notes
+-----------
+
+This driver does not auto-detect devices. You will have to instantiate the
+devices explicitly. Please see Documentation/i2c/instantiating-devices.rst for
+details.
+
+Sysfs entries
+-------------
+
+The following attributes are supported:
+
+======================= ======================================================
+curr1_crit              Critical maximum current.
+curr1_crit_alarm        Input current critical alarm.
+curr1_input             Measured output current.
+curr1_label             "iin"
+curr1_max               Maximum input current.
+curr1_max_alarm         Maximum input current high alarm.
+curr1_rated_max         Maximum rated input current.
+curr2_crit              Critical maximum current.
+curr2_crit_alarm        Output current critical alarm.
+curr2_input             Measured output current.
+curr2_label             "iout1"
+curr2_max               Maximum output current.
+curr2_max_alarm         Output current high alarm.
+curr2_rated_max         Maximum rated output current.
+
+
+fan1_alarm              Fan 1 warning.
+fan1_fault	        Fan 1 fault.
+fan1_input	        Fan 1 speed in RPM.
+fan1_target             Set fan speed reference.
+
+in1_alarm               Input voltage under-voltage alarm.
+in1_input               Measured input voltage.
+in1_label               "vin"
+in1_rated_max           Maximum rated input voltage.
+in1_rated_min           Minimum rated input voltage.
+in2_crit                Critical maximum output voltage.
+in2_crit_alarm          Output voltage critical high alarm.
+in2_input               Measured output voltage.
+in2_label               "vout1"
+in2_lcrit               Critical minimum output voltage.
+in2_lcrit_alarm         Output voltage critical low alarm.
+in2_rated_max           Maximum rated output voltage.
+in2_rated_min           Minimum rated output voltage.
+
+power1_alarm            Input fault or alarm.
+power1_input            Measured input power.
+power1_label            "pin"
+power1_max              Input power limit.
+power1_rated_max        Maximum rated input power.
+power2_crit             Critical output power limit.
+power2_crit_alarm       Output power crit alarm limit exceeded.
+power2_input            Measured output power.
+power2_label            "pout"
+power2_max              Output power limit.
+power2_max_alarm        Output power high alarm.
+power2_rated_max        Maximum rated output power.
+
+temp[1-3]_input         Measured temperature.
+temp[1-2]_max           Maximum temperature.
+temp[1-3]_rated_max     Temperature high alarm.
+======================= ======================================================
diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
index f1fe75f596a5..dc4ebed13617 100644
--- a/Documentation/hwmon/index.rst
+++ b/Documentation/hwmon/index.rst
@@ -23,6 +23,7 @@ Hardware Monitoring Kernel Drivers
    abituguru
    abituguru3
    acpi_power_meter
+   acbel-fsg032
    ad7314
    adc128d818
    adm1021
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4 5/5] ARM: dts: aspeed: p10bmc: Change power supply info
  2023-03-22 11:46 [PATCH v4 0/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply Lakshmi Yadlapati
                   ` (3 preceding siblings ...)
  2023-03-22 11:46 ` [PATCH v4 4/5] docs: hwmon: Add documentaion for acbel-fsg032 PSU Lakshmi Yadlapati
@ 2023-03-22 11:46 ` Lakshmi Yadlapati
  4 siblings, 0 replies; 10+ messages in thread
From: Lakshmi Yadlapati @ 2023-03-22 11:46 UTC (permalink / raw)
  To: robh+dt, linux, jdelvare, krzysztof.kozlowski+dt, joel, andrew, eajames
  Cc: linux-kernel, linux-hwmon, devicetree, Lakshmi Yadlapati

Bonnell system supports new ACBEL FSG032 power supply on
I2C addresses 5A and 5B. Update the device tree with new
power supply information and device addresses.

Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
---
 arch/arm/boot/dts/aspeed-bmc-ibm-bonnell.dts | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/aspeed-bmc-ibm-bonnell.dts b/arch/arm/boot/dts/aspeed-bmc-ibm-bonnell.dts
index a5be0ee048ec..4f959a4f8b58 100644
--- a/arch/arm/boot/dts/aspeed-bmc-ibm-bonnell.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-ibm-bonnell.dts
@@ -552,14 +552,14 @@ ucd90160@64 {
 &i2c3 {
 	status = "okay";
 
-	power-supply@58 {
-		compatible = "ibm,cffps";
-		reg = <0x58>;
+	power-supply@5a {
+		compatible = "acbel,fsg032";
+		reg = <0x5a>;
 	};
 
-	power-supply@59 {
-		compatible = "ibm,cffps";
-		reg = <0x59>;
+	power-supply@5b {
+		compatible = "acbel,fsg032";
+		reg = <0x5b>;
 	};
 };
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 1/5] dt-bindings: vendor-prefixes: Add prefix for acbel
  2023-03-22 11:46 ` [PATCH v4 1/5] dt-bindings: vendor-prefixes: Add prefix for acbel Lakshmi Yadlapati
@ 2023-03-22 11:48   ` Krzysztof Kozlowski
  2023-03-22 12:05     ` Lakshmi Yadlapati
  0 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-22 11:48 UTC (permalink / raw)
  To: Lakshmi Yadlapati, robh+dt, linux, jdelvare,
	krzysztof.kozlowski+dt, joel, andrew, eajames
  Cc: linux-kernel, linux-hwmon, devicetree

On 22/03/2023 12:46, Lakshmi Yadlapati wrote:
> Add a vendor prefix entry for acbel (https://www.acbel.com)
> 
> Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
> ---

This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new
versions. However, there's no need to repost patches *only* to add the
tags. The upstream maintainer will do that for acks received on the
version they apply.

https://elixir.bootlin.com/linux/v5.17/source/Documentation/process/submitting-patches.rst#L540

If a tag was not added on purpose, please state why and what changed.


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v4 1/5] dt-bindings: vendor-prefixes: Add prefix for acbel
  2023-03-22 11:48   ` Krzysztof Kozlowski
@ 2023-03-22 12:05     ` Lakshmi Yadlapati
  0 siblings, 0 replies; 10+ messages in thread
From: Lakshmi Yadlapati @ 2023-03-22 12:05 UTC (permalink / raw)
  To: Krzysztof Kozlowski, robh+dt, linux, jdelvare,
	krzysztof.kozlowski+dt, joel, andrew, eajames
  Cc: linux-kernel, linux-hwmon, devicetree



On 3/22/23, 6:48 AM, "Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org <mailto:krzysztof.kozlowski@linaro.org>> wrote:


On 22/03/2023 12:46, Lakshmi Yadlapati wrote:
> Add a vendor prefix entry for acbel (https://www.acbel.com <https://www.acbel.com> )
> 
> Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com <mailto:lakshmiy@us.ibm.com>>
> ---


This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.


If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new
versions. However, there's no need to repost patches *only* to add the
tags. The upstream maintainer will do that for acks received on the
version they apply.


https://elixir.bootlin.com/linux/v5.17/source/Documentation/process/submitting-patches.rst#L540 <https://elixir.bootlin.com/linux/v5.17/source/Documentation/process/submitting-patches.rst#L540> 


If a tag was not added on purpose, please state why and what changed.

sorry about missing the tags, this is my first code drop, new to this process. Thx


Best regards,
Krzysztof






^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 2/5] dt-bindings: trivial-devices: Add acbel,fsg032
  2023-03-22 11:46 ` [PATCH v4 2/5] dt-bindings: trivial-devices: Add acbel,fsg032 Lakshmi Yadlapati
@ 2023-03-31 18:16   ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2023-03-31 18:16 UTC (permalink / raw)
  To: Lakshmi Yadlapati
  Cc: krzysztof.kozlowski+dt, linux, linux-hwmon, linux-kernel, joel,
	jdelvare, andrew, devicetree, eajames, robh+dt


On Wed, 22 Mar 2023 06:46:20 -0500, Lakshmi Yadlapati wrote:
> Add new Acbel FSG032 power supply to trivial devices.
> 
> Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
> ---
>  Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4 3/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply
  2023-03-22 11:46 ` [PATCH v4 3/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply Lakshmi Yadlapati
@ 2023-04-08 15:36   ` Guenter Roeck
  0 siblings, 0 replies; 10+ messages in thread
From: Guenter Roeck @ 2023-04-08 15:36 UTC (permalink / raw)
  To: Lakshmi Yadlapati
  Cc: robh+dt, jdelvare, krzysztof.kozlowski+dt, joel, andrew, eajames,
	linux-kernel, linux-hwmon, devicetree

On Wed, Mar 22, 2023 at 06:46:21AM -0500, Lakshmi Yadlapati wrote:
> Add the driver to support ACBEL FSG032 power supply.
> 
> Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
> ---
>  drivers/hwmon/pmbus/Kconfig        |  9 +++
>  drivers/hwmon/pmbus/Makefile       |  1 +
>  drivers/hwmon/pmbus/acbel-fsg032.c | 96 ++++++++++++++++++++++++++++++
>  3 files changed, 106 insertions(+)
>  create mode 100644 drivers/hwmon/pmbus/acbel-fsg032.c
> 
> diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
> index 59d9a7430499..270b6336b76d 100644
> --- a/drivers/hwmon/pmbus/Kconfig
> +++ b/drivers/hwmon/pmbus/Kconfig
> @@ -27,6 +27,15 @@ config SENSORS_PMBUS
>  	  This driver can also be built as a module. If so, the module will
>  	  be called pmbus.
>  
> +config SENSORS_ACBEL_FSG032
> +	tristate "ACBEL FSG032 Power Supply"
> +	help
> +	  If you say yes here you get hardware monitoring support for the ACBEL
> +	  FSG032 Power Supply.
> +
> +	  This driver can also be built as a module. If so, the module will
> +	  be called acbel-fsg032.
> +
>  config SENSORS_ADM1266
>  	tristate "Analog Devices ADM1266 Sequencer"
>  	select CRC8
> diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
> index 3ae019916267..84ee960a6c2d 100644
> --- a/drivers/hwmon/pmbus/Makefile
> +++ b/drivers/hwmon/pmbus/Makefile
> @@ -5,6 +5,7 @@
>  
>  obj-$(CONFIG_PMBUS)		+= pmbus_core.o
>  obj-$(CONFIG_SENSORS_PMBUS)	+= pmbus.o
> +obj-$(CONFIG_SENSORS_ACBEL_FSG032) += acbel-fsg032.o
>  obj-$(CONFIG_SENSORS_ADM1266)	+= adm1266.o
>  obj-$(CONFIG_SENSORS_ADM1275)	+= adm1275.o
>  obj-$(CONFIG_SENSORS_BEL_PFE)	+= bel-pfe.o
> diff --git a/drivers/hwmon/pmbus/acbel-fsg032.c b/drivers/hwmon/pmbus/acbel-fsg032.c
> new file mode 100644
> index 000000000000..7bfa0bf048db
> --- /dev/null
> +++ b/drivers/hwmon/pmbus/acbel-fsg032.c
> @@ -0,0 +1,96 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright 2023 IBM Corp.
> + */
> +
> +#include <linux/device.h>
> +#include <linux/fs.h>
> +#include <linux/i2c.h>
> +#include <linux/module.h>
> +#include <linux/pmbus.h>
> +#include <linux/hwmon-sysfs.h>
> +#include "pmbus.h"
> +
> +struct acbel_fsg032 {
> +	struct i2c_client *client;
> +};

Not used anywhere and pointless.

> +
> +static const struct i2c_device_id acbel_fsg032_id[] = {
> +	{ "acbel_fsg032" },
> +	{}
> +};
> +
> +static struct pmbus_driver_info acbel_fsg032_info = {
> +	.pages = 1,
> +	.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN |
> +		   PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT | PMBUS_HAVE_POUT |
> +		   PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 |
> +		   PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_VOUT |
> +		   PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_TEMP |
> +		   PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_FAN12,
> +};
> +
> +static int acbel_fsg032_probe(struct i2c_client *client)
> +{
> +	struct acbel_fsg032 *psu;
> +	u8 buf[I2C_SMBUS_BLOCK_MAX + 1];
> +	struct device *dev = &client->dev;
> +	int rc;
> +
> +	rc = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
> +	if (rc < 0) {
> +		dev_err(dev, "Failed to read PMBUS_MFR_ID\n");
> +		return rc;
> +	}
> +	if (strncmp(buf, "ACBEL", 5)) {
> +		buf[rc] = '\0';
> +		dev_err(dev, "Manufacturer '%s' not supported\n", buf);
> +		return -ENODEV;
> +	}
> +
> +	rc = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
> +	if (rc < 0) {
> +		dev_err(dev, "Failed to read PMBUS_MFR_MODEL\n");
> +		return rc;
> +	}
> +
> +	if (strncmp(buf, "FSG032", 6)) {
> +		buf[rc] = '\0';
> +		dev_err(dev, "Model '%s' not supported\n", buf);
> +		return -ENODEV;
> +	}
> +
> +	rc = pmbus_do_probe(client, &acbel_fsg032_info);
> +	if (rc)
> +		return rc;
> +	/*
> +         * Don't fail the probe if there isn't enough memory for debugfs.
> +         */
> +	psu = devm_kzalloc(&client->dev, sizeof(*psu), GFP_KERNEL);
> +	if (!psu)
> +		return 0;

'psu is not used anywhere and allocating it is pointless. I am quite sure
that I did bring that up before.

Guenter

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-04-08 15:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 11:46 [PATCH v4 0/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply Lakshmi Yadlapati
2023-03-22 11:46 ` [PATCH v4 1/5] dt-bindings: vendor-prefixes: Add prefix for acbel Lakshmi Yadlapati
2023-03-22 11:48   ` Krzysztof Kozlowski
2023-03-22 12:05     ` Lakshmi Yadlapati
2023-03-22 11:46 ` [PATCH v4 2/5] dt-bindings: trivial-devices: Add acbel,fsg032 Lakshmi Yadlapati
2023-03-31 18:16   ` Rob Herring
2023-03-22 11:46 ` [PATCH v4 3/5] hwmon: (pmbus/acbel-fsg032) Add Acbel power supply Lakshmi Yadlapati
2023-04-08 15:36   ` Guenter Roeck
2023-03-22 11:46 ` [PATCH v4 4/5] docs: hwmon: Add documentaion for acbel-fsg032 PSU Lakshmi Yadlapati
2023-03-22 11:46 ` [PATCH v4 5/5] ARM: dts: aspeed: p10bmc: Change power supply info Lakshmi Yadlapati

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).