Commit 7a750b39 authored by Jerome Brunet's avatar Jerome Brunet Committed by Guenter Roeck
Browse files

hwmon: (pmbus/core) allow drivers to override WRITE_PROTECT



Use _pmbus_read_byte_data() rather than calling smbus directly to check
the write protection status. This give a chance to device implementing
write protection differently to report back on the actual write protection
status.

Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Message-ID: <20241105-tps25990-v4-2-0e312ac70b62@baylibre.com>
[groeck: Fix page parameter of _pmbus_read_byte_data()]
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 544177f2
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -2719,9 +2719,7 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
	 * limit registers need to be disabled.
	 */
	if (!(data->flags & PMBUS_NO_WRITE_PROTECT)) {
		pmbus_wait(client);
		ret = i2c_smbus_read_byte_data(client, PMBUS_WRITE_PROTECT);
		pmbus_update_ts(client, false);
		ret = _pmbus_read_byte_data(client, -1, PMBUS_WRITE_PROTECT);

		if (ret > 0 && (ret & PB_WP_ANY))
			data->flags |= PMBUS_WRITE_PROTECTED | PMBUS_SKIP_STATUS_CHECK;