drivers/video/fbdev/vt8500lcdfb.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/vt8500lcdfb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/vt8500lcdfb.c- Extension
.c- Size
- 12638 bytes
- Lines
- 490
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/delay.hlinux/dma-mapping.hlinux/errno.hlinux/fb.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/mm.hlinux/module.hlinux/platform_device.hlinux/slab.hlinux/string.hlinux/wait.hvideo/of_display_timing.hvt8500lcdfb.hwmt_ge_rops.hlinux/of.hlinux/of_fdt.hlinux/memblock.h
Detected Declarations
function Copyrightfunction chan_to_fieldfunction vt8500lcd_setcolregfunction vt8500lcd_ioctlfunction vt8500lcd_pan_displayfunction vt8500lcd_blankfunction vt8500lcd_handle_irqfunction vt8500lcd_probefunction vt8500lcd_remove
Annotated Snippet
if (info->var.bits_per_pixel == 16) {
/* RGB565 */
info->var.red.offset = 11;
info->var.red.length = 5;
info->var.red.msb_right = 0;
info->var.green.offset = 5;
info->var.green.length = 6;
info->var.green.msb_right = 0;
info->var.blue.offset = 0;
info->var.blue.length = 5;
info->var.blue.msb_right = 0;
} else {
/* Equal depths per channel */
info->var.red.offset = info->var.bits_per_pixel
* 2 / 3;
info->var.red.length = info->var.bits_per_pixel / 3;
info->var.red.msb_right = 0;
info->var.green.offset = info->var.bits_per_pixel / 3;
info->var.green.length = info->var.bits_per_pixel / 3;
info->var.green.msb_right = 0;
info->var.blue.offset = 0;
info->var.blue.length = info->var.bits_per_pixel / 3;
info->var.blue.msb_right = 0;
}
info->fix.visual = FB_VISUAL_TRUECOLOR;
info->fix.line_length = info->var.bits_per_pixel > 16 ?
info->var.xres_virtual << 2 :
info->var.xres_virtual << 1;
}
for (i = 0; i < 8; i++) {
if (bpp_values[i] == info->var.bits_per_pixel)
reg_bpp = i;
}
control0 = readl(fbi->regbase) & ~0xf;
writel(0, fbi->regbase);
while (readl(fbi->regbase + 0x38) & 0x10)
/* wait */;
writel((((info->var.hsync_len - 1) & 0x3f) << 26)
| ((info->var.left_margin & 0xff) << 18)
| (((info->var.xres - 1) & 0x3ff) << 8)
| (info->var.right_margin & 0xff), fbi->regbase + 0x4);
writel((((info->var.vsync_len - 1) & 0x3f) << 26)
| ((info->var.upper_margin & 0xff) << 18)
| (((info->var.yres - 1) & 0x3ff) << 8)
| (info->var.lower_margin & 0xff), fbi->regbase + 0x8);
writel((((info->var.yres - 1) & 0x400) << 2)
| ((info->var.xres - 1) & 0x400), fbi->regbase + 0x10);
writel(0x80000000, fbi->regbase + 0x20);
writel(control0 | (reg_bpp << 1) | 0x100, fbi->regbase);
return 0;
}
static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
{
chan &= 0xffff;
chan >>= 16 - bf->length;
return chan << bf->offset;
}
static int vt8500lcd_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp,
struct fb_info *info) {
struct vt8500lcd_info *fbi = to_vt8500lcd_info(info);
int ret = 1;
unsigned int val;
if (regno >= 256)
return -EINVAL;
if (info->var.grayscale)
red = green = blue =
(19595 * red + 38470 * green + 7471 * blue) >> 16;
switch (fbi->fb.fix.visual) {
case FB_VISUAL_TRUECOLOR:
if (regno < 16) {
u32 *pal = fbi->fb.pseudo_palette;
val = chan_to_field(red, &fbi->fb.var.red);
val |= chan_to_field(green, &fbi->fb.var.green);
val |= chan_to_field(blue, &fbi->fb.var.blue);
pal[regno] = val;
ret = 0;
}
break;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/dma-mapping.h`, `linux/errno.h`, `linux/fb.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/kernel.h`.
- Detected declarations: `function Copyright`, `function chan_to_field`, `function vt8500lcd_setcolreg`, `function vt8500lcd_ioctl`, `function vt8500lcd_pan_display`, `function vt8500lcd_blank`, `function vt8500lcd_handle_irq`, `function vt8500lcd_probe`, `function vt8500lcd_remove`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.