Skip to content

Commit 3cd1ef2

Browse files
PatrickRudolphgroeck
authored andcommitted
hwmon: pmbus: pli12096bc: Add write delay
Tests on PLI12096bc showed that sometimes a small delay is necessary after a write operation before a new operation can be processed. If not respected the device will probably NACK the data phase of the SMBus transaction. Tests showed that the probability to observe transaction errors can be raised by either reading sensor data or toggling the regulator enable. Further tests showed that 250 microseconds, as used previously for the CLEAR_FAULTS workaround, is sufficient. Signed-off-by: Patrick Rudolph <[email protected]> Message-ID: <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent 9c4e673 commit 3cd1ef2

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

drivers/hwmon/pmbus/pli1209bc.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,6 @@ static int pli1209bc_read_word_data(struct i2c_client *client, int page,
5454
}
5555
}
5656

57-
static int pli1209bc_write_byte(struct i2c_client *client, int page, u8 reg)
58-
{
59-
int ret;
60-
61-
switch (reg) {
62-
case PMBUS_CLEAR_FAULTS:
63-
ret = pmbus_write_byte(client, page, reg);
64-
/*
65-
* PLI1209 takes 230 usec to execute the CLEAR_FAULTS command.
66-
* During that time it's busy and NACKs all requests on the
67-
* SMBUS interface. It also NACKs reads on PMBUS_STATUS_BYTE
68-
* making it impossible to poll the BUSY flag.
69-
*
70-
* Just wait for not BUSY unconditionally.
71-
*/
72-
usleep_range(250, 300);
73-
break;
74-
default:
75-
ret = -ENODATA;
76-
break;
77-
}
78-
return ret;
79-
}
80-
8157
#if IS_ENABLED(CONFIG_SENSORS_PLI1209BC_REGULATOR)
8258
static const struct regulator_desc pli1209bc_reg_desc = {
8359
.name = "vout2",
@@ -127,7 +103,7 @@ static struct pmbus_driver_info pli1209bc_info = {
127103
| PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP
128104
| PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_INPUT,
129105
.read_word_data = pli1209bc_read_word_data,
130-
.write_byte = pli1209bc_write_byte,
106+
.write_delay = 250,
131107
#if IS_ENABLED(CONFIG_SENSORS_PLI1209BC_REGULATOR)
132108
.num_regulators = 1,
133109
.reg_desc = &pli1209bc_reg_desc,

0 commit comments

Comments
 (0)