drivers/video/fbdev/wm8505fb.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/wm8505fb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/wm8505fb.c- Extension
.c- Size
- 10207 bytes
- Lines
- 408
- 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/delay.hlinux/dma-mapping.hlinux/fb.hlinux/errno.hlinux/err.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/memblock.hlinux/mm.hlinux/module.hlinux/of.hlinux/of_fdt.hlinux/platform_device.hlinux/slab.hlinux/string.hlinux/wait.hvideo/of_display_timing.hwm8505fb_regs.hwmt_ge_rops.h
Detected Declarations
struct wm8505fb_infofunction wm8505fb_init_hwfunction wm8505fb_set_timingfunction wm8505fb_set_parfunction contrast_showfunction contrast_storefunction chan_to_fieldfunction wm8505fb_setcolregfunction wm8505fb_pan_displayfunction wm8505fb_blankfunction wm8505fb_probefunction wm8505fb_remove
Annotated Snippet
struct wm8505fb_info {
struct fb_info fb;
void __iomem *regbase;
unsigned int contrast;
};
static int wm8505fb_init_hw(struct fb_info *info)
{
struct wm8505fb_info *fbi = to_wm8505fb_info(info);
int i;
/* I know the purpose only of few registers, so clear unknown */
for (i = 0; i < 0x200; i += 4)
writel(0, fbi->regbase + i);
/* Set frame buffer address */
writel(fbi->fb.fix.smem_start, fbi->regbase + WMT_GOVR_FBADDR);
writel(fbi->fb.fix.smem_start, fbi->regbase + WMT_GOVR_FBADDR1);
/*
* Set in-memory picture format to RGB
* 0x31C sets the correct color mode (RGB565) for WM8650
* Bit 8+9 (0x300) are ignored on WM8505 as reserved
*/
writel(0x31c, fbi->regbase + WMT_GOVR_COLORSPACE);
writel(1, fbi->regbase + WMT_GOVR_COLORSPACE1);
/* Virtual buffer size */
writel(info->var.xres, fbi->regbase + WMT_GOVR_XRES);
writel(info->var.xres_virtual, fbi->regbase + WMT_GOVR_XRES_VIRTUAL);
/* black magic ;) */
writel(0xf, fbi->regbase + WMT_GOVR_FHI);
writel(4, fbi->regbase + WMT_GOVR_DVO_SET);
writel(1, fbi->regbase + WMT_GOVR_MIF_ENABLE);
writel(1, fbi->regbase + WMT_GOVR_REG_UPDATE);
return 0;
}
static int wm8505fb_set_timing(struct fb_info *info)
{
struct wm8505fb_info *fbi = to_wm8505fb_info(info);
int h_start = info->var.left_margin;
int h_end = h_start + info->var.xres;
int h_all = h_end + info->var.right_margin;
int h_sync = info->var.hsync_len;
int v_start = info->var.upper_margin;
int v_end = v_start + info->var.yres;
int v_all = v_end + info->var.lower_margin;
int v_sync = info->var.vsync_len;
writel(0, fbi->regbase + WMT_GOVR_TG);
writel(h_start, fbi->regbase + WMT_GOVR_TIMING_H_START);
writel(h_end, fbi->regbase + WMT_GOVR_TIMING_H_END);
writel(h_all, fbi->regbase + WMT_GOVR_TIMING_H_ALL);
writel(h_sync, fbi->regbase + WMT_GOVR_TIMING_H_SYNC);
writel(v_start, fbi->regbase + WMT_GOVR_TIMING_V_START);
writel(v_end, fbi->regbase + WMT_GOVR_TIMING_V_END);
writel(v_all, fbi->regbase + WMT_GOVR_TIMING_V_ALL);
writel(v_sync, fbi->regbase + WMT_GOVR_TIMING_V_SYNC);
writel(1, fbi->regbase + WMT_GOVR_TG);
return 0;
}
static int wm8505fb_set_par(struct fb_info *info)
{
struct wm8505fb_info *fbi = to_wm8505fb_info(info);
if (!fbi)
return -EINVAL;
if (info->var.bits_per_pixel == 32) {
info->var.red.offset = 16;
info->var.red.length = 8;
info->var.red.msb_right = 0;
info->var.green.offset = 8;
info->var.green.length = 8;
info->var.green.msb_right = 0;
info->var.blue.offset = 0;
info->var.blue.length = 8;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/dma-mapping.h`, `linux/fb.h`, `linux/errno.h`, `linux/err.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct wm8505fb_info`, `function wm8505fb_init_hw`, `function wm8505fb_set_timing`, `function wm8505fb_set_par`, `function contrast_show`, `function contrast_store`, `function chan_to_field`, `function wm8505fb_setcolreg`, `function wm8505fb_pan_display`, `function wm8505fb_blank`.
- 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.