diff mbox series

[v4,2/7] hwmon: (pmbus/core) allow drivers to override WRITE_PROTECT

Message ID 20241105-tps25990-v4-2-0e312ac70b62@baylibre.com
State New
Headers show
Series hwmon: pmbus: add tps25990 efuse support | expand

Commit Message

Jerome Brunet Nov. 5, 2024, 5:58 p.m. UTC
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: Jerome Brunet <jbrunet@baylibre.com>
---
 drivers/hwmon/pmbus/pmbus_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Guenter Roeck Nov. 6, 2024, 3:58 p.m. UTC | #1
On Tue, Nov 05, 2024 at 06:58:39PM +0100, Jerome Brunet wrote:
> 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: Jerome Brunet <jbrunet@baylibre.com>

Applied,

Thanks,
Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index ce7fd4ca9d89b0f0a02e6c99db391a7cfca924a8..085a4dc91d9bad3d2aacdd946b74a094ea9ae458 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -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, 0xff, PMBUS_WRITE_PROTECT);
 
 		if (ret > 0 && (ret & PB_WP_ANY))
 			data->flags |= PMBUS_WRITE_PROTECTED | PMBUS_SKIP_STATUS_CHECK;