drivers/staging/fbtft/fb_ssd1325.c
Source file repositories/reference/linux-study-clean/drivers/staging/fbtft/fb_ssd1325.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/fbtft/fb_ssd1325.c- Extension
.c- Size
- 4073 bytes
- Lines
- 186
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/init.hlinux/gpio/consumer.hlinux/delay.hfbtft.h
Detected Declarations
function init_displayfunction rgb565_to_g16function set_addr_winfunction blankfunction set_gammafunction write_vmem
Annotated Snippet
if (i > 0 && curves[i] < 1) {
dev_err(par->info->device,
"Illegal value in Grayscale Lookup Table at index %d.\n"
"Must be greater than 0\n", i);
return -EINVAL;
}
if (curves[i] > 7) {
dev_err(par->info->device,
"Illegal value(s) in Grayscale Lookup Table.\n"
"At index=%d, the accumulated value has exceeded 7\n",
i);
return -EINVAL;
}
}
write_reg(par, 0xB8);
for (i = 0; i < 8; i++)
write_reg(par, (curves[i] & 0xFF));
return 0;
}
static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
{
u16 *vmem16 = (u16 *)par->info->screen_buffer;
u8 *buf = par->txbuf.buf;
u8 n1;
u8 n2;
int y, x;
int ret;
for (x = 0; x < par->info->var.xres; x++) {
if (x % 2)
continue;
for (y = 0; y < par->info->var.yres; y++) {
n1 = rgb565_to_g16(vmem16[y * par->info->var.xres + x]);
n2 = rgb565_to_g16(vmem16
[y * par->info->var.xres + x + 1]);
*buf = (n1 << 4) | n2;
buf++;
}
}
gpiod_set_value(par->gpio.dc, 1);
/* Write data */
ret = par->fbtftops.write(par, par->txbuf.buf,
par->info->var.xres * par->info->var.yres / 2);
if (ret < 0)
dev_err(par->info->device,
"%s: write failed and returned: %d\n", __func__, ret);
return ret;
}
static struct fbtft_display display = {
.regwidth = 8,
.width = WIDTH,
.height = HEIGHT,
.txbuflen = WIDTH * HEIGHT / 2,
.gamma_num = GAMMA_NUM,
.gamma_len = GAMMA_LEN,
.gamma = DEFAULT_GAMMA,
.fbtftops = {
.write_vmem = write_vmem,
.init_display = init_display,
.set_addr_win = set_addr_win,
.blank = blank,
.set_gamma = set_gamma,
},
};
FBTFT_REGISTER_DRIVER(DRVNAME, "solomon,ssd1325", &display);
MODULE_ALIAS("spi:" DRVNAME);
MODULE_ALIAS("platform:" DRVNAME);
MODULE_ALIAS("spi:ssd1325");
MODULE_ALIAS("platform:ssd1325");
MODULE_DESCRIPTION("SSD1325 OLED Driver");
MODULE_AUTHOR("Alexey Mednyy");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/gpio/consumer.h`, `linux/delay.h`, `fbtft.h`.
- Detected declarations: `function init_display`, `function rgb565_to_g16`, `function set_addr_win`, `function blank`, `function set_gamma`, `function write_vmem`.
- Atlas domain: Driver Families / drivers/staging.
- 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.