drivers/leds/leds-lp5569.c
Source file repositories/reference/linux-study-clean/drivers/leds/leds-lp5569.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/leds/leds-lp5569.c- Extension
.c- Size
- 14190 bytes
- Lines
- 545
- 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/bitfield.hlinux/cleanup.hlinux/delay.hlinux/firmware.hlinux/i2c.hlinux/iopoll.hlinux/leds.hlinux/module.hlinux/mutex.hlinux/of.hlinux/platform_data/leds-lp55xx.hlinux/slab.hdt-bindings/leds/leds-lp55xx.hleds-lp55xx-common.h
Detected Declarations
function Copyrightfunction lp5569_init_program_enginefunction lp5569_post_init_devicefunction lp5569_led_open_testfunction lp5569_led_short_testfunction lp5569_selftest
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2024 Christian Marangi <ansuelsmth@gmail.com>
*/
#include <linux/bitfield.h>
#include <linux/cleanup.h>
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/i2c.h>
#include <linux/iopoll.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/platform_data/leds-lp55xx.h>
#include <linux/slab.h>
#include <dt-bindings/leds/leds-lp55xx.h>
#include "leds-lp55xx-common.h"
#define LP5569_MAX_LEDS 9
/* Memory is used like this:
* 0x00 engine 1 program (4 pages)
* 0x40 engine 2 program (4 pages)
* 0x80 engine 3 program (4 pages)
* 0xc0 engine 1 muxing info (1 page)
* 0xd0 engine 2 muxing info (1 page)
* 0xe0 engine 3 muxing info (1 page)
*/
#define LP5569_PAGES_PER_ENGINE 4
#define LP5569_REG_ENABLE 0x00
#define LP5569_ENABLE BIT(6)
#define LP5569_REG_EXEC_CTRL 0x01
#define LP5569_MODE_ENG_SHIFT 2
#define LP5569_REG_OP_MODE 0x02
#define LP5569_EXEC_ENG_SHIFT 2
#define LP5569_REG_ENABLE_LEDS_MSB 0x04
#define LP5569_REG_ENABLE_LEDS_LSB 0x05
#define LP5569_REG_LED_CTRL_BASE 0x07
#define LP5569_FADER_MAPPING_MASK GENMASK(7, 5)
#define LP5569_REG_LED_PWM_BASE 0x16
#define LP5569_REG_LED_CURRENT_BASE 0x22
#define LP5569_REG_MISC 0x2F
#define LP5569_AUTO_INC BIT(6)
#define LP5569_PWR_SAVE BIT(5)
#define LP5569_CP_MODE_MASK GENMASK(4, 3)
#define LP5569_PWM_PWR_SAVE BIT(2)
#define LP5569_INTERNAL_CLK BIT(0)
#define LP5569_REG_MISC2 0x33
#define LP5569_LED_SHORT_TEST BIT(4)
#define LP5569_LED_OPEN_TEST BIT(3)
#define LP5569_REG_STATUS 0x3C
#define LP5569_MASK_BUSY BIT(7)
#define LP5569_STARTUP_BUSY BIT(6)
#define LP5569_ENGINE_BUSY BIT(5)
#define LP5569_ENGINE1_INT BIT(2)
#define LP5569_ENGINE2_INT BIT(1)
#define LP5569_ENGINE3_INT BIT(0)
#define LP5569_ENG_STATUS_MASK (LP5569_ENGINE1_INT | LP5569_ENGINE2_INT | \
LP5569_ENGINE3_INT)
#define LP5569_REG_IO_CONTROL 0x3D
#define LP5569_CLK_OUTPUT BIT(3)
#define LP5569_REG_RESET 0x3F
#define LP5569_RESET 0xFF
#define LP5569_REG_MASTER_FADER_BASE 0x46
#define LP5569_REG_CH1_PROG_START 0x4B
#define LP5569_REG_CH2_PROG_START 0x4C
#define LP5569_REG_CH3_PROG_START 0x4D
#define LP5569_REG_PROG_PAGE_SEL 0x4F
#define LP5569_REG_PROG_MEM 0x50
#define LP5569_REG_LED_FAULT1 0x81
#define LP5569_LED_FAULT8 BIT(0)
#define LP5569_REG_LED_FAULT2 0x82
#define LP5569_LED_FAULT7 BIT(7)
#define LP5569_LED_FAULT6 BIT(6)
#define LP5569_LED_FAULT5 BIT(5)
#define LP5569_LED_FAULT4 BIT(4)
#define LP5569_LED_FAULT3 BIT(3)
#define LP5569_LED_FAULT2 BIT(2)
#define LP5569_LED_FAULT1 BIT(1)
#define LP5569_LED_FAULT0 BIT(0)
#define LP5569_ENG1_PROG_ADDR 0x0
#define LP5569_ENG2_PROG_ADDR 0x40
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/cleanup.h`, `linux/delay.h`, `linux/firmware.h`, `linux/i2c.h`, `linux/iopoll.h`, `linux/leds.h`, `linux/module.h`.
- Detected declarations: `function Copyright`, `function lp5569_init_program_engine`, `function lp5569_post_init_device`, `function lp5569_led_open_test`, `function lp5569_led_short_test`, `function lp5569_selftest`.
- 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.