drivers/mfd/atc260x-core.c
Source file repositories/reference/linux-study-clean/drivers/mfd/atc260x-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/atc260x-core.c- Extension
.c- Size
- 9258 bytes
- Lines
- 308
- 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.
- 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/mfd/atc260x/core.hlinux/mfd/core.hlinux/module.hlinux/of.hlinux/regmap.h
Detected Declarations
struct atc260x_init_regsfunction regmap_lock_mutexfunction regmap_unlock_mutexfunction atc260x_cmu_resetfunction atc260x_dev_initfunction atc260x_match_devicefunction atc260x_device_probeexport atc260x_match_deviceexport atc260x_device_probe
Annotated Snippet
struct atc260x_init_regs {
unsigned int cmu_devrst;
unsigned int cmu_devrst_ints;
unsigned int ints_msk;
unsigned int pad_en;
unsigned int pad_en_extirq;
};
static void regmap_lock_mutex(void *__mutex)
{
struct mutex *mutex = __mutex;
/*
* Using regmap within an atomic context (e.g. accessing a PMIC when
* powering system down) is normally allowed only if the regmap type
* is MMIO and the regcache type is either REGCACHE_NONE or
* REGCACHE_FLAT. For slow buses like I2C and SPI, the regmap is
* internally protected by a mutex which is acquired non-atomically.
*
* Let's improve this by using a customized locking scheme inspired
* from I2C atomic transfer. See i2c_in_atomic_xfer_mode() for a
* starting point.
*/
if (system_state > SYSTEM_RUNNING && irqs_disabled())
mutex_trylock(mutex);
else
mutex_lock(mutex);
}
static void regmap_unlock_mutex(void *__mutex)
{
struct mutex *mutex = __mutex;
mutex_unlock(mutex);
}
static const struct regmap_config atc2603c_regmap_config = {
.reg_bits = 8,
.val_bits = 16,
.max_register = ATC2603C_SADDR,
.cache_type = REGCACHE_NONE,
};
static const struct regmap_config atc2609a_regmap_config = {
.reg_bits = 8,
.val_bits = 16,
.max_register = ATC2609A_SADDR,
.cache_type = REGCACHE_NONE,
};
static const struct regmap_irq atc2603c_regmap_irqs[] = {
REGMAP_IRQ_REG(ATC2603C_IRQ_AUDIO, 0, ATC2603C_INTS_MSK_AUDIO),
REGMAP_IRQ_REG(ATC2603C_IRQ_OV, 0, ATC2603C_INTS_MSK_OV),
REGMAP_IRQ_REG(ATC2603C_IRQ_OC, 0, ATC2603C_INTS_MSK_OC),
REGMAP_IRQ_REG(ATC2603C_IRQ_OT, 0, ATC2603C_INTS_MSK_OT),
REGMAP_IRQ_REG(ATC2603C_IRQ_UV, 0, ATC2603C_INTS_MSK_UV),
REGMAP_IRQ_REG(ATC2603C_IRQ_ALARM, 0, ATC2603C_INTS_MSK_ALARM),
REGMAP_IRQ_REG(ATC2603C_IRQ_ONOFF, 0, ATC2603C_INTS_MSK_ONOFF),
REGMAP_IRQ_REG(ATC2603C_IRQ_SGPIO, 0, ATC2603C_INTS_MSK_SGPIO),
REGMAP_IRQ_REG(ATC2603C_IRQ_IR, 0, ATC2603C_INTS_MSK_IR),
REGMAP_IRQ_REG(ATC2603C_IRQ_REMCON, 0, ATC2603C_INTS_MSK_REMCON),
REGMAP_IRQ_REG(ATC2603C_IRQ_POWER_IN, 0, ATC2603C_INTS_MSK_POWERIN),
};
static const struct regmap_irq atc2609a_regmap_irqs[] = {
REGMAP_IRQ_REG(ATC2609A_IRQ_AUDIO, 0, ATC2609A_INTS_MSK_AUDIO),
REGMAP_IRQ_REG(ATC2609A_IRQ_OV, 0, ATC2609A_INTS_MSK_OV),
REGMAP_IRQ_REG(ATC2609A_IRQ_OC, 0, ATC2609A_INTS_MSK_OC),
REGMAP_IRQ_REG(ATC2609A_IRQ_OT, 0, ATC2609A_INTS_MSK_OT),
REGMAP_IRQ_REG(ATC2609A_IRQ_UV, 0, ATC2609A_INTS_MSK_UV),
REGMAP_IRQ_REG(ATC2609A_IRQ_ALARM, 0, ATC2609A_INTS_MSK_ALARM),
REGMAP_IRQ_REG(ATC2609A_IRQ_ONOFF, 0, ATC2609A_INTS_MSK_ONOFF),
REGMAP_IRQ_REG(ATC2609A_IRQ_WKUP, 0, ATC2609A_INTS_MSK_WKUP),
REGMAP_IRQ_REG(ATC2609A_IRQ_IR, 0, ATC2609A_INTS_MSK_IR),
REGMAP_IRQ_REG(ATC2609A_IRQ_REMCON, 0, ATC2609A_INTS_MSK_REMCON),
REGMAP_IRQ_REG(ATC2609A_IRQ_POWER_IN, 0, ATC2609A_INTS_MSK_POWERIN),
};
static const struct regmap_irq_chip atc2603c_regmap_irq_chip = {
.name = "atc2603c",
.irqs = atc2603c_regmap_irqs,
.num_irqs = ARRAY_SIZE(atc2603c_regmap_irqs),
.num_regs = 1,
.status_base = ATC2603C_INTS_PD,
.unmask_base = ATC2603C_INTS_MSK,
};
static const struct regmap_irq_chip atc2609a_regmap_irq_chip = {
.name = "atc2609a",
.irqs = atc2609a_regmap_irqs,
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/mfd/atc260x/core.h`, `linux/mfd/core.h`, `linux/module.h`, `linux/of.h`, `linux/regmap.h`.
- Detected declarations: `struct atc260x_init_regs`, `function regmap_lock_mutex`, `function regmap_unlock_mutex`, `function atc260x_cmu_reset`, `function atc260x_dev_init`, `function atc260x_match_device`, `function atc260x_device_probe`, `export atc260x_match_device`, `export atc260x_device_probe`.
- 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.
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.