[PATCH v7 0/9] hwmon: pmbus: adm1266: add support

From: alexandru.tachici
Date: Mon Jul 27 2020 - 12:16:38 EST

From: Alexandru Tachici <alexandru.tachici@xxxxxxxxxx>

Add PMBus probing driver for the adm1266 Cascadable
Super Sequencer with Margin Control and Fault Recording.
Driver is using the pmbus_core, creating sysfs files
under hwmon for inputs: vh1->vh4 and vp1->vp13.

1. Add PMBus probing driver for inputs vh1->vh4
and vp1->vp13.

2. Add Block Write-Read Process Call command.
A PMBus specific implementation was required because
block write with I2C_SMBUS_PROC_CALL flag allows a
maximum of 32 bytes to be received.

3. This makes adm1266 driver expose GPIOs
to user-space. Currently are read only. Future
developments on the firmware will allow
them to be writable.

4. Allow the current sate of the sequencer to be read
through debugfs.

5. Blackboxes are 64 bytes of chip state related data
that is generated on faults. Use the nvmem kernel api
to expose the blackbox chip functionality to userspace.

6. Add group command support. This will allow the driver
to stop/program all cascaded adm1266 devices at once.

7. Writing the firmware hex file with offset 0
to the nvmem of the master adm1266 will trigger
the firmware programming of all cascaded devices.
The master adm1266 of each device is specified in
the devicetree.

8. Writing the configuration hex file to 0x30000
byte address of the nvmem file will trigger the
programming of that device in particular.

9. DT bindings for ADM1266.

Alexandru Tachici (9):
hwmon: pmbus: adm1266: add support
hwmon: pmbus: adm1266: Add Block process call
hwmon: pmbus: adm1266: Add support for GPIOs
hwmon: pmbus: adm1266: add debugfs for states
hwmon: pmbus: adm1266: read blackbox
hwmon: pmbus: adm1266: Add group command support
hwmon: pmbus: adm1266: program firmware
hwmon: pmbus: adm1266: program configuration
dt-bindings: hwmon: Add bindings for ADM1266

Changelog: v5 -> v6:
- added adm1266 to index.rst
- changed max lines length from 80 to 100
- replaced i2c_get_dma_safe_msg_buf with the use of kzalloc and ____cacheline_aligned
- removed #ifdef CONFIG_GPIOLIB
- removed ioctl commands, the state of the device can be read through debugfs
- use the device managed version of nvmem_register
- on power-up, set the UNIX time to adm1266 (this value is reset
to 0 on each power-cycle).
- removed patch adm1266: debugfs for blackbox info, rtc in blackbox is enough
to help identify the current index
- added two new nvmem cells for firmware and configuration

Changelog: v6 -> v7:
- fixed compilation warning: removed unused variable ,entry, in

.../bindings/hwmon/adi,adm1266.yaml | 56 +
Documentation/hwmon/adm1266.rst | 37 +
Documentation/hwmon/index.rst | 1 +
drivers/hwmon/pmbus/Kconfig | 10 +
drivers/hwmon/pmbus/Makefile | 1 +
drivers/hwmon/pmbus/adm1266.c | 1272 +++++++++++++++++
6 files changed, 1377 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwmon/adi,adm1266.yaml
create mode 100644 Documentation/hwmon/adm1266.rst
create mode 100644 drivers/hwmon/pmbus/adm1266.c