On 5/3/21 9:11 AM, Vadim Pasternak wrote: > Hi Guenter! > ... >>> + case PMBUS_VIN_OV_FAULT_LIMIT: >>> + case PMBUS_VIN_UV_WARN_LIMIT: >>> + ret = pmbus_read_word_data(client, page, phase, reg); >>> + if (ret <= 0) >>> + return ret; >>> + >>> + val = mp2888_reg2data_linear11(ret, PSC_VOLTAGE_IN); >>> + ret = val * MP2888_VIN_MANTISSA; >>> + break; >> >> Unless I am missing something, this is linear11 with, for some reason, bit 10 >> erroneously set for PMBUS_READ_VIN. That means that setting the format >> for PSC_VOLTAGE_IN and clearing bit 10 for PMBUS_READ_VIN should work >> without local conversion. Am I missing something ? > > On board I have vin 12V. > From register I am getting 0xed80. > If I am masking bit 10, 0xe980, it gives me 48.12 V, masking bits 11,10 gives 24.00. > For getting 12, I should mask bits 11, 10 and shift left bits 8 - 0. > But I it doesn't look right things to do. > Turns out that is because the data format for READ_VIN is not linear11, it is something like linear10. The mantissa is 10 bit (unsigned), the exponent is 6 bit. So the exponent is -5, not -6 as one would assume. With that in mind, I'd still prefer to fix up READ_VIN to linear11 instead of converting the limits to direct mode. Thanks, Guenter