drivers/video/fbdev/sm501fb.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/sm501fb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/sm501fb.c- Extension
.c- Size
- 54258 bytes
- Lines
- 2249
- 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.
- 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/tty.hlinux/slab.hlinux/delay.hlinux/fb.hlinux/init.hlinux/vmalloc.hlinux/dma-mapping.hlinux/interrupt.hlinux/workqueue.hlinux/wait.hlinux/platform_device.hlinux/clk.hlinux/console.hlinux/io.hlinux/string_choices.hlinux/uaccess.hasm/div64.hlinux/pm.hlinux/sm501.hlinux/sm501-regs.hedid.h
Detected Declarations
struct sm501_memstruct sm501fb_infostruct sm501fb_parenum sm501_controllerfunction h_totalfunction v_totalfunction sm501fb_sync_regsfunction cursorsfunction sm501fb_ps_to_hzfunction sm501fb_setup_gammafunction sm501fb_check_varfunction sm501fb_check_var_crtfunction sm501fb_check_var_pnlfunction sm501fb_set_par_commonfunction sm501fb_set_par_geometryfunction sm501fb_pan_crtfunction sm501fb_pan_pnlfunction sm501fb_set_par_crtfunction sm501fb_panel_powerfunction sm501fb_set_par_pnlfunction chan_to_fieldfunction sm501fb_setcolregfunction sm501fb_blank_pnlfunction sm501fb_blank_crtfunction sm501fb_cursorfunction sm501fb_crtsrc_showfunction sm501fb_crtsrc_storefunction sm501fb_show_regsfunction sm501fb_debug_show_crtfunction sm501fb_debug_show_pnlfunction sm501fb_syncfunction sm501fb_copyareafunction sm501fb_fillrectfunction sm501_init_cursorfunction sm501fb_startfunction sm501fb_stopfunction sm501fb_init_fbfunction sm501fb_probe_onefunction sm501_free_init_fbfunction sm501fb_start_onefunction sm501fb_probefunction sm501fb_removefunction sm501fb_suspend_fbfunction sm501fb_resume_fbfunction sm501fb_suspendfunction sm501fb_resume
Annotated Snippet
struct sm501_mem {
unsigned long size;
unsigned long sm_addr; /* offset from base of sm501 fb. */
void __iomem *k_addr;
};
/* private data that is shared between all frambuffers* */
struct sm501fb_info {
struct device *dev;
struct fb_info *fb[2]; /* fb info for both heads */
struct resource *fbmem_res; /* framebuffer resource */
struct resource *regs_res; /* registers resource */
struct resource *regs2d_res; /* 2d registers resource */
struct sm501_platdata_fb *pdata; /* our platform data */
unsigned long pm_crt_ctrl; /* pm: crt ctrl save */
int irq;
int swap_endian; /* set to swap rgb=>bgr */
void __iomem *regs; /* remapped registers */
void __iomem *regs2d; /* 2d remapped registers */
void __iomem *fbmem; /* remapped framebuffer */
size_t fbmem_len; /* length of remapped region */
u8 *edid_data;
char *fb_mode;
};
/* per-framebuffer private data */
struct sm501fb_par {
u32 pseudo_palette[16];
enum sm501_controller head;
struct sm501_mem cursor;
struct sm501_mem screen;
struct fb_ops ops;
void *store_fb;
void *store_cursor;
void __iomem *cursor_regs;
struct sm501fb_info *info;
};
/* Helper functions */
static inline int h_total(struct fb_var_screeninfo *var)
{
return var->xres + var->left_margin +
var->right_margin + var->hsync_len;
}
static inline int v_total(struct fb_var_screeninfo *var)
{
return var->yres + var->upper_margin +
var->lower_margin + var->vsync_len;
}
/* sm501fb_sync_regs()
*
* This call is mainly for PCI bus systems where we need to
* ensure that any writes to the bus are completed before the
* next phase, or after completing a function.
*/
static inline void sm501fb_sync_regs(struct sm501fb_info *info)
{
smc501_readl(info->regs);
}
/* sm501_alloc_mem
*
* This is an attempt to lay out memory for the two framebuffers and
* everything else
*
* |fbmem_res->start fbmem_res->end|
* | |
* |fb[0].fix.smem_start | |fb[1].fix.smem_start | 2K |
* |-> fb[0].fix.smem_len <-| spare |-> fb[1].fix.smem_len <-|-> cursors <-|
*
* The "spare" space is for the 2d engine data
* the fixed is space for the cursors (2x1Kbyte)
*
* we need to allocate memory for the 2D acceleration engine
* command list and the data for the engine to deal with.
*
* - all allocations must be 128bit aligned
* - cursors are 64x64x2 bits (1Kbyte)
*
*/
#define SM501_MEMF_CURSOR (1)
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/errno.h`, `linux/string.h`, `linux/mm.h`, `linux/tty.h`, `linux/slab.h`, `linux/delay.h`.
- Detected declarations: `struct sm501_mem`, `struct sm501fb_info`, `struct sm501fb_par`, `enum sm501_controller`, `function h_total`, `function v_total`, `function sm501fb_sync_regs`, `function cursors`, `function sm501fb_ps_to_hz`, `function sm501fb_setup_gamma`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: source 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.