drivers/video/fbdev/simplefb.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/simplefb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/simplefb.c- Extension
.c- Size
- 17863 bytes
- Lines
- 694
- 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/aperture.hlinux/clk.hlinux/errno.hlinux/fb.hlinux/io.hlinux/module.hlinux/of.hlinux/of_clk.hlinux/of_platform.hlinux/of_reserved_mem.hlinux/parser.hlinux/platform_data/simplefb.hlinux/platform_device.hlinux/pm_domain.hlinux/regulator/consumer.h
Detected Declarations
struct simplefb_parstruct simplefb_paramsfunction simplefb_setcolregfunction unregister_framebufferfunction simplefb_parse_dtfunction simplefb_parse_pdfunction usfunction simplefb_clocks_enablefunction simplefb_clocks_destroyfunction simplefb_clocks_getfunction simplefb_clocks_enablefunction simplefb_regulators_enablefunction simplefb_regulators_destroyfunction simplefb_regulators_getfunction simplefb_regulators_enablefunction simplefb_attach_genpdsfunction simplefb_detach_genpdsfunction simplefb_probefunction simplefb_remove
Annotated Snippet
struct simplefb_par {
u32 palette[PSEUDO_PALETTE_SIZE];
resource_size_t base;
resource_size_t size;
struct resource *mem;
#if defined CONFIG_OF && defined CONFIG_COMMON_CLK
bool clks_enabled;
unsigned int clk_count;
struct clk **clks;
#endif
#if defined CONFIG_OF && defined CONFIG_PM_GENERIC_DOMAINS
unsigned int num_genpds;
struct device **genpds;
struct device_link **genpd_links;
#endif
#if defined CONFIG_OF && defined CONFIG_REGULATOR
bool regulators_enabled;
u32 regulator_count;
struct regulator **regulators;
#endif
};
static void simplefb_clocks_destroy(struct simplefb_par *par);
static void simplefb_regulators_destroy(struct simplefb_par *par);
static void simplefb_detach_genpds(void *res);
/*
* fb_ops.fb_destroy is called by the last put_fb_info() call at the end
* of unregister_framebuffer() or fb_release(). Do any cleanup here.
*/
static void simplefb_destroy(struct fb_info *info)
{
struct simplefb_par *par = info->par;
struct resource *mem = par->mem;
simplefb_regulators_destroy(info->par);
simplefb_clocks_destroy(info->par);
simplefb_detach_genpds(info->par);
if (info->screen_base)
iounmap(info->screen_base);
framebuffer_release(info);
if (mem)
release_mem_region(mem->start, resource_size(mem));
}
static const struct fb_ops simplefb_ops = {
.owner = THIS_MODULE,
FB_DEFAULT_IOMEM_OPS,
.fb_destroy = simplefb_destroy,
.fb_setcolreg = simplefb_setcolreg,
};
static struct simplefb_format simplefb_formats[] = SIMPLEFB_FORMATS;
struct simplefb_params {
u32 width;
u32 height;
u32 stride;
struct simplefb_format *format;
struct resource memory;
};
static int simplefb_parse_dt(struct platform_device *pdev,
struct simplefb_params *params)
{
struct device_node *np = pdev->dev.of_node;
int ret;
const char *format;
int i;
ret = of_property_read_u32(np, "width", ¶ms->width);
if (ret) {
dev_err(&pdev->dev, "Can't parse width property\n");
return ret;
}
ret = of_property_read_u32(np, "height", ¶ms->height);
if (ret) {
dev_err(&pdev->dev, "Can't parse height property\n");
return ret;
}
ret = of_property_read_u32(np, "stride", ¶ms->stride);
if (ret) {
dev_err(&pdev->dev, "Can't parse stride property\n");
return ret;
}
Annotation
- Immediate include surface: `linux/aperture.h`, `linux/clk.h`, `linux/errno.h`, `linux/fb.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/of_clk.h`.
- Detected declarations: `struct simplefb_par`, `struct simplefb_params`, `function simplefb_setcolreg`, `function unregister_framebuffer`, `function simplefb_parse_dt`, `function simplefb_parse_pd`, `function us`, `function simplefb_clocks_enable`, `function simplefb_clocks_destroy`, `function simplefb_clocks_get`.
- 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.