arch/arm/common/locomo.c
Source file repositories/reference/linux-study-clean/arch/arm/common/locomo.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/common/locomo.c- Extension
.c- Size
- 23519 bytes
- Lines
- 887
- Domain
- Architecture Layer
- Bucket
- arch/arm
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/module.hlinux/init.hlinux/kernel.hlinux/delay.hlinux/errno.hlinux/ioport.hlinux/platform_device.hlinux/slab.hlinux/spinlock.hlinux/io.hasm/irq.hasm/mach/irq.hasm/hardware/locomo.h
Detected Declarations
struct locomostruct locomo_dev_infostruct locomo_save_datafunction locomo_handlerfunction locomo_ack_irqfunction locomo_unmask_irqfunction locomo_setup_irqfunction locomo_dev_releasefunction locomo_init_one_childfunction locomo_suspendfunction locomo_resumefunction __locomo_probefunction locomo_remove_childfunction __locomo_removefunction locomo_probefunction locomo_removefunction driverfunction locomo_gpio_set_dirfunction locomo_gpio_read_levelfunction locomo_gpio_read_outputfunction locomo_gpio_writefunction locomo_m62332_sendbitfunction locomo_m62332_senddatafunction locomo_frontlight_setfunction locomo_matchfunction locomo_bus_probefunction locomo_bus_removefunction locomo_driver_registerfunction locomo_driver_unregisterfunction locomo_initfunction locomo_exitmodule init locomo_initexport locomo_gpio_set_direxport locomo_gpio_read_levelexport locomo_gpio_read_outputexport locomo_gpio_writeexport locomo_m62332_senddataexport locomo_frontlight_setexport locomo_driver_registerexport locomo_driver_unregister
Annotated Snippet
static const struct bus_type locomo_bus_type;
struct locomo_dev_info {
unsigned long offset;
unsigned long length;
unsigned int devid;
unsigned int irq[1];
const char * name;
};
/* All the locomo devices. If offset is non-zero, the mapbase for the
* locomo_dev will be set to the chip base plus offset. If offset is
* zero, then the mapbase for the locomo_dev will be set to zero. An
* offset of zero means the device only uses GPIOs or other helper
* functions inside this file */
static struct locomo_dev_info locomo_devices[] = {
{
.devid = LOCOMO_DEVID_KEYBOARD,
.irq = { IRQ_LOCOMO_KEY },
.name = "locomo-keyboard",
.offset = LOCOMO_KEYBOARD,
.length = 16,
},
{
.devid = LOCOMO_DEVID_FRONTLIGHT,
.irq = {},
.name = "locomo-frontlight",
.offset = LOCOMO_FRONTLIGHT,
.length = 8,
},
{
.devid = LOCOMO_DEVID_BACKLIGHT,
.irq = {},
.name = "locomo-backlight",
.offset = LOCOMO_BACKLIGHT,
.length = 8,
},
{
.devid = LOCOMO_DEVID_AUDIO,
.irq = {},
.name = "locomo-audio",
.offset = LOCOMO_AUDIO,
.length = 4,
},
{
.devid = LOCOMO_DEVID_LED,
.irq = {},
.name = "locomo-led",
.offset = LOCOMO_LED,
.length = 8,
},
{
.devid = LOCOMO_DEVID_UART,
.irq = {},
.name = "locomo-uart",
.offset = 0,
.length = 0,
},
{
.devid = LOCOMO_DEVID_SPI,
.irq = {},
.name = "locomo-spi",
.offset = LOCOMO_SPI,
.length = 0x30,
},
};
static void locomo_handler(struct irq_desc *desc)
{
struct locomo *lchip = irq_desc_get_handler_data(desc);
int req, i;
/* Acknowledge the parent IRQ */
desc->irq_data.chip->irq_ack(&desc->irq_data);
/* check why this interrupt was generated */
req = locomo_readl(lchip->base + LOCOMO_ICR) & 0x0f00;
if (req) {
unsigned int irq;
/* generate the next interrupt(s) */
irq = lchip->irq_base;
for (i = 0; i <= 3; i++, irq++) {
if (req & (0x0100 << i)) {
generic_handle_irq(irq);
}
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/kernel.h`, `linux/delay.h`, `linux/errno.h`, `linux/ioport.h`, `linux/platform_device.h`, `linux/slab.h`.
- Detected declarations: `struct locomo`, `struct locomo_dev_info`, `struct locomo_save_data`, `function locomo_handler`, `function locomo_ack_irq`, `function locomo_unmask_irq`, `function locomo_setup_irq`, `function locomo_dev_release`, `function locomo_init_one_child`, `function locomo_suspend`.
- Atlas domain: Architecture Layer / arch/arm.
- Implementation status: pattern 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.