drivers/video/backlight/ep93xx_bl.c
Source file repositories/reference/linux-study-clean/drivers/video/backlight/ep93xx_bl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/backlight/ep93xx_bl.c- Extension
.c- Size
- 3191 bytes
- Lines
- 132
- 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/platform_device.hlinux/io.hlinux/backlight.h
Detected Declarations
struct ep93xxblfunction ep93xxbl_setfunction ep93xxbl_update_statusfunction ep93xxbl_get_brightnessfunction ep93xxbl_probefunction ep93xxbl_suspendfunction ep93xxbl_resume
Annotated Snippet
struct ep93xxbl {
void __iomem *mmio;
int brightness;
};
static int ep93xxbl_set(struct backlight_device *bl, int brightness)
{
struct ep93xxbl *ep93xxbl = bl_get_data(bl);
writel((brightness << 8) | EP93XX_MAX_COUNT, ep93xxbl->mmio);
ep93xxbl->brightness = brightness;
return 0;
}
static int ep93xxbl_update_status(struct backlight_device *bl)
{
return ep93xxbl_set(bl, backlight_get_brightness(bl));
}
static int ep93xxbl_get_brightness(struct backlight_device *bl)
{
struct ep93xxbl *ep93xxbl = bl_get_data(bl);
return ep93xxbl->brightness;
}
static const struct backlight_ops ep93xxbl_ops = {
.update_status = ep93xxbl_update_status,
.get_brightness = ep93xxbl_get_brightness,
};
static int ep93xxbl_probe(struct platform_device *dev)
{
struct ep93xxbl *ep93xxbl;
struct backlight_device *bl;
struct backlight_properties props;
struct resource *res;
ep93xxbl = devm_kzalloc(&dev->dev, sizeof(*ep93xxbl), GFP_KERNEL);
if (!ep93xxbl)
return -ENOMEM;
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!res)
return -ENXIO;
/*
* FIXME - We don't do a request_mem_region here because we are
* sharing the register space with the framebuffer driver (see
* drivers/video/ep93xx-fb.c) and doing so will cause the second
* loaded driver to return -EBUSY.
*
* NOTE: No locking is required; the framebuffer does not touch
* this register.
*/
ep93xxbl->mmio = devm_ioremap(&dev->dev, res->start,
resource_size(res));
if (!ep93xxbl->mmio)
return -ENXIO;
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW;
props.max_brightness = EP93XX_MAX_BRIGHT;
bl = devm_backlight_device_register(&dev->dev, dev->name, &dev->dev,
ep93xxbl, &ep93xxbl_ops, &props);
if (IS_ERR(bl))
return PTR_ERR(bl);
bl->props.brightness = EP93XX_DEF_BRIGHT;
platform_set_drvdata(dev, bl);
ep93xxbl_update_status(bl);
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int ep93xxbl_suspend(struct device *dev)
{
struct backlight_device *bl = dev_get_drvdata(dev);
return ep93xxbl_set(bl, 0);
}
static int ep93xxbl_resume(struct device *dev)
{
struct backlight_device *bl = dev_get_drvdata(dev);
Annotation
- Immediate include surface: `linux/module.h`, `linux/platform_device.h`, `linux/io.h`, `linux/backlight.h`.
- Detected declarations: `struct ep93xxbl`, `function ep93xxbl_set`, `function ep93xxbl_update_status`, `function ep93xxbl_get_brightness`, `function ep93xxbl_probe`, `function ep93xxbl_suspend`, `function ep93xxbl_resume`.
- 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.