~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/hwmon.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3     hwmon.h - part of lm_sensors, Linux kernel modules for hardware monitoring
  4 
  5     This file declares helper functions for the sysfs class "hwmon",
  6     for use by sensors drivers.
  7 
  8     Copyright (C) 2005 Mark M. Hoffman <mhoffman@lightlink.com>
  9 
 10 */
 11 
 12 #ifndef _HWMON_H_
 13 #define _HWMON_H_
 14 
 15 #include <linux/bitops.h>
 16 
 17 struct device;
 18 struct attribute_group;
 19 
 20 enum hwmon_sensor_types {
 21         hwmon_chip,
 22         hwmon_temp,
 23         hwmon_in,
 24         hwmon_curr,
 25         hwmon_power,
 26         hwmon_energy,
 27         hwmon_humidity,
 28         hwmon_fan,
 29         hwmon_pwm,
 30         hwmon_intrusion,
 31         hwmon_max,
 32 };
 33 
 34 enum hwmon_chip_attributes {
 35         hwmon_chip_temp_reset_history,
 36         hwmon_chip_in_reset_history,
 37         hwmon_chip_curr_reset_history,
 38         hwmon_chip_power_reset_history,
 39         hwmon_chip_register_tz,
 40         hwmon_chip_update_interval,
 41         hwmon_chip_alarms,
 42         hwmon_chip_samples,
 43         hwmon_chip_curr_samples,
 44         hwmon_chip_in_samples,
 45         hwmon_chip_power_samples,
 46         hwmon_chip_temp_samples,
 47         hwmon_chip_beep_enable,
 48         hwmon_chip_pec,
 49 };
 50 
 51 #define HWMON_C_TEMP_RESET_HISTORY      BIT(hwmon_chip_temp_reset_history)
 52 #define HWMON_C_IN_RESET_HISTORY        BIT(hwmon_chip_in_reset_history)
 53 #define HWMON_C_CURR_RESET_HISTORY      BIT(hwmon_chip_curr_reset_history)
 54 #define HWMON_C_POWER_RESET_HISTORY     BIT(hwmon_chip_power_reset_history)
 55 #define HWMON_C_REGISTER_TZ             BIT(hwmon_chip_register_tz)
 56 #define HWMON_C_UPDATE_INTERVAL         BIT(hwmon_chip_update_interval)
 57 #define HWMON_C_ALARMS                  BIT(hwmon_chip_alarms)
 58 #define HWMON_C_SAMPLES                 BIT(hwmon_chip_samples)
 59 #define HWMON_C_CURR_SAMPLES            BIT(hwmon_chip_curr_samples)
 60 #define HWMON_C_IN_SAMPLES              BIT(hwmon_chip_in_samples)
 61 #define HWMON_C_POWER_SAMPLES           BIT(hwmon_chip_power_samples)
 62 #define HWMON_C_TEMP_SAMPLES            BIT(hwmon_chip_temp_samples)
 63 #define HWMON_C_BEEP_ENABLE             BIT(hwmon_chip_beep_enable)
 64 #define HWMON_C_PEC                     BIT(hwmon_chip_pec)
 65 
 66 enum hwmon_temp_attributes {
 67         hwmon_temp_enable,
 68         hwmon_temp_input,
 69         hwmon_temp_type,
 70         hwmon_temp_lcrit,
 71         hwmon_temp_lcrit_hyst,
 72         hwmon_temp_min,
 73         hwmon_temp_min_hyst,
 74         hwmon_temp_max,
 75         hwmon_temp_max_hyst,
 76         hwmon_temp_crit,
 77         hwmon_temp_crit_hyst,
 78         hwmon_temp_emergency,
 79         hwmon_temp_emergency_hyst,
 80         hwmon_temp_alarm,
 81         hwmon_temp_lcrit_alarm,
 82         hwmon_temp_min_alarm,
 83         hwmon_temp_max_alarm,
 84         hwmon_temp_crit_alarm,
 85         hwmon_temp_emergency_alarm,
 86         hwmon_temp_fault,
 87         hwmon_temp_offset,
 88         hwmon_temp_label,
 89         hwmon_temp_lowest,
 90         hwmon_temp_highest,
 91         hwmon_temp_reset_history,
 92         hwmon_temp_rated_min,
 93         hwmon_temp_rated_max,
 94         hwmon_temp_beep,
 95 };
 96 
 97 #define HWMON_T_ENABLE          BIT(hwmon_temp_enable)
 98 #define HWMON_T_INPUT           BIT(hwmon_temp_input)
 99 #define HWMON_T_TYPE            BIT(hwmon_temp_type)
100 #define HWMON_T_LCRIT           BIT(hwmon_temp_lcrit)
101 #define HWMON_T_LCRIT_HYST      BIT(hwmon_temp_lcrit_hyst)
102 #define HWMON_T_MIN             BIT(hwmon_temp_min)
103 #define HWMON_T_MIN_HYST        BIT(hwmon_temp_min_hyst)
104 #define HWMON_T_MAX             BIT(hwmon_temp_max)
105 #define HWMON_T_MAX_HYST        BIT(hwmon_temp_max_hyst)
106 #define HWMON_T_CRIT            BIT(hwmon_temp_crit)
107 #define HWMON_T_CRIT_HYST       BIT(hwmon_temp_crit_hyst)
108 #define HWMON_T_EMERGENCY       BIT(hwmon_temp_emergency)
109 #define HWMON_T_EMERGENCY_HYST  BIT(hwmon_temp_emergency_hyst)
110 #define HWMON_T_ALARM           BIT(hwmon_temp_alarm)
111 #define HWMON_T_MIN_ALARM       BIT(hwmon_temp_min_alarm)
112 #define HWMON_T_MAX_ALARM       BIT(hwmon_temp_max_alarm)
113 #define HWMON_T_CRIT_ALARM      BIT(hwmon_temp_crit_alarm)
114 #define HWMON_T_LCRIT_ALARM     BIT(hwmon_temp_lcrit_alarm)
115 #define HWMON_T_EMERGENCY_ALARM BIT(hwmon_temp_emergency_alarm)
116 #define HWMON_T_FAULT           BIT(hwmon_temp_fault)
117 #define HWMON_T_OFFSET          BIT(hwmon_temp_offset)
118 #define HWMON_T_LABEL           BIT(hwmon_temp_label)
119 #define HWMON_T_LOWEST          BIT(hwmon_temp_lowest)
120 #define HWMON_T_HIGHEST         BIT(hwmon_temp_highest)
121 #define HWMON_T_RESET_HISTORY   BIT(hwmon_temp_reset_history)
122 #define HWMON_T_RATED_MIN       BIT(hwmon_temp_rated_min)
123 #define HWMON_T_RATED_MAX       BIT(hwmon_temp_rated_max)
124 #define HWMON_T_BEEP            BIT(hwmon_temp_beep)
125 
126 enum hwmon_in_attributes {
127         hwmon_in_enable,
128         hwmon_in_input,
129         hwmon_in_min,
130         hwmon_in_max,
131         hwmon_in_lcrit,
132         hwmon_in_crit,
133         hwmon_in_average,
134         hwmon_in_lowest,
135         hwmon_in_highest,
136         hwmon_in_reset_history,
137         hwmon_in_label,
138         hwmon_in_alarm,
139         hwmon_in_min_alarm,
140         hwmon_in_max_alarm,
141         hwmon_in_lcrit_alarm,
142         hwmon_in_crit_alarm,
143         hwmon_in_rated_min,
144         hwmon_in_rated_max,
145         hwmon_in_beep,
146         hwmon_in_fault,
147 };
148 
149 #define HWMON_I_ENABLE          BIT(hwmon_in_enable)
150 #define HWMON_I_INPUT           BIT(hwmon_in_input)
151 #define HWMON_I_MIN             BIT(hwmon_in_min)
152 #define HWMON_I_MAX             BIT(hwmon_in_max)
153 #define HWMON_I_LCRIT           BIT(hwmon_in_lcrit)
154 #define HWMON_I_CRIT            BIT(hwmon_in_crit)
155 #define HWMON_I_AVERAGE         BIT(hwmon_in_average)
156 #define HWMON_I_LOWEST          BIT(hwmon_in_lowest)
157 #define HWMON_I_HIGHEST         BIT(hwmon_in_highest)
158 #define HWMON_I_RESET_HISTORY   BIT(hwmon_in_reset_history)
159 #define HWMON_I_LABEL           BIT(hwmon_in_label)
160 #define HWMON_I_ALARM           BIT(hwmon_in_alarm)
161 #define HWMON_I_MIN_ALARM       BIT(hwmon_in_min_alarm)
162 #define HWMON_I_MAX_ALARM       BIT(hwmon_in_max_alarm)
163 #define HWMON_I_LCRIT_ALARM     BIT(hwmon_in_lcrit_alarm)
164 #define HWMON_I_CRIT_ALARM      BIT(hwmon_in_crit_alarm)
165 #define HWMON_I_RATED_MIN       BIT(hwmon_in_rated_min)
166 #define HWMON_I_RATED_MAX       BIT(hwmon_in_rated_max)
167 #define HWMON_I_BEEP            BIT(hwmon_in_beep)
168 #define HWMON_I_FAULT           BIT(hwmon_in_fault)
169 
170 enum hwmon_curr_attributes {
171         hwmon_curr_enable,
172         hwmon_curr_input,
173         hwmon_curr_min,
174         hwmon_curr_max,
175         hwmon_curr_lcrit,
176         hwmon_curr_crit,
177         hwmon_curr_average,
178         hwmon_curr_lowest,
179         hwmon_curr_highest,
180         hwmon_curr_reset_history,
181         hwmon_curr_label,
182         hwmon_curr_alarm,
183         hwmon_curr_min_alarm,
184         hwmon_curr_max_alarm,
185         hwmon_curr_lcrit_alarm,
186         hwmon_curr_crit_alarm,
187         hwmon_curr_rated_min,
188         hwmon_curr_rated_max,
189         hwmon_curr_beep,
190 };
191 
192 #define HWMON_C_ENABLE          BIT(hwmon_curr_enable)
193 #define HWMON_C_INPUT           BIT(hwmon_curr_input)
194 #define HWMON_C_MIN             BIT(hwmon_curr_min)
195 #define HWMON_C_MAX             BIT(hwmon_curr_max)
196 #define HWMON_C_LCRIT           BIT(hwmon_curr_lcrit)
197 #define HWMON_C_CRIT            BIT(hwmon_curr_crit)
198 #define HWMON_C_AVERAGE         BIT(hwmon_curr_average)
199 #define HWMON_C_LOWEST          BIT(hwmon_curr_lowest)
200 #define HWMON_C_HIGHEST         BIT(hwmon_curr_highest)
201 #define HWMON_C_RESET_HISTORY   BIT(hwmon_curr_reset_history)
202 #define HWMON_C_LABEL           BIT(hwmon_curr_label)
203 #define HWMON_C_ALARM           BIT(hwmon_curr_alarm)
204 #define HWMON_C_MIN_ALARM       BIT(hwmon_curr_min_alarm)
205 #define HWMON_C_MAX_ALARM       BIT(hwmon_curr_max_alarm)
206 #define HWMON_C_LCRIT_ALARM     BIT(hwmon_curr_lcrit_alarm)
207 #define HWMON_C_CRIT_ALARM      BIT(hwmon_curr_crit_alarm)
208 #define HWMON_C_RATED_MIN       BIT(hwmon_curr_rated_min)
209 #define HWMON_C_RATED_MAX       BIT(hwmon_curr_rated_max)
210 #define HWMON_C_BEEP            BIT(hwmon_curr_beep)
211 
212 enum hwmon_power_attributes {
213         hwmon_power_enable,
214         hwmon_power_average,
215         hwmon_power_average_interval,
216         hwmon_power_average_interval_max,
217         hwmon_power_average_interval_min,
218         hwmon_power_average_highest,
219         hwmon_power_average_lowest,
220         hwmon_power_average_max,
221         hwmon_power_average_min,
222         hwmon_power_input,
223         hwmon_power_input_highest,
224         hwmon_power_input_lowest,
225         hwmon_power_reset_history,
226         hwmon_power_accuracy,
227         hwmon_power_cap,
228         hwmon_power_cap_hyst,
229         hwmon_power_cap_max,
230         hwmon_power_cap_min,
231         hwmon_power_min,
232         hwmon_power_max,
233         hwmon_power_crit,
234         hwmon_power_lcrit,
235         hwmon_power_label,
236         hwmon_power_alarm,
237         hwmon_power_cap_alarm,
238         hwmon_power_min_alarm,
239         hwmon_power_max_alarm,
240         hwmon_power_lcrit_alarm,
241         hwmon_power_crit_alarm,
242         hwmon_power_rated_min,
243         hwmon_power_rated_max,
244 };
245 
246 #define HWMON_P_ENABLE                  BIT(hwmon_power_enable)
247 #define HWMON_P_AVERAGE                 BIT(hwmon_power_average)
248 #define HWMON_P_AVERAGE_INTERVAL        BIT(hwmon_power_average_interval)
249 #define HWMON_P_AVERAGE_INTERVAL_MAX    BIT(hwmon_power_average_interval_max)
250 #define HWMON_P_AVERAGE_INTERVAL_MIN    BIT(hwmon_power_average_interval_min)
251 #define HWMON_P_AVERAGE_HIGHEST         BIT(hwmon_power_average_highest)
252 #define HWMON_P_AVERAGE_LOWEST          BIT(hwmon_power_average_lowest)
253 #define HWMON_P_AVERAGE_MAX             BIT(hwmon_power_average_max)
254 #define HWMON_P_AVERAGE_MIN             BIT(hwmon_power_average_min)
255 #define HWMON_P_INPUT                   BIT(hwmon_power_input)
256 #define HWMON_P_INPUT_HIGHEST           BIT(hwmon_power_input_highest)
257 #define HWMON_P_INPUT_LOWEST            BIT(hwmon_power_input_lowest)
258 #define HWMON_P_RESET_HISTORY           BIT(hwmon_power_reset_history)
259 #define HWMON_P_ACCURACY                BIT(hwmon_power_accuracy)
260 #define HWMON_P_CAP                     BIT(hwmon_power_cap)
261 #define HWMON_P_CAP_HYST                BIT(hwmon_power_cap_hyst)
262 #define HWMON_P_CAP_MAX                 BIT(hwmon_power_cap_max)
263 #define HWMON_P_CAP_MIN                 BIT(hwmon_power_cap_min)
264 #define HWMON_P_MIN                     BIT(hwmon_power_min)
265 #define HWMON_P_MAX                     BIT(hwmon_power_max)
266 #define HWMON_P_LCRIT                   BIT(hwmon_power_lcrit)
267 #define HWMON_P_CRIT                    BIT(hwmon_power_crit)
268 #define HWMON_P_LABEL                   BIT(hwmon_power_label)
269 #define HWMON_P_ALARM                   BIT(hwmon_power_alarm)
270 #define HWMON_P_CAP_ALARM               BIT(hwmon_power_cap_alarm)
271 #define HWMON_P_MIN_ALARM               BIT(hwmon_power_min_alarm)
272 #define HWMON_P_MAX_ALARM               BIT(hwmon_power_max_alarm)
273 #define HWMON_P_LCRIT_ALARM             BIT(hwmon_power_lcrit_alarm)
274 #define HWMON_P_CRIT_ALARM              BIT(hwmon_power_crit_alarm)
275 #define HWMON_P_RATED_MIN               BIT(hwmon_power_rated_min)
276 #define HWMON_P_RATED_MAX               BIT(hwmon_power_rated_max)
277 
278 enum hwmon_energy_attributes {
279         hwmon_energy_enable,
280         hwmon_energy_input,
281         hwmon_energy_label,
282 };
283 
284 #define HWMON_E_ENABLE                  BIT(hwmon_energy_enable)
285 #define HWMON_E_INPUT                   BIT(hwmon_energy_input)
286 #define HWMON_E_LABEL                   BIT(hwmon_energy_label)
287 
288 enum hwmon_humidity_attributes {
289         hwmon_humidity_enable,
290         hwmon_humidity_input,
291         hwmon_humidity_label,
292         hwmon_humidity_min,
293         hwmon_humidity_min_hyst,
294         hwmon_humidity_max,
295         hwmon_humidity_max_hyst,
296         hwmon_humidity_alarm,
297         hwmon_humidity_fault,
298         hwmon_humidity_rated_min,
299         hwmon_humidity_rated_max,
300         hwmon_humidity_min_alarm,
301         hwmon_humidity_max_alarm,
302 };
303 
304 #define HWMON_H_ENABLE                  BIT(hwmon_humidity_enable)
305 #define HWMON_H_INPUT                   BIT(hwmon_humidity_input)
306 #define HWMON_H_LABEL                   BIT(hwmon_humidity_label)
307 #define HWMON_H_MIN                     BIT(hwmon_humidity_min)
308 #define HWMON_H_MIN_HYST                BIT(hwmon_humidity_min_hyst)
309 #define HWMON_H_MAX                     BIT(hwmon_humidity_max)
310 #define HWMON_H_MAX_HYST                BIT(hwmon_humidity_max_hyst)
311 #define HWMON_H_ALARM                   BIT(hwmon_humidity_alarm)
312 #define HWMON_H_FAULT                   BIT(hwmon_humidity_fault)
313 #define HWMON_H_RATED_MIN               BIT(hwmon_humidity_rated_min)
314 #define HWMON_H_RATED_MAX               BIT(hwmon_humidity_rated_max)
315 #define HWMON_H_MIN_ALARM               BIT(hwmon_humidity_min_alarm)
316 #define HWMON_H_MAX_ALARM               BIT(hwmon_humidity_max_alarm)
317 
318 enum hwmon_fan_attributes {
319         hwmon_fan_enable,
320         hwmon_fan_input,
321         hwmon_fan_label,
322         hwmon_fan_min,
323         hwmon_fan_max,
324         hwmon_fan_div,
325         hwmon_fan_pulses,
326         hwmon_fan_target,
327         hwmon_fan_alarm,
328         hwmon_fan_min_alarm,
329         hwmon_fan_max_alarm,
330         hwmon_fan_fault,
331         hwmon_fan_beep,
332 };
333 
334 #define HWMON_F_ENABLE                  BIT(hwmon_fan_enable)
335 #define HWMON_F_INPUT                   BIT(hwmon_fan_input)
336 #define HWMON_F_LABEL                   BIT(hwmon_fan_label)
337 #define HWMON_F_MIN                     BIT(hwmon_fan_min)
338 #define HWMON_F_MAX                     BIT(hwmon_fan_max)
339 #define HWMON_F_DIV                     BIT(hwmon_fan_div)
340 #define HWMON_F_PULSES                  BIT(hwmon_fan_pulses)
341 #define HWMON_F_TARGET                  BIT(hwmon_fan_target)
342 #define HWMON_F_ALARM                   BIT(hwmon_fan_alarm)
343 #define HWMON_F_MIN_ALARM               BIT(hwmon_fan_min_alarm)
344 #define HWMON_F_MAX_ALARM               BIT(hwmon_fan_max_alarm)
345 #define HWMON_F_FAULT                   BIT(hwmon_fan_fault)
346 #define HWMON_F_BEEP                    BIT(hwmon_fan_beep)
347 
348 enum hwmon_pwm_attributes {
349         hwmon_pwm_input,
350         hwmon_pwm_enable,
351         hwmon_pwm_mode,
352         hwmon_pwm_freq,
353         hwmon_pwm_auto_channels_temp,
354 };
355 
356 #define HWMON_PWM_INPUT                 BIT(hwmon_pwm_input)
357 #define HWMON_PWM_ENABLE                BIT(hwmon_pwm_enable)
358 #define HWMON_PWM_MODE                  BIT(hwmon_pwm_mode)
359 #define HWMON_PWM_FREQ                  BIT(hwmon_pwm_freq)
360 #define HWMON_PWM_AUTO_CHANNELS_TEMP    BIT(hwmon_pwm_auto_channels_temp)
361 
362 enum hwmon_intrusion_attributes {
363         hwmon_intrusion_alarm,
364         hwmon_intrusion_beep,
365 };
366 #define HWMON_INTRUSION_ALARM           BIT(hwmon_intrusion_alarm)
367 #define HWMON_INTRUSION_BEEP            BIT(hwmon_intrusion_beep)
368 
369 /**
370  * struct hwmon_ops - hwmon device operations
371  * @is_visible: Callback to return attribute visibility. Mandatory.
372  *              Parameters are:
373  *              @const void *drvdata:
374  *                      Pointer to driver-private data structure passed
375  *                      as argument to hwmon_device_register_with_info().
376  *              @type:  Sensor type
377  *              @attr:  Sensor attribute
378  *              @channel:
379  *                      Channel number
380  *              The function returns the file permissions.
381  *              If the return value is 0, no attribute will be created.
382  * @read:       Read callback for data attributes. Mandatory if readable
383  *              data attributes are present.
384  *              Parameters are:
385  *              @dev:   Pointer to hardware monitoring device
386  *              @type:  Sensor type
387  *              @attr:  Sensor attribute
388  *              @channel:
389  *                      Channel number
390  *              @val:   Pointer to returned value
391  *              The function returns 0 on success or a negative error number.
392  * @read_string:
393  *              Read callback for string attributes. Mandatory if string
394  *              attributes are present.
395  *              Parameters are:
396  *              @dev:   Pointer to hardware monitoring device
397  *              @type:  Sensor type
398  *              @attr:  Sensor attribute
399  *              @channel:
400  *                      Channel number
401  *              @str:   Pointer to returned string
402  *              The function returns 0 on success or a negative error number.
403  * @write:      Write callback for data attributes. Mandatory if writeable
404  *              data attributes are present.
405  *              Parameters are:
406  *              @dev:   Pointer to hardware monitoring device
407  *              @type:  Sensor type
408  *              @attr:  Sensor attribute
409  *              @channel:
410  *                      Channel number
411  *              @val:   Value to write
412  *              The function returns 0 on success or a negative error number.
413  */
414 struct hwmon_ops {
415         umode_t (*is_visible)(const void *drvdata, enum hwmon_sensor_types type,
416                               u32 attr, int channel);
417         int (*read)(struct device *dev, enum hwmon_sensor_types type,
418                     u32 attr, int channel, long *val);
419         int (*read_string)(struct device *dev, enum hwmon_sensor_types type,
420                     u32 attr, int channel, const char **str);
421         int (*write)(struct device *dev, enum hwmon_sensor_types type,
422                      u32 attr, int channel, long val);
423 };
424 
425 /**
426  * struct hwmon_channel_info - Channel information
427  * @type:       Channel type.
428  * @config:     Pointer to NULL-terminated list of channel parameters.
429  *              Use for per-channel attributes.
430  */
431 struct hwmon_channel_info {
432         enum hwmon_sensor_types type;
433         const u32 *config;
434 };
435 
436 #define HWMON_CHANNEL_INFO(stype, ...)          \
437         (&(const struct hwmon_channel_info) {   \
438                 .type = hwmon_##stype,          \
439                 .config = (const u32 []) {      \
440                         __VA_ARGS__, 0          \
441                 }                               \
442         })
443 
444 /**
445  * struct hwmon_chip_info - Chip configuration
446  * @ops:        Pointer to hwmon operations.
447  * @info:       Null-terminated list of channel information.
448  */
449 struct hwmon_chip_info {
450         const struct hwmon_ops *ops;
451         const struct hwmon_channel_info * const *info;
452 };
453 
454 /* hwmon_device_register() is deprecated */
455 struct device *hwmon_device_register(struct device *dev);
456 
457 /*
458  * hwmon_device_register_with_groups() and
459  * devm_hwmon_device_register_with_groups() are deprecated.
460  */
461 struct device *
462 hwmon_device_register_with_groups(struct device *dev, const char *name,
463                                   void *drvdata,
464                                   const struct attribute_group **groups);
465 struct device *
466 devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
467                                        void *drvdata,
468                                        const struct attribute_group **groups);
469 struct device *
470 hwmon_device_register_with_info(struct device *dev,
471                                 const char *name, void *drvdata,
472                                 const struct hwmon_chip_info *info,
473                                 const struct attribute_group **extra_groups);
474 struct device *
475 hwmon_device_register_for_thermal(struct device *dev, const char *name,
476                                   void *drvdata);
477 struct device *
478 devm_hwmon_device_register_with_info(struct device *dev,
479                                 const char *name, void *drvdata,
480                                 const struct hwmon_chip_info *info,
481                                 const struct attribute_group **extra_groups);
482 
483 void hwmon_device_unregister(struct device *dev);
484 void devm_hwmon_device_unregister(struct device *dev);
485 
486 int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type,
487                        u32 attr, int channel);
488 
489 char *hwmon_sanitize_name(const char *name);
490 char *devm_hwmon_sanitize_name(struct device *dev, const char *name);
491 
492 /**
493  * hwmon_is_bad_char - Is the char invalid in a hwmon name
494  * @ch: the char to be considered
495  *
496  * hwmon_is_bad_char() can be used to determine if the given character
497  * may not be used in a hwmon name.
498  *
499  * Returns true if the char is invalid, false otherwise.
500  */
501 static inline bool hwmon_is_bad_char(const char ch)
502 {
503         switch (ch) {
504         case '-':
505         case '*':
506         case ' ':
507         case '\t':
508         case '\n':
509                 return true;
510         default:
511                 return false;
512         }
513 }
514 
515 #endif
516 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php