drivers/video/fbdev/kyro/fbdev.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/kyro/fbdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/kyro/fbdev.c- Extension
.c- Size
- 21128 bytes
- Lines
- 815
- Domain
- Driver Families
- Bucket
- drivers/video
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/aperture.hlinux/module.hlinux/types.hlinux/kernel.hlinux/mm.hlinux/errno.hlinux/string.hlinux/delay.hlinux/fb.hlinux/ioctl.hlinux/init.hlinux/pci.hasm/io.hlinux/uaccess.hvideo/kyro.hSTG4000Reg.hSTG4000Interface.h
Detected Declarations
function kyro_dev_video_mode_setfunction kyro_dev_overlay_createfunction kyro_dev_overlay_viewport_setfunction get_line_lengthfunction kyrofb_check_varfunction kyrofb_set_parfunction kyrofb_setcolregfunction kyrofb_setupfunction kyrofb_ioctlfunction kyrofb_probefunction kyrofb_removefunction kyrofb_initfunction kyrofb_exitmodule init kyrofb_init
Annotated Snippet
static struct pci_driver kyrofb_pci_driver = {
.name = "kyrofb",
.id_table = kyrofb_pci_tbl,
.probe = kyrofb_probe,
.remove = kyrofb_remove,
};
static const struct fb_ops kyrofb_ops = {
.owner = THIS_MODULE,
FB_DEFAULT_IOMEM_OPS,
.fb_check_var = kyrofb_check_var,
.fb_set_par = kyrofb_set_par,
.fb_setcolreg = kyrofb_setcolreg,
.fb_ioctl = kyrofb_ioctl,
};
static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct fb_info *info;
struct kyrofb_info *currentpar;
unsigned long size;
int err;
err = aperture_remove_conflicting_pci_devices(pdev, "kyrofb");
if (err)
return err;
err = pcim_enable_device(pdev);
if (err) {
printk(KERN_WARNING "kyrofb: Can't enable pdev: %d\n", err);
return err;
}
info = framebuffer_alloc(sizeof(struct kyrofb_info), &pdev->dev);
if (!info)
return -ENOMEM;
err = pcim_request_all_regions(pdev, "kyrofb");
if (err)
goto out_free_fb;
currentpar = info->par;
kyro_fix.smem_start = pci_resource_start(pdev, 0);
kyro_fix.smem_len = pci_resource_len(pdev, 0);
kyro_fix.mmio_start = pci_resource_start(pdev, 1);
kyro_fix.mmio_len = pci_resource_len(pdev, 1);
currentpar->regbase = deviceInfo.pSTGReg =
devm_ioremap(&pdev->dev, kyro_fix.mmio_start,
kyro_fix.mmio_len);
if (!currentpar->regbase)
goto out_free_fb;
info->screen_base = devm_ioremap_wc(&pdev->dev, kyro_fix.smem_start,
kyro_fix.smem_len);
if (!info->screen_base)
goto out_free_fb;
if (!nomtrr)
currentpar->wc_cookie = arch_phys_wc_add(kyro_fix.smem_start,
kyro_fix.smem_len);
kyro_fix.ypanstep = nopan ? 0 : 1;
kyro_fix.ywrapstep = nowrap ? 0 : 1;
info->fbops = &kyrofb_ops;
info->fix = kyro_fix;
info->pseudo_palette = currentpar->palette;
SetCoreClockPLL(deviceInfo.pSTGReg, pdev);
deviceInfo.ulNextFreeVidMem = 0;
deviceInfo.ulOverlayOffset = 0;
/* This should give a reasonable default video mode */
if (!fb_find_mode(&info->var, info, mode_option, kyro_modedb,
NUM_TOTAL_MODES, &kyro_modedb[VMODE_1024_768_75], 32))
info->var = kyro_var;
fb_alloc_cmap(&info->cmap, 256, 0);
kyrofb_set_par(info);
kyrofb_check_var(&info->var, info);
size = get_line_length(info->var.xres_virtual,
info->var.bits_per_pixel);
size *= info->var.yres_virtual;
fb_memset_io(info->screen_base, 0, size);
Annotation
- Immediate include surface: `linux/aperture.h`, `linux/module.h`, `linux/types.h`, `linux/kernel.h`, `linux/mm.h`, `linux/errno.h`, `linux/string.h`, `linux/delay.h`.
- Detected declarations: `function kyro_dev_video_mode_set`, `function kyro_dev_overlay_create`, `function kyro_dev_overlay_viewport_set`, `function get_line_length`, `function kyrofb_check_var`, `function kyrofb_set_par`, `function kyrofb_setcolreg`, `function kyrofb_setup`, `function kyrofb_ioctl`, `function kyrofb_probe`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.