drivers/power/supply/bq27xxx_battery.c
Source file repositories/reference/linux-study-clean/drivers/power/supply/bq27xxx_battery.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/supply/bq27xxx_battery.c- Extension
.c- Size
- 65602 bytes
- Lines
- 2314
- Domain
- Driver Families
- Bucket
- drivers/power
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/device.hlinux/module.hlinux/mutex.hlinux/param.hlinux/jiffies.hlinux/workqueue.hlinux/delay.hlinux/platform_device.hlinux/power_supply.hlinux/slab.hlinux/of.hlinux/power/bq27xxx_battery.h
Detected Declarations
struct bq27xxx_dm_regstruct bq27xxx_dm_bufenum bq27xxx_reg_indexenum bq27xxx_dm_reg_idfunction poll_interval_param_setfunction bq27xxx_readfunction bq27xxx_writefunction bq27xxx_read_blockfunction bq27xxx_write_blockfunction bq27xxx_battery_sealfunction bq27xxx_battery_unsealfunction bq27xxx_battery_checksum_dm_blockfunction bq27xxx_battery_read_dm_blockfunction bq27xxx_battery_update_dm_blockfunction bq27xxx_battery_cfgupdate_privfunction bq27xxx_battery_set_cfgupdatefunction bq27xxx_battery_soft_resetfunction bq27xxx_battery_write_dm_blockfunction bq27xxx_battery_set_configfunction bq27xxx_battery_settingsfunction bq27xxx_battery_read_socfunction bq27xxx_battery_read_chargefunction bq27xxx_battery_read_nacfunction bq27xxx_battery_read_rcfunction bq27xxx_battery_read_fccfunction bq27xxx_battery_read_dcapfunction bq27xxx_battery_read_energyfunction bq27xxx_battery_read_temperaturefunction bq27xxx_battery_read_cyctfunction bq27xxx_battery_read_timefunction bq27xxx_battery_overtempfunction bq27xxx_battery_undertempfunction bq27xxx_battery_deadfunction bq27xxx_battery_capacity_inaccuratefunction bq27xxx_battery_read_healthfunction bq27xxx_battery_is_fullfunction bq27xxx_battery_current_and_statusfunction bq27xxx_battery_update_unlockedfunction bq27xxx_battery_updatefunction bq27xxx_battery_pollfunction bq27xxx_battery_pwr_avgfunction bq27xxx_battery_capacity_levelfunction bq27xxx_battery_voltagefunction QV1function bq27xxx_battery_read_dmin_voltfunction bq27xxx_simple_valuefunction bq27xxx_battery_get_propertyfunction bq27xxx_external_power_changed
Annotated Snippet
struct bq27xxx_dm_reg {
u8 subclass_id;
u8 offset;
u8 bytes;
u16 min, max;
};
enum bq27xxx_dm_reg_id {
BQ27XXX_DM_DESIGN_CAPACITY = 0,
BQ27XXX_DM_DESIGN_ENERGY,
BQ27XXX_DM_TERMINATE_VOLTAGE,
};
#define bq27000_dm_regs NULL
#define bq27010_dm_regs NULL
#define bq2750x_dm_regs NULL
#define bq2751x_dm_regs NULL
#define bq2752x_dm_regs NULL
#if 0 /* not yet tested */
static struct bq27xxx_dm_reg bq27500_dm_regs[] = {
[BQ27XXX_DM_DESIGN_CAPACITY] = { 48, 10, 2, 0, 65535 },
[BQ27XXX_DM_DESIGN_ENERGY] = { }, /* missing on chip */
[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 80, 48, 2, 1000, 32767 },
};
#else
#define bq27500_dm_regs NULL
#endif
/* todo create data memory definitions from datasheets and test on chips */
#define bq27510g1_dm_regs NULL
#define bq27510g2_dm_regs NULL
#define bq27510g3_dm_regs NULL
#define bq27520g1_dm_regs NULL
#define bq27520g2_dm_regs NULL
#define bq27520g3_dm_regs NULL
#define bq27520g4_dm_regs NULL
#define bq27521_dm_regs NULL
#define bq27530_dm_regs NULL
#define bq27531_dm_regs NULL
#define bq27541_dm_regs NULL
#define bq27542_dm_regs NULL
#define bq27546_dm_regs NULL
#define bq27742_dm_regs NULL
#if 0 /* not yet tested */
static struct bq27xxx_dm_reg bq27545_dm_regs[] = {
[BQ27XXX_DM_DESIGN_CAPACITY] = { 48, 23, 2, 0, 32767 },
[BQ27XXX_DM_DESIGN_ENERGY] = { 48, 25, 2, 0, 32767 },
[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 80, 67, 2, 2800, 3700 },
};
#else
#define bq27545_dm_regs NULL
#endif
static struct bq27xxx_dm_reg bq27411_dm_regs[] = {
[BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 10, 2, 0, 32767 },
[BQ27XXX_DM_DESIGN_ENERGY] = { 82, 12, 2, 0, 32767 },
[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 16, 2, 2800, 3700 },
};
static struct bq27xxx_dm_reg bq27421_dm_regs[] = {
[BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 10, 2, 0, 8000 },
[BQ27XXX_DM_DESIGN_ENERGY] = { 82, 12, 2, 0, 32767 },
[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 16, 2, 2500, 3700 },
};
static struct bq27xxx_dm_reg bq27425_dm_regs[] = {
[BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 12, 2, 0, 32767 },
[BQ27XXX_DM_DESIGN_ENERGY] = { 82, 14, 2, 0, 32767 },
[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 18, 2, 2800, 3700 },
};
static struct bq27xxx_dm_reg bq27426_dm_regs[] = {
[BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 6, 2, 0, 8000 },
[BQ27XXX_DM_DESIGN_ENERGY] = { 82, 8, 2, 0, 32767 },
[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 10, 2, 2500, 3700 },
};
#if 0 /* not yet tested */
#define bq27441_dm_regs bq27421_dm_regs
#else
#define bq27441_dm_regs NULL
#endif
#if 0 /* not yet tested */
static struct bq27xxx_dm_reg bq27621_dm_regs[] = {
[BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 3, 2, 0, 8000 },
[BQ27XXX_DM_DESIGN_ENERGY] = { 82, 5, 2, 0, 32767 },
[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 9, 2, 2500, 3700 },
Annotation
- Immediate include surface: `linux/device.h`, `linux/module.h`, `linux/mutex.h`, `linux/param.h`, `linux/jiffies.h`, `linux/workqueue.h`, `linux/delay.h`, `linux/platform_device.h`.
- Detected declarations: `struct bq27xxx_dm_reg`, `struct bq27xxx_dm_buf`, `enum bq27xxx_reg_index`, `enum bq27xxx_dm_reg_id`, `function poll_interval_param_set`, `function bq27xxx_read`, `function bq27xxx_write`, `function bq27xxx_read_block`, `function bq27xxx_write_block`, `function bq27xxx_battery_seal`.
- Atlas domain: Driver Families / drivers/power.
- Implementation status: integration 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.