drivers/power/supply/adc-battery-helper.h
Source file repositories/reference/linux-study-clean/drivers/power/supply/adc-battery-helper.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/supply/adc-battery-helper.h- Extension
.h- Size
- 2401 bytes
- Lines
- 63
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mutex.hlinux/workqueue.h
Detected Declarations
struct power_supplystruct gpio_descstruct adc_battery_helper
Annotated Snippet
struct adc_battery_helper {
struct power_supply *psy;
struct gpio_desc *charge_finished;
struct delayed_work work;
struct mutex lock;
adc_battery_helper_get_func get_voltage_and_current_now;
int ocv_uv[ADC_BAT_HELPER_MOV_AVG_WINDOW_SIZE]; /* micro-volt */
int intern_res_mohm[ADC_BAT_HELPER_MOV_AVG_WINDOW_SIZE]; /* milli-ohm */
int poll_count;
int ocv_avg_index;
int ocv_avg_uv; /* micro-volt */
int intern_res_poll_count;
int intern_res_avg_index;
int intern_res_avg_mohm; /* milli-ohm */
int volt_uv; /* micro-volt */
int curr_ua; /* micro-ampere */
int capacity; /* percent */
int status;
bool supplied;
};
extern const enum power_supply_property adc_battery_helper_properties[];
/* Must be const cannot be an external. Asserted in adc-battery-helper.c */
#define ADC_HELPER_NUM_PROPERTIES 7
int adc_battery_helper_init(struct adc_battery_helper *help, struct power_supply *psy,
adc_battery_helper_get_func get_voltage_and_current_now,
struct gpio_desc *charge_finished_gpio);
/*
* The below functions can be directly used as power-supply / suspend-resume
* callbacks. They cast the power_supply_get_drvdata() / dev_get_drvdata() data
* directly to struct adc_battery_helper. Therefor struct adc_battery_helper
* MUST be the first member of the battery driver's data struct.
*/
int adc_battery_helper_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val);
void adc_battery_helper_external_power_changed(struct power_supply *psy);
int adc_battery_helper_suspend(struct device *dev);
int adc_battery_helper_resume(struct device *dev);
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/workqueue.h`.
- Detected declarations: `struct power_supply`, `struct gpio_desc`, `struct adc_battery_helper`.
- 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.