drivers/power/supply/ip5xxx_power.c
Source file repositories/reference/linux-study-clean/drivers/power/supply/ip5xxx_power.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/supply/ip5xxx_power.c- Extension
.c- Size
- 25303 bytes
- Lines
- 884
- Domain
- Driver Families
- Bucket
- drivers/power
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/i2c.hlinux/module.hlinux/power_supply.hlinux/regmap.h
Detected Declarations
struct ip5xxxstruct ip5xxx_battery_adc_regsstruct ip5xxx_regfield_configfunction ip5xxx_readfunction ip5xxx_writefunction ip5xxx_initializefunction ip5xxx_battery_get_statusfunction ip5xxx_battery_get_charge_typefunction ip5xxx_battery_get_healthfunction ip5xxx_battery_get_voltage_maxfunction ip5xxx_battery_read_adcfunction ip5xxx_battery_get_propertyfunction ip5xxx_battery_set_voltage_maxfunction ip5xxx_battery_set_propertyfunction ip5xxx_battery_property_is_writeablefunction ip5xxx_boost_get_propertyfunction ip5xxx_boost_set_propertyfunction ip5xxx_boost_property_is_writeablefunction ip5xxx_setup_regsfunction ip5xxx_power_probe
Annotated Snippet
struct ip5xxx {
struct regmap *regmap;
bool initialized;
struct {
struct {
/* Charger enable */
struct regmap_field *enable;
/* Constant voltage value */
struct regmap_field *const_volt_sel;
/* Constant current value */
struct regmap_field *const_curr_sel;
/* Charger status */
struct regmap_field *status;
/* Charging ended flag */
struct regmap_field *chg_end;
/* Timeout flags (CV, charge, trickle) */
struct regmap_field *timeout;
/* Overvoltage limit */
struct regmap_field *vin_overvolt;
} charger;
struct {
/* Boost converter enable */
struct regmap_field *enable;
struct {
/* Light load shutdown enable */
struct regmap_field *enable;
/* Light load shutdown current limit */
struct regmap_field *i_limit;
} light_load_shutdown;
/* Automatic powerup on increased load */
struct regmap_field *load_powerup_en;
/* Automatic powerup on VIN pull-out */
struct regmap_field *vin_pullout_en;
/* Undervoltage limit */
struct regmap_field *undervolt_limit;
/* Light load status flag */
struct regmap_field *light_load_status;
} boost;
struct {
/* NTC disable */
struct regmap_field *ntc_dis;
/* Battery voltage type */
struct regmap_field *type;
/* Battery voltage autoset from Vset pin */
struct regmap_field *vset_en;
struct {
/* Battery measurement registers */
struct ip5xxx_battery_adc_regs {
struct regmap_field *low;
struct regmap_field *high;
} volt, curr, open_volt;
} adc;
} battery;
struct {
/* Double/long press shutdown enable */
struct regmap_field *shdn_enable;
/* WLED activation: double press or long press */
struct regmap_field *wled_mode;
/* Shutdown activation: double press or long press */
struct regmap_field *shdn_mode;
/* Long press time */
struct regmap_field *long_press_time;
/* Button pressed */
struct regmap_field *pressed;
/* Button long-pressed */
struct regmap_field *long_pressed;
/* Button short-pressed */
struct regmap_field *short_pressed;
} btn;
struct {
/* WLED enable */
struct regmap_field *enable;
/* WLED detect */
struct regmap_field *detect_en;
/* WLED present */
struct regmap_field *present;
} wled;
} regs;
/* Maximum supported battery voltage (via regs.battery.type) */
int vbat_max;
/* Scaling constants for regs.boost.undervolt_limit */
struct {
int setpoint;
int microvolts_per_bit;
} boost_undervolt;
/* Scaling constants for regs.charger.const_curr_sel */
struct {
int setpoint;
} const_curr;
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/module.h`, `linux/power_supply.h`, `linux/regmap.h`.
- Detected declarations: `struct ip5xxx`, `struct ip5xxx_battery_adc_regs`, `struct ip5xxx_regfield_config`, `function ip5xxx_read`, `function ip5xxx_write`, `function ip5xxx_initialize`, `function ip5xxx_battery_get_status`, `function ip5xxx_battery_get_charge_type`, `function ip5xxx_battery_get_health`, `function ip5xxx_battery_get_voltage_max`.
- Atlas domain: Driver Families / drivers/power.
- Implementation status: source implementation candidate.
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.