drivers/leds/blink/leds-lgm-sso.c
Source file repositories/reference/linux-study-clean/drivers/leds/blink/leds-lgm-sso.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/leds/blink/leds-lgm-sso.c- Extension
.c- Size
- 20603 bytes
- Lines
- 875
- 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.
- 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/bitfield.hlinux/clk.hlinux/gpio/consumer.hlinux/gpio/driver.hlinux/init.hlinux/kernel.hlinux/leds.hlinux/mfd/syscon.hlinux/module.hlinux/platform_device.hlinux/property.hlinux/regmap.hlinux/sizes.hlinux/uaccess.h
Detected Declarations
struct sso_led_privstruct sso_led_descstruct sso_ledstruct sso_gpiostruct sso_led_privfunction sso_get_blink_rate_idxfunction sso_led_pin_to_groupfunction sso_led_get_freq_srcfunction sso_led_pin_blink_offfunction sso_led_freq_setfunction sso_led_brightness_setfunction sso_led_brightness_getfunction delay_to_freq_idxfunction sso_led_blink_setfunction sso_led_hw_cfgfunction sso_create_ledfunction sso_init_freqfunction sso_gpio_requestfunction sso_gpio_freefunction sso_gpio_get_dirfunction sso_gpio_dir_outfunction sso_gpio_getfunction sso_gpio_setfunction sso_gpio_gc_initfunction sso_gpio_get_freq_idxfunction sso_register_shift_clkfunction sso_gpio_freq_setfunction sso_gpio_hw_initfunction sso_led_shutdownfunction __sso_led_dt_parsefunction fwnode_for_each_child_nodefunction sso_led_dt_parsefunction sso_probe_gpiosfunction sso_clock_disable_unpreparefunction intel_sso_led_probefunction intel_sso_led_removefunction list_for_each_entry_safe
Annotated Snippet
struct sso_led_desc {
const char *name;
const char *default_trigger;
unsigned int brightness;
unsigned int blink_rate;
unsigned int retain_state_suspended:1;
unsigned int retain_state_shutdown:1;
unsigned int panic_indicator:1;
unsigned int hw_blink:1;
unsigned int hw_trig:1;
unsigned int blinking:1;
int freq_idx;
u32 pin;
};
struct sso_led {
struct list_head list;
struct led_classdev cdev;
struct gpio_desc *gpiod;
struct sso_led_desc desc;
struct sso_led_priv *priv;
};
struct sso_gpio {
struct gpio_chip chip;
int shift_clk_freq;
int edge;
int freq;
u32 pins;
u32 alloc_bitmap;
};
struct sso_led_priv {
struct regmap *mmap;
struct device *dev;
struct platform_device *pdev;
struct clk_bulk_data clocks[2];
u32 fpid_clkrate;
u32 gptc_clkrate;
u32 freq[MAX_FREQ_RANK];
struct list_head led_list;
struct sso_gpio gpio;
};
static int sso_get_blink_rate_idx(struct sso_led_priv *priv, u32 rate)
{
int i;
for (i = 0; i < MAX_FREQ_RANK; i++) {
if (rate <= priv->freq[i])
return i;
}
return -1;
}
static unsigned int sso_led_pin_to_group(u32 pin)
{
if (pin < LED_GRP0_PIN_MAX)
return LED_GRP0_0_23;
else if (pin < LED_GRP1_PIN_MAX)
return LED_GRP1_24_28;
else
return LED_GRP2_29_31;
}
static u32 sso_led_get_freq_src(int freq_idx)
{
if (freq_idx < MAX_FPID_FREQ_RANK)
return CLK_SRC_FPID;
else if (freq_idx < MAX_GPTC_FREQ_RANK)
return CLK_SRC_GPTC;
else
return CLK_SRC_GPTC_HS;
}
static u32 sso_led_pin_blink_off(u32 pin, unsigned int group)
{
if (group == LED_GRP2_29_31)
return pin - LED_GRP1_PIN_MAX;
else if (group == LED_GRP1_24_28)
return pin - LED_GRP0_PIN_MAX;
else /* led 0 - 23 in led 32 location */
return SSO_LED_MAX_NUM - LED_GRP1_PIN_MAX;
}
static struct sso_led
*cdev_to_sso_led_data(struct led_classdev *led_cdev)
{
return container_of(led_cdev, struct sso_led, cdev);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/gpio/consumer.h`, `linux/gpio/driver.h`, `linux/init.h`, `linux/kernel.h`, `linux/leds.h`, `linux/mfd/syscon.h`.
- Detected declarations: `struct sso_led_priv`, `struct sso_led_desc`, `struct sso_led`, `struct sso_gpio`, `struct sso_led_priv`, `function sso_get_blink_rate_idx`, `function sso_led_pin_to_group`, `function sso_led_get_freq_src`, `function sso_led_pin_blink_off`, `function sso_led_freq_set`.
- 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.