drivers/power/supply/bq25980_charger.c
Source file repositories/reference/linux-study-clean/drivers/power/supply/bq25980_charger.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/supply/bq25980_charger.c- Extension
.c- Size
- 32598 bytes
- Lines
- 1298
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/err.hlinux/i2c.hlinux/init.hlinux/interrupt.hlinux/kernel.hlinux/module.hlinux/power_supply.hlinux/regmap.hlinux/types.hlinux/delay.hlinux/device.hlinux/moduleparam.hlinux/slab.hbq25980_charger.h
Detected Declarations
struct bq25980_statestruct bq25980_chip_infostruct bq25980_init_datastruct bq25980_deviceenum bq25980_idfunction bq25980_get_input_curr_limfunction bq25980_set_hizfunction bq25980_set_input_curr_limfunction bq25980_get_input_volt_limfunction bq25980_set_input_volt_limfunction bq25980_get_const_charge_currfunction bq25980_set_const_charge_currfunction bq25980_get_const_charge_voltfunction bq25980_set_const_charge_voltfunction bq25980_set_bypassfunction bq25980_set_chg_enfunction bq25980_get_adc_ibusfunction bq25980_get_adc_vbusfunction bq25980_get_ibat_adcfunction bq25980_get_adc_vbatfunction bq25980_get_statefunction bq25980_get_battery_propertyfunction bq25980_set_charger_propertyfunction bq25980_get_charger_propertyfunction bq25980_state_changedfunction bq25980_irq_handler_threadfunction bq25980_property_is_writeablefunction bq25980_is_volatile_regfunction bq25980_power_supply_initfunction bq25980_hw_initfunction bq25980_parse_dtfunction bq25980_probe
Annotated Snippet
struct bq25980_state {
bool dischg;
bool ovp;
bool ocp;
bool wdt;
bool tflt;
bool online;
bool ce;
bool hiz;
bool bypass;
u32 vbat_adc;
u32 vsys_adc;
u32 ibat_adc;
};
enum bq25980_id {
BQ25980,
BQ25975,
BQ25960,
};
struct bq25980_chip_info {
int model_id;
const struct regmap_config *regmap_config;
int busocp_def;
int busocp_sc_max;
int busocp_byp_max;
int busocp_sc_min;
int busocp_byp_min;
int busovp_sc_def;
int busovp_byp_def;
int busovp_sc_step;
int busovp_sc_offset;
int busovp_byp_step;
int busovp_byp_offset;
int busovp_sc_min;
int busovp_sc_max;
int busovp_byp_min;
int busovp_byp_max;
int batovp_def;
int batovp_max;
int batovp_min;
int batovp_step;
int batovp_offset;
int batocp_def;
int batocp_max;
};
struct bq25980_init_data {
u32 ichg;
u32 bypass_ilim;
u32 sc_ilim;
u32 vreg;
u32 iterm;
u32 iprechg;
u32 bypass_vlim;
u32 sc_vlim;
u32 ichg_max;
u32 vreg_max;
};
struct bq25980_device {
struct i2c_client *client;
struct device *dev;
struct power_supply *charger;
struct power_supply *battery;
struct mutex lock;
struct regmap *regmap;
char model_name[I2C_NAME_SIZE];
struct bq25980_init_data init_data;
const struct bq25980_chip_info *chip_info;
struct bq25980_state state;
int watchdog_timer;
};
static const struct reg_default bq25980_reg_defs[] = {
{BQ25980_BATOVP, 0x5A},
{BQ25980_BATOVP_ALM, 0x46},
{BQ25980_BATOCP, 0x51},
{BQ25980_BATOCP_ALM, 0x50},
Annotation
- Immediate include surface: `linux/err.h`, `linux/i2c.h`, `linux/init.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/module.h`, `linux/power_supply.h`, `linux/regmap.h`.
- Detected declarations: `struct bq25980_state`, `struct bq25980_chip_info`, `struct bq25980_init_data`, `struct bq25980_device`, `enum bq25980_id`, `function bq25980_get_input_curr_lim`, `function bq25980_set_hiz`, `function bq25980_set_input_curr_lim`, `function bq25980_get_input_volt_lim`, `function bq25980_set_input_volt_lim`.
- Atlas domain: Driver Families / drivers/power.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.