mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-09-03 15:55:15 +00:00
sensors: Add support for power min, lcrit, min_alarm, lcrit_alarm
SFP modules measure the transmit power of the lazer. The sensor has expected minimum values, and alarms when these minimams are reached. Add support to sensors to print these. Signed-off-by: Andrew Lunn <andrew@lunn.ch>
This commit is contained in:
committed by
Guenter Roeck
parent
70f7e08484
commit
dcf23676cc
@@ -6,6 +6,13 @@ over time. This document summarizes these evolutions so that application
|
||||
authors can quickly figure out how to test for the availability of a
|
||||
given new feature.
|
||||
|
||||
0x4?? lm-sensors 3.?.?
|
||||
* Added support for power min, lcrit, min_alarm and lcrit_alarm
|
||||
enum sensors_subfeature_type SENSORS_SUBFEATURE_POWER_MIN
|
||||
enum sensors_subfeature_type SENSORS_SUBFEATURE_POWER_LCRIT
|
||||
enum sensors_subfeature_type SENSORS_SUBFEATURE_POWER_MIN_ALARM
|
||||
enum sensors_subfeature_type SENSORS_SUBFEATURE_POWER_LCRIT_ALARM
|
||||
|
||||
0x440 lm-sensors 3.4.0
|
||||
* Defined SENSORS_FEATURE_MAX
|
||||
enum sensors_feature_type SENSORS_FEATURE_MAX
|
||||
|
@@ -214,11 +214,15 @@ typedef enum sensors_subfeature_type {
|
||||
SENSORS_SUBFEATURE_POWER_CAP_HYST,
|
||||
SENSORS_SUBFEATURE_POWER_MAX,
|
||||
SENSORS_SUBFEATURE_POWER_CRIT,
|
||||
SENSORS_SUBFEATURE_POWER_MIN,
|
||||
SENSORS_SUBFEATURE_POWER_LCRIT,
|
||||
SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL = (SENSORS_FEATURE_POWER << 8) | 0x80,
|
||||
SENSORS_SUBFEATURE_POWER_ALARM,
|
||||
SENSORS_SUBFEATURE_POWER_CAP_ALARM,
|
||||
SENSORS_SUBFEATURE_POWER_MAX_ALARM,
|
||||
SENSORS_SUBFEATURE_POWER_CRIT_ALARM,
|
||||
SENSORS_SUBFEATURE_POWER_MIN_ALARM,
|
||||
SENSORS_SUBFEATURE_POWER_LCRIT_ALARM,
|
||||
|
||||
SENSORS_SUBFEATURE_ENERGY_INPUT = SENSORS_FEATURE_ENERGY << 8,
|
||||
|
||||
|
@@ -280,9 +280,13 @@ static const struct subfeature_type_match power_matches[] = {
|
||||
{ "cap_alarm", SENSORS_SUBFEATURE_POWER_CAP_ALARM },
|
||||
{ "alarm", SENSORS_SUBFEATURE_POWER_ALARM },
|
||||
{ "max", SENSORS_SUBFEATURE_POWER_MAX },
|
||||
{ "min", SENSORS_SUBFEATURE_POWER_MIN },
|
||||
{ "min_alarm", SENSORS_SUBFEATURE_POWER_MIN_ALARM },
|
||||
{ "max_alarm", SENSORS_SUBFEATURE_POWER_MAX_ALARM },
|
||||
{ "crit", SENSORS_SUBFEATURE_POWER_CRIT },
|
||||
{ "lcrit", SENSORS_SUBFEATURE_POWER_LCRIT },
|
||||
{ "crit_alarm", SENSORS_SUBFEATURE_POWER_CRIT_ALARM },
|
||||
{ "lcrit_alarm", SENSORS_SUBFEATURE_POWER_LCRIT_ALARM },
|
||||
{ "average_interval", SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
@@ -562,10 +562,14 @@ static void scale_value(double *value, const char **prefixstr)
|
||||
|
||||
static const struct sensor_subfeature_list power_common_sensors[] = {
|
||||
{ SENSORS_SUBFEATURE_POWER_ALARM, NULL, 1, NULL },
|
||||
{ SENSORS_SUBFEATURE_POWER_MAX_ALARM, NULL, 1, "MIN" },
|
||||
{ SENSORS_SUBFEATURE_POWER_MAX_ALARM, NULL, 1, "MAX" },
|
||||
{ SENSORS_SUBFEATURE_POWER_LCRIT_ALARM, NULL, 1, "LCRIT" },
|
||||
{ SENSORS_SUBFEATURE_POWER_CRIT_ALARM, NULL, 1, "CRIT" },
|
||||
{ SENSORS_SUBFEATURE_POWER_CAP_ALARM, NULL, 1, "CAP" },
|
||||
{ SENSORS_SUBFEATURE_POWER_MAX, NULL, 0, "max" },
|
||||
{ SENSORS_SUBFEATURE_POWER_MIN, NULL, 0, "min" },
|
||||
{ SENSORS_SUBFEATURE_POWER_LCRIT, NULL, 0, "lcrit" },
|
||||
{ SENSORS_SUBFEATURE_POWER_CRIT, NULL, 0, "crit" },
|
||||
{ SENSORS_SUBFEATURE_POWER_CAP, NULL, 0, "cap" },
|
||||
{ -1, NULL, 0, NULL }
|
||||
@@ -590,7 +594,7 @@ static const struct sensor_subfeature_list power_avg_sensors[] = {
|
||||
{ -1, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
#define NUM_POWER_ALARMS 4
|
||||
#define NUM_POWER_ALARMS 6
|
||||
#define NUM_POWER_SENSORS (ARRAY_SIZE(power_common_sensors) \
|
||||
+ ARRAY_SIZE(power_inst_sensors) \
|
||||
- NUM_POWER_ALARMS - 2)
|
||||
|
Reference in New Issue
Block a user