arch/arm/mach-footbridge/netwinder-hw.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-footbridge/netwinder-hw.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-footbridge/netwinder-hw.c- Extension
.c- Size
- 14427 bytes
- Lines
- 773
- Domain
- Architecture Layer
- Bucket
- arch/arm
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- 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/module.hlinux/ioport.hlinux/kernel.hlinux/delay.hlinux/init.hlinux/io.hlinux/spinlock.hlinux/slab.hlinux/leds.hasm/hardware/dec21285.hasm/mach-types.hasm/setup.hasm/system_misc.hasm/mach/arch.hcommon.h
Detected Declarations
struct netwinder_ledfunction Copyrightfunction wb977_closefunction wb977_wbfunction wb977_wwfunction nw_gpio_modify_opfunction __gpio_modify_iofunction nw_gpio_modify_iofunction nw_gpio_readfunction wb977_init_globalfunction wb977_init_printerfunction wb977_init_keyboardfunction wb977_init_irdafunction wb977_init_gpiofunction wb977_initfunction nw_cpld_modifyfunction cpld_initfunction rwa010_unlockfunction rwa010_read_identfunction rwa010_global_initfunction rwa010_game_port_initfunction rwa010_waveartist_initfunction rwa010_soundblaster_initfunction rwa010_soundblaster_resetfunction rwa010_initfunction nw_hw_initfunction fixup_netwinderfunction netwinder_restartfunction netwinder_led_setfunction netwinder_led_getfunction netwinder_leds_initmodule init netwinder_leds_initexport nw_gpio_lockexport nw_gpio_modify_opexport nw_gpio_modify_ioexport nw_gpio_readexport nw_cpld_modify
Annotated Snippet
struct netwinder_led {
struct led_classdev cdev;
u8 mask;
};
/*
* The triggers lines up below will only be used if the
* LED triggers are compiled in.
*/
static const struct {
const char *name;
const char *trigger;
} netwinder_leds[] = {
{ "netwinder:green", "heartbeat", },
{ "netwinder:red", "cpu0", },
};
/*
* The LED control in Netwinder is reversed:
* - setting bit means turn off LED
* - clearing bit means turn on LED
*/
static void netwinder_led_set(struct led_classdev *cdev,
enum led_brightness b)
{
struct netwinder_led *led = container_of(cdev,
struct netwinder_led, cdev);
unsigned long flags;
u32 reg;
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
reg = nw_gpio_read();
if (b != LED_OFF)
reg &= ~led->mask;
else
reg |= led->mask;
nw_gpio_modify_op(led->mask, reg);
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
}
static enum led_brightness netwinder_led_get(struct led_classdev *cdev)
{
struct netwinder_led *led = container_of(cdev,
struct netwinder_led, cdev);
unsigned long flags;
u32 reg;
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
reg = nw_gpio_read();
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
return (reg & led->mask) ? LED_OFF : LED_FULL;
}
static int __init netwinder_leds_init(void)
{
int i;
if (!machine_is_netwinder())
return -ENODEV;
for (i = 0; i < ARRAY_SIZE(netwinder_leds); i++) {
struct netwinder_led *led;
led = kzalloc_obj(*led);
if (!led)
break;
led->cdev.name = netwinder_leds[i].name;
led->cdev.brightness_set = netwinder_led_set;
led->cdev.brightness_get = netwinder_led_get;
led->cdev.default_trigger = netwinder_leds[i].trigger;
if (i == 0)
led->mask = GPIO_GREEN_LED;
else
led->mask = GPIO_RED_LED;
if (led_classdev_register(NULL, &led->cdev) < 0) {
kfree(led);
break;
}
}
return 0;
}
/*
* Since we may have triggers on any subsystem, defer registration
* until after subsystem_init.
Annotation
- Immediate include surface: `linux/module.h`, `linux/ioport.h`, `linux/kernel.h`, `linux/delay.h`, `linux/init.h`, `linux/io.h`, `linux/spinlock.h`, `linux/slab.h`.
- Detected declarations: `struct netwinder_led`, `function Copyright`, `function wb977_close`, `function wb977_wb`, `function wb977_ww`, `function nw_gpio_modify_op`, `function __gpio_modify_io`, `function nw_gpio_modify_io`, `function nw_gpio_read`, `function wb977_init_global`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.