drivers/leds/leds-lm355x.c
Source file repositories/reference/linux-study-clean/drivers/leds/leds-lm355x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/leds/leds-lm355x.c- Extension
.c- Size
- 12785 bytes
- Lines
- 530
- 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/module.hlinux/delay.hlinux/i2c.hlinux/leds.hlinux/slab.hlinux/platform_device.hlinux/fs.hlinux/regmap.hlinux/platform_data/leds-lm355x.h
Detected Declarations
struct lm355x_reg_datastruct lm355x_chip_datastruct indicatorenum lm355x_typeenum lm355x_regsenum lm355x_modeenum lm3556_indic_pulse_timeenum lm3556_indic_n_blankenum lm3556_indic_periodfunction lm355x_chip_initfunction lm355x_controlfunction lm355x_torch_brightness_setfunction lm355x_strobe_brightness_setfunction lm355x_indicator_brightness_setfunction pattern_storefunction lm355x_probefunction lm355x_remove
Annotated Snippet
struct lm355x_reg_data {
u8 regno;
u8 mask;
u8 shift;
};
struct lm355x_chip_data {
struct device *dev;
enum lm355x_type type;
struct led_classdev cdev_flash;
struct led_classdev cdev_torch;
struct led_classdev cdev_indicator;
struct lm355x_platform_data *pdata;
struct regmap *regmap;
struct mutex lock;
unsigned int last_flag;
struct lm355x_reg_data *regs;
};
/* specific indicator function for lm3556 */
enum lm3556_indic_pulse_time {
PULSE_TIME_0_MS = 0,
PULSE_TIME_32_MS,
PULSE_TIME_64_MS,
PULSE_TIME_92_MS,
PULSE_TIME_128_MS,
PULSE_TIME_160_MS,
PULSE_TIME_196_MS,
PULSE_TIME_224_MS,
PULSE_TIME_256_MS,
PULSE_TIME_288_MS,
PULSE_TIME_320_MS,
PULSE_TIME_352_MS,
PULSE_TIME_384_MS,
PULSE_TIME_416_MS,
PULSE_TIME_448_MS,
PULSE_TIME_480_MS,
};
enum lm3556_indic_n_blank {
INDIC_N_BLANK_0 = 0,
INDIC_N_BLANK_1,
INDIC_N_BLANK_2,
INDIC_N_BLANK_3,
INDIC_N_BLANK_4,
INDIC_N_BLANK_5,
INDIC_N_BLANK_6,
INDIC_N_BLANK_7,
INDIC_N_BLANK_8,
INDIC_N_BLANK_9,
INDIC_N_BLANK_10,
INDIC_N_BLANK_11,
INDIC_N_BLANK_12,
INDIC_N_BLANK_13,
INDIC_N_BLANK_14,
INDIC_N_BLANK_15,
};
enum lm3556_indic_period {
INDIC_PERIOD_0 = 0,
INDIC_PERIOD_1,
INDIC_PERIOD_2,
INDIC_PERIOD_3,
INDIC_PERIOD_4,
INDIC_PERIOD_5,
INDIC_PERIOD_6,
INDIC_PERIOD_7,
};
#define INDIC_PATTERN_SIZE 4
struct indicator {
u8 blinking;
u8 period_cnt;
};
/* indicator pattern data only for lm3556 */
static struct indicator indicator_pattern[INDIC_PATTERN_SIZE] = {
[0] = {(INDIC_N_BLANK_1 << 4) | PULSE_TIME_32_MS, INDIC_PERIOD_1},
[1] = {(INDIC_N_BLANK_15 << 4) | PULSE_TIME_32_MS, INDIC_PERIOD_2},
[2] = {(INDIC_N_BLANK_10 << 4) | PULSE_TIME_32_MS, INDIC_PERIOD_4},
[3] = {(INDIC_N_BLANK_5 << 4) | PULSE_TIME_32_MS, INDIC_PERIOD_7},
};
static struct lm355x_reg_data lm3554_regs[REG_MAX] = {
[REG_FLAG] = {0xD0, 0xBF, 0},
[REG_TORCH_CFG] = {0xE0, 0x80, 7},
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/i2c.h`, `linux/leds.h`, `linux/slab.h`, `linux/platform_device.h`, `linux/fs.h`, `linux/regmap.h`.
- Detected declarations: `struct lm355x_reg_data`, `struct lm355x_chip_data`, `struct indicator`, `enum lm355x_type`, `enum lm355x_regs`, `enum lm355x_mode`, `enum lm3556_indic_pulse_time`, `enum lm3556_indic_n_blank`, `enum lm3556_indic_period`, `function lm355x_chip_init`.
- 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.