arch/arm/mach-omap2/omap-wakeupgen.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-omap2/omap-wakeupgen.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-omap2/omap-wakeupgen.c- Extension
.c- Size
- 16352 bytes
- Lines
- 635
- Domain
- Architecture Layer
- Bucket
- arch/arm
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/init.hlinux/io.hlinux/irq.hlinux/irqchip.hlinux/irqdomain.hlinux/of_address.hlinux/platform_device.hlinux/cpu.hlinux/notifier.hlinux/cpu_pm.homap-wakeupgen.homap-secure.hsoc.homap4-sar-layout.hcommon.hpm.h
Detected Declarations
struct omap_wakeupgen_opsfunction wakeupgen_readlfunction wakeupgen_writelfunction sar_writelfunction _wakeupgen_get_irq_infofunction _wakeupgen_clearfunction _wakeupgen_setfunction wakeupgen_maskfunction wakeupgen_unmaskfunction wakeupgen_irq_set_typefunction _wakeupgen_save_masksfunction _wakeupgen_restore_masksfunction _wakeupgen_set_allfunction wakeupgen_irqmask_allfunction omap4_irq_save_contextfunction omap5_irq_save_contextfunction am43xx_irq_save_contextfunction irq_save_contextfunction irq_sar_clearfunction am43xx_irq_restore_contextfunction irq_restore_contextfunction irq_save_secure_contextfunction omap_wakeupgen_cpu_onlinefunction omap_wakeupgen_cpu_deadfunction irq_hotplug_initfunction irq_hotplug_initfunction irq_pm_initfunction irq_pm_initfunction omap_secure_apis_supportfunction wakeupgen_domain_translatefunction wakeupgen_domain_allocfunction wakeupgen_init
Annotated Snippet
struct omap_wakeupgen_ops {
void (*save_context)(void);
void (*restore_context)(void);
};
static struct omap_wakeupgen_ops *wakeupgen_ops;
/*
* Static helper functions.
*/
static inline u32 wakeupgen_readl(u8 idx, u32 cpu)
{
return readl_relaxed(wakeupgen_base + OMAP_WKG_ENB_A_0 +
(cpu * CPU_ENA_OFFSET) + (idx * 4));
}
static inline void wakeupgen_writel(u32 val, u8 idx, u32 cpu)
{
writel_relaxed(val, wakeupgen_base + OMAP_WKG_ENB_A_0 +
(cpu * CPU_ENA_OFFSET) + (idx * 4));
}
static inline void sar_writel(u32 val, u32 offset, u8 idx)
{
writel_relaxed(val, sar_base + offset + (idx * 4));
}
static inline int _wakeupgen_get_irq_info(u32 irq, u32 *bit_posn, u8 *reg_index)
{
/*
* Each WakeupGen register controls 32 interrupt.
* i.e. 1 bit per SPI IRQ
*/
*reg_index = irq >> 5;
*bit_posn = irq %= 32;
return 0;
}
static void _wakeupgen_clear(unsigned int irq, unsigned int cpu)
{
u32 val, bit_number;
u8 i;
if (_wakeupgen_get_irq_info(irq, &bit_number, &i))
return;
val = wakeupgen_readl(i, cpu);
val &= ~BIT(bit_number);
wakeupgen_writel(val, i, cpu);
}
static void _wakeupgen_set(unsigned int irq, unsigned int cpu)
{
u32 val, bit_number;
u8 i;
if (_wakeupgen_get_irq_info(irq, &bit_number, &i))
return;
val = wakeupgen_readl(i, cpu);
val |= BIT(bit_number);
wakeupgen_writel(val, i, cpu);
}
/*
* Architecture specific Mask extension
*/
static void wakeupgen_mask(struct irq_data *d)
{
unsigned long flags;
raw_spin_lock_irqsave(&wakeupgen_lock, flags);
_wakeupgen_clear(d->hwirq, irq_target_cpu[d->hwirq]);
raw_spin_unlock_irqrestore(&wakeupgen_lock, flags);
irq_chip_mask_parent(d);
}
/*
* Architecture specific Unmask extension
*/
static void wakeupgen_unmask(struct irq_data *d)
{
unsigned long flags;
raw_spin_lock_irqsave(&wakeupgen_lock, flags);
_wakeupgen_set(d->hwirq, irq_target_cpu[d->hwirq]);
raw_spin_unlock_irqrestore(&wakeupgen_lock, flags);
irq_chip_unmask_parent(d);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/io.h`, `linux/irq.h`, `linux/irqchip.h`, `linux/irqdomain.h`, `linux/of_address.h`, `linux/platform_device.h`.
- Detected declarations: `struct omap_wakeupgen_ops`, `function wakeupgen_readl`, `function wakeupgen_writel`, `function sar_writel`, `function _wakeupgen_get_irq_info`, `function _wakeupgen_clear`, `function _wakeupgen_set`, `function wakeupgen_mask`, `function wakeupgen_unmask`, `function wakeupgen_irq_set_type`.
- Atlas domain: Architecture Layer / arch/arm.
- Implementation status: source 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.