/* Return the voltage from the given register in mV or mA */ staticint ltc4260_get_value(struct device *dev, u8 reg)
{ struct regmap *regmap = dev_get_drvdata(dev); unsignedint val; int ret;
ret = regmap_read(regmap, reg, &val); if (ret < 0) return ret;
switch (reg) { case LTC4260_ADIN: /* 10 mV resolution. Convert to mV. */
val = val * 10; break; case LTC4260_SOURCE: /* 400 mV resolution. Convert to mV. */
val = val * 400; break; case LTC4260_SENSE: /* * 300 uV resolution. Convert to current as measured with * an 1 mOhm sense resistor, in mA. If a different sense * resistor is installed, calculate the actual current by * dividing the reported current by the sense resistor value * in mOhm.
*/
val = val * 300; break; default: return -EINVAL;
}
/* * Voltage alarms * UV/OV faults are associated with the input voltage, and the POWER BAD and * FET SHORT faults are associated with the output voltage.
*/ static SENSOR_DEVICE_ATTR_RO(in1_min_alarm, ltc4260_bool, FAULT_UV); static SENSOR_DEVICE_ATTR_RO(in1_max_alarm, ltc4260_bool, FAULT_OV); static SENSOR_DEVICE_ATTR_RO(in2_alarm, ltc4260_bool,
FAULT_POWER_BAD | FAULT_FET_SHORT);
/* Current (via sense resistor) */ static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc4260_value, LTC4260_SENSE);
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.