diff options
author | Guenter Roeck <linux@roeck-us.net> | 2016-06-20 14:01:57 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2016-09-09 00:34:15 -0400 |
commit | 00d616cf872bb552a6853df288efcdb9f937a489 (patch) | |
tree | 5d0e17490a51f4ac6152882ed5497ec3f48a92b0 | |
parent | d560168b5d0fb4a70c74b386564072a819d9bf71 (diff) |
hwmon: (core) Add voltage attribute support to new API
Acked-by: Punit Agrawal <punit.agrawal@arm.com>
Reviewed-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/hwmon.c | 21 | ||||
-rw-r--r-- | include/linux/hwmon.h | 35 |
2 files changed, 56 insertions, 0 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 3e4cc442a089..7697dfa92558 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c | |||
@@ -259,6 +259,7 @@ static struct attribute *hwmon_genattr(struct device *dev, | |||
259 | 259 | ||
260 | static const char * const hwmon_chip_attr_templates[] = { | 260 | static const char * const hwmon_chip_attr_templates[] = { |
261 | [hwmon_chip_temp_reset_history] = "temp_reset_history", | 261 | [hwmon_chip_temp_reset_history] = "temp_reset_history", |
262 | [hwmon_chip_in_reset_history] = "in_reset_history", | ||
262 | [hwmon_chip_update_interval] = "update_interval", | 263 | [hwmon_chip_update_interval] = "update_interval", |
263 | [hwmon_chip_alarms] = "alarms", | 264 | [hwmon_chip_alarms] = "alarms", |
264 | }; | 265 | }; |
@@ -290,14 +291,34 @@ static const char * const hwmon_temp_attr_templates[] = { | |||
290 | [hwmon_temp_reset_history] = "temp%d_reset_history", | 291 | [hwmon_temp_reset_history] = "temp%d_reset_history", |
291 | }; | 292 | }; |
292 | 293 | ||
294 | static const char * const hwmon_in_attr_templates[] = { | ||
295 | [hwmon_in_input] = "in%d_input", | ||
296 | [hwmon_in_min] = "in%d_min", | ||
297 | [hwmon_in_max] = "in%d_max", | ||
298 | [hwmon_in_lcrit] = "in%d_lcrit", | ||
299 | [hwmon_in_crit] = "in%d_crit", | ||
300 | [hwmon_in_average] = "in%d_average", | ||
301 | [hwmon_in_lowest] = "in%d_lowest", | ||
302 | [hwmon_in_highest] = "in%d_highest", | ||
303 | [hwmon_in_reset_history] = "in%d_reset_history", | ||
304 | [hwmon_in_label] = "in%d_label", | ||
305 | [hwmon_in_alarm] = "in%d_alarm", | ||
306 | [hwmon_in_min_alarm] = "in%d_min_alarm", | ||
307 | [hwmon_in_max_alarm] = "in%d_max_alarm", | ||
308 | [hwmon_in_lcrit_alarm] = "in%d_lcrit_alarm", | ||
309 | [hwmon_in_crit_alarm] = "in%d_crit_alarm", | ||
310 | }; | ||
311 | |||
293 | static const char * const *__templates[] = { | 312 | static const char * const *__templates[] = { |
294 | [hwmon_chip] = hwmon_chip_attr_templates, | 313 | [hwmon_chip] = hwmon_chip_attr_templates, |
295 | [hwmon_temp] = hwmon_temp_attr_templates, | 314 | [hwmon_temp] = hwmon_temp_attr_templates, |
315 | [hwmon_in] = hwmon_in_attr_templates, | ||
296 | }; | 316 | }; |
297 | 317 | ||
298 | static const int __templates_size[] = { | 318 | static const int __templates_size[] = { |
299 | [hwmon_chip] = ARRAY_SIZE(hwmon_chip_attr_templates), | 319 | [hwmon_chip] = ARRAY_SIZE(hwmon_chip_attr_templates), |
300 | [hwmon_temp] = ARRAY_SIZE(hwmon_temp_attr_templates), | 320 | [hwmon_temp] = ARRAY_SIZE(hwmon_temp_attr_templates), |
321 | [hwmon_in] = ARRAY_SIZE(hwmon_in_attr_templates), | ||
301 | }; | 322 | }; |
302 | 323 | ||
303 | static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info) | 324 | static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info) |
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 52e56d71d742..a01b8e3fc6f3 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h | |||
@@ -30,6 +30,7 @@ enum hwmon_sensor_types { | |||
30 | 30 | ||
31 | enum hwmon_chip_attributes { | 31 | enum hwmon_chip_attributes { |
32 | hwmon_chip_temp_reset_history, | 32 | hwmon_chip_temp_reset_history, |
33 | hwmon_chip_in_reset_history, | ||
33 | hwmon_chip_register_tz, | 34 | hwmon_chip_register_tz, |
34 | hwmon_chip_update_interval, | 35 | hwmon_chip_update_interval, |
35 | hwmon_chip_alarms, | 36 | hwmon_chip_alarms, |
@@ -91,6 +92,40 @@ enum hwmon_temp_attributes { | |||
91 | #define HWMON_T_HIGHEST BIT(hwmon_temp_highest) | 92 | #define HWMON_T_HIGHEST BIT(hwmon_temp_highest) |
92 | #define HWMON_T_RESET_HISTORY BIT(hwmon_temp_reset_history) | 93 | #define HWMON_T_RESET_HISTORY BIT(hwmon_temp_reset_history) |
93 | 94 | ||
95 | enum hwmon_in_attributes { | ||
96 | hwmon_in_input, | ||
97 | hwmon_in_min, | ||
98 | hwmon_in_max, | ||
99 | hwmon_in_lcrit, | ||
100 | hwmon_in_crit, | ||
101 | hwmon_in_average, | ||
102 | hwmon_in_lowest, | ||
103 | hwmon_in_highest, | ||
104 | hwmon_in_reset_history, | ||
105 | hwmon_in_label, | ||
106 | hwmon_in_alarm, | ||
107 | hwmon_in_min_alarm, | ||
108 | hwmon_in_max_alarm, | ||
109 | hwmon_in_lcrit_alarm, | ||
110 | hwmon_in_crit_alarm, | ||
111 | }; | ||
112 | |||
113 | #define HWMON_I_INPUT BIT(hwmon_in_input) | ||
114 | #define HWMON_I_MIN BIT(hwmon_in_min) | ||
115 | #define HWMON_I_MAX BIT(hwmon_in_max) | ||
116 | #define HWMON_I_LCRIT BIT(hwmon_in_lcrit) | ||
117 | #define HWMON_I_CRIT BIT(hwmon_in_crit) | ||
118 | #define HWMON_I_AVERAGE BIT(hwmon_in_average) | ||
119 | #define HWMON_I_LOWEST BIT(hwmon_in_lowest) | ||
120 | #define HWMON_I_HIGHEST BIT(hwmon_in_highest) | ||
121 | #define HWMON_I_RESET_HISTORY BIT(hwmon_in_reset_history) | ||
122 | #define HWMON_I_LABEL BIT(hwmon_in_label) | ||
123 | #define HWMON_I_ALARM BIT(hwmon_in_alarm) | ||
124 | #define HWMON_I_MIN_ALARM BIT(hwmon_in_min_alarm) | ||
125 | #define HWMON_I_MAX_ALARM BIT(hwmon_in_max_alarm) | ||
126 | #define HWMON_I_LCRIT_ALARM BIT(hwmon_in_lcrit_alarm) | ||
127 | #define HWMON_I_CRIT_ALARM BIT(hwmon_in_crit_alarm) | ||
128 | |||
94 | /** | 129 | /** |
95 | * struct hwmon_ops - hwmon device operations | 130 | * struct hwmon_ops - hwmon device operations |
96 | * @is_visible: Callback to return attribute visibility. Mandatory. | 131 | * @is_visible: Callback to return attribute visibility. Mandatory. |