drivers/leds/leds-lp50xx.c
Source file repositories/reference/linux-study-clean/drivers/leds/leds-lp50xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/leds/leds-lp50xx.c- Extension
.c- Size
- 17647 bytes
- Lines
- 639
- 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.
- 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/gpio/consumer.hlinux/i2c.hlinux/init.hlinux/leds.hlinux/mod_devicetable.hlinux/module.hlinux/mutex.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.huapi/linux/uleds.hlinux/led-class-multicolor.h
Detected Declarations
struct lp50xx_chip_infostruct lp50xx_ledstruct lp50xxenum lp50xx_modelfunction lp50xx_brightness_setfunction lp50xx_set_banksfunction lp50xx_resetfunction lp50xx_enablefunction lp50xx_disablefunction lp50xx_probe_ledsfunction lp50xx_probe_dtfunction device_for_each_child_node_scopedfunction fwnode_for_each_child_nodefunction lp50xx_probefunction lp50xx_remove
Annotated Snippet
struct lp50xx_chip_info {
const struct regmap_config *lp50xx_regmap_config;
int model_id;
u8 max_modules;
u8 num_leds;
u8 led_brightness0_reg;
u8 mix_out0_reg;
u8 bank_brt_reg;
u8 bank_mix_reg;
u8 reset_reg;
};
static const struct lp50xx_chip_info lp50xx_chip_info_tbl[] = {
[LP5009] = {
.model_id = LP5009,
.max_modules = LP5009_MAX_LED_MODULES,
.num_leds = LP5009_MAX_LED_MODULES * LP50XX_LEDS_PER_MODULE,
.led_brightness0_reg = LP5012_LED0_BRT,
.mix_out0_reg = LP5012_OUT0_CLR,
.bank_brt_reg = LP5012_BNK_BRT,
.bank_mix_reg = LP5012_BNKA_CLR,
.reset_reg = LP5012_RESET,
.lp50xx_regmap_config = &lp5012_regmap_config,
},
[LP5012] = {
.model_id = LP5012,
.max_modules = LP5012_MAX_LED_MODULES,
.num_leds = LP5012_MAX_LED_MODULES * LP50XX_LEDS_PER_MODULE,
.led_brightness0_reg = LP5012_LED0_BRT,
.mix_out0_reg = LP5012_OUT0_CLR,
.bank_brt_reg = LP5012_BNK_BRT,
.bank_mix_reg = LP5012_BNKA_CLR,
.reset_reg = LP5012_RESET,
.lp50xx_regmap_config = &lp5012_regmap_config,
},
[LP5018] = {
.model_id = LP5018,
.max_modules = LP5018_MAX_LED_MODULES,
.num_leds = LP5018_MAX_LED_MODULES * LP50XX_LEDS_PER_MODULE,
.led_brightness0_reg = LP5024_LED0_BRT,
.mix_out0_reg = LP5024_OUT0_CLR,
.bank_brt_reg = LP5024_BNK_BRT,
.bank_mix_reg = LP5024_BNKA_CLR,
.reset_reg = LP5024_RESET,
.lp50xx_regmap_config = &lp5024_regmap_config,
},
[LP5024] = {
.model_id = LP5024,
.max_modules = LP5024_MAX_LED_MODULES,
.num_leds = LP5024_MAX_LED_MODULES * LP50XX_LEDS_PER_MODULE,
.led_brightness0_reg = LP5024_LED0_BRT,
.mix_out0_reg = LP5024_OUT0_CLR,
.bank_brt_reg = LP5024_BNK_BRT,
.bank_mix_reg = LP5024_BNKA_CLR,
.reset_reg = LP5024_RESET,
.lp50xx_regmap_config = &lp5024_regmap_config,
},
[LP5030] = {
.model_id = LP5030,
.max_modules = LP5030_MAX_LED_MODULES,
.num_leds = LP5030_MAX_LED_MODULES * LP50XX_LEDS_PER_MODULE,
.led_brightness0_reg = LP5036_LED0_BRT,
.mix_out0_reg = LP5036_OUT0_CLR,
.bank_brt_reg = LP5036_BNK_BRT,
.bank_mix_reg = LP5036_BNKA_CLR,
.reset_reg = LP5036_RESET,
.lp50xx_regmap_config = &lp5036_regmap_config,
},
[LP5036] = {
.model_id = LP5036,
.max_modules = LP5036_MAX_LED_MODULES,
.num_leds = LP5036_MAX_LED_MODULES * LP50XX_LEDS_PER_MODULE,
.led_brightness0_reg = LP5036_LED0_BRT,
.mix_out0_reg = LP5036_OUT0_CLR,
.bank_brt_reg = LP5036_BNK_BRT,
.bank_mix_reg = LP5036_BNKA_CLR,
.reset_reg = LP5036_RESET,
.lp50xx_regmap_config = &lp5036_regmap_config,
},
};
struct lp50xx_led {
struct led_classdev_mc mc_cdev;
struct lp50xx *priv;
u8 ctrl_bank_enabled;
int led_number;
};
/**
* struct lp50xx -
Annotation
- Immediate include surface: `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/init.h`, `linux/leds.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/mutex.h`, `linux/regmap.h`.
- Detected declarations: `struct lp50xx_chip_info`, `struct lp50xx_led`, `struct lp50xx`, `enum lp50xx_model`, `function lp50xx_brightness_set`, `function lp50xx_set_banks`, `function lp50xx_reset`, `function lp50xx_enable`, `function lp50xx_disable`, `function lp50xx_probe_leds`.
- Atlas domain: Driver Families / drivers/leds.
- 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.