drivers/video/backlight/omap1_bl.c
Source file repositories/reference/linux-study-clean/drivers/video/backlight/omap1_bl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/backlight/omap1_bl.c- Extension
.c- Size
- 3695 bytes
- Lines
- 165
- 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/kernel.hlinux/init.hlinux/platform_device.hlinux/backlight.hlinux/slab.hlinux/platform_data/omap1_bl.hlinux/soc/ti/omap1-io.hlinux/soc/ti/omap1-mux.h
Detected Declarations
struct omap_backlightfunction omapbl_send_intensityfunction omapbl_send_enablefunction omapbl_enablefunction omapbl_suspendfunction omapbl_resumefunction omapbl_set_enabledfunction omapbl_update_statusfunction omapbl_get_intensityfunction omapbl_probe
Annotated Snippet
struct omap_backlight {
bool enabled;
int current_intensity;
struct device *dev;
struct omap_backlight_config *pdata;
};
static inline void omapbl_send_intensity(int intensity)
{
omap_writeb(intensity, OMAP_PWL_ENABLE);
}
static inline void omapbl_send_enable(int enable)
{
omap_writeb(enable, OMAP_PWL_CLK_ENABLE);
}
static void omapbl_enable(struct omap_backlight *bl, bool enable)
{
if (enable) {
omapbl_send_intensity(bl->current_intensity);
omapbl_send_enable(1);
} else {
omapbl_send_intensity(0);
omapbl_send_enable(0);
}
}
#ifdef CONFIG_PM_SLEEP
static int omapbl_suspend(struct device *dev)
{
struct backlight_device *bl_dev = dev_get_drvdata(dev);
struct omap_backlight *bl = bl_get_data(bl_dev);
omapbl_enable(bl, false);
return 0;
}
static int omapbl_resume(struct device *dev)
{
struct backlight_device *bl_dev = dev_get_drvdata(dev);
struct omap_backlight *bl = bl_get_data(bl_dev);
omapbl_enable(bl, bl->enabled);
return 0;
}
#endif
static void omapbl_set_enabled(struct backlight_device *dev, bool enable)
{
struct omap_backlight *bl = bl_get_data(dev);
omapbl_enable(bl, enable);
bl->enabled = enable;
}
static int omapbl_update_status(struct backlight_device *dev)
{
struct omap_backlight *bl = bl_get_data(dev);
bool enable;
if (bl->current_intensity != dev->props.brightness) {
if (bl->enabled)
omapbl_send_intensity(dev->props.brightness);
bl->current_intensity = dev->props.brightness;
}
enable = !backlight_is_blank(dev);
if (enable != bl->enabled)
omapbl_set_enabled(dev, enable);
return 0;
}
static int omapbl_get_intensity(struct backlight_device *dev)
{
struct omap_backlight *bl = bl_get_data(dev);
return bl->current_intensity;
}
static const struct backlight_ops omapbl_ops = {
.get_brightness = omapbl_get_intensity,
.update_status = omapbl_update_status,
};
static int omapbl_probe(struct platform_device *pdev)
{
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/platform_device.h`, `linux/backlight.h`, `linux/slab.h`, `linux/platform_data/omap1_bl.h`, `linux/soc/ti/omap1-io.h`.
- Detected declarations: `struct omap_backlight`, `function omapbl_send_intensity`, `function omapbl_send_enable`, `function omapbl_enable`, `function omapbl_suspend`, `function omapbl_resume`, `function omapbl_set_enabled`, `function omapbl_update_status`, `function omapbl_get_intensity`, `function omapbl_probe`.
- 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.