[PATCH 0/2] hwmon: (pmbus/max31785) refactor inter-access delay

Sanman Pradhan posted 2 patches 1 month ago
There is a newer version of this series
drivers/hwmon/pmbus/max31785.c | 186 +++++++++++----------------------
1 file changed, 59 insertions(+), 127 deletions(-)
[PATCH 0/2] hwmon: (pmbus/max31785) refactor inter-access delay
Posted by Sanman Pradhan 1 month ago
From: Sanman Pradhan <psanman@juniper.net>

This series refactors the MAX31785 PMBus driver to utilize the core PMBus
access_delay mechanism, removing a significant amount of custom delay
boilerplate.

The MAX31785 fan controller is prone to NACKing master transactions if they
are issued too closely together. Historically, the driver handled this
by wrapping all SMBus and PMBus reads/writes with a custom timestamp and
delay checking function. By offloading this to pmbus_driver_info.access_delay,
we can clean up the driver considerably.

Patch 1:
Fixes a minor argument type mismatch (u16 to u8) in a local wrapper
function as a preparatory cleanup.

Patch 2:
- Replaces the local delay wrappers with info.access_delay = 250.
- Explicitly sandwiches the raw i2c_transfer() long-read path with 
  usleep_range() delays since it bypasses the PMBus core timing.
- Fixes a bug in max31785_read_byte_data() where physical pages were 
  incorrectly remapped. This allows physical page accesses to fall back 
  to the PMBus core, and lets us safely transition to the core 
  pmbus_update_fan() helper.
- Fixes probe-time delay enforcement by using the wrapped read for MFR_REVISION.
- Minor cleanups (renaming 'virtual' to 'vpage', dropping unused macros).

Sanman Pradhan (2):
  hwmon: (pmbus/max31785) fix argument type for
    i2c_smbus_write_byte_data wrapper
  hwmon: (pmbus/max31785) use access_delay for PMBus-mediated accesses

 drivers/hwmon/pmbus/max31785.c | 186 +++++++++++----------------------
 1 file changed, 59 insertions(+), 127 deletions(-)

-- 
2.34.1