drivers/video/fbdev/udlfb.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/udlfb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/udlfb.c- Extension
.c- Size
- 52442 bytes
- Lines
- 1991
- 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 user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/init.hlinux/usb.hlinux/uaccess.hlinux/mm.hlinux/fb.hlinux/vmalloc.hlinux/slab.hlinux/delay.hlinux/unaligned.hvideo/udlfb.hedid.h
Detected Declarations
struct dlfb_deferred_freefunction FB_BLANK_UNBLANKfunction dlfb_lfsr16function dlfb_set_video_modefunction dlfb_vm_openfunction dlfb_vm_closefunction dlfb_ops_mmapfunction alignmentfunction buffersfunction dlfb_render_hlinefunction dlfb_handle_damagefunction dlfb_init_damagefunction dlfb_damage_workfunction dlfb_offload_damagefunction dlfb_dpy_deferred_iofunction dlfb_get_edidfunction dlfb_ops_ioctlfunction dlfb_ops_setcolregfunction dlfb_ops_openfunction dlfb_ops_destroyfunction dlfb_ops_releasefunction dlfb_is_valid_modefunction dlfb_var_color_formatfunction dlfb_ops_check_varfunction dlfb_ops_set_parfunction dlfb_ops_blankfunction dlfb_ops_damage_rangefunction dlfb_ops_damage_areafunction dlfb_deferred_vfreefunction dlfb_realloc_framebufferfunction dlfb_setup_modesfunction tofunction metrics_bytes_rendered_showfunction metrics_bytes_identical_showfunction metrics_bytes_sent_showfunction metrics_cpu_kcycles_used_showfunction edid_showfunction edid_storefunction metrics_reset_storefunction dlfb_select_std_channelfunction dlfb_parse_vendor_descriptorfunction dlfb_usb_probefunction dlfb_usb_disconnectfunction dlfb_urb_completionfunction dlfb_free_urb_listfunction dlfb_alloc_urb_listfunction dlfb_submit_urb
Annotated Snippet
struct dlfb_deferred_free {
struct list_head list;
void *mem;
};
static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info, u32 new_len);
/* dlfb keeps a list of urbs for efficient bulk transfers */
static void dlfb_urb_completion(struct urb *urb);
static struct urb *dlfb_get_urb(struct dlfb_data *dlfb);
static int dlfb_submit_urb(struct dlfb_data *dlfb, struct urb * urb, size_t len);
static int dlfb_alloc_urb_list(struct dlfb_data *dlfb, int count, size_t size);
static void dlfb_free_urb_list(struct dlfb_data *dlfb);
/*
* All DisplayLink bulk operations start with 0xAF, followed by specific code
* All operations are written to buffers which then later get sent to device
*/
static char *dlfb_set_register(char *buf, u8 reg, u8 val)
{
*buf++ = 0xAF;
*buf++ = 0x20;
*buf++ = reg;
*buf++ = val;
return buf;
}
static char *dlfb_vidreg_lock(char *buf)
{
return dlfb_set_register(buf, 0xFF, 0x00);
}
static char *dlfb_vidreg_unlock(char *buf)
{
return dlfb_set_register(buf, 0xFF, 0xFF);
}
/*
* Map FB_BLANK_* to DisplayLink register
* DLReg FB_BLANK_*
* ----- -----------------------------
* 0x00 FB_BLANK_UNBLANK (0)
* 0x01 FB_BLANK (1)
* 0x03 FB_BLANK_VSYNC_SUSPEND (2)
* 0x05 FB_BLANK_HSYNC_SUSPEND (3)
* 0x07 FB_BLANK_POWERDOWN (4) Note: requires modeset to come back
*/
static char *dlfb_blanking(char *buf, int fb_blank)
{
u8 reg;
switch (fb_blank) {
case FB_BLANK_POWERDOWN:
reg = 0x07;
break;
case FB_BLANK_HSYNC_SUSPEND:
reg = 0x05;
break;
case FB_BLANK_VSYNC_SUSPEND:
reg = 0x03;
break;
case FB_BLANK_NORMAL:
reg = 0x01;
break;
default:
reg = 0x00;
}
buf = dlfb_set_register(buf, 0x1F, reg);
return buf;
}
static char *dlfb_set_color_depth(char *buf, u8 selection)
{
return dlfb_set_register(buf, 0x00, selection);
}
static char *dlfb_set_base16bpp(char *wrptr, u32 base)
{
/* the base pointer is 16 bits wide, 0x20 is hi byte. */
wrptr = dlfb_set_register(wrptr, 0x20, base >> 16);
wrptr = dlfb_set_register(wrptr, 0x21, base >> 8);
return dlfb_set_register(wrptr, 0x22, base);
}
/*
* DisplayLink HW has separate 16bpp and 8bpp framebuffers.
* In 24bpp modes, the low 323 RGB bits go in the 8bpp framebuffer
*/
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/usb.h`, `linux/uaccess.h`, `linux/mm.h`, `linux/fb.h`, `linux/vmalloc.h`.
- Detected declarations: `struct dlfb_deferred_free`, `function FB_BLANK_UNBLANK`, `function dlfb_lfsr16`, `function dlfb_set_video_mode`, `function dlfb_vm_open`, `function dlfb_vm_close`, `function dlfb_ops_mmap`, `function alignment`, `function buffers`, `function dlfb_render_hline`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.