drivers/power/supply/bq2515x_charger.c
Source file repositories/reference/linux-study-clean/drivers/power/supply/bq2515x_charger.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/supply/bq2515x_charger.c- Extension
.c- Size
- 29669 bytes
- Lines
- 1167
- 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/err.hlinux/i2c.hlinux/init.hlinux/kernel.hlinux/module.hlinux/gpio/consumer.hlinux/power_supply.hlinux/regmap.hlinux/types.h
Detected Declarations
struct bq2515x_init_datastruct bq2515x_infostruct bq2515x_devicefunction bq2515x_wake_upfunction bq2515x_update_ps_statusfunction bq2515x_disable_watchdog_timersfunction bq2515x_get_battery_voltage_nowfunction bq2515x_get_battery_current_nowfunction bq2515x_get_charge_disablefunction bq2515x_set_charge_disablefunction bq2515x_get_const_charge_currentfunction bq2515x_set_const_charge_currentfunction bq2515x_get_precharge_currentfunction bq2515x_set_precharge_currentfunction bq2515x_charging_statusfunction bq2515x_get_batt_regfunction bq2515x_set_batt_regfunction bq2515x_get_ilim_lvlfunction bq2515x_set_ilim_lvlfunction bq2515x_power_supply_property_is_writeablefunction bq2515x_charger_get_healthfunction bq2515x_mains_set_propertyfunction bq2515x_mains_get_propertyfunction bq2515x_battery_get_propertyfunction bq2515x_power_supply_registerfunction bq2515x_hw_initfunction bq2515x_read_propertiesfunction bq2515x_volatile_registerfunction bq2515x_probe
Annotated Snippet
struct bq2515x_init_data {
int ilim;
int ichg;
int vbatreg;
int iprechg;
};
/**
* struct bq2515x_info -
* @regmap_config: register map config
* @ilim: input current limit
*/
struct bq2515x_info {
const struct regmap_config *regmap_config;
int ilim;
};
/**
* struct bq2515x_device -
* @mains: mains properties
* @battery: battery properties
* @regmap: register map structure
* @dev: device structure
*
* @reset_gpio: manual reset (MR) pin
* @powerdown_gpio: low power mode pin
* @ac_detect_gpio: power good (PG) pin
* @ce_gpio: charge enable (CE) pin
*
* @info: device info
* @model_name: string value describing device model
* @mains_online: boolean value indicating power supply online
*
* @init_data: charger initialization data structure
*/
struct bq2515x_device {
struct power_supply *mains;
struct power_supply *battery;
struct regmap *regmap;
struct device *dev;
struct gpio_desc *reset_gpio;
struct gpio_desc *powerdown_gpio;
struct gpio_desc *ac_detect_gpio;
struct gpio_desc *ce_gpio;
const struct bq2515x_info *info;
char model_name[I2C_NAME_SIZE];
bool mains_online;
struct bq2515x_init_data init_data;
};
static const struct reg_default bq25150_reg_defaults[] = {
{BQ2515X_FLAG0, 0x0},
{BQ2515X_FLAG1, 0x0},
{BQ2515X_FLAG2, 0x0},
{BQ2515X_FLAG3, 0x0},
{BQ2515X_MASK0, 0x0},
{BQ2515X_MASK1, 0x0},
{BQ2515X_MASK2, 0x71},
{BQ2515X_MASK3, 0x0},
{BQ2515X_VBAT_CTRL, 0x3C},
{BQ2515X_ICHG_CTRL, 0x8},
{BQ2515X_PCHRGCTRL, 0x2},
{BQ2515X_TERMCTRL, 0x14},
{BQ2515X_BUVLO, 0x0},
{BQ2515X_CHARGERCTRL0, 0x82},
{BQ2515X_CHARGERCTRL1, 0x42},
{BQ2515X_ILIMCTRL, 0x1},
{BQ2515X_LDOCTRL, 0xB0},
{BQ2515X_MRCTRL, 0x2A},
{BQ2515X_ICCTRL0, 0x10},
{BQ2515X_ICCTRL1, 0x0},
{BQ2515X_ICCTRL2, 0x0},
{BQ2515X_ADCCTRL0, 0x2},
{BQ2515X_ADCCTRL1, 0x40},
{BQ2515X_ADC_COMP1_M, 0x23},
{BQ2515X_ADC_COMP1_L, 0x20},
{BQ2515X_ADC_COMP2_M, 0x38},
{BQ2515X_ADC_COMP2_L, 0x90},
{BQ2515X_ADC_COMP3_M, 0x0},
{BQ2515X_ADC_COMP3_L, 0x0},
{BQ2515X_ADC_READ_EN, 0x0},
{BQ2515X_TS_FASTCHGCTRL, 0x34},
{BQ2515X_TS_COLD, 0x7C},
{BQ2515X_TS_COOL, 0x6D},
{BQ2515X_TS_WARM, 0x38},
{BQ2515X_TS_HOT, 0x27},
{BQ2515X_DEVICE_ID, 0x20},
Annotation
- Immediate include surface: `linux/err.h`, `linux/i2c.h`, `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/gpio/consumer.h`, `linux/power_supply.h`, `linux/regmap.h`.
- Detected declarations: `struct bq2515x_init_data`, `struct bq2515x_info`, `struct bq2515x_device`, `function bq2515x_wake_up`, `function bq2515x_update_ps_status`, `function bq2515x_disable_watchdog_timers`, `function bq2515x_get_battery_voltage_now`, `function bq2515x_get_battery_current_now`, `function bq2515x_get_charge_disable`, `function bq2515x_set_charge_disable`.
- 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.