include/linux/power_supply.h
Source file repositories/reference/linux-study-clean/include/linux/power_supply.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/power_supply.h- Extension
.h- Size
- 42440 bytes
- Lines
- 1028
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/workqueue.hlinux/leds.hlinux/rwsem.hlinux/list.hlinux/spinlock.hlinux/notifier.h
Detected Declarations
struct device_nodestruct power_supplystruct power_supply_configstruct power_supply_descstruct power_supply_extstruct power_supplystruct power_supply_infostruct power_supply_battery_ocv_tablestruct power_supply_resistance_temp_tablestruct power_supply_vbat_ri_tablestruct power_supply_maintenance_charge_tablestruct power_supply_battery_infoenum power_supply_charge_typeenum power_supply_propertyenum power_supply_typeenum power_supply_usb_typeenum power_supply_charge_behaviourenum power_supply_notifier_eventsfunction power_supply_putfunction power_supply_supports_maintenance_chargingfunction power_supply_supports_vbat2rifunction power_supply_supports_temp2rifunction power_supply_is_system_suppliedfunction power_supply_set_propertyfunction power_supply_set_property_directfunction power_supply_is_amp_propertyfunction power_supply_is_watt_propertyfunction power_supply_charge_behaviour_showfunction power_supply_charge_behaviour_parsefunction power_supply_charge_types_showfunction power_supply_charge_types_parse
Annotated Snippet
struct power_supply_config {
struct fwnode_handle *fwnode;
/* Driver private data */
void *drv_data;
/* Device specific sysfs attributes */
const struct attribute_group **attr_grp;
char **supplied_to;
size_t num_supplicants;
bool no_wakeup_source;
};
/* Description of power supply */
struct power_supply_desc {
const char *name;
enum power_supply_type type;
u8 charge_behaviours;
u32 charge_types;
u32 usb_types;
const enum power_supply_property *properties;
size_t num_properties;
/*
* Functions for drivers implementing power supply class.
* These shouldn't be called directly by other drivers for accessing
* this power supply. Instead use power_supply_*() functions (for
* example power_supply_get_property()).
*/
int (*get_property)(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val);
int (*set_property)(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val);
/*
* property_is_writeable() will be called during registration
* of power supply. If this happens during device probe then it must
* not access internal data of device (because probe did not end).
*/
int (*property_is_writeable)(struct power_supply *psy,
enum power_supply_property psp);
void (*external_power_changed)(struct power_supply *psy);
/*
* Set if thermal zone should not be created for this power supply.
* For example for virtual supplies forwarding calls to actual
* sensors or other supplies.
*/
bool no_thermal;
/* For APM emulation, think legacy userspace. */
int use_for_apm;
};
struct power_supply_ext {
const char *const name;
u8 charge_behaviours;
u32 charge_types;
const enum power_supply_property *properties;
size_t num_properties;
int (*get_property)(struct power_supply *psy,
const struct power_supply_ext *ext,
void *data,
enum power_supply_property psp,
union power_supply_propval *val);
int (*set_property)(struct power_supply *psy,
const struct power_supply_ext *ext,
void *data,
enum power_supply_property psp,
const union power_supply_propval *val);
int (*property_is_writeable)(struct power_supply *psy,
const struct power_supply_ext *ext,
void *data,
enum power_supply_property psp);
};
struct power_supply {
const struct power_supply_desc *desc;
char **supplied_to;
size_t num_supplicants;
char **supplied_from;
size_t num_supplies;
/* Driver private data */
void *drv_data;
Annotation
- Immediate include surface: `linux/device.h`, `linux/workqueue.h`, `linux/leds.h`, `linux/rwsem.h`, `linux/list.h`, `linux/spinlock.h`, `linux/notifier.h`.
- Detected declarations: `struct device_node`, `struct power_supply`, `struct power_supply_config`, `struct power_supply_desc`, `struct power_supply_ext`, `struct power_supply`, `struct power_supply_info`, `struct power_supply_battery_ocv_table`, `struct power_supply_resistance_temp_table`, `struct power_supply_vbat_ri_table`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.