Re: [PATCH v3 3/3] hwmon: (pmbus): Add driver for BluTek BPA-RS600

2021-03-29 Thread Guenter Roeck
On Wed, Mar 17, 2021 at 05:02:31PM +1300, Chris Packham wrote:
> The BPA-RS600 is a compact 600W AC to DC removable power supply module.
> 
> Signed-off-by: Chris Packham 
> Reviewed-by: Guenter Roeck 

Applied to hwmon-next.

Thanks,
Guenter


Re: [PATCH v3 3/3] hwmon: (pmbus): Add driver for BluTek BPA-RS600

2021-03-19 Thread Guenter Roeck
On Wed, Mar 17, 2021 at 05:02:31PM +1300, Chris Packham wrote:
> The BPA-RS600 is a compact 600W AC to DC removable power supply module.
> 
> Signed-off-by: Chris Packham 

For my reference (aiting for bindings approval):

Reviewed-by: Guenter Roeck 

Guenter

> ---
> 
> Notes:
> Changes in v3:
> - Fix typo BPD -> BPA
> - Allow for NUL terminator in buf
> Changes in v2:
> - Whitespace and line length cleanup
> - Add comments about commands that return data but shouldn't be used
> 
>  Documentation/hwmon/bpa-rs600.rst |  74 +
>  drivers/hwmon/pmbus/Kconfig   |   9 ++
>  drivers/hwmon/pmbus/Makefile  |   1 +
>  drivers/hwmon/pmbus/bpa-rs600.c   | 172 ++
>  4 files changed, 256 insertions(+)
>  create mode 100644 Documentation/hwmon/bpa-rs600.rst
>  create mode 100644 drivers/hwmon/pmbus/bpa-rs600.c
> 
> diff --git a/Documentation/hwmon/bpa-rs600.rst 
> b/Documentation/hwmon/bpa-rs600.rst
> new file mode 100644
> index ..28313995d4ae
> --- /dev/null
> +++ b/Documentation/hwmon/bpa-rs600.rst
> @@ -0,0 +1,74 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +Kernel driver bpa-rs600
> +===
> +
> +Supported chips:
> +
> +  * BPA-RS600-120
> +
> +Datasheet: Publicly available at the BluTek website
> +   
> http://blutekpower.com/wp-content/uploads/2019/01/BPA-RS600-120-07-19-2018.pdf
> +
> +Authors:
> +  - Chris Packham 
> +
> +Description
> +---
> +
> +The BPA-RS600 is a compact 600W removable power supply module.
> +
> +Usage Notes
> +---
> +
> +This driver does not probe for PMBus devices. You will have to instantiate
> +devices explicitly.
> +
> +Sysfs attributes
> +
> +
> +=== 
> +curr1_label "iin"
> +curr1_input  Measured input current
> +curr1_maxMaximum input current
> +curr1_max_alarm  Input current high alarm
> +
> +curr2_label  "iout1"
> +curr2_input  Measured output current
> +curr2_maxMaximum output current
> +curr2_max_alarm  Output current high alarm
> +
> +fan1_input   Measured fan speed
> +fan1_alarm   Fan warning
> +fan1_fault   Fan fault
> +
> +in1_label"vin"
> +in1_inputMeasured input voltage
> +in1_max  Maximum input voltage
> +in1_max_alarmInput voltage high alarm
> +in1_min  Minimum input voltage
> +in1_min_alarmInput voltage low alarm
> +
> +in2_label"vout1"
> +in2_inputMeasured output voltage
> +in2_max  Maximum output voltage
> +in2_max_alarmOutput voltage high alarm
> +in2_min  Maximum output voltage
> +in2_min_alarmOutput voltage low alarm
> +
> +power1_label "pin"
> +power1_input Measured input power
> +power1_alarm Input power alarm
> +power1_max   Maximum input power
> +
> +power2_label "pout1"
> +power2_input Measured output power
> +power2_max   Maximum output power
> +power2_max_alarm Output power high alarm
> +
> +temp1_input  Measured temperature around input connector
> +temp1_alarm  Temperature alarm
> +
> +temp2_input  Measured temperature around output connector
> +temp2_alarm  Temperature alarm
> +=== 
> diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
> index 32d2fc850621..512d6f656dca 100644
> --- a/drivers/hwmon/pmbus/Kconfig
> +++ b/drivers/hwmon/pmbus/Kconfig
> @@ -56,6 +56,15 @@ config SENSORS_BEL_PFE
> This driver can also be built as a module. If so, the module will
> be called bel-pfe.
>  
> +config SENSORS_BPA_RS600
> + tristate "BluTek BPA-RS600 Power Supplies"
> + help
> +   If you say yes here you get hardware monitoring support for BluTek
> +   BPA-RS600 Power Supplies.
> +
> +   This driver can also be built as a module. If so, the module will
> +   be called bpa-rs600.
> +
>  config SENSORS_IBM_CFFPS
>   tristate "IBM Common Form Factor Power Supply"
>   depends on LEDS_CLASS
> diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
> index 6a4ba0fdc1db..80a437060dc4 100644
> --- a/drivers/hwmon/pmbus/Makefile
> +++ b/drivers/hwmon/pmbus/Makefile
> @@ -8,6 +8,7 @@ obj-$(CONFIG_SENSORS_PMBUS)   += pmbus.o
>  obj-$(CONFIG_SENSORS_ADM1266)+= adm1266.o
>  obj-$(CONFIG_SENSORS_ADM1275)+= adm1275.o
>  obj-$(CONFIG_SENSORS_BEL_PFE)+= bel-pfe.o
> +obj-$(CONFIG_SENSORS_BPA_RS600)  += bpa-rs600.o
>  obj-$(CONFIG_SENSORS_IBM_CFFPS)  += ibm-cffps.o
>  obj-$(CONFIG_SENSORS_INSPUR_IPSPS) += inspur-ipsps.o
>  obj-$(CONFIG_SENSORS_IR35221)+= ir35221.o
> diff --git 

[PATCH v3 3/3] hwmon: (pmbus): Add driver for BluTek BPA-RS600

2021-03-16 Thread Chris Packham
The BPA-RS600 is a compact 600W AC to DC removable power supply module.

Signed-off-by: Chris Packham 
---

Notes:
Changes in v3:
- Fix typo BPD -> BPA
- Allow for NUL terminator in buf
Changes in v2:
- Whitespace and line length cleanup
- Add comments about commands that return data but shouldn't be used

 Documentation/hwmon/bpa-rs600.rst |  74 +
 drivers/hwmon/pmbus/Kconfig   |   9 ++
 drivers/hwmon/pmbus/Makefile  |   1 +
 drivers/hwmon/pmbus/bpa-rs600.c   | 172 ++
 4 files changed, 256 insertions(+)
 create mode 100644 Documentation/hwmon/bpa-rs600.rst
 create mode 100644 drivers/hwmon/pmbus/bpa-rs600.c

diff --git a/Documentation/hwmon/bpa-rs600.rst 
b/Documentation/hwmon/bpa-rs600.rst
new file mode 100644
index ..28313995d4ae
--- /dev/null
+++ b/Documentation/hwmon/bpa-rs600.rst
@@ -0,0 +1,74 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+Kernel driver bpa-rs600
+===
+
+Supported chips:
+
+  * BPA-RS600-120
+
+Datasheet: Publicly available at the BluTek website
+   
http://blutekpower.com/wp-content/uploads/2019/01/BPA-RS600-120-07-19-2018.pdf
+
+Authors:
+  - Chris Packham 
+
+Description
+---
+
+The BPA-RS600 is a compact 600W removable power supply module.
+
+Usage Notes
+---
+
+This driver does not probe for PMBus devices. You will have to instantiate
+devices explicitly.
+
+Sysfs attributes
+
+
+=== 
+curr1_label "iin"
+curr1_inputMeasured input current
+curr1_max  Maximum input current
+curr1_max_alarmInput current high alarm
+
+curr2_label"iout1"
+curr2_inputMeasured output current
+curr2_max  Maximum output current
+curr2_max_alarmOutput current high alarm
+
+fan1_input Measured fan speed
+fan1_alarm Fan warning
+fan1_fault Fan fault
+
+in1_label  "vin"
+in1_input  Measured input voltage
+in1_maxMaximum input voltage
+in1_max_alarm  Input voltage high alarm
+in1_minMinimum input voltage
+in1_min_alarm  Input voltage low alarm
+
+in2_label  "vout1"
+in2_input  Measured output voltage
+in2_maxMaximum output voltage
+in2_max_alarm  Output voltage high alarm
+in2_minMaximum output voltage
+in2_min_alarm  Output voltage low alarm
+
+power1_label   "pin"
+power1_input   Measured input power
+power1_alarm   Input power alarm
+power1_max Maximum input power
+
+power2_label   "pout1"
+power2_input   Measured output power
+power2_max Maximum output power
+power2_max_alarm   Output power high alarm
+
+temp1_inputMeasured temperature around input connector
+temp1_alarmTemperature alarm
+
+temp2_inputMeasured temperature around output connector
+temp2_alarmTemperature alarm
+=== 
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 32d2fc850621..512d6f656dca 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -56,6 +56,15 @@ config SENSORS_BEL_PFE
  This driver can also be built as a module. If so, the module will
  be called bel-pfe.
 
+config SENSORS_BPA_RS600
+   tristate "BluTek BPA-RS600 Power Supplies"
+   help
+ If you say yes here you get hardware monitoring support for BluTek
+ BPA-RS600 Power Supplies.
+
+ This driver can also be built as a module. If so, the module will
+ be called bpa-rs600.
+
 config SENSORS_IBM_CFFPS
tristate "IBM Common Form Factor Power Supply"
depends on LEDS_CLASS
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
index 6a4ba0fdc1db..80a437060dc4 100644
--- a/drivers/hwmon/pmbus/Makefile
+++ b/drivers/hwmon/pmbus/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o
 obj-$(CONFIG_SENSORS_ADM1266)  += adm1266.o
 obj-$(CONFIG_SENSORS_ADM1275)  += adm1275.o
 obj-$(CONFIG_SENSORS_BEL_PFE)  += bel-pfe.o
+obj-$(CONFIG_SENSORS_BPA_RS600)+= bpa-rs600.o
 obj-$(CONFIG_SENSORS_IBM_CFFPS)+= ibm-cffps.o
 obj-$(CONFIG_SENSORS_INSPUR_IPSPS) += inspur-ipsps.o
 obj-$(CONFIG_SENSORS_IR35221)  += ir35221.o
diff --git a/drivers/hwmon/pmbus/bpa-rs600.c b/drivers/hwmon/pmbus/bpa-rs600.c
new file mode 100644
index ..c4ede68b3e26
--- /dev/null
+++ b/drivers/hwmon/pmbus/bpa-rs600.c
@@ -0,0 +1,172 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Hardware monitoring driver for BluTek BPA-RS600 Power Supplies
+ *
+ * Copyright 2021 Allied Telesis Labs
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include