Skip to contentSkip to conversation

Add support for HiTRON HAC300S PSU

PATCH Applied Vasileios Amoiridis 2 participants 5 messages Jan 19 – Jan 27

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Add support for HiTRON HAC300S PSU

From: Vasileios Amoiridis <[email protected]>

Changes in v2:
--------------

Patch 1/2:
- fixed type
- Added Ack-By

Patch 2/2:
- removed if statement for VOUT_MODE reg
- device specific read_word_data function reads only affected registers and returns -ENODATA
- fixed typos

v1:
---

Add support for the HiTRON HAC300S AC/DC switching power supply in compact PCI format, with a 300W rating. This is a simple PMBUS compatible device.

There is a small caveat with the internal registers of the device and more specifically with the PMBUS_VOUT_MODE. As it is already described in the driver, the device does not support the PMBUS_VOUT_MODE register and at the same time, it returns the voltage output values in Linear11 which is not adhering to the PMBus specification (PMBus Specification Part II, Section 7.1-7.3). For that reason the PMBUS_VOUT_MODE register is being faked and returns the exponent value of the READ_VOUT register. The exponent part of the VOUT_* registers is being cleard in order to return the mantissa to the pmbus core.

Vasileios Amoiridis (2):
dt-bindings: trivial-devices: Add hitron,hac300s
hwmon: Add support for HiTRON HAC300S PSU

 .../devicetree/bindings/trivial-devices.yaml  |   2 +
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 Documentation/hwmon/hac300s.rst               |  37 +++++
 Documentation/hwmon/index.rst                 |   1 +
 MAINTAINERS                                   |   7 +
 drivers/hwmon/pmbus/Kconfig                   |   9 ++
 drivers/hwmon/pmbus/Makefile                  |   1 +
 drivers/hwmon/pmbus/hac300s.c                 | 132 ++++++++++++++++++
 8 files changed, 191 insertions(+)
 create mode 100644 Documentation/hwmon/hac300s.rst
 create mode 100644 drivers/hwmon/pmbus/hac300s.c
Signature · 1 line
2.47.3
#1 lore raw

PATCH v2 1/2 dt-bindings: trivial-devices: Add hitron,hac300s

From: Vasileios Amoiridis <[email protected]>

Add HiTRON HAC300S PSU to trivial devices since it is simple PMBUS capable device.

Since this is the first supported device from this vendor, document its name to the vendor-prefixes.yaml file as well.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 2 files changed, 4 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index d0f7dbf15d6f..efa1957948a5 100644
@@ -123,6 +123,8 @@ properties:
           - fsl,mma8450
             # MPR121: Proximity Capacitive Touch Sensor Controller
           - fsl,mpr121
+            # HiTRON AC/DC CompactPCI Power Supply
+          - hitron,hac300s
             # Honeywell Humidicon HIH-6130 humidity/temperature sensor
           - honeywell,hi6130
             # IBM Common Form Factor Power Supply Versions (all versions)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index c7591b2aec2a..fdb11141e597 100644
@@ -701,6 +701,8 @@ patternProperties:
     description: Hitachi Ltd.
   "^hitex,.*":
     description: Hitex Development Tools
+  "^hitron,.*":
+    description: HiTRON Electronics Corporation
   "^holt,.*":
     description: Holt Integrated Circuits, Inc.
   "^holtek,.*":
Signature · 1 line
2.47.3
maintainer Applied
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: trivial-devices: Add hitron,hac300s

Quoted 10 lines · Vasileios Amoiridis

From: Vasileios Amoiridis <[email protected]>

Add HiTRON HAC300S PSU to trivial devices since it is simple PMBUS capable device.

Since this is the first supported device from this vendor, document its name to the vendor-prefixes.yaml file as well.

Applied.

Thanks,
Guenter

#3 lore raw

PATCH v2 2/2 hwmon: Add support for HiTRON HAC300S PSU

In reply to Vasileios Amoiridis

From: Vasileios Amoiridis <[email protected]>

Add Support for HiTRON HAC300S PSU. This is a AC/DC hot-swappable CompactPCI Serial Dual output active current sharing switching power supply with a 312W rating.

---
 Documentation/hwmon/hac300s.rst |  37 +++++++++
 Documentation/hwmon/index.rst   |   1 +
 MAINTAINERS                     |   7 ++
 drivers/hwmon/pmbus/Kconfig     |   9 +++
 drivers/hwmon/pmbus/Makefile    |   1 +
 drivers/hwmon/pmbus/hac300s.c   | 132 ++++++++++++++++++++++++++++++++
 6 files changed, 187 insertions(+)
 create mode 100644 Documentation/hwmon/hac300s.rst
 create mode 100644 drivers/hwmon/pmbus/hac300s.c
Documentation/hwmon/hac300s.rst new file +37 -0
new file mode 100644
index 000000000000..8b11d3e72295
@@ -0,0 +1,37 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+Kernel driver hac300s
+=====================
+
+Supported chips:
+
+   * HiTRON HAC300S
+
+     Prefix: 'hac300s'
+
+     Datasheet: Publicly available at HiTRON website.
+
+Author:
+
+  - Vasileios Amoiridis <[email protected]>
+
+Description
+-----------
+
+This driver supports the HiTRON HAC300S PSU. It is a Universal AC input
+harmonic correction AC-DC hot-swappable CompactPCI Serial Dual output
+(with 5V standby) 312 Watts active current sharing switching power supply.
+
+The device has an input of 90-264VAC and 2 nominal output voltaged at 12V and
+5V which they can supplu up to 25A and 2.5A respectively.
+
+Sysfs entries
+-------------
+
+======= ==========================================
+curr1   Output current
+in1     Output voltage
+power1  Output power
+temp1   Ambient temperature inside the module
+temp2   Internal secondary component's temperature
+======= ==========================================
Documentation/hwmon/index.rst +1 -0
index 85d7a686883e..f00ce656e9dd 100644
@@ -84,6 +84,7 @@ Hardware Monitoring Kernel Drivers
    gl518sm
    gpd-fan
    gxp-fan-ctrl
+   hac300s
    hih6130
    hp-wmi-sensors
    hs3001
MAINTAINERS +7 -0
index cf755238c429..e4b4a41a2c07 100644
@@ -11259,6 +11259,13 @@ F:	kernel/time/timer_list.c
 F:	kernel/time/timer_migration.*
 F:	tools/testing/selftests/timers/
 
+HITRON HAC300S PSU DRIVER
+M:	Vasileios Amoiridis <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/hwmon/hac300s.rst
+F:	drivers/hwmon/pmbus/hac300s.c
+
 DELAY, SLEEP, TIMEKEEPING, TIMERS [RUST]
 M:	Andreas Hindborg <[email protected]>
 R:	Boqun Feng <[email protected]>
drivers/hwmon/pmbus/Kconfig +9 -0
index f3fb94cebf1a..4c2cb51dbe3f 100644
@@ -124,6 +124,15 @@ config SENSORS_FSP_3Y
 	  This driver can also be built as a module. If so, the module will
 	  be called fsp-3y.
 
+config SENSORS_HAC300S
+	tristate "Hitron HAC300S-D120E PSU"
+	help
+	  If you say yes here you get hardware monitoring support for the
+	  Hitron HAC300S-D120E Power Supply.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called hac300s.
+
 config SENSORS_IBM_CFFPS
 	tristate "IBM Common Form Factor Power Supply"
 	depends on LEDS_CLASS
drivers/hwmon/pmbus/Makefile +1 -0
index 349a89b6d92e..b92309019d35 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_SENSORS_BEL_PFE)	+= bel-pfe.o
 obj-$(CONFIG_SENSORS_BPA_RS600)	+= bpa-rs600.o
 obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) += delta-ahe50dc-fan.o
 obj-$(CONFIG_SENSORS_FSP_3Y)	+= fsp-3y.o
+obj-$(CONFIG_SENSORS_HAC300S)	+= hac300s.o
 obj-$(CONFIG_SENSORS_IBM_CFFPS)	+= ibm-cffps.o
 obj-$(CONFIG_SENSORS_DPS920AB)	+= dps920ab.o
 obj-$(CONFIG_SENSORS_INA233)	+= ina233.o
drivers/hwmon/pmbus/hac300s.c new file +132 -0

132 lines not on this page · raw message

Signature · 1 line
2.47.3
maintainer
#4 lore raw

Re: [PATCH v2 2/2] hwmon: Add support for HiTRON HAC300S PSU

Quoted 7 lines · Vasileios Amoiridis

From: Vasileios Amoiridis <[email protected]>

Add Support for HiTRON HAC300S PSU. This is a AC/DC hot-swappable CompactPCI Serial Dual output active current sharing switching power supply with a 312W rating.

checkpatch --strict returns various whitespace errors. Please run that command in the future.

Also,

drivers/hwmon/pmbus/hac300s.c line 44

Quoted 9 lines
drivers/hwmon/pmbus/hac300s.c new file +9 -0
+static int hac300s_read_byte_data(struct i2c_client *client, int page, int reg)
+{
+	const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
+	struct hac300s_data *data = to_hac300s_data(info);
+
+	if (reg == PMBUS_VOUT_MODE)
+		return data->exponent;
+
+	return pmbus_read_byte_data(client, page, reg);

This should return -ENODATA.

No need to resend; I fixed it all up and applied the patch.

Thanks,
Guenter