drivers/video/backlight/lm3533_bl.c
Source file repositories/reference/linux-study-clean/drivers/video/backlight/lm3533_bl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/backlight/lm3533_bl.c- Extension
.c- Size
- 8475 bytes
- Lines
- 399
- Domain
- Driver Families
- Bucket
- drivers/video
- 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/module.hlinux/init.hlinux/platform_device.hlinux/backlight.hlinux/slab.hlinux/mfd/lm3533.h
Detected Declarations
struct lm3533_blfunction lm3533_bl_get_ctrlbank_idfunction lm3533_bl_update_statusfunction lm3533_bl_get_brightnessfunction show_idfunction show_als_channelfunction show_als_enfunction store_als_enfunction show_linearfunction store_linearfunction show_pwmfunction store_pwmfunction lm3533_bl_attr_is_visiblefunction lm3533_bl_setupfunction lm3533_bl_probefunction lm3533_bl_removefunction lm3533_bl_suspendfunction lm3533_bl_resumefunction lm3533_bl_shutdown
Annotated Snippet
struct lm3533_bl {
struct lm3533 *lm3533;
struct lm3533_ctrlbank cb;
struct backlight_device *bd;
int id;
};
static inline int lm3533_bl_get_ctrlbank_id(struct lm3533_bl *bl)
{
return bl->id;
}
static int lm3533_bl_update_status(struct backlight_device *bd)
{
struct lm3533_bl *bl = bl_get_data(bd);
return lm3533_ctrlbank_set_brightness(&bl->cb, backlight_get_brightness(bd));
}
static int lm3533_bl_get_brightness(struct backlight_device *bd)
{
struct lm3533_bl *bl = bl_get_data(bd);
u8 val;
int ret;
ret = lm3533_ctrlbank_get_brightness(&bl->cb, &val);
if (ret)
return ret;
return val;
}
static const struct backlight_ops lm3533_bl_ops = {
.get_brightness = lm3533_bl_get_brightness,
.update_status = lm3533_bl_update_status,
};
static ssize_t show_id(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct lm3533_bl *bl = dev_get_drvdata(dev);
return scnprintf(buf, PAGE_SIZE, "%d\n", bl->id);
}
static ssize_t show_als_channel(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct lm3533_bl *bl = dev_get_drvdata(dev);
unsigned channel = lm3533_bl_get_ctrlbank_id(bl);
return scnprintf(buf, PAGE_SIZE, "%u\n", channel);
}
static ssize_t show_als_en(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct lm3533_bl *bl = dev_get_drvdata(dev);
int ctrlbank = lm3533_bl_get_ctrlbank_id(bl);
u8 val;
u8 mask;
bool enable;
int ret;
ret = lm3533_read(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF, &val);
if (ret)
return ret;
mask = 1 << (2 * ctrlbank);
enable = val & mask;
return scnprintf(buf, PAGE_SIZE, "%d\n", enable);
}
static ssize_t store_als_en(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{
struct lm3533_bl *bl = dev_get_drvdata(dev);
int ctrlbank = lm3533_bl_get_ctrlbank_id(bl);
int enable;
u8 val;
u8 mask;
int ret;
if (kstrtoint(buf, 0, &enable))
return -EINVAL;
mask = 1 << (2 * ctrlbank);
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/platform_device.h`, `linux/backlight.h`, `linux/slab.h`, `linux/mfd/lm3533.h`.
- Detected declarations: `struct lm3533_bl`, `function lm3533_bl_get_ctrlbank_id`, `function lm3533_bl_update_status`, `function lm3533_bl_get_brightness`, `function show_id`, `function show_als_channel`, `function show_als_en`, `function store_als_en`, `function show_linear`, `function store_linear`.
- Atlas domain: Driver Families / drivers/video.
- 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.