drivers/gpu/drm/tiny/ili9225.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/tiny/ili9225.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/tiny/ili9225.c- Extension
.c- Size
- 16300 bytes
- Lines
- 562
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/dma-buf.hlinux/gpio/consumer.hlinux/module.hlinux/property.hlinux/spi/spi.hvideo/mipi_display.hdrm/clients/drm_client_setup.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_damage_helper.hdrm/drm_drv.hdrm/drm_fb_dma_helper.hdrm/drm_fbdev_dma.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_dma_helper.hdrm/drm_managed.hdrm/drm_mipi_dbi.hdrm/drm_print.hdrm/drm_rect.h
Detected Declarations
struct ili9225_devicefunction ili9225_commandfunction ili9225_fb_dirtyfunction ili9225_plane_helper_atomic_updatefunction ili9225_crtc_helper_atomic_enablefunction ili9225_crtc_helper_atomic_disablefunction ili9225_dbi_commandfunction ili9225_probefunction ili9225_removefunction ili9225_shutdown
Annotated Snippet
struct ili9225_device {
struct mipi_dbi_dev dbidev;
struct drm_plane plane;
struct drm_crtc crtc;
struct drm_encoder encoder;
struct drm_connector connector;
};
static struct ili9225_device *to_ili9225_device(struct drm_device *dev)
{
return container_of(drm_to_mipi_dbi_dev(dev), struct ili9225_device, dbidev);
}
static inline int ili9225_command(struct mipi_dbi *dbi, u8 cmd, u16 data)
{
u8 par[2] = { data >> 8, data & 0xff };
return mipi_dbi_command_buf(dbi, cmd, par, 2);
}
static void ili9225_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
struct drm_rect *rect, struct drm_format_conv_state *fmtcnv_state)
{
struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(fb->dev);
unsigned int height = rect->y2 - rect->y1;
unsigned int width = rect->x2 - rect->x1;
struct mipi_dbi *dbi = &dbidev->dbi;
bool swap = dbi->swap_bytes;
u16 x_start, y_start;
u16 x1, x2, y1, y2;
int ret = 0;
bool full;
void *tr;
full = width == fb->width && height == fb->height;
DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
if (!dbi->dc || !full || swap ||
fb->format->format == DRM_FORMAT_XRGB8888) {
tr = dbidev->tx_buf;
ret = mipi_dbi_buf_copy(tr, src, fb, rect, swap, fmtcnv_state);
if (ret)
goto err_msg;
} else {
tr = src->vaddr; /* TODO: Use mapping abstraction properly */
}
switch (dbidev->rotation) {
default:
x1 = rect->x1;
x2 = rect->x2 - 1;
y1 = rect->y1;
y2 = rect->y2 - 1;
x_start = x1;
y_start = y1;
break;
case 90:
x1 = rect->y1;
x2 = rect->y2 - 1;
y1 = fb->width - rect->x2;
y2 = fb->width - rect->x1 - 1;
x_start = x1;
y_start = y2;
break;
case 180:
x1 = fb->width - rect->x2;
x2 = fb->width - rect->x1 - 1;
y1 = fb->height - rect->y2;
y2 = fb->height - rect->y1 - 1;
x_start = x2;
y_start = y2;
break;
case 270:
x1 = fb->height - rect->y2;
x2 = fb->height - rect->y1 - 1;
y1 = rect->x1;
y2 = rect->x2 - 1;
x_start = x2;
y_start = y1;
break;
}
ili9225_command(dbi, ILI9225_HORIZ_WINDOW_ADDR_1, x2);
ili9225_command(dbi, ILI9225_HORIZ_WINDOW_ADDR_2, x1);
ili9225_command(dbi, ILI9225_VERT_WINDOW_ADDR_1, y2);
ili9225_command(dbi, ILI9225_VERT_WINDOW_ADDR_2, y1);
ili9225_command(dbi, ILI9225_RAM_ADDRESS_SET_1, x_start);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/dma-buf.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/property.h`, `linux/spi/spi.h`, `video/mipi_display.h`, `drm/clients/drm_client_setup.h`.
- Detected declarations: `struct ili9225_device`, `function ili9225_command`, `function ili9225_fb_dirty`, `function ili9225_plane_helper_atomic_update`, `function ili9225_crtc_helper_atomic_enable`, `function ili9225_crtc_helper_atomic_disable`, `function ili9225_dbi_command`, `function ili9225_probe`, `function ili9225_remove`, `function ili9225_shutdown`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.