STRUCT LPG_CHANNEL(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct lpg_channel(9) πŸ’–

okay so bestie, we're in the Kernel API Manual today and the star of the show is struct lpg_channel(9) β€” literally just per channel data. one struct, one channel, all the vibes. let's get into it 🫢


✨ NAME ✨

struct lpg_channel β€” per channel data. that's it, that's the whole name. short, sweet, iconic πŸ‘‘


🌈 SYNOPSIS 🌈

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;
 };

no cap, that's a lot of fields, but every single one is doing its job πŸ’…


πŸŽ€ Members πŸŽ€

now the good part β€” meet the cast, one field at a time. everyone gets a moment to shine ✨

  • lpg β€” reference to parent lpg. the main character it reports to πŸ’–
  • base β€” base address of the PWM channel. the address, the whole address, nothing but the address 🏠
  • triled_mask β€” mask in TRILED to enable this channel. it's the enable button, but make it a bitmask πŸ”₯
  • lut_mask β€” mask in LUT to start pattern generator for this channel. starts the pattern generator, lowkey a hype-man πŸŽ‰
  • subtype β€” PMIC hardware block subtype. hardware lore, iykyk 🧚
  • sdam_offset β€” channel offset in LPG SDAM. where it sits in the SDAM neighbourhood πŸ“
  • in_use β€” channel is exposed to LED framework. true means the LED framework has claimed it, so hands off πŸ™ˆ
  • color β€” color of the LED attached to this channel. the aesthetic, fr 🌈
  • dtest_line β€” DTEST line for output, or 0 if disabled. zero means nope, disabled, we're not doing that πŸ’€
  • dtest_value β€” DTEST line configuration. the settings for that DTEST line βš™οΈ
  • pwm_value β€” duty (in microseconds) of the generated pulses, overridden by LUT. yes unit is microseconds, and yes LUT can just take over 😀
  • enabled β€” output enabled? the question mark is load-bearing, bestie πŸ’…
  • period β€” period (in nanoseconds) of the generated pulses. nanoseconds!! so tiny, so precise ⏱️
  • clk_sel β€” reference clock frequency selector. picks which reference clock frequency we're on πŸ•°οΈ
  • pre_div_sel β€” divider selector of the reference clock. divider, but the selector one 🎚️
  • pre_div_exp β€” exponential divider of the reference clock. now it's exponential, she's fancy πŸ‘‘
  • pwm_resolution_sel β€” pwm resolution selector. how much resolution do we want? yes πŸ’œ
  • ramp_enabled β€” duty cycle is driven by iterating over lookup table. the LUT is driving, buckle up πŸš—
  • ramp_ping_pong β€” reverse through pattern, rather than wrapping to start. ping pong!! going back instead of loop-de-loop πŸ“
  • ramp_oneshot β€” perform only a single pass over the pattern. one pass, no encore, periodt βœ‹
  • ramp_reverse β€” iterate over pattern backwards. back, back, back it up πŸ”™
  • ramp_tick_ms β€” length (in milliseconds) of one step in the pattern. one step = this many ms 🐾
  • ramp_lo_pause_ms β€” pause (in milliseconds) before iterating over pattern. the pre-game pause 🧘
  • ramp_hi_pause_ms β€” pause (in milliseconds) after iterating over pattern. the post-game pause πŸ›¬
  • pattern_lo_idx β€” start index of associated pattern. start here bestie 🟒
  • pattern_hi_idx β€” last index of associated pattern. and stop here πŸ”΄
heads up: pwm_value is in microseconds and period is in nanoseconds β€” do not mix them up, that's a vibe check you will fail 😭

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/leds/rgb/leds-qcom-lpg.c β€” plus these certified besties: struct lpg_led(9), struct lpg(9), struct lpg_channel_data(9), struct lpg_data(9) ✨


and that's the page!! huge shoutout to ./drivers/leds/rgb for the source and October 2026 for the date β€” slay, go read the other structs, ily, bye πŸ’–πŸŽ€πŸ«Ά

πŸ“¦ where this page comes from