drivers/mfd/tps6594-core.c
Source file repositories/reference/linux-study-clean/drivers/mfd/tps6594-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/tps6594-core.c- Extension
.c- Size
- 34956 bytes
- Lines
- 802
- Domain
- Driver Families
- Bucket
- drivers/mfd
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/completion.hlinux/delay.hlinux/interrupt.hlinux/module.hlinux/of.hlinux/reboot.hlinux/mfd/core.hlinux/mfd/tps6594.h
Detected Declarations
function tps6594_get_irq_regfunction tps65224_get_irq_regfunction tps6594_handle_post_irqfunction tps6594_check_crc_modefunction tps6594_set_crc_featurefunction tps6594_enable_crcfunction tps6594_power_off_handlerfunction tps6594_device_initexport tps6594_volatile_tableexport tps65224_volatile_tableexport tps6594_device_init
Annotated Snippet
if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) {
regmap_reg = TPS6594_REG_INT_FSM_ERR;
mask_val = TPS6594_BIT_COMM_ERR_INT;
} else {
regmap_reg = TPS6594_REG_INT_COMM_ERR;
mask_val = TPS6594_BIT_COMM_ADR_ERR_INT;
}
ret = regmap_write_bits(tps->regmap, regmap_reg, mask_val, mask_val);
}
return ret;
};
static struct regmap_irq_chip tps6594_irq_chip = {
.ack_base = TPS6594_REG_INT_BUCK1_2,
.ack_invert = 1,
.clear_ack = 1,
.init_ack_masked = 1,
.num_regs = ARRAY_SIZE(tps6594_irq_reg),
.irqs = tps6594_irqs,
.num_irqs = ARRAY_SIZE(tps6594_irqs),
.get_irq_reg = tps6594_get_irq_reg,
.handle_post_irq = tps6594_handle_post_irq,
};
static struct regmap_irq_chip tps65224_irq_chip = {
.ack_base = TPS6594_REG_INT_BUCK,
.ack_invert = 1,
.clear_ack = 1,
.init_ack_masked = 1,
.num_regs = ARRAY_SIZE(tps65224_irq_reg),
.irqs = tps65224_irqs,
.num_irqs = ARRAY_SIZE(tps65224_irqs),
.get_irq_reg = tps65224_get_irq_reg,
.handle_post_irq = tps6594_handle_post_irq,
};
static struct regmap_irq_chip tps652g1_irq_chip = {
.ack_base = TPS6594_REG_INT_BUCK,
.ack_invert = 1,
.clear_ack = 1,
.init_ack_masked = 1,
.num_regs = ARRAY_SIZE(tps65224_irq_reg),
.irqs = tps652g1_irqs,
.num_irqs = ARRAY_SIZE(tps652g1_irqs),
.get_irq_reg = tps65224_get_irq_reg,
.handle_post_irq = tps6594_handle_post_irq,
};
static const struct regmap_range tps6594_volatile_ranges[] = {
regmap_reg_range(TPS6594_REG_INT_TOP, TPS6594_REG_STAT_READBACK_ERR),
regmap_reg_range(TPS6594_REG_RTC_STATUS, TPS6594_REG_RTC_STATUS),
};
const struct regmap_access_table tps6594_volatile_table = {
.yes_ranges = tps6594_volatile_ranges,
.n_yes_ranges = ARRAY_SIZE(tps6594_volatile_ranges),
};
EXPORT_SYMBOL_GPL(tps6594_volatile_table);
static const struct regmap_range tps65224_volatile_ranges[] = {
regmap_reg_range(TPS6594_REG_INT_TOP, TPS6594_REG_STAT_SEVERE_ERR),
};
const struct regmap_access_table tps65224_volatile_table = {
.yes_ranges = tps65224_volatile_ranges,
.n_yes_ranges = ARRAY_SIZE(tps65224_volatile_ranges),
};
EXPORT_SYMBOL_GPL(tps65224_volatile_table);
static int tps6594_check_crc_mode(struct tps6594 *tps, bool primary_pmic)
{
int ret;
unsigned int regmap_reg, mask_val;
if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) {
regmap_reg = TPS6594_REG_CONFIG_2;
mask_val = TPS65224_BIT_I2C1_SPI_CRC_EN;
} else {
regmap_reg = TPS6594_REG_SERIAL_IF_CONFIG;
mask_val = TPS6594_BIT_I2C1_SPI_CRC_EN;
}
/*
* Check if CRC is enabled.
* Once CRC is enabled, it can't be disabled until next power cycle.
*/
tps->use_crc = true;
ret = regmap_test_bits(tps->regmap, regmap_reg, mask_val);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/completion.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/module.h`, `linux/of.h`, `linux/reboot.h`, `linux/mfd/core.h`.
- Detected declarations: `function tps6594_get_irq_reg`, `function tps65224_get_irq_reg`, `function tps6594_handle_post_irq`, `function tps6594_check_crc_mode`, `function tps6594_set_crc_feature`, `function tps6594_enable_crc`, `function tps6594_power_off_handler`, `function tps6594_device_init`, `export tps6594_volatile_table`, `export tps65224_volatile_table`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: integration 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.