xref: /linux/drivers/power/supply/power_supply.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Functions private to power supply 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 struct device;
13 struct device_type;
14 struct power_supply;
15 
16 extern int power_supply_property_is_writeable(struct power_supply *psy,
17 					      enum power_supply_property psp);
18 
19 #ifdef CONFIG_SYSFS
20 
21 extern void __init power_supply_init_attrs(void);
22 extern int power_supply_uevent(const struct device *dev, struct kobj_uevent_env *env);
23 extern const struct attribute_group *power_supply_attr_groups[];
24 
25 #else
26 
27 static inline void power_supply_init_attrs(void) {}
28 #define power_supply_attr_groups NULL
29 #define power_supply_uevent NULL
30 
31 #endif /* CONFIG_SYSFS */
32 
33 #ifdef CONFIG_LEDS_TRIGGERS
34 
35 extern void power_supply_update_leds(struct power_supply *psy);
36 extern int power_supply_create_triggers(struct power_supply *psy);
37 extern void power_supply_remove_triggers(struct power_supply *psy);
38 
39 #else
40 
41 static inline void power_supply_update_leds(struct power_supply *psy) {}
42 static inline int power_supply_create_triggers(struct power_supply *psy)
43 { return 0; }
44 static inline void power_supply_remove_triggers(struct power_supply *psy) {}
45 
46 #endif /* CONFIG_LEDS_TRIGGERS */
47 
48 #ifdef CONFIG_POWER_SUPPLY_HWMON
49 
50 int power_supply_add_hwmon_sysfs(struct power_supply *psy);
51 void power_supply_remove_hwmon_sysfs(struct power_supply *psy);
52 
53 #else
54 
55 static inline int power_supply_add_hwmon_sysfs(struct power_supply *psy)
56 {
57 	return 0;
58 }
59 
60 static inline
61 void power_supply_remove_hwmon_sysfs(struct power_supply *psy) {}
62 
63 #endif /* CONFIG_POWER_SUPPLY_HWMON */
64