STRUCT LPG(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 struct lpg(9) β€” LPG device context 🌸

okay bestie, so this is a page from the Kernel API Manual (that's the 9 in struct lpg(9), iykyk) and it's literally just the ✨ anatomy ✨ of struct lpg β€” the LPG device context. no cap, it's a whole vibe check of a struct, so let's get into it πŸ’…


✨ NAME ✨

struct lpg β€” the LPG device context 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole thing, character for character, don't touch it, she's perfect:

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;
    struct pbs_dev *pbs_dev;
    struct nvmem_device *lpg_chan_sdam;
    struct nvmem_device *lut_sdam;
    unsigned long pbs_en_bitmap;
    u32 triled_base;
    u32 triled_src;
    bool triled_has_atc_ctl;
    bool triled_has_src_sel;
    unsigned int num_channels;
    struct lpg_channel channels[];
};

πŸ‘‘ Members πŸ‘‘

okay so each of these fields is kind of a main character in her own right, so let's introduce them one by one, no skips, no cuts πŸ’–

πŸŽ€ the basics

  • dev β€” pointer to the LPG device 🌈
  • map β€” the regmap used for register access, so she can actually talk to the hardware
  • lock β€” used to synchronize LED and pwm callback requests πŸ”’ (yes, you need it, don't skip it)
  • pwm β€” the PWM-chip object β€” but only if she's operating in PWM mode ✨
  • data β€” a reference to the version specific data (every version's got her own lore, fr fr)

πŸ“ the LUT block (optional, but iconic)

  • lut_base β€” base address of the LUT block β€” and yes it's optional πŸ™ˆ
  • lut_size β€” number of entries in the LUT block
  • lut_bitmap β€” the allocation bitmap for LUT entries

πŸ’œ the SDAM + PBS corner

  • pbs_dev β€” the PBS device
  • lpg_chan_sdam β€” the LPG SDAM peripheral device
  • lut_sdam β€” the LUT SDAM peripheral device
  • pbs_en_bitmap β€” a bitmap for tracking PBS triggers πŸ‘€

🧚 the TRILED block (also optional, also iconic)

  • triled_base β€” base address of the TRILED block β€” optional, just like LUT πŸŽ€
  • triled_src β€” the power-source for the TRILED
  • triled_has_atc_ctl β€” true if there's a TRI_LED_ATC_CTL register
  • triled_has_src_sel β€” true if there's a TRI_LED_SRC_SEL register

⭐ the channels

  • num_channels β€” number of channels
  • channels β€” the list of PWM channels πŸ’« (she's a flexible array member, she grows, she's literally that girl)

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/leds/rgb/leds-qcom-lpg.c, struct lpg_channel(9), struct lpg_led(9), struct lpg_channel_data(9), struct lpg_data(9)


okay that's the whole page, bestie, you ate that 🫢 go forth and read the source (it lives in ./drivers/leds/rgb, naur literally) β€” this drop is dated October 2026, so like, future knowledge, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from