staticint bpa_rs600_read_byte_data(struct i2c_client *client, int page, int reg)
{ int ret;
if (page > 0) return -ENXIO;
switch (reg) { case PMBUS_FAN_CONFIG_12: /* * Two fans are reported in PMBUS_FAN_CONFIG_12 but there is * only one fan in the module. Mask out the FAN2 bits.
*/
ret = pmbus_read_byte_data(client, 0, PMBUS_FAN_CONFIG_12); if (ret >= 0)
ret &= ~(PB_FAN_2_INSTALLED | PB_FAN_2_PULSE_MASK); break; default:
ret = -ENODATA; break;
}
return ret;
}
/* * The BPA-RS600 violates the PMBus spec. Specifically it treats the * mantissa as unsigned. Deal with this here to allow the PMBus core * to work with correctly encoded data.
*/ staticint bpa_rs600_read_vin(struct i2c_client *client)
{ int ret, exponent, mantissa;
ret = pmbus_read_word_data(client, 0, 0xff, PMBUS_READ_VIN); if (ret < 0) return ret;
if (ret & BIT(10)) {
exponent = ret >> 11;
mantissa = ret & 0x7ff;
exponent++;
mantissa >>= 1;
ret = (exponent << 11) | mantissa;
}
return ret;
}
/* * Firmware V5.70 incorrectly reports 1640W for MFR_PIN_MAX. * Deal with this by returning a sensible value.
*/ staticint bpa_rs600_read_pin_max(struct i2c_client *client)
{ int ret;
ret = pmbus_read_word_data(client, 0, 0xff, PMBUS_MFR_PIN_MAX); if (ret < 0) return ret;
staticint bpa_rs600_read_word_data(struct i2c_client *client, int page, int phase, int reg)
{ int ret;
if (page > 0) return -ENXIO;
switch (reg) { case PMBUS_VIN_UV_WARN_LIMIT: case PMBUS_VIN_OV_WARN_LIMIT: case PMBUS_VOUT_UV_WARN_LIMIT: case PMBUS_VOUT_OV_WARN_LIMIT: case PMBUS_IIN_OC_WARN_LIMIT: case PMBUS_IOUT_OC_WARN_LIMIT: case PMBUS_PIN_OP_WARN_LIMIT: case PMBUS_POUT_OP_WARN_LIMIT: case PMBUS_VIN_UV_FAULT_LIMIT: case PMBUS_VIN_OV_FAULT_LIMIT: case PMBUS_VOUT_UV_FAULT_LIMIT: case PMBUS_VOUT_OV_FAULT_LIMIT: /* These commands return data but it is invalid/un-documented */
ret = -ENXIO; break; case PMBUS_READ_VIN:
ret = bpa_rs600_read_vin(client); break; case PMBUS_MFR_PIN_MAX:
ret = bpa_rs600_read_pin_max(client); break; default: if (reg >= PMBUS_VIRT_BASE)
ret = -ENXIO; else
ret = -ENODATA; break;
}
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.