drivers/mfd/mt6397-irq.c
Source file repositories/reference/linux-study-clean/drivers/mfd/mt6397-irq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/mt6397-irq.c- Extension
.c- Size
- 6284 bytes
- Lines
- 239
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hlinux/irq.hlinux/irqdomain.hlinux/module.hlinux/platform_device.hlinux/regmap.hlinux/suspend.hlinux/mfd/mt6323/core.hlinux/mfd/mt6323/registers.hlinux/mfd/mt6328/core.hlinux/mfd/mt6328/registers.hlinux/mfd/mt6331/core.hlinux/mfd/mt6331/registers.hlinux/mfd/mt6397/core.hlinux/mfd/mt6397/registers.h
Detected Declarations
function mt6397_irq_lockfunction mt6397_irq_sync_unlockfunction mt6397_irq_disablefunction mt6397_irq_enablefunction mt6397_irq_set_wakefunction mt6397_irq_handle_regfunction mt6397_irq_threadfunction mt6397_irq_domain_mapfunction mt6397_irq_pm_notifierfunction mt6397_irq_init
Annotated Snippet
if (status & BIT(i)) {
irq = irq_find_mapping(mt6397->irq_domain, irqbase + i);
if (irq)
handle_nested_irq(irq);
}
}
regmap_write(mt6397->regmap, reg, status);
}
static irqreturn_t mt6397_irq_thread(int irq, void *data)
{
struct mt6397_chip *mt6397 = data;
mt6397_irq_handle_reg(mt6397, mt6397->int_status[0], 0);
mt6397_irq_handle_reg(mt6397, mt6397->int_status[1], 16);
if (mt6397->int_status[2])
mt6397_irq_handle_reg(mt6397, mt6397->int_status[2], 32);
return IRQ_HANDLED;
}
static int mt6397_irq_domain_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hw)
{
struct mt6397_chip *mt6397 = d->host_data;
irq_set_chip_data(irq, mt6397);
irq_set_chip_and_handler(irq, &mt6397_irq_chip, handle_level_irq);
irq_set_nested_thread(irq, 1);
irq_set_noprobe(irq);
return 0;
}
static const struct irq_domain_ops mt6397_irq_domain_ops = {
.map = mt6397_irq_domain_map,
};
static int mt6397_irq_pm_notifier(struct notifier_block *notifier,
unsigned long pm_event, void *unused)
{
struct mt6397_chip *chip =
container_of(notifier, struct mt6397_chip, pm_nb);
switch (pm_event) {
case PM_SUSPEND_PREPARE:
regmap_write(chip->regmap,
chip->int_con[0], chip->wake_mask[0]);
regmap_write(chip->regmap,
chip->int_con[1], chip->wake_mask[1]);
if (chip->int_con[2])
regmap_write(chip->regmap,
chip->int_con[2], chip->wake_mask[2]);
enable_irq_wake(chip->irq);
break;
case PM_POST_SUSPEND:
regmap_write(chip->regmap,
chip->int_con[0], chip->irq_masks_cur[0]);
regmap_write(chip->regmap,
chip->int_con[1], chip->irq_masks_cur[1]);
if (chip->int_con[2])
regmap_write(chip->regmap,
chip->int_con[2], chip->irq_masks_cur[2]);
disable_irq_wake(chip->irq);
break;
default:
break;
}
return NOTIFY_DONE;
}
int mt6397_irq_init(struct mt6397_chip *chip)
{
int ret;
mutex_init(&chip->irqlock);
switch (chip->chip_id) {
case MT6323_CHIP_ID:
chip->int_con[0] = MT6323_INT_CON0;
chip->int_con[1] = MT6323_INT_CON1;
chip->int_status[0] = MT6323_INT_STATUS0;
chip->int_status[1] = MT6323_INT_STATUS1;
break;
case MT6328_CHIP_ID:
chip->int_con[0] = MT6328_INT_CON0;
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/module.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/suspend.h`, `linux/mfd/mt6323/core.h`.
- Detected declarations: `function mt6397_irq_lock`, `function mt6397_irq_sync_unlock`, `function mt6397_irq_disable`, `function mt6397_irq_enable`, `function mt6397_irq_set_wake`, `function mt6397_irq_handle_reg`, `function mt6397_irq_thread`, `function mt6397_irq_domain_map`, `function mt6397_irq_pm_notifier`, `function mt6397_irq_init`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: source 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.