drivers/power/supply/tps65090-charger.c
Source file repositories/reference/linux-study-clean/drivers/power/supply/tps65090-charger.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/supply/tps65090-charger.c- Extension
.c- Size
- 8560 bytes
- Lines
- 353
- 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/delay.hlinux/err.hlinux/freezer.hlinux/init.hlinux/interrupt.hlinux/kernel.hlinux/kthread.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/power_supply.hlinux/slab.hlinux/mfd/tps65090.h
Detected Declarations
struct tps65090_chargerfunction tps65090_low_chrg_currentfunction tps65090_enable_chargingfunction tps65090_config_chargerfunction tps65090_ac_get_propertyfunction tps65090_charger_isrfunction tps65090_parse_dt_charger_datafunction tps65090_charger_poll_taskfunction tps65090_charger_probefunction tps65090_charger_remove
Annotated Snippet
struct tps65090_charger {
struct device *dev;
int ac_online;
int prev_ac_online;
int irq;
struct task_struct *poll_task;
bool passive_mode;
struct power_supply *ac;
struct tps65090_platform_data *pdata;
};
static enum power_supply_property tps65090_ac_props[] = {
POWER_SUPPLY_PROP_ONLINE,
};
static int tps65090_low_chrg_current(struct tps65090_charger *charger)
{
int ret;
if (charger->passive_mode)
return 0;
ret = tps65090_write(charger->dev->parent, TPS65090_REG_CG_CTRL5,
TPS65090_NOITERM);
if (ret < 0) {
dev_err(charger->dev, "%s(): error reading in register 0x%x\n",
__func__, TPS65090_REG_CG_CTRL5);
return ret;
}
return 0;
}
static int tps65090_enable_charging(struct tps65090_charger *charger)
{
int ret;
uint8_t ctrl0 = 0;
if (charger->passive_mode)
return 0;
ret = tps65090_read(charger->dev->parent, TPS65090_REG_CG_CTRL0,
&ctrl0);
if (ret < 0) {
dev_err(charger->dev, "%s(): error reading in register 0x%x\n",
__func__, TPS65090_REG_CG_CTRL0);
return ret;
}
ret = tps65090_write(charger->dev->parent, TPS65090_REG_CG_CTRL0,
(ctrl0 | TPS65090_CHARGER_ENABLE));
if (ret < 0) {
dev_err(charger->dev, "%s(): error writing in register 0x%x\n",
__func__, TPS65090_REG_CG_CTRL0);
return ret;
}
return 0;
}
static int tps65090_config_charger(struct tps65090_charger *charger)
{
uint8_t intrmask = 0;
int ret;
if (charger->passive_mode)
return 0;
if (charger->pdata->enable_low_current_chrg) {
ret = tps65090_low_chrg_current(charger);
if (ret < 0) {
dev_err(charger->dev,
"error configuring low charge current\n");
return ret;
}
}
/* Enable the VACG interrupt for AC power detect */
ret = tps65090_read(charger->dev->parent, TPS65090_REG_INTR_MASK,
&intrmask);
if (ret < 0) {
dev_err(charger->dev, "%s(): error reading in register 0x%x\n",
__func__, TPS65090_REG_INTR_MASK);
return ret;
}
ret = tps65090_write(charger->dev->parent, TPS65090_REG_INTR_MASK,
(intrmask | TPS65090_VACG));
if (ret < 0) {
dev_err(charger->dev, "%s(): error writing in register 0x%x\n",
__func__, TPS65090_REG_CG_CTRL0);
return ret;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/err.h`, `linux/freezer.h`, `linux/init.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/kthread.h`, `linux/module.h`.
- Detected declarations: `struct tps65090_charger`, `function tps65090_low_chrg_current`, `function tps65090_enable_charging`, `function tps65090_config_charger`, `function tps65090_ac_get_property`, `function tps65090_charger_isr`, `function tps65090_parse_dt_charger_data`, `function tps65090_charger_poll_task`, `function tps65090_charger_probe`, `function tps65090_charger_remove`.
- 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.