drivers/leds/leds-is31fl319x.c
Source file repositories/reference/linux-study-clean/drivers/leds/leds-is31fl319x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/leds/leds-is31fl319x.c- Extension
.c- Size
- 17548 bytes
- Lines
- 597
- 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/err.hlinux/i2c.hlinux/leds.hlinux/mod_devicetable.hlinux/module.hlinux/property.hlinux/regmap.hlinux/slab.hlinux/delay.hlinux/gpio/consumer.h
Detected Declarations
struct is31fl319x_chipstruct is31fl319x_ledstruct is31fl319x_chipdeffunction is31fl319x_readable_regfunction is31fl3190_volatile_regfunction is31fl3196_volatile_regfunction is31fl3190_brightness_setfunction is31fl3196_brightness_setfunction is31fl319x_parse_child_fwfunction is31fl319x_parse_fwfunction device_for_each_child_node_scopedfunction is31fl3190_microamp_to_csfunction is31fl3196_microamp_to_csfunction is31fl3196_db_to_gainfunction is31fl319x_probe
Annotated Snippet
struct is31fl319x_chip {
const struct is31fl319x_chipdef *cdef;
struct i2c_client *client;
struct gpio_desc *shutdown_gpio;
struct regmap *regmap;
struct mutex lock;
u32 audio_gain_db;
struct is31fl319x_led {
struct is31fl319x_chip *chip;
struct led_classdev cdev;
u32 max_microamp;
bool configured;
} leds[IS31FL319X_MAX_LEDS];
};
struct is31fl319x_chipdef {
int num_leds;
u8 reset_reg;
const struct regmap_config *is31fl319x_regmap_config;
int (*brightness_set)(struct led_classdev *cdev, enum led_brightness brightness);
u32 current_default;
u32 current_min;
u32 current_max;
bool is_3196or3199;
};
static bool is31fl319x_readable_reg(struct device *dev, unsigned int reg)
{
/* we have no readable registers */
return false;
}
static bool is31fl3190_volatile_reg(struct device *dev, unsigned int reg)
{
/* volatile registers are not cached */
switch (reg) {
case IS31FL3190_DATA_UPDATE:
case IS31FL3190_TIME_UPDATE:
case IS31FL3190_RESET:
return true; /* always write-through */
default:
return false;
}
}
static const struct reg_default is31fl3190_reg_defaults[] = {
{ IS31FL3190_LEDMODE, 0x00 },
{ IS31FL3190_CURRENT, 0x00 },
{ IS31FL3190_PWM(0), 0x00 },
{ IS31FL3190_PWM(1), 0x00 },
{ IS31FL3190_PWM(2), 0x00 },
};
static const struct regmap_config is31fl3190_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = IS31FL3190_RESET,
.cache_type = REGCACHE_FLAT,
.readable_reg = is31fl319x_readable_reg,
.volatile_reg = is31fl3190_volatile_reg,
.reg_defaults = is31fl3190_reg_defaults,
.num_reg_defaults = ARRAY_SIZE(is31fl3190_reg_defaults),
};
static bool is31fl3196_volatile_reg(struct device *dev, unsigned int reg)
{
/* volatile registers are not cached */
switch (reg) {
case IS31FL3196_DATA_UPDATE:
case IS31FL3196_TIME_UPDATE:
case IS31FL3196_RESET:
return true; /* always write-through */
default:
return false;
}
}
static const struct reg_default is31fl3196_reg_defaults[] = {
{ IS31FL3196_CONFIG1, 0x00 },
{ IS31FL3196_CONFIG2, 0x00 },
{ IS31FL3196_PWM(0), 0x00 },
{ IS31FL3196_PWM(1), 0x00 },
{ IS31FL3196_PWM(2), 0x00 },
{ IS31FL3196_PWM(3), 0x00 },
{ IS31FL3196_PWM(4), 0x00 },
{ IS31FL3196_PWM(5), 0x00 },
{ IS31FL3196_PWM(6), 0x00 },
{ IS31FL3196_PWM(7), 0x00 },
{ IS31FL3196_PWM(8), 0x00 },
Annotation
- Immediate include surface: `linux/err.h`, `linux/i2c.h`, `linux/leds.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/property.h`, `linux/regmap.h`, `linux/slab.h`.
- Detected declarations: `struct is31fl319x_chip`, `struct is31fl319x_led`, `struct is31fl319x_chipdef`, `function is31fl319x_readable_reg`, `function is31fl3190_volatile_reg`, `function is31fl3196_volatile_reg`, `function is31fl3190_brightness_set`, `function is31fl3196_brightness_set`, `function is31fl319x_parse_child_fw`, `function is31fl319x_parse_fw`.
- 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.