val &= ~TEMP_CFG_CYCLES;
val |= FIELD_PREP(TEMP_CFG_CYCLES, clk);
val |= TEMP_CFG_ENA;
writel(val, hwmon->base + TEMP_CFG);
}
staticint s5_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *temp)
{ struct s5_hwmon *hwmon = dev_get_drvdata(dev); int rc = 0, value;
u32 stat;
switch (attr) { case hwmon_temp_input:
stat = readl_relaxed(hwmon->base + TEMP_STAT); if (!(stat & TEMP_STAT_VALID)) return -EAGAIN;
value = stat & TEMP_STAT_TEMP; /* * From register documentation: * Temp(C) = TEMP_SENSOR_STAT.TEMP / 4096 * 352.2 - 109.4
*/
value = DIV_ROUND_CLOSEST(value * 3522, 4096) - 1094; /* * Scale down by 10 from above and multiply by 1000 to * have millidegrees as specified by the hwmon sysfs * interface.
*/
value *= 100;
*temp = value; break; default:
rc = -EOPNOTSUPP; break;
}
return rc;
}
static umode_t s5_is_visible(constvoid *_data, enum hwmon_sensor_types type,
u32 attr, int channel)
{ if (type != hwmon_temp) return 0;
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.