drivers/staging/fbtft/fbtft-core.c
Source file repositories/reference/linux-study-clean/drivers/staging/fbtft/fbtft-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/fbtft/fbtft-core.c- Extension
.c- Size
- 33428 bytes
- Lines
- 1272
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- 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/errno.hlinux/string.hlinux/mm.hlinux/vmalloc.hlinux/slab.hlinux/init.hlinux/fb.hlinux/gpio/consumer.hlinux/spi/spi.hlinux/delay.hlinux/uaccess.hlinux/backlight.hlinux/platform_device.hlinux/property.hlinux/spinlock.hvideo/mipi_display.hfbtft.hinternal.h
Detected Declarations
function fbtft_write_buf_dcfunction fbtft_dbg_hexfunction fbtft_request_one_gpiofunction fbtft_request_gpiosfunction fbtft_backlight_update_statusfunction fbtft_backlight_get_brightnessfunction fbtft_unregister_backlightfunction fbtft_register_backlightfunction fbtft_set_addr_winfunction fbtft_resetfunction fbtft_update_displayfunction fbtft_mkdirtyfunction fbtft_deferred_iofunction chan_to_fieldfunction fbtft_fb_setcolregfunction fbtft_fb_blankfunction fbtft_ops_damage_rangefunction fbtft_ops_damage_areafunction fbtft_merge_fbtftopsfunction fbtft_framebuffer_releasefunction fbtft_register_framebufferfunction fbtft_unregister_framebufferfunction fbtft_init_display_from_propertyfunction fbtft_init_displayfunction fbtft_verify_gpiosfunction fbtft_property_valuefunction fbtft_probe_commonfunction fbtft_remove_commonexport fbtft_write_buf_dcexport fbtft_dbg_hexexport fbtft_unregister_backlightexport fbtft_register_backlightexport fbtft_framebuffer_allocexport fbtft_framebuffer_releaseexport fbtft_register_framebufferexport fbtft_unregister_framebufferexport fbtft_init_displayexport fbtft_probe_commonexport fbtft_remove_common
Annotated Snippet
if (regno < 16) {
u32 *pal = info->pseudo_palette;
val = chan_to_field(red, &info->var.red);
val |= chan_to_field(green, &info->var.green);
val |= chan_to_field(blue, &info->var.blue);
pal[regno] = val;
ret = 0;
}
break;
}
return ret;
}
static int fbtft_fb_blank(int blank, struct fb_info *info)
{
struct fbtft_par *par = info->par;
int ret = -EINVAL;
fb_dbg(info, "blank=%d\n", blank);
if (!par->fbtftops.blank)
return ret;
switch (blank) {
case FB_BLANK_POWERDOWN:
case FB_BLANK_VSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
case FB_BLANK_NORMAL:
ret = par->fbtftops.blank(par, true);
break;
case FB_BLANK_UNBLANK:
ret = par->fbtftops.blank(par, false);
break;
}
return ret;
}
static void fbtft_ops_damage_range(struct fb_info *info, off_t off, size_t len)
{
struct fbtft_par *par = info->par;
u32 start, end;
start = off / info->fix.line_length;
end = (off + len - 1) / info->fix.line_length;
par->fbtftops.mkdirty(info, start, end - start + 1);
}
static void fbtft_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height)
{
struct fbtft_par *par = info->par;
par->fbtftops.mkdirty(info, y, height);
}
FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(fbtft_ops,
fbtft_ops_damage_range,
fbtft_ops_damage_area)
static const struct fb_ops fbtft_ops = {
.owner = THIS_MODULE,
FB_DEFAULT_DEFERRED_OPS(fbtft_ops),
.fb_setcolreg = fbtft_fb_setcolreg,
.fb_blank = fbtft_fb_blank,
};
static void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src)
{
if (src->write)
dst->write = src->write;
if (src->read)
dst->read = src->read;
if (src->write_vmem)
dst->write_vmem = src->write_vmem;
if (src->write_register)
dst->write_register = src->write_register;
if (src->set_addr_win)
dst->set_addr_win = src->set_addr_win;
if (src->reset)
dst->reset = src->reset;
if (src->mkdirty)
dst->mkdirty = src->mkdirty;
if (src->update_display)
dst->update_display = src->update_display;
if (src->init_display)
dst->init_display = src->init_display;
if (src->blank)
dst->blank = src->blank;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/errno.h`, `linux/string.h`, `linux/mm.h`, `linux/vmalloc.h`, `linux/slab.h`, `linux/init.h`.
- Detected declarations: `function fbtft_write_buf_dc`, `function fbtft_dbg_hex`, `function fbtft_request_one_gpio`, `function fbtft_request_gpios`, `function fbtft_backlight_update_status`, `function fbtft_backlight_get_brightness`, `function fbtft_unregister_backlight`, `function fbtft_register_backlight`, `function fbtft_set_addr_win`, `function fbtft_reset`.
- Atlas domain: Driver Families / drivers/staging.
- 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.