drivers/video/fbdev/core/fb_backlight.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/core/fb_backlight.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/core/fb_backlight.c- Extension
.c- Size
- 1247 bytes
- Lines
- 52
- Domain
- Driver Families
- Bucket
- drivers/video
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/backlight.hlinux/export.hlinux/fb.hlinux/mutex.h
Detected Declarations
function fb_bl_default_curvefunction fb_bl_notify_blankexport fb_bl_default_curveexport fb_bl_device
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
#include <linux/backlight.h>
#include <linux/export.h>
#include <linux/fb.h>
#include <linux/mutex.h>
#if IS_ENABLED(CONFIG_FB_BACKLIGHT)
/*
* This function generates a linear backlight curve
*
* 0: off
* 1-7: min
* 8-127: linear from min to max
*/
void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max)
{
unsigned int i, flat, count, range = (max - min);
mutex_lock(&fb_info->bl_curve_mutex);
fb_info->bl_curve[0] = off;
for (flat = 1; flat < (FB_BACKLIGHT_LEVELS / 16); ++flat)
fb_info->bl_curve[flat] = min;
count = FB_BACKLIGHT_LEVELS * 15 / 16;
for (i = 0; i < count; ++i)
fb_info->bl_curve[flat + i] = min + (range * (i + 1) / count);
mutex_unlock(&fb_info->bl_curve_mutex);
}
EXPORT_SYMBOL_GPL(fb_bl_default_curve);
struct backlight_device *fb_bl_device(struct fb_info *info)
{
return info->bl_dev;
}
EXPORT_SYMBOL(fb_bl_device);
void fb_bl_notify_blank(struct fb_info *info, int old_blank)
{
bool on = info->blank == FB_BLANK_UNBLANK;
bool prev_on = old_blank == FB_BLANK_UNBLANK;
if (info->bl_dev)
backlight_notify_blank(info->bl_dev, info->device, on, prev_on);
else
backlight_notify_blank_all(info->device, on, prev_on);
}
#endif
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/export.h`, `linux/fb.h`, `linux/mutex.h`.
- Detected declarations: `function fb_bl_default_curve`, `function fb_bl_notify_blank`, `export fb_bl_default_curve`, `export fb_bl_device`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: integration 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.