#define TPS53681_MFR_SPECIFIC_20 0xe4 /* Number of phases, per page */
staticconststruct i2c_device_id tps53679_id[];
staticint tps53679_identify_mode(struct i2c_client *client, struct pmbus_driver_info *info)
{
u8 vout_params; int i, ret;
for (i = 0; i < info->pages; i++) { /* Read the register with VOUT scaling value.*/
ret = pmbus_read_byte_data(client, i, PMBUS_VOUT_MODE); if (ret < 0) return ret;
vout_params = ret & GENMASK(4, 0);
switch (vout_params) { case TPS53679_PROT_VR13_10MV: case TPS53679_PROT_VR12_5_10MV:
info->vrm_version[i] = vr13; break; case TPS53679_PROT_VR13_5MV: case TPS53679_PROT_VR12_5MV: case TPS53679_PROT_IMVP8_5MV:
info->vrm_version[i] = vr12; break; default: return -EINVAL;
}
}
return 0;
}
staticint tps53679_identify_phases(struct i2c_client *client, struct pmbus_driver_info *info)
{ int ret;
/* On TPS53681, only channel A provides per-phase output current */
ret = pmbus_read_byte_data(client, 0, TPS53681_MFR_SPECIFIC_20); if (ret < 0) return ret;
info->phases[0] = (ret & 0x07) + 1;
return 0;
}
staticint tps53679_identify_chip(struct i2c_client *client,
u8 revision, char *id)
{
u8 buf[I2C_SMBUS_BLOCK_MAX]; int ret; int buf_len; int id_len;
ret = pmbus_read_byte_data(client, 0, PMBUS_REVISION); if (ret < 0) return ret; if (ret != revision) {
dev_err(&client->dev, "Unexpected PMBus revision 0x%x\n", ret); return -ENODEV;
}
ret = i2c_smbus_read_block_data(client, PMBUS_IC_DEVICE_ID, buf); if (ret < 0) return ret;
/* Adjust length if null terminator if present */
buf_len = (buf[ret - 1] != '\x00' ? ret : ret - 1);
/* * Common identification function for chips with multi-phase support. * Since those chips have special configuration registers, we want to have * some level of reassurance that we are really talking with the chip * being probed. Check PMBus revision and chip ID.
*/ staticint tps53679_identify_multiphase(struct i2c_client *client, struct pmbus_driver_info *info, int pmbus_rev, char *device_id)
{ int ret;
ret = tps53679_identify_chip(client, pmbus_rev, device_id); if (ret < 0) return ret;
ret = tps53679_identify_mode(client, info); if (ret < 0) return ret;
staticint tps53681_read_word_data(struct i2c_client *client, int page, int phase, int reg)
{ /* * For reading the total output current (READ_IOUT) for all phases, * the chip datasheet is a bit vague. It says "PHASE must be set to * FFh to access all phases simultaneously. PHASE may also be set to * 80h readack (!) the total phase current". * Experiments show that the command does _not_ report the total * current for all phases if the phase is set to 0xff. Instead, it * appears to report the current of one of the phases. Override phase * parameter with 0x80 when reading the total output current on page 0.
*/ if (reg == PMBUS_READ_IOUT && page == 0 && phase == 0xff) return pmbus_read_word_data(client, page, 0x80, reg); return -ENODATA;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.