drivers/leds/leds-lp5562.c
Source file repositories/reference/linux-study-clean/drivers/leds/leds-lp5562.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/leds/leds-lp5562.c- Extension
.c- Size
- 10300 bytes
- Lines
- 425
- Domain
- Driver Families
- Bucket
- drivers/leds
- 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/cleanup.hlinux/delay.hlinux/firmware.hlinux/i2c.hlinux/leds.hlinux/module.hlinux/mutex.hlinux/of.hlinux/platform_data/leds-lp55xx.hlinux/slab.hleds-lp55xx-common.h
Detected Declarations
function Copyrightfunction lp5562_wait_enable_donefunction lp5562_set_led_currentfunction lp5562_run_enginefunction lp5562_post_init_devicefunction lp5562_multicolor_brightnessfunction lp5562_led_brightnessfunction lp5562_write_program_memoryfunction _is_pc_overflowfunction lp5562_run_predef_led_patternfunction lp5562_store_patternfunction lp5562_store_engine_mux
Annotated Snippet
switch (idx) {
case LP55XX_ENGINE_1:
val = LP5562_ENG1_FOR_W;
break;
case LP55XX_ENGINE_2:
val = LP5562_ENG2_FOR_W;
break;
case LP55XX_ENGINE_3:
val = LP5562_ENG3_FOR_W;
break;
default:
return -EINVAL;
}
} else {
dev_err(dev, "choose RGB or W\n");
return -EINVAL;
}
guard(mutex)(&chip->lock);
lp55xx_update_bits(chip, LP5562_REG_ENG_SEL, mask, val);
return len;
}
static LP55XX_DEV_ATTR_WO(led_pattern, lp5562_store_pattern);
static LP55XX_DEV_ATTR_WO(engine_mux, lp5562_store_engine_mux);
static struct attribute *lp5562_attributes[] = {
&dev_attr_led_pattern.attr,
&dev_attr_engine_mux.attr,
NULL,
};
static const struct attribute_group lp5562_group = {
.attrs = lp5562_attributes,
};
/* Chip specific configurations */
static struct lp55xx_device_config lp5562_cfg = {
.max_channel = LP5562_MAX_LEDS,
.reg_op_mode = {
.addr = LP5562_REG_OP_MODE,
},
.reg_exec = {
.addr = LP5562_REG_ENABLE,
},
.reset = {
.addr = LP5562_REG_RESET,
.val = LP5562_RESET,
},
.enable = {
.addr = LP5562_REG_ENABLE,
.val = LP5562_ENABLE_DEFAULT,
},
.prog_mem_base = {
.addr = LP5562_REG_PROG_MEM_ENG1,
},
.post_init_device = lp5562_post_init_device,
.set_led_current = lp5562_set_led_current,
.brightness_fn = lp5562_led_brightness,
.multicolor_brightness_fn = lp5562_multicolor_brightness,
.run_engine = lp5562_run_engine,
.firmware_cb = lp55xx_firmware_loaded_cb,
.dev_attr_group = &lp5562_group,
};
static const struct i2c_device_id lp5562_id[] = {
{ .name = "lp5562", .driver_data = (kernel_ulong_t)&lp5562_cfg },
{ }
};
MODULE_DEVICE_TABLE(i2c, lp5562_id);
static const struct of_device_id of_lp5562_leds_match[] = {
{ .compatible = "ti,lp5562", .data = &lp5562_cfg, },
{},
};
MODULE_DEVICE_TABLE(of, of_lp5562_leds_match);
static struct i2c_driver lp5562_driver = {
.driver = {
.name = "lp5562",
.of_match_table = of_lp5562_leds_match,
},
.probe = lp55xx_probe,
.remove = lp55xx_remove,
.id_table = lp5562_id,
};
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/delay.h`, `linux/firmware.h`, `linux/i2c.h`, `linux/leds.h`, `linux/module.h`, `linux/mutex.h`, `linux/of.h`.
- Detected declarations: `function Copyright`, `function lp5562_wait_enable_done`, `function lp5562_set_led_current`, `function lp5562_run_engine`, `function lp5562_post_init_device`, `function lp5562_multicolor_brightness`, `function lp5562_led_brightness`, `function lp5562_write_program_memory`, `function _is_pc_overflow`, `function lp5562_run_predef_led_pattern`.
- Atlas domain: Driver Families / drivers/leds.
- 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.