hwmon: (core) Add support for rated attributes
Adding implementation for new attributes (rated_min/rated_max) for currentX, inX, powerX, tempX and humidityX. Tested with OpenBMC stack and simple hwmon driver using rated_min/rated_max for the following types of sensors: hwmon_temp, hwmon_in, hwmon_curr, hwmon_power, hwmon_humidity. For each sensor rated attributes were available and returned expected values. Signed-off-by: Zbigniew Lukwinski <zbigniew.lukwinski@linux.intel.com> Link: https://lore.kernel.org/r/1596224237-32280-3-git-send-email-zbigniew.lukwinski@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
e8e612350f
commit
1967f71267
|
@ -431,6 +431,8 @@ static const char * const hwmon_temp_attr_templates[] = {
|
|||
[hwmon_temp_lowest] = "temp%d_lowest",
|
||||
[hwmon_temp_highest] = "temp%d_highest",
|
||||
[hwmon_temp_reset_history] = "temp%d_reset_history",
|
||||
[hwmon_temp_rated_min] = "temp%d_rated_min",
|
||||
[hwmon_temp_rated_max] = "temp%d_rated_max",
|
||||
};
|
||||
|
||||
static const char * const hwmon_in_attr_templates[] = {
|
||||
|
@ -450,6 +452,8 @@ static const char * const hwmon_in_attr_templates[] = {
|
|||
[hwmon_in_max_alarm] = "in%d_max_alarm",
|
||||
[hwmon_in_lcrit_alarm] = "in%d_lcrit_alarm",
|
||||
[hwmon_in_crit_alarm] = "in%d_crit_alarm",
|
||||
[hwmon_in_rated_min] = "in%d_rated_min",
|
||||
[hwmon_in_rated_max] = "in%d_rated_max",
|
||||
};
|
||||
|
||||
static const char * const hwmon_curr_attr_templates[] = {
|
||||
|
@ -469,6 +473,8 @@ static const char * const hwmon_curr_attr_templates[] = {
|
|||
[hwmon_curr_max_alarm] = "curr%d_max_alarm",
|
||||
[hwmon_curr_lcrit_alarm] = "curr%d_lcrit_alarm",
|
||||
[hwmon_curr_crit_alarm] = "curr%d_crit_alarm",
|
||||
[hwmon_curr_rated_min] = "curr%d_rated_min",
|
||||
[hwmon_curr_rated_max] = "curr%d_rated_max",
|
||||
};
|
||||
|
||||
static const char * const hwmon_power_attr_templates[] = {
|
||||
|
@ -501,6 +507,8 @@ static const char * const hwmon_power_attr_templates[] = {
|
|||
[hwmon_power_max_alarm] = "power%d_max_alarm",
|
||||
[hwmon_power_lcrit_alarm] = "power%d_lcrit_alarm",
|
||||
[hwmon_power_crit_alarm] = "power%d_crit_alarm",
|
||||
[hwmon_power_rated_min] = "power%d_rated_min",
|
||||
[hwmon_power_rated_max] = "power%d_rated_max",
|
||||
};
|
||||
|
||||
static const char * const hwmon_energy_attr_templates[] = {
|
||||
|
@ -519,6 +527,8 @@ static const char * const hwmon_humidity_attr_templates[] = {
|
|||
[hwmon_humidity_max_hyst] = "humidity%d_max_hyst",
|
||||
[hwmon_humidity_alarm] = "humidity%d_alarm",
|
||||
[hwmon_humidity_fault] = "humidity%d_fault",
|
||||
[hwmon_humidity_rated_min] = "humidity%d_rated_min",
|
||||
[hwmon_humidity_rated_max] = "humidity%d_rated_max",
|
||||
};
|
||||
|
||||
static const char * const hwmon_fan_attr_templates[] = {
|
||||
|
|
|
@ -85,6 +85,8 @@ enum hwmon_temp_attributes {
|
|||
hwmon_temp_lowest,
|
||||
hwmon_temp_highest,
|
||||
hwmon_temp_reset_history,
|
||||
hwmon_temp_rated_min,
|
||||
hwmon_temp_rated_max,
|
||||
};
|
||||
|
||||
#define HWMON_T_ENABLE BIT(hwmon_temp_enable)
|
||||
|
@ -112,6 +114,8 @@ enum hwmon_temp_attributes {
|
|||
#define HWMON_T_LOWEST BIT(hwmon_temp_lowest)
|
||||
#define HWMON_T_HIGHEST BIT(hwmon_temp_highest)
|
||||
#define HWMON_T_RESET_HISTORY BIT(hwmon_temp_reset_history)
|
||||
#define HWMON_T_RATED_MIN BIT(hwmon_temp_rated_min)
|
||||
#define HWMON_T_RATED_MAX BIT(hwmon_temp_rated_max)
|
||||
|
||||
enum hwmon_in_attributes {
|
||||
hwmon_in_enable,
|
||||
|
@ -130,6 +134,8 @@ enum hwmon_in_attributes {
|
|||
hwmon_in_max_alarm,
|
||||
hwmon_in_lcrit_alarm,
|
||||
hwmon_in_crit_alarm,
|
||||
hwmon_in_rated_min,
|
||||
hwmon_in_rated_max,
|
||||
};
|
||||
|
||||
#define HWMON_I_ENABLE BIT(hwmon_in_enable)
|
||||
|
@ -148,6 +154,8 @@ enum hwmon_in_attributes {
|
|||
#define HWMON_I_MAX_ALARM BIT(hwmon_in_max_alarm)
|
||||
#define HWMON_I_LCRIT_ALARM BIT(hwmon_in_lcrit_alarm)
|
||||
#define HWMON_I_CRIT_ALARM BIT(hwmon_in_crit_alarm)
|
||||
#define HWMON_I_RATED_MIN BIT(hwmon_in_rated_min)
|
||||
#define HWMON_I_RATED_MAX BIT(hwmon_in_rated_max)
|
||||
|
||||
enum hwmon_curr_attributes {
|
||||
hwmon_curr_enable,
|
||||
|
@ -166,6 +174,8 @@ enum hwmon_curr_attributes {
|
|||
hwmon_curr_max_alarm,
|
||||
hwmon_curr_lcrit_alarm,
|
||||
hwmon_curr_crit_alarm,
|
||||
hwmon_curr_rated_min,
|
||||
hwmon_curr_rated_max,
|
||||
};
|
||||
|
||||
#define HWMON_C_ENABLE BIT(hwmon_curr_enable)
|
||||
|
@ -184,6 +194,8 @@ enum hwmon_curr_attributes {
|
|||
#define HWMON_C_MAX_ALARM BIT(hwmon_curr_max_alarm)
|
||||
#define HWMON_C_LCRIT_ALARM BIT(hwmon_curr_lcrit_alarm)
|
||||
#define HWMON_C_CRIT_ALARM BIT(hwmon_curr_crit_alarm)
|
||||
#define HWMON_C_RATED_MIN BIT(hwmon_curr_rated_min)
|
||||
#define HWMON_C_RATED_MAX BIT(hwmon_curr_rated_max)
|
||||
|
||||
enum hwmon_power_attributes {
|
||||
hwmon_power_enable,
|
||||
|
@ -215,6 +227,8 @@ enum hwmon_power_attributes {
|
|||
hwmon_power_max_alarm,
|
||||
hwmon_power_lcrit_alarm,
|
||||
hwmon_power_crit_alarm,
|
||||
hwmon_power_rated_min,
|
||||
hwmon_power_rated_max,
|
||||
};
|
||||
|
||||
#define HWMON_P_ENABLE BIT(hwmon_power_enable)
|
||||
|
@ -246,6 +260,8 @@ enum hwmon_power_attributes {
|
|||
#define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm)
|
||||
#define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm)
|
||||
#define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm)
|
||||
#define HWMON_P_RATED_MIN BIT(hwmon_power_rated_min)
|
||||
#define HWMON_P_RATED_MAX BIT(hwmon_power_rated_max)
|
||||
|
||||
enum hwmon_energy_attributes {
|
||||
hwmon_energy_enable,
|
||||
|
@ -267,6 +283,8 @@ enum hwmon_humidity_attributes {
|
|||
hwmon_humidity_max_hyst,
|
||||
hwmon_humidity_alarm,
|
||||
hwmon_humidity_fault,
|
||||
hwmon_humidity_rated_min,
|
||||
hwmon_humidity_rated_max,
|
||||
};
|
||||
|
||||
#define HWMON_H_ENABLE BIT(hwmon_humidity_enable)
|
||||
|
@ -278,6 +296,8 @@ enum hwmon_humidity_attributes {
|
|||
#define HWMON_H_MAX_HYST BIT(hwmon_humidity_max_hyst)
|
||||
#define HWMON_H_ALARM BIT(hwmon_humidity_alarm)
|
||||
#define HWMON_H_FAULT BIT(hwmon_humidity_fault)
|
||||
#define HWMON_H_RATED_MIN BIT(hwmon_humidity_rated_min)
|
||||
#define HWMON_H_RATED_MAX BIT(hwmon_humidity_rated_max)
|
||||
|
||||
enum hwmon_fan_attributes {
|
||||
hwmon_fan_enable,
|
||||
|
|
Loading…
Reference in New Issue