drivers/power/supply/bd71828-power.c
Source file repositories/reference/linux-study-clean/drivers/power/supply/bd71828-power.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/supply/bd71828-power.c- Extension
.c- Size
- 35675 bytes
- Lines
- 1274
- 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.
- 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/interrupt.hlinux/kernel.hlinux/mfd/rohm-bd71815.hlinux/mfd/rohm-bd71828.hlinux/mfd/rohm-bd72720.hlinux/module.hlinux/mod_devicetable.hlinux/platform_device.hlinux/property.hlinux/power_supply.hlinux/slab.hlinux/sysfs.h
Detected Declarations
struct pwr_regsstruct bd71828_powerstruct bd7182x_irq_resfunction bd7182x_write16function bd7182x_read16_himaskfunction bd71828_get_vbatfunction bd71828_get_current_ds_adcfunction bd71815_get_tempfunction bd71828_get_tempfunction bd71828_charge_statusfunction get_chg_onlinefunction get_bat_onlinefunction bd71828_bat_insertedfunction bd71815_bat_insertedfunction bd71828_init_hardwarefunction bd71828_charger_get_propertyfunction bd71828_charger_set_propertyfunction bd71828_charger_property_is_writeablefunction bd71828_battery_get_propertyfunction bd71828_battery_set_propertyfunction bd71828_battery_property_is_writeablefunction bd7182x_dcin_removedfunction bd718x7_chg_donefunction bd7182x_dcin_detectedfunction bd71828_vbat_low_resfunction bd71828_vbat_low_detfunction bd71828_temp_bat_hi_detfunction bd71828_temp_bat_hi_resfunction bd71828_temp_bat_low_detfunction bd71828_temp_bat_low_resfunction bd71828_temp_vf_detfunction bd71828_temp_vf_resfunction bd71828_temp_vf125_detfunction bd71828_temp_vf125_resfunction bd7182x_get_irqsfunction bd7182x_get_rsensfunction auto_dcin_limit_showfunction auto_dcin_limit_storefunction bd71828_ac_sysfs_group_visiblefunction bd71828_power_probe
Annotated Snippet
struct pwr_regs {
unsigned int vbat_avg;
unsigned int ibat;
unsigned int ibat_avg;
unsigned int ilim_stat;
unsigned int btemp_vth;
unsigned int chg_state;
unsigned int bat_temp;
unsigned int dcin_set;
unsigned int dcin_stat;
unsigned int dcin_online_mask;
unsigned int dcin_collapse_limit;
unsigned int chg_set1;
unsigned int chg_en;
unsigned int vbat_alm_limit_u;
unsigned int conf;
unsigned int vdcin;
unsigned int vdcin_himask;
};
static const struct pwr_regs pwr_regs_bd71828 = {
.vbat_avg = BD71828_REG_VBAT_U,
.ibat = BD71828_REG_IBAT_U,
.ibat_avg = BD71828_REG_IBAT_AVG_U,
.ilim_stat = BD71828_REG_ILIM_STAT,
.btemp_vth = BD71828_REG_VM_BTMP_U,
.chg_state = BD71828_REG_CHG_STATE,
.bat_temp = BD71828_REG_BAT_TEMP,
.dcin_set = BD71828_REG_DCIN_SET,
.dcin_stat = BD71828_REG_DCIN_STAT,
.dcin_online_mask = BD7182x_MASK_DCIN_DET,
.dcin_collapse_limit = BD71828_REG_DCIN_CLPS,
.chg_set1 = BD71828_REG_CHG_SET1,
.chg_en = BD71828_REG_CHG_EN,
.vbat_alm_limit_u = BD71828_REG_ALM_VBAT_LIMIT_U,
.conf = BD71828_REG_CONF,
.vdcin = BD71828_REG_VDCIN_U,
.vdcin_himask = BD7182x_MASK_VDCIN_U,
};
static const struct pwr_regs pwr_regs_bd71815 = {
.vbat_avg = BD71815_REG_VM_SA_VBAT_U,
/* BD71815 does not have separate current and current avg */
.ibat = BD71815_REG_CC_CURCD_U,
.ibat_avg = BD71815_REG_CC_CURCD_U,
.btemp_vth = BD71815_REG_VM_BTMP,
.chg_state = BD71815_REG_CHG_STATE,
.bat_temp = BD71815_REG_BAT_TEMP,
.dcin_stat = BD71815_REG_DCIN_STAT,
.dcin_online_mask = BD7182x_MASK_DCIN_DET,
.dcin_collapse_limit = BD71815_REG_DCIN_CLPS,
.chg_set1 = BD71815_REG_CHG_SET1,
.chg_en = BD71815_REG_CHG_SET1,
.vbat_alm_limit_u = BD71815_REG_ALM_VBAT_TH_U,
.conf = BD71815_REG_CONF,
.vdcin = BD71815_REG_VM_DCIN_U,
.vdcin_himask = BD7182x_MASK_VDCIN_U,
};
static struct pwr_regs pwr_regs_bd72720 = {
.vbat_avg = BD72720_REG_VM_SA_VBAT_U,
.ibat = BD72720_REG_CC_CURCD_U,
.ibat_avg = BD72720_REG_CC_SA_CURCD_U,
.btemp_vth = BD72720_REG_VM_BTMP_U,
/*
* Note, state 0x40 IMP_CHK. not documented
* on other variants but was still handled in
* existing code. No memory traces as to why.
*/
.chg_state = BD72720_REG_CHG_STATE,
.bat_temp = BD72720_REG_CHG_BAT_TEMP_STAT,
.dcin_stat = BD72720_REG_INT_VBUS_SRC,
.dcin_online_mask = BD72720_MASK_DCIN_DET,
.dcin_collapse_limit = -1, /* Automatic. Setting not supported */
.chg_set1 = BD72720_REG_CHG_SET_1,
.chg_en = BD72720_REG_CHG_EN,
/* 15mV note in data-sheet */
.vbat_alm_limit_u = BD72720_REG_ALM_VBAT_TH_U,
.conf = BD72720_REG_CONF, /* o XSTB, only PON. Seprate slave addr */
.vdcin = BD72720_REG_VM_VBUS_U, /* 10 bits not 11 as with other ICs */
.vdcin_himask = BD72720_MASK_VDCIN_U,
};
struct bd71828_power {
struct regmap *regmap;
enum rohm_chip_type chip_type;
struct device *dev;
struct power_supply *ac;
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/kernel.h`, `linux/mfd/rohm-bd71815.h`, `linux/mfd/rohm-bd71828.h`, `linux/mfd/rohm-bd72720.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/platform_device.h`.
- Detected declarations: `struct pwr_regs`, `struct bd71828_power`, `struct bd7182x_irq_res`, `function bd7182x_write16`, `function bd7182x_read16_himask`, `function bd71828_get_vbat`, `function bd71828_get_current_ds_adc`, `function bd71815_get_temp`, `function bd71828_get_temp`, `function bd71828_charge_status`.
- Atlas domain: Driver Families / drivers/power.
- Implementation status: source implementation candidate.
- 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.