drivers/power/supply/ab8500_chargalg.c
Source file repositories/reference/linux-study-clean/drivers/power/supply/ab8500_chargalg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/supply/ab8500_chargalg.c- Extension
.c- Size
- 54033 bytes
- Lines
- 1852
- 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/init.hlinux/module.hlinux/device.hlinux/component.hlinux/hrtimer.hlinux/interrupt.hlinux/delay.hlinux/slab.hlinux/platform_device.hlinux/power_supply.hlinux/completion.hlinux/workqueue.hlinux/kobject.hlinux/of.hlinux/mfd/core.hlinux/mfd/abx500.hlinux/mfd/abx500/ab8500.hlinux/notifier.hab8500-bm.hab8500-chargalg.h
Detected Declarations
struct ab8500_chargalg_charger_infostruct ab8500_chargalg_battery_datastruct ab8500_chargalg_eventsstruct ab8500_charge_curr_maximizationstruct ab8500_chargalgenum ab8500_chargersenum ab8500_chargalg_statesenum maxim_retfunction ab8500_chargalg_safety_timer_expiredfunction ab8500_chargalg_maintenance_timer_expiredfunction ab8500_chargalg_state_tofunction ab8500_chargalg_check_charger_enablefunction ab8500_chargalg_check_charger_connectionfunction ab8500_chargalg_start_safety_timerfunction ab8500_chargalg_stop_safety_timerfunction ab8500_chargalg_start_maintenance_timerfunction ab8500_chargalg_stop_maintenance_timerfunction ab8500_chargalg_kick_watchdogfunction ab8500_chargalg_ac_enfunction ab8500_chargalg_usb_enfunction ab8500_chargalg_update_chg_currfunction ab8500_chargalg_stop_chargingfunction ab8500_chargalg_hold_chargingfunction ab8500_chargalg_start_chargingfunction ab8500_chargalg_check_tempfunction ab8500_chargalg_check_charger_voltagefunction ab8500_chargalg_end_of_chargefunction init_maxim_chg_currfunction ab8500_chargalg_chg_curr_maximfunction handle_maxim_chg_currfunction ab8500_chargalg_get_ext_psy_datafunction ab8500_chargalg_external_power_changedfunction ab8500_chargalg_time_to_restartfunction ab8500_chargalg_algorithmfunction ab8500_chargalg_periodic_workfunction ab8500_chargalg_wd_workfunction ab8500_chargalg_workfunction ab8500_chargalg_get_propertyfunction ab8500_chargalg_resumefunction ab8500_chargalg_suspendfunction ab8500_chargalg_bindfunction ab8500_chargalg_unbindfunction ab8500_chargalg_probefunction ab8500_chargalg_remove
Annotated Snippet
struct ab8500_chargalg_charger_info {
enum ab8500_chargers conn_chg;
enum ab8500_chargers prev_conn_chg;
enum ab8500_chargers online_chg;
enum ab8500_chargers prev_online_chg;
enum ab8500_chargers charger_type;
bool usb_chg_ok;
bool ac_chg_ok;
int usb_volt_uv;
int usb_curr_ua;
int ac_volt_uv;
int ac_curr_ua;
int usb_vset_uv;
int usb_iset_ua;
int ac_vset_uv;
int ac_iset_ua;
};
struct ab8500_chargalg_battery_data {
int temp;
int volt_uv;
int avg_curr_ua;
int inst_curr_ua;
int percent;
};
enum ab8500_chargalg_states {
STATE_HANDHELD_INIT,
STATE_HANDHELD,
STATE_CHG_NOT_OK_INIT,
STATE_CHG_NOT_OK,
STATE_HW_TEMP_PROTECT_INIT,
STATE_HW_TEMP_PROTECT,
STATE_NORMAL_INIT,
STATE_NORMAL,
STATE_WAIT_FOR_RECHARGE_INIT,
STATE_WAIT_FOR_RECHARGE,
STATE_MAINTENANCE_A_INIT,
STATE_MAINTENANCE_A,
STATE_MAINTENANCE_B_INIT,
STATE_MAINTENANCE_B,
STATE_TEMP_UNDEROVER_INIT,
STATE_TEMP_UNDEROVER,
STATE_TEMP_LOWHIGH_INIT,
STATE_TEMP_LOWHIGH,
STATE_OVV_PROTECT_INIT,
STATE_OVV_PROTECT,
STATE_SAFETY_TIMER_EXPIRED_INIT,
STATE_SAFETY_TIMER_EXPIRED,
STATE_BATT_REMOVED_INIT,
STATE_BATT_REMOVED,
STATE_WD_EXPIRED_INIT,
STATE_WD_EXPIRED,
};
static const char * const states[] = {
"HANDHELD_INIT",
"HANDHELD",
"CHG_NOT_OK_INIT",
"CHG_NOT_OK",
"HW_TEMP_PROTECT_INIT",
"HW_TEMP_PROTECT",
"NORMAL_INIT",
"NORMAL",
"WAIT_FOR_RECHARGE_INIT",
"WAIT_FOR_RECHARGE",
"MAINTENANCE_A_INIT",
"MAINTENANCE_A",
"MAINTENANCE_B_INIT",
"MAINTENANCE_B",
"TEMP_UNDEROVER_INIT",
"TEMP_UNDEROVER",
"TEMP_LOWHIGH_INIT",
"TEMP_LOWHIGH",
"OVV_PROTECT_INIT",
"OVV_PROTECT",
"SAFETY_TIMER_EXPIRED_INIT",
"SAFETY_TIMER_EXPIRED",
"BATT_REMOVED_INIT",
"BATT_REMOVED",
"WD_EXPIRED_INIT",
"WD_EXPIRED",
};
struct ab8500_chargalg_events {
bool batt_unknown;
bool mainextchnotok;
bool batt_ovv;
bool batt_rem;
bool btemp_underover;
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/device.h`, `linux/component.h`, `linux/hrtimer.h`, `linux/interrupt.h`, `linux/delay.h`, `linux/slab.h`.
- Detected declarations: `struct ab8500_chargalg_charger_info`, `struct ab8500_chargalg_battery_data`, `struct ab8500_chargalg_events`, `struct ab8500_charge_curr_maximization`, `struct ab8500_chargalg`, `enum ab8500_chargers`, `enum ab8500_chargalg_states`, `enum maxim_ret`, `function ab8500_chargalg_safety_timer_expired`, `function ab8500_chargalg_maintenance_timer_expired`.
- 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.