From b90f994a37cc1fc028807007fbf5f1df7d6bf141 Mon Sep 17 00:00:00 2001 From: Mårten Lindahl Date: Thu, 28 Apr 2022 16:40:38 +0200 Subject: hwmon: (pmbus/ltc2978) Add chip specific write_byte_data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Several of the manuals for devices supported by this driver describes the need for a minimum wait time before the chip is ready to receive next command. This wait time is already implemented in the driver as a ltc_wait_ready function with a driver defined wait time of 100 ms, and is considered for specific devices before reading/writing data on the pmbus. Since this driver uses the default pmbus_regulator_ops for the enable/ disable/is_enabled functions we should add a driver specific callback for write_byte_data to prevent bypassing the wait time recommendations for the following devices: ltc3880/ltc3882/ltc3883/ltc3884/ltc3886/ ltc3887/ltc3889/ltm4664/ltm4675/ltm4676/ltm4677/ltm4678/ltm4680/ltm4686/ ltm4700/ltc7880. Signed-off-by: Mårten Lindahl Link: https://lore.kernel.org/r/20220428144039.2464667-4-marten.lindahl@axis.com Signed-off-by: Guenter Roeck --- drivers/hwmon/pmbus/ltc2978.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/hwmon') diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c index 0127273883f0..531aa674a928 100644 --- a/drivers/hwmon/pmbus/ltc2978.c +++ b/drivers/hwmon/pmbus/ltc2978.c @@ -196,6 +196,17 @@ static int ltc_read_byte_data(struct i2c_client *client, int page, int reg) return pmbus_read_byte_data(client, page, reg); } +static int ltc_write_byte_data(struct i2c_client *client, int page, int reg, u8 value) +{ + int ret; + + ret = ltc_wait_ready(client); + if (ret < 0) + return ret; + + return pmbus_write_byte_data(client, page, reg, value); +} + static int ltc_write_byte(struct i2c_client *client, int page, u8 byte) { int ret; @@ -681,6 +692,7 @@ static int ltc2978_probe(struct i2c_client *client) info = &data->info; info->write_word_data = ltc2978_write_word_data; info->write_byte = ltc_write_byte; + info->write_byte_data = ltc_write_byte_data; info->read_word_data = ltc_read_word_data; info->read_byte_data = ltc_read_byte_data; -- cgit v1.2.3-59-g8ed1b