hwmon: (pmbus) Virtualize pmbus_write_byte
With virtual pages and to be able to handle more chips, it is necessary to virtualise pmbus_write_byte(). Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
This commit is contained in:
Родитель
322a8b0340
Коммит
044cd3a574
|
@ -325,6 +325,7 @@ struct pmbus_driver_info {
|
||||||
int (*read_word_data)(struct i2c_client *client, int page, int reg);
|
int (*read_word_data)(struct i2c_client *client, int page, int reg);
|
||||||
int (*write_word_data)(struct i2c_client *client, int page, int reg,
|
int (*write_word_data)(struct i2c_client *client, int page, int reg,
|
||||||
u16 word);
|
u16 word);
|
||||||
|
int (*write_byte)(struct i2c_client *client, int page, u8 value);
|
||||||
/*
|
/*
|
||||||
* The identify function determines supported PMBus functionality.
|
* The identify function determines supported PMBus functionality.
|
||||||
* This function is only necessary if a chip driver supports multiple
|
* This function is only necessary if a chip driver supports multiple
|
||||||
|
|
|
@ -182,6 +182,24 @@ int pmbus_write_byte(struct i2c_client *client, int page, u8 value)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(pmbus_write_byte);
|
EXPORT_SYMBOL_GPL(pmbus_write_byte);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* _pmbus_write_byte() is similar to pmbus_write_byte(), but checks if
|
||||||
|
* a device specific mapping funcion exists and calls it if necessary.
|
||||||
|
*/
|
||||||
|
static int _pmbus_write_byte(struct i2c_client *client, int page, u8 value)
|
||||||
|
{
|
||||||
|
struct pmbus_data *data = i2c_get_clientdata(client);
|
||||||
|
const struct pmbus_driver_info *info = data->info;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
if (info->write_byte) {
|
||||||
|
status = info->write_byte(client, page, value);
|
||||||
|
if (status != -ENODATA)
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
return pmbus_write_byte(client, page, value);
|
||||||
|
}
|
||||||
|
|
||||||
int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word)
|
int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
@ -281,7 +299,7 @@ static int _pmbus_read_byte_data(struct i2c_client *client, int page, int reg)
|
||||||
|
|
||||||
static void pmbus_clear_fault_page(struct i2c_client *client, int page)
|
static void pmbus_clear_fault_page(struct i2c_client *client, int page)
|
||||||
{
|
{
|
||||||
pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS);
|
_pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pmbus_clear_faults(struct i2c_client *client)
|
void pmbus_clear_faults(struct i2c_client *client)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче