drivers/mfd/tps65219.c
Source file repositories/reference/linux-study-clean/drivers/mfd/tps65219.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/tps65219.c- Extension
.c- Size
- 27417 bytes
- Lines
- 576
- Domain
- Driver Families
- Bucket
- drivers/mfd
- 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/i2c.hlinux/reboot.hlinux/regmap.hlinux/mfd/core.hlinux/mfd/tps65219.h
Detected Declarations
struct tps65219_chip_datafunction tps65219_warm_resetfunction tps65219_cold_resetfunction tps65219_soft_shutdownfunction tps65219_power_off_handlerfunction tps65219_restartfunction tps65219_restart_handlerfunction tps65219_probe
Annotated Snippet
struct tps65219_chip_data {
const struct regmap_irq_chip *irq_chip;
const struct mfd_cell *cells;
int n_cells;
};
static const struct tps65219_chip_data chip_info_table[] = {
[TPS65214] = {
.irq_chip = &tps65214_irq_chip,
.cells = tps65214_cells,
.n_cells = ARRAY_SIZE(tps65214_cells),
},
[TPS65215] = {
.irq_chip = &tps65215_irq_chip,
.cells = tps65215_cells,
.n_cells = ARRAY_SIZE(tps65215_cells),
},
[TPS65219] = {
.irq_chip = &tps65219_irq_chip,
.cells = tps65219_cells,
.n_cells = ARRAY_SIZE(tps65219_cells),
},
};
static int tps65219_probe(struct i2c_client *client)
{
struct tps65219 *tps;
const struct tps65219_chip_data *pmic;
unsigned int chip_id;
bool pwr_button;
int ret;
tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
if (!tps)
return -ENOMEM;
i2c_set_clientdata(client, tps);
tps->dev = &client->dev;
chip_id = (uintptr_t)i2c_get_match_data(client);
pmic = &chip_info_table[chip_id];
tps->regmap = devm_regmap_init_i2c(client, &tps65219_regmap_config);
if (IS_ERR(tps->regmap)) {
ret = PTR_ERR(tps->regmap);
dev_err(tps->dev, "Failed to allocate register map: %d\n", ret);
return ret;
}
if (chip_id == TPS65214) {
ret = i2c_smbus_write_byte_data(client, TPS65214_REG_LOCK,
TPS65214_LOCK_ACCESS_CMD);
if (ret) {
dev_err(tps->dev, "Failed to unlock registers %d\n", ret);
return ret;
}
}
ret = devm_regmap_add_irq_chip(tps->dev, tps->regmap, client->irq,
IRQF_ONESHOT, 0, pmic->irq_chip,
&tps->irq_data);
if (ret)
return ret;
ret = devm_mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO,
pmic->cells, pmic->n_cells,
NULL, 0, regmap_irq_get_domain(tps->irq_data));
if (ret) {
dev_err(tps->dev, "Failed to add child devices: %d\n", ret);
return ret;
}
pwr_button = of_property_read_bool(tps->dev->of_node, "ti,power-button");
if (pwr_button) {
ret = devm_mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO,
&tps65219_pwrbutton_cell, 1, NULL, 0,
regmap_irq_get_domain(tps->irq_data));
if (ret) {
dev_err(tps->dev, "Failed to add power-button: %d\n", ret);
return ret;
}
}
ret = devm_register_restart_handler(tps->dev,
tps65219_restart_handler,
tps);
if (ret) {
dev_err(tps->dev, "cannot register restart handler, %d\n", ret);
return ret;
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/reboot.h`, `linux/regmap.h`, `linux/mfd/core.h`, `linux/mfd/tps65219.h`.
- Detected declarations: `struct tps65219_chip_data`, `function tps65219_warm_reset`, `function tps65219_cold_reset`, `function tps65219_soft_shutdown`, `function tps65219_power_off_handler`, `function tps65219_restart`, `function tps65219_restart_handler`, `function tps65219_probe`.
- Atlas domain: Driver Families / drivers/mfd.
- 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.