drivers/leds/rgb/leds-qcom-lpg.c
Source file repositories/reference/linux-study-clean/drivers/leds/rgb/leds-qcom-lpg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/leds/rgb/leds-qcom-lpg.c- Extension
.c- Size
- 48835 bytes
- Lines
- 1851
- 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/bits.hlinux/bitfield.hlinux/led-class-multicolor.hlinux/module.hlinux/nvmem-consumer.hlinux/of.hlinux/platform_device.hlinux/pwm.hlinux/regmap.hlinux/slab.hlinux/soc/qcom/qcom-pbs.h
Detected Declarations
struct lpg_datastruct lpg_channelstruct lpg_ledstruct lpgstruct lpg_channel_datastruct lpg_datafunction lpg_clear_pbs_triggerfunction lpg_set_pbs_triggerfunction lpg_sdam_configure_triggersfunction triled_setfunction lpg_lut_store_sdamfunction lpg_lut_storefunction lpg_lut_freefunction lpg_lut_syncfunction lpg_calc_freqfunction lpg_calc_dutyfunction lpg_apply_freqfunction lpg_enable_glitchfunction lpg_disable_glitchfunction lpg_apply_pwm_valuefunction lpg_sdam_apply_lut_controlfunction lpg_apply_lut_controlfunction lpg_apply_controlfunction lpg_apply_syncfunction lpg_parse_dtestfunction lpg_apply_dtestfunction lpg_applyfunction lpg_brightness_setfunction lpg_brightness_single_setfunction lpg_brightness_mc_setfunction lpg_blink_setfunction lpg_blink_single_setfunction lpg_blink_mc_setfunction lpg_pattern_setfunction lpg_pattern_single_setfunction lpg_pattern_mc_setfunction lpg_pattern_clearfunction lpg_pattern_single_clearfunction lpg_pattern_mc_clearfunction lpg_pwm_requestfunction lpg_pwm_applyfunction lpg_pwm_get_statefunction lpg_add_pwmfunction lpg_parse_channelfunction lpg_add_ledfunction for_each_available_child_of_node_scopedfunction lpg_init_channelsfunction lpg_init_triled
Annotated Snippet
struct lpg_channel {
struct lpg *lpg;
u32 base;
unsigned int triled_mask;
unsigned int lut_mask;
unsigned int subtype;
u32 sdam_offset;
bool in_use;
int color;
u32 dtest_line;
u32 dtest_value;
u16 pwm_value;
bool enabled;
u64 period;
unsigned int clk_sel;
unsigned int pre_div_sel;
unsigned int pre_div_exp;
unsigned int pwm_resolution_sel;
bool ramp_enabled;
bool ramp_ping_pong;
bool ramp_oneshot;
bool ramp_reverse;
unsigned short ramp_tick_ms;
unsigned long ramp_lo_pause_ms;
unsigned long ramp_hi_pause_ms;
unsigned int pattern_lo_idx;
unsigned int pattern_hi_idx;
};
/**
* struct lpg_led - logical LED object
* @lpg: lpg context reference
* @cdev: LED class device
* @mcdev: Multicolor LED class device
* @channels: list of channels associated with the LED
* @num_channels: number of @channels
*/
struct lpg_led {
struct lpg *lpg;
struct led_classdev cdev;
struct led_classdev_mc mcdev;
unsigned int num_channels;
struct lpg_channel *channels[] __counted_by(num_channels);
};
/**
* struct lpg - LPG device context
* @dev: pointer to LPG device
* @map: regmap for register access
* @lock: used to synchronize LED and pwm callback requests
* @pwm: PWM-chip object, if operating in PWM mode
* @data: reference to version specific data
* @lut_base: base address of the LUT block (optional)
* @lut_size: number of entries in the LUT block
* @lut_bitmap: allocation bitmap for LUT entries
* @pbs_dev: PBS device
* @lpg_chan_sdam: LPG SDAM peripheral device
* @lut_sdam: LUT SDAM peripheral device
* @pbs_en_bitmap: bitmap for tracking PBS triggers
* @triled_base: base address of the TRILED block (optional)
* @triled_src: power-source for the TRILED
* @triled_has_atc_ctl: true if there is TRI_LED_ATC_CTL register
* @triled_has_src_sel: true if there is TRI_LED_SRC_SEL register
* @num_channels: number of @channels
* @channels: list of PWM channels
*/
struct lpg {
struct device *dev;
struct regmap *map;
struct mutex lock;
struct pwm_chip *pwm;
const struct lpg_data *data;
u32 lut_base;
u32 lut_size;
unsigned long *lut_bitmap;
Annotation
- Immediate include surface: `linux/bits.h`, `linux/bitfield.h`, `linux/led-class-multicolor.h`, `linux/module.h`, `linux/nvmem-consumer.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pwm.h`.
- Detected declarations: `struct lpg_data`, `struct lpg_channel`, `struct lpg_led`, `struct lpg`, `struct lpg_channel_data`, `struct lpg_data`, `function lpg_clear_pbs_trigger`, `function lpg_set_pbs_trigger`, `function lpg_sdam_configure_triggers`, `function triled_set`.
- 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.