drivers/mfd/stmpe.c
Source file repositories/reference/linux-study-clean/drivers/mfd/stmpe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/stmpe.c- Extension
.c- Size
- 38921 bytes
- Lines
- 1529
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/err.hlinux/gpio/consumer.hlinux/export.hlinux/kernel.hlinux/interrupt.hlinux/irq.hlinux/irqdomain.hlinux/of.hlinux/pm.hlinux/slab.hlinux/mfd/core.hlinux/delay.hlinux/regulator/consumer.hstmpe.h
Detected Declarations
struct stmpe_platform_datafunction __stmpe_enablefunction __stmpe_disablefunction __stmpe_reg_readfunction __stmpe_reg_writefunction __stmpe_set_bitsfunction __stmpe_block_readfunction __stmpe_block_writefunction stmpe_enablefunction stmpe_disablefunction stmpe_reg_readfunction stmpe_reg_writefunction stmpe_set_bitsfunction stmpe_block_readfunction stmpe_block_writefunction stmpe_set_altfuncfunction stmpe801_enablefunction stmpe811_enablefunction stmpe811_adc_common_initfunction stmpe811_get_altfuncfunction stmpe1600_enablefunction stmpe_round_timeoutfunction stmpe_autosleepfunction stmpe1601_autosleepfunction stmpe1601_enablefunction stmpe1601_get_altfuncfunction stmpe1801_enablefunction stmpe_resetfunction stmpe24xx_enablefunction stmpe24xx_get_altfuncfunction stmpe_irqfunction stmpe_irq_lockfunction stmpe_irq_sync_unlockfunction stmpe_irq_maskfunction stmpe_irq_unmaskfunction stmpe_irq_mapfunction stmpe_irq_unmapfunction stmpe_irq_initfunction stmpe_chip_initfunction stmpe_add_devicefunction stmpe_devices_initfunction stmpe_of_probefunction for_each_available_child_of_nodefunction stmpe_probefunction stmpe_removefunction stmpe_suspendfunction stmpe_resumeexport stmpe_enable
Annotated Snippet
struct stmpe_platform_data {
int id;
unsigned int blocks;
unsigned int irq_trigger;
bool autosleep;
int autosleep_timeout;
};
static int __stmpe_enable(struct stmpe *stmpe, unsigned int blocks)
{
return stmpe->variant->enable(stmpe, blocks, true);
}
static int __stmpe_disable(struct stmpe *stmpe, unsigned int blocks)
{
return stmpe->variant->enable(stmpe, blocks, false);
}
static int __stmpe_reg_read(struct stmpe *stmpe, u8 reg)
{
int ret;
ret = stmpe->ci->read_byte(stmpe, reg);
if (ret < 0)
dev_err(stmpe->dev, "failed to read reg %#x: %d\n", reg, ret);
dev_vdbg(stmpe->dev, "rd: reg %#x => data %#x\n", reg, ret);
return ret;
}
static int __stmpe_reg_write(struct stmpe *stmpe, u8 reg, u8 val)
{
int ret;
dev_vdbg(stmpe->dev, "wr: reg %#x <= %#x\n", reg, val);
ret = stmpe->ci->write_byte(stmpe, reg, val);
if (ret < 0)
dev_err(stmpe->dev, "failed to write reg %#x: %d\n", reg, ret);
return ret;
}
static int __stmpe_set_bits(struct stmpe *stmpe, u8 reg, u8 mask, u8 val)
{
int ret;
ret = __stmpe_reg_read(stmpe, reg);
if (ret < 0)
return ret;
ret &= ~mask;
ret |= val;
return __stmpe_reg_write(stmpe, reg, ret);
}
static int __stmpe_block_read(struct stmpe *stmpe, u8 reg, u8 length,
u8 *values)
{
int ret;
ret = stmpe->ci->read_block(stmpe, reg, length, values);
if (ret < 0)
dev_err(stmpe->dev, "failed to read regs %#x: %d\n", reg, ret);
dev_vdbg(stmpe->dev, "rd: reg %#x (%d) => ret %#x\n", reg, length, ret);
stmpe_dump_bytes("stmpe rd: ", values, length);
return ret;
}
static int __stmpe_block_write(struct stmpe *stmpe, u8 reg, u8 length,
const u8 *values)
{
int ret;
dev_vdbg(stmpe->dev, "wr: regs %#x (%d)\n", reg, length);
stmpe_dump_bytes("stmpe wr: ", values, length);
ret = stmpe->ci->write_block(stmpe, reg, length, values);
if (ret < 0)
dev_err(stmpe->dev, "failed to write regs %#x: %d\n", reg, ret);
return ret;
}
/**
* stmpe_enable - enable blocks on an STMPE device
Annotation
- Immediate include surface: `linux/err.h`, `linux/gpio/consumer.h`, `linux/export.h`, `linux/kernel.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/of.h`.
- Detected declarations: `struct stmpe_platform_data`, `function __stmpe_enable`, `function __stmpe_disable`, `function __stmpe_reg_read`, `function __stmpe_reg_write`, `function __stmpe_set_bits`, `function __stmpe_block_read`, `function __stmpe_block_write`, `function stmpe_enable`, `function stmpe_disable`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.