drivers/video/fbdev/sh7760fb.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/sh7760fb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/sh7760fb.c- Extension
.c- Size
- 14167 bytes
- Lines
- 585
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/completion.hlinux/delay.hlinux/dma-mapping.hlinux/fb.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/module.hlinux/platform_device.hlinux/slab.hasm/sh7760fb.h
Detected Declarations
struct sh7760fb_parfunction sh7760fb_irqfunction wait_for_lpsfunction sh7760fb_blankfunction sh7760_setcolregfunction sh7760fb_get_color_infofunction sh7760fb_check_varfunction sh7760fb_set_parfunction Ifunction sh7760fb_free_memfunction sh7760fb_alloc_memfunction sh7760fb_probefunction sh7760fb_remove
Annotated Snippet
struct sh7760fb_par {
void __iomem *base;
int irq;
struct sh7760fb_platdata *pd; /* display information */
dma_addr_t fbdma; /* physical address */
int rot; /* rotation enabled? */
u32 pseudo_palette[16];
struct platform_device *dev;
struct resource *ioarea;
struct completion vsync; /* vsync irq event */
};
static irqreturn_t sh7760fb_irq(int irq, void *data)
{
struct completion *c = data;
complete(c);
return IRQ_HANDLED;
}
/* wait_for_lps - wait until power supply has reached a certain state. */
static int wait_for_lps(struct sh7760fb_par *par, int val)
{
int i = 100;
while (--i && ((ioread16(par->base + LDPMMR) & 3) != val))
msleep(1);
if (i <= 0)
return -ETIMEDOUT;
return 0;
}
/* en/disable the LCDC */
static int sh7760fb_blank(int blank, struct fb_info *info)
{
struct sh7760fb_par *par = info->par;
struct sh7760fb_platdata *pd = par->pd;
unsigned short cntr = ioread16(par->base + LDCNTR);
unsigned short intr = ioread16(par->base + LDINTR);
int lps;
if (blank == FB_BLANK_UNBLANK) {
intr |= VINT_START;
cntr = LDCNTR_DON2 | LDCNTR_DON;
lps = 3;
} else {
intr &= ~VINT_START;
cntr = LDCNTR_DON2;
lps = 0;
}
if (pd->blank)
pd->blank(blank);
iowrite16(intr, par->base + LDINTR);
iowrite16(cntr, par->base + LDCNTR);
return wait_for_lps(par, lps);
}
static int sh7760_setcolreg (u_int regno,
u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info)
{
u32 *palette = info->pseudo_palette;
if (regno >= 16)
return -EINVAL;
/* only FB_VISUAL_TRUECOLOR supported */
red >>= 16 - info->var.red.length;
green >>= 16 - info->var.green.length;
blue >>= 16 - info->var.blue.length;
transp >>= 16 - info->var.transp.length;
palette[regno] = (red << info->var.red.offset) |
(green << info->var.green.offset) |
(blue << info->var.blue.offset) |
(transp << info->var.transp.offset);
return 0;
}
Annotation
- Immediate include surface: `linux/completion.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/fb.h`, `linux/interrupt.h`, `linux/io.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `struct sh7760fb_par`, `function sh7760fb_irq`, `function wait_for_lps`, `function sh7760fb_blank`, `function sh7760_setcolreg`, `function sh7760fb_get_color_info`, `function sh7760fb_check_var`, `function sh7760fb_set_par`, `function I`, `function sh7760fb_free_mem`.
- 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.