drivers/net/dsa/mv88e6xxx/leds.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/mv88e6xxx/leds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/mv88e6xxx/leds.c- Extension
.c- Size
- 22292 bytes
- Lines
- 849
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/leds.hlinux/property.hchip.hglobal2.hport.h
Detected Declarations
struct mv88e6xxx_led_hwconfigfunction mv88e6xxx_port_led_writefunction mv88e6xxx_port_led_readfunction mv88e6xxx_led_brightness_setfunction mv88e6xxx_led0_brightness_set_blockingfunction mv88e6xxx_led1_brightness_set_blockingfunction mv88e6xxx_led_match_selectorfunction mv88e6xxx_led_match_rulefunction mv88e6xxx_led_get_selectorfunction mv88e6xxx_led_set_blinking_periodfunction mv88e6xxx_led_blink_setfunction mv88e6xxx_led0_blink_setfunction mv88e6xxx_led1_blink_setfunction mv88e6xxx_led0_hw_control_is_supportedfunction mv88e6xxx_led1_hw_control_is_supportedfunction mv88e6xxx_led_hw_control_setfunction mv88e6xxx_led_hw_control_getfunction mv88e6xxx_led0_hw_control_setfunction mv88e6xxx_led1_hw_control_setfunction mv88e6xxx_led0_hw_control_getfunction mv88e6xxx_led1_hw_control_getfunction mv88e6xxx_led0_hw_control_get_devicefunction mv88e6xxx_led1_hw_control_get_devicefunction mv88e6xxx_port_setup_ledsfunction fwnode_for_each_child_node
Annotated Snippet
struct mv88e6xxx_led_hwconfig {
int led;
u8 portmask;
unsigned long rules;
bool fiber;
bool blink_activity;
u16 selector;
};
/* The following is a lookup table to check what rules we can support on a
* certain LED given restrictions such as that some rules only work with fiber
* (SFP) connections and some blink on activity by default.
*/
#define MV88E6XXX_PORTS_0_3 (BIT(0) | BIT(1) | BIT(2) | BIT(3))
#define MV88E6XXX_PORTS_4_5 (BIT(4) | BIT(5))
#define MV88E6XXX_PORT_4 BIT(4)
#define MV88E6XXX_PORT_5 BIT(5)
/* Entries are listed in selector order.
*
* These configurations vary across different switch families, list
* different tables per-family here.
*/
static const struct mv88e6xxx_led_hwconfig mv88e6352_led_hwconfigs[] = {
{
.led = 0,
.portmask = MV88E6XXX_PORT_4,
.rules = BIT(TRIGGER_NETDEV_LINK),
.blink_activity = true,
.selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL0,
},
{
.led = 1,
.portmask = MV88E6XXX_PORT_5,
.rules = BIT(TRIGGER_NETDEV_LINK_1000),
.blink_activity = true,
.selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL0,
},
{
.led = 0,
.portmask = MV88E6XXX_PORTS_0_3,
.rules = BIT(TRIGGER_NETDEV_LINK_100) | BIT(TRIGGER_NETDEV_LINK_1000),
.blink_activity = true,
.selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL1,
},
{
.led = 1,
.portmask = MV88E6XXX_PORTS_0_3,
.rules = BIT(TRIGGER_NETDEV_LINK_10) | BIT(TRIGGER_NETDEV_LINK_100),
.blink_activity = true,
.selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL1,
},
{
.led = 0,
.portmask = MV88E6XXX_PORTS_4_5,
.rules = BIT(TRIGGER_NETDEV_LINK_100),
.blink_activity = true,
.fiber = true,
.selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL1,
},
{
.led = 1,
.portmask = MV88E6XXX_PORTS_4_5,
.rules = BIT(TRIGGER_NETDEV_LINK_1000),
.blink_activity = true,
.fiber = true,
.selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL1,
},
{
.led = 0,
.portmask = MV88E6XXX_PORTS_0_3,
.rules = BIT(TRIGGER_NETDEV_LINK_1000),
.blink_activity = true,
.selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL2,
},
{
.led = 1,
.portmask = MV88E6XXX_PORTS_0_3,
.rules = BIT(TRIGGER_NETDEV_LINK_10) | BIT(TRIGGER_NETDEV_LINK_100),
.blink_activity = true,
.selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL2,
},
{
.led = 0,
.portmask = MV88E6XXX_PORTS_4_5,
.rules = BIT(TRIGGER_NETDEV_LINK_1000),
.blink_activity = true,
.fiber = true,
.selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL2,
},
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/leds.h`, `linux/property.h`, `chip.h`, `global2.h`, `port.h`.
- Detected declarations: `struct mv88e6xxx_led_hwconfig`, `function mv88e6xxx_port_led_write`, `function mv88e6xxx_port_led_read`, `function mv88e6xxx_led_brightness_set`, `function mv88e6xxx_led0_brightness_set_blocking`, `function mv88e6xxx_led1_brightness_set_blocking`, `function mv88e6xxx_led_match_selector`, `function mv88e6xxx_led_match_rule`, `function mv88e6xxx_led_get_selector`, `function mv88e6xxx_led_set_blinking_period`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.