]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/linux/power_supply.h
Merge tag 'fs.move_mount.move_mount_set_group.v5.15' of git://git.kernel.org/pub...
[mirror_ubuntu-jammy-kernel.git] / include / linux / power_supply.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Universal power supply monitor class
4 *
5 * Copyright © 2007 Anton Vorontsov <cbou@mail.ru>
6 * Copyright © 2004 Szabolcs Gyurko
7 * Copyright © 2003 Ian Molton <spyro@f2s.com>
8 *
9 * Modified: 2004, Oct Szabolcs Gyurko
10 */
11
12 #ifndef __LINUX_POWER_SUPPLY_H__
13 #define __LINUX_POWER_SUPPLY_H__
14
15 #include <linux/device.h>
16 #include <linux/workqueue.h>
17 #include <linux/leds.h>
18 #include <linux/spinlock.h>
19 #include <linux/notifier.h>
20
21 /*
22 * All voltages, currents, charges, energies, time and temperatures in uV,
23 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise
24 * stated. It's driver's job to convert its raw values to units in which
25 * this class operates.
26 */
27
28 /*
29 * For systems where the charger determines the maximum battery capacity
30 * the min and max fields should be used to present these values to user
31 * space. Unused/unknown fields will not appear in sysfs.
32 */
33
34 enum {
35 POWER_SUPPLY_STATUS_UNKNOWN = 0,
36 POWER_SUPPLY_STATUS_CHARGING,
37 POWER_SUPPLY_STATUS_DISCHARGING,
38 POWER_SUPPLY_STATUS_NOT_CHARGING,
39 POWER_SUPPLY_STATUS_FULL,
40 };
41
42 /* What algorithm is the charger using? */
43 enum {
44 POWER_SUPPLY_CHARGE_TYPE_UNKNOWN = 0,
45 POWER_SUPPLY_CHARGE_TYPE_NONE,
46 POWER_SUPPLY_CHARGE_TYPE_TRICKLE, /* slow speed */
47 POWER_SUPPLY_CHARGE_TYPE_FAST, /* fast speed */
48 POWER_SUPPLY_CHARGE_TYPE_STANDARD, /* normal speed */
49 POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE, /* dynamically adjusted speed */
50 POWER_SUPPLY_CHARGE_TYPE_CUSTOM, /* use CHARGE_CONTROL_* props */
51 POWER_SUPPLY_CHARGE_TYPE_LONGLIFE, /* slow speed, longer life */
52 };
53
54 enum {
55 POWER_SUPPLY_HEALTH_UNKNOWN = 0,
56 POWER_SUPPLY_HEALTH_GOOD,
57 POWER_SUPPLY_HEALTH_OVERHEAT,
58 POWER_SUPPLY_HEALTH_DEAD,
59 POWER_SUPPLY_HEALTH_OVERVOLTAGE,
60 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
61 POWER_SUPPLY_HEALTH_COLD,
62 POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE,
63 POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
64 POWER_SUPPLY_HEALTH_OVERCURRENT,
65 POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED,
66 POWER_SUPPLY_HEALTH_WARM,
67 POWER_SUPPLY_HEALTH_COOL,
68 POWER_SUPPLY_HEALTH_HOT,
69 };
70
71 enum {
72 POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0,
73 POWER_SUPPLY_TECHNOLOGY_NiMH,
74 POWER_SUPPLY_TECHNOLOGY_LION,
75 POWER_SUPPLY_TECHNOLOGY_LIPO,
76 POWER_SUPPLY_TECHNOLOGY_LiFe,
77 POWER_SUPPLY_TECHNOLOGY_NiCd,
78 POWER_SUPPLY_TECHNOLOGY_LiMn,
79 };
80
81 enum {
82 POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN = 0,
83 POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL,
84 POWER_SUPPLY_CAPACITY_LEVEL_LOW,
85 POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,
86 POWER_SUPPLY_CAPACITY_LEVEL_HIGH,
87 POWER_SUPPLY_CAPACITY_LEVEL_FULL,
88 };
89
90 enum {
91 POWER_SUPPLY_SCOPE_UNKNOWN = 0,
92 POWER_SUPPLY_SCOPE_SYSTEM,
93 POWER_SUPPLY_SCOPE_DEVICE,
94 };
95
96 enum power_supply_property {
97 /* Properties of type `int' */
98 POWER_SUPPLY_PROP_STATUS = 0,
99 POWER_SUPPLY_PROP_CHARGE_TYPE,
100 POWER_SUPPLY_PROP_HEALTH,
101 POWER_SUPPLY_PROP_PRESENT,
102 POWER_SUPPLY_PROP_ONLINE,
103 POWER_SUPPLY_PROP_AUTHENTIC,
104 POWER_SUPPLY_PROP_TECHNOLOGY,
105 POWER_SUPPLY_PROP_CYCLE_COUNT,
106 POWER_SUPPLY_PROP_VOLTAGE_MAX,
107 POWER_SUPPLY_PROP_VOLTAGE_MIN,
108 POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
109 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
110 POWER_SUPPLY_PROP_VOLTAGE_NOW,
111 POWER_SUPPLY_PROP_VOLTAGE_AVG,
112 POWER_SUPPLY_PROP_VOLTAGE_OCV,
113 POWER_SUPPLY_PROP_VOLTAGE_BOOT,
114 POWER_SUPPLY_PROP_CURRENT_MAX,
115 POWER_SUPPLY_PROP_CURRENT_NOW,
116 POWER_SUPPLY_PROP_CURRENT_AVG,
117 POWER_SUPPLY_PROP_CURRENT_BOOT,
118 POWER_SUPPLY_PROP_POWER_NOW,
119 POWER_SUPPLY_PROP_POWER_AVG,
120 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
121 POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN,
122 POWER_SUPPLY_PROP_CHARGE_FULL,
123 POWER_SUPPLY_PROP_CHARGE_EMPTY,
124 POWER_SUPPLY_PROP_CHARGE_NOW,
125 POWER_SUPPLY_PROP_CHARGE_AVG,
126 POWER_SUPPLY_PROP_CHARGE_COUNTER,
127 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
128 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
129 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
130 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
131 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT,
132 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
133 POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD, /* in percents! */
134 POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD, /* in percents! */
135 POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
136 POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT,
137 POWER_SUPPLY_PROP_INPUT_POWER_LIMIT,
138 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
139 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
140 POWER_SUPPLY_PROP_ENERGY_FULL,
141 POWER_SUPPLY_PROP_ENERGY_EMPTY,
142 POWER_SUPPLY_PROP_ENERGY_NOW,
143 POWER_SUPPLY_PROP_ENERGY_AVG,
144 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */
145 POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN, /* in percents! */
146 POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX, /* in percents! */
147 POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN, /* in percents! */
148 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
149 POWER_SUPPLY_PROP_TEMP,
150 POWER_SUPPLY_PROP_TEMP_MAX,
151 POWER_SUPPLY_PROP_TEMP_MIN,
152 POWER_SUPPLY_PROP_TEMP_ALERT_MIN,
153 POWER_SUPPLY_PROP_TEMP_ALERT_MAX,
154 POWER_SUPPLY_PROP_TEMP_AMBIENT,
155 POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN,
156 POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX,
157 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
158 POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
159 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
160 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
161 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
162 POWER_SUPPLY_PROP_USB_TYPE,
163 POWER_SUPPLY_PROP_SCOPE,
164 POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
165 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
166 POWER_SUPPLY_PROP_CALIBRATE,
167 POWER_SUPPLY_PROP_MANUFACTURE_YEAR,
168 POWER_SUPPLY_PROP_MANUFACTURE_MONTH,
169 POWER_SUPPLY_PROP_MANUFACTURE_DAY,
170 /* Properties of type `const char *' */
171 POWER_SUPPLY_PROP_MODEL_NAME,
172 POWER_SUPPLY_PROP_MANUFACTURER,
173 POWER_SUPPLY_PROP_SERIAL_NUMBER,
174 };
175
176 enum power_supply_type {
177 POWER_SUPPLY_TYPE_UNKNOWN = 0,
178 POWER_SUPPLY_TYPE_BATTERY,
179 POWER_SUPPLY_TYPE_UPS,
180 POWER_SUPPLY_TYPE_MAINS,
181 POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */
182 POWER_SUPPLY_TYPE_USB_DCP, /* Dedicated Charging Port */
183 POWER_SUPPLY_TYPE_USB_CDP, /* Charging Downstream Port */
184 POWER_SUPPLY_TYPE_USB_ACA, /* Accessory Charger Adapters */
185 POWER_SUPPLY_TYPE_USB_TYPE_C, /* Type C Port */
186 POWER_SUPPLY_TYPE_USB_PD, /* Power Delivery Port */
187 POWER_SUPPLY_TYPE_USB_PD_DRP, /* PD Dual Role Port */
188 POWER_SUPPLY_TYPE_APPLE_BRICK_ID, /* Apple Charging Method */
189 POWER_SUPPLY_TYPE_WIRELESS, /* Wireless */
190 };
191
192 enum power_supply_usb_type {
193 POWER_SUPPLY_USB_TYPE_UNKNOWN = 0,
194 POWER_SUPPLY_USB_TYPE_SDP, /* Standard Downstream Port */
195 POWER_SUPPLY_USB_TYPE_DCP, /* Dedicated Charging Port */
196 POWER_SUPPLY_USB_TYPE_CDP, /* Charging Downstream Port */
197 POWER_SUPPLY_USB_TYPE_ACA, /* Accessory Charger Adapters */
198 POWER_SUPPLY_USB_TYPE_C, /* Type C Port */
199 POWER_SUPPLY_USB_TYPE_PD, /* Power Delivery Port */
200 POWER_SUPPLY_USB_TYPE_PD_DRP, /* PD Dual Role Port */
201 POWER_SUPPLY_USB_TYPE_PD_PPS, /* PD Programmable Power Supply */
202 POWER_SUPPLY_USB_TYPE_APPLE_BRICK_ID, /* Apple Charging Method */
203 };
204
205 enum power_supply_notifier_events {
206 PSY_EVENT_PROP_CHANGED,
207 };
208
209 union power_supply_propval {
210 int intval;
211 const char *strval;
212 };
213
214 struct device_node;
215 struct power_supply;
216
217 /* Run-time specific power supply configuration */
218 struct power_supply_config {
219 struct device_node *of_node;
220 struct fwnode_handle *fwnode;
221
222 /* Driver private data */
223 void *drv_data;
224
225 /* Device specific sysfs attributes */
226 const struct attribute_group **attr_grp;
227
228 char **supplied_to;
229 size_t num_supplicants;
230 };
231
232 /* Description of power supply */
233 struct power_supply_desc {
234 const char *name;
235 enum power_supply_type type;
236 const enum power_supply_usb_type *usb_types;
237 size_t num_usb_types;
238 const enum power_supply_property *properties;
239 size_t num_properties;
240
241 /*
242 * Functions for drivers implementing power supply class.
243 * These shouldn't be called directly by other drivers for accessing
244 * this power supply. Instead use power_supply_*() functions (for
245 * example power_supply_get_property()).
246 */
247 int (*get_property)(struct power_supply *psy,
248 enum power_supply_property psp,
249 union power_supply_propval *val);
250 int (*set_property)(struct power_supply *psy,
251 enum power_supply_property psp,
252 const union power_supply_propval *val);
253 /*
254 * property_is_writeable() will be called during registration
255 * of power supply. If this happens during device probe then it must
256 * not access internal data of device (because probe did not end).
257 */
258 int (*property_is_writeable)(struct power_supply *psy,
259 enum power_supply_property psp);
260 void (*external_power_changed)(struct power_supply *psy);
261 void (*set_charged)(struct power_supply *psy);
262
263 /*
264 * Set if thermal zone should not be created for this power supply.
265 * For example for virtual supplies forwarding calls to actual
266 * sensors or other supplies.
267 */
268 bool no_thermal;
269 /* For APM emulation, think legacy userspace. */
270 int use_for_apm;
271 };
272
273 struct power_supply {
274 const struct power_supply_desc *desc;
275
276 char **supplied_to;
277 size_t num_supplicants;
278
279 char **supplied_from;
280 size_t num_supplies;
281 struct device_node *of_node;
282
283 /* Driver private data */
284 void *drv_data;
285
286 /* private */
287 struct device dev;
288 struct work_struct changed_work;
289 struct delayed_work deferred_register_work;
290 spinlock_t changed_lock;
291 bool changed;
292 bool initialized;
293 bool removing;
294 atomic_t use_cnt;
295 #ifdef CONFIG_THERMAL
296 struct thermal_zone_device *tzd;
297 struct thermal_cooling_device *tcd;
298 #endif
299
300 #ifdef CONFIG_LEDS_TRIGGERS
301 struct led_trigger *charging_full_trig;
302 char *charging_full_trig_name;
303 struct led_trigger *charging_trig;
304 char *charging_trig_name;
305 struct led_trigger *full_trig;
306 char *full_trig_name;
307 struct led_trigger *online_trig;
308 char *online_trig_name;
309 struct led_trigger *charging_blink_full_solid_trig;
310 char *charging_blink_full_solid_trig_name;
311 #endif
312 };
313
314 /*
315 * This is recommended structure to specify static power supply parameters.
316 * Generic one, parametrizable for different power supplies. Power supply
317 * class itself does not use it, but that's what implementing most platform
318 * drivers, should try reuse for consistency.
319 */
320
321 struct power_supply_info {
322 const char *name;
323 int technology;
324 int voltage_max_design;
325 int voltage_min_design;
326 int charge_full_design;
327 int charge_empty_design;
328 int energy_full_design;
329 int energy_empty_design;
330 int use_for_apm;
331 };
332
333 struct power_supply_battery_ocv_table {
334 int ocv; /* microVolts */
335 int capacity; /* percent */
336 };
337
338 struct power_supply_resistance_temp_table {
339 int temp; /* celsius */
340 int resistance; /* internal resistance percent */
341 };
342
343 #define POWER_SUPPLY_OCV_TEMP_MAX 20
344
345 /*
346 * This is the recommended struct to manage static battery parameters,
347 * populated by power_supply_get_battery_info(). Most platform drivers should
348 * use these for consistency.
349 * Its field names must correspond to elements in enum power_supply_property.
350 * The default field value is -EINVAL.
351 * Power supply class itself doesn't use this.
352 */
353
354 struct power_supply_battery_info {
355 unsigned int technology; /* from the enum above */
356 int energy_full_design_uwh; /* microWatt-hours */
357 int charge_full_design_uah; /* microAmp-hours */
358 int voltage_min_design_uv; /* microVolts */
359 int voltage_max_design_uv; /* microVolts */
360 int tricklecharge_current_ua; /* microAmps */
361 int precharge_current_ua; /* microAmps */
362 int precharge_voltage_max_uv; /* microVolts */
363 int charge_term_current_ua; /* microAmps */
364 int charge_restart_voltage_uv; /* microVolts */
365 int overvoltage_limit_uv; /* microVolts */
366 int constant_charge_current_max_ua; /* microAmps */
367 int constant_charge_voltage_max_uv; /* microVolts */
368 int factory_internal_resistance_uohm; /* microOhms */
369 int ocv_temp[POWER_SUPPLY_OCV_TEMP_MAX];/* celsius */
370 int temp_ambient_alert_min; /* celsius */
371 int temp_ambient_alert_max; /* celsius */
372 int temp_alert_min; /* celsius */
373 int temp_alert_max; /* celsius */
374 int temp_min; /* celsius */
375 int temp_max; /* celsius */
376 struct power_supply_battery_ocv_table *ocv_table[POWER_SUPPLY_OCV_TEMP_MAX];
377 int ocv_table_size[POWER_SUPPLY_OCV_TEMP_MAX];
378 struct power_supply_resistance_temp_table *resist_table;
379 int resist_table_size;
380 };
381
382 extern struct atomic_notifier_head power_supply_notifier;
383 extern int power_supply_reg_notifier(struct notifier_block *nb);
384 extern void power_supply_unreg_notifier(struct notifier_block *nb);
385 #if IS_ENABLED(CONFIG_POWER_SUPPLY)
386 extern struct power_supply *power_supply_get_by_name(const char *name);
387 extern void power_supply_put(struct power_supply *psy);
388 #else
389 static inline void power_supply_put(struct power_supply *psy) {}
390 static inline struct power_supply *power_supply_get_by_name(const char *name)
391 { return NULL; }
392 #endif
393 #ifdef CONFIG_OF
394 extern struct power_supply *power_supply_get_by_phandle(struct device_node *np,
395 const char *property);
396 extern struct power_supply *devm_power_supply_get_by_phandle(
397 struct device *dev, const char *property);
398 #else /* !CONFIG_OF */
399 static inline struct power_supply *
400 power_supply_get_by_phandle(struct device_node *np, const char *property)
401 { return NULL; }
402 static inline struct power_supply *
403 devm_power_supply_get_by_phandle(struct device *dev, const char *property)
404 { return NULL; }
405 #endif /* CONFIG_OF */
406
407 extern int power_supply_get_battery_info(struct power_supply *psy,
408 struct power_supply_battery_info *info);
409 extern void power_supply_put_battery_info(struct power_supply *psy,
410 struct power_supply_battery_info *info);
411 extern int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table *table,
412 int table_len, int ocv);
413 extern struct power_supply_battery_ocv_table *
414 power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
415 int temp, int *table_len);
416 extern int power_supply_batinfo_ocv2cap(struct power_supply_battery_info *info,
417 int ocv, int temp);
418 extern int
419 power_supply_temp2resist_simple(struct power_supply_resistance_temp_table *table,
420 int table_len, int temp);
421 extern void power_supply_changed(struct power_supply *psy);
422 extern int power_supply_am_i_supplied(struct power_supply *psy);
423 extern int power_supply_set_input_current_limit_from_supplier(
424 struct power_supply *psy);
425 extern int power_supply_set_battery_charged(struct power_supply *psy);
426
427 #ifdef CONFIG_POWER_SUPPLY
428 extern int power_supply_is_system_supplied(void);
429 #else
430 static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
431 #endif
432
433 extern int power_supply_get_property(struct power_supply *psy,
434 enum power_supply_property psp,
435 union power_supply_propval *val);
436 #if IS_ENABLED(CONFIG_POWER_SUPPLY)
437 extern int power_supply_set_property(struct power_supply *psy,
438 enum power_supply_property psp,
439 const union power_supply_propval *val);
440 #else
441 static inline int power_supply_set_property(struct power_supply *psy,
442 enum power_supply_property psp,
443 const union power_supply_propval *val)
444 { return 0; }
445 #endif
446 extern int power_supply_property_is_writeable(struct power_supply *psy,
447 enum power_supply_property psp);
448 extern void power_supply_external_power_changed(struct power_supply *psy);
449
450 extern struct power_supply *__must_check
451 power_supply_register(struct device *parent,
452 const struct power_supply_desc *desc,
453 const struct power_supply_config *cfg);
454 extern struct power_supply *__must_check
455 power_supply_register_no_ws(struct device *parent,
456 const struct power_supply_desc *desc,
457 const struct power_supply_config *cfg);
458 extern struct power_supply *__must_check
459 devm_power_supply_register(struct device *parent,
460 const struct power_supply_desc *desc,
461 const struct power_supply_config *cfg);
462 extern struct power_supply *__must_check
463 devm_power_supply_register_no_ws(struct device *parent,
464 const struct power_supply_desc *desc,
465 const struct power_supply_config *cfg);
466 extern void power_supply_unregister(struct power_supply *psy);
467 extern int power_supply_powers(struct power_supply *psy, struct device *dev);
468
469 #define to_power_supply(device) container_of(device, struct power_supply, dev)
470
471 extern void *power_supply_get_drvdata(struct power_supply *psy);
472 /* For APM emulation, think legacy userspace. */
473 extern struct class *power_supply_class;
474
475 static inline bool power_supply_is_amp_property(enum power_supply_property psp)
476 {
477 switch (psp) {
478 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
479 case POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN:
480 case POWER_SUPPLY_PROP_CHARGE_FULL:
481 case POWER_SUPPLY_PROP_CHARGE_EMPTY:
482 case POWER_SUPPLY_PROP_CHARGE_NOW:
483 case POWER_SUPPLY_PROP_CHARGE_AVG:
484 case POWER_SUPPLY_PROP_CHARGE_COUNTER:
485 case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
486 case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
487 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
488 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
489 case POWER_SUPPLY_PROP_CURRENT_MAX:
490 case POWER_SUPPLY_PROP_CURRENT_NOW:
491 case POWER_SUPPLY_PROP_CURRENT_AVG:
492 case POWER_SUPPLY_PROP_CURRENT_BOOT:
493 return true;
494 default:
495 break;
496 }
497
498 return false;
499 }
500
501 static inline bool power_supply_is_watt_property(enum power_supply_property psp)
502 {
503 switch (psp) {
504 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
505 case POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN:
506 case POWER_SUPPLY_PROP_ENERGY_FULL:
507 case POWER_SUPPLY_PROP_ENERGY_EMPTY:
508 case POWER_SUPPLY_PROP_ENERGY_NOW:
509 case POWER_SUPPLY_PROP_ENERGY_AVG:
510 case POWER_SUPPLY_PROP_VOLTAGE_MAX:
511 case POWER_SUPPLY_PROP_VOLTAGE_MIN:
512 case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
513 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
514 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
515 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
516 case POWER_SUPPLY_PROP_VOLTAGE_OCV:
517 case POWER_SUPPLY_PROP_VOLTAGE_BOOT:
518 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
519 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
520 case POWER_SUPPLY_PROP_POWER_NOW:
521 return true;
522 default:
523 break;
524 }
525
526 return false;
527 }
528
529 #ifdef CONFIG_POWER_SUPPLY_HWMON
530 int power_supply_add_hwmon_sysfs(struct power_supply *psy);
531 void power_supply_remove_hwmon_sysfs(struct power_supply *psy);
532 #else
533 static inline int power_supply_add_hwmon_sysfs(struct power_supply *psy)
534 {
535 return 0;
536 }
537
538 static inline
539 void power_supply_remove_hwmon_sysfs(struct power_supply *psy) {}
540 #endif
541
542 #endif /* __LINUX_POWER_SUPPLY_H__ */