aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pmbus/pmbus_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/pmbus/pmbus_core.c')
-rw-r--r--drivers/hwmon/pmbus/pmbus_core.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 5c1b6cf31701..a561c3a0e916 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -182,6 +182,24 @@ int pmbus_write_byte(struct i2c_client *client, int page, u8 value)
182} 182}
183EXPORT_SYMBOL_GPL(pmbus_write_byte); 183EXPORT_SYMBOL_GPL(pmbus_write_byte);
184 184
185/*
186 * _pmbus_write_byte() is similar to pmbus_write_byte(), but checks if
187 * a device specific mapping funcion exists and calls it if necessary.
188 */
189static int _pmbus_write_byte(struct i2c_client *client, int page, u8 value)
190{
191 struct pmbus_data *data = i2c_get_clientdata(client);
192 const struct pmbus_driver_info *info = data->info;
193 int status;
194
195 if (info->write_byte) {
196 status = info->write_byte(client, page, value);
197 if (status != -ENODATA)
198 return status;
199 }
200 return pmbus_write_byte(client, page, value);
201}
202
185int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word) 203int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word)
186{ 204{
187 int rv; 205 int rv;
@@ -281,7 +299,7 @@ static int _pmbus_read_byte_data(struct i2c_client *client, int page, int reg)
281 299
282static void pmbus_clear_fault_page(struct i2c_client *client, int page) 300static void pmbus_clear_fault_page(struct i2c_client *client, int page)
283{ 301{
284 pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS); 302 _pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS);
285} 303}
286 304
287void pmbus_clear_faults(struct i2c_client *client) 305void pmbus_clear_faults(struct i2c_client *client)