staticint sl28cpld_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, long *input)
{ struct sl28cpld_hwmon *hwmon = dev_get_drvdata(dev); unsignedint value; int ret;
switch (attr) { case hwmon_fan_input:
ret = regmap_read(hwmon->regmap, hwmon->offset + FAN_INPUT,
&value); if (ret) return ret; /* * The register has a 7 bit value and 1 bit which indicates the * scale. If the MSB is set, then the lower 7 bit has to be * multiplied by 8, to get the correct reading.
*/ if (value & FAN_SCALE_X8)
value = FIELD_GET(FAN_VALUE_MASK, value) << 3;
/* * The counter period is 1000ms and the sysfs specification * says we should assume 2 pulses per revolution.
*/
value *= 60 / 2;
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.