drivers/gpu/drm/tiny/gm12u320.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/tiny/gm12u320.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/tiny/gm12u320.c- Extension
.c- Size
- 22135 bytes
- Lines
- 748
- 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.
- 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/pm.hlinux/usb.hdrm/clients/drm_client_setup.hdrm/drm_atomic_helper.hdrm/drm_atomic_state_helper.hdrm/drm_connector.hdrm/drm_damage_helper.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_fbdev_shmem.hdrm/drm_file.hdrm/drm_format_helper.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_atomic_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_gem_shmem_helper.hdrm/drm_ioctl.hdrm/drm_managed.hdrm/drm_modeset_helper_vtables.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.h
Detected Declarations
struct gm12u320_devicefunction gm12u320_usb_allocfunction gm12u320_misc_requestfunction gm12u320_32bpp_to_24bpp_packedfunction gm12u320_copy_fb_to_blocksfunction gm12u320_fb_update_workfunction gm12u320_fb_mark_dirtyfunction gm12u320_stop_fb_updatefunction gm12u320_set_ecomodefunction gm12u320_conn_get_modesfunction gm12u320_conn_initfunction gm12u320_pipe_enablefunction gm12u320_pipe_disablefunction gm12u320_pipe_updatefunction gm12u320_usb_probefunction gm12u320_usb_disconnectfunction gm12u320_suspendfunction gm12u320_resume
Annotated Snippet
struct gm12u320_device {
struct drm_device dev;
struct drm_simple_display_pipe pipe;
struct drm_connector conn;
unsigned char *cmd_buf;
unsigned char *data_buf[GM12U320_BLOCK_COUNT];
struct {
struct delayed_work work;
struct mutex lock;
struct drm_framebuffer *fb;
struct drm_rect rect;
int frame;
int draw_status_timeout;
struct iosys_map src_map;
} fb_update;
};
#define to_gm12u320(__dev) container_of(__dev, struct gm12u320_device, dev)
static const char cmd_data[CMD_SIZE] = {
0x55, 0x53, 0x42, 0x43, 0x00, 0x00, 0x00, 0x00,
0x68, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x10, 0xff,
0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const char cmd_draw[CMD_SIZE] = {
0x55, 0x53, 0x42, 0x43, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xfe,
0x00, 0x00, 0x00, 0xc0, 0xd1, 0x05, 0x00, 0x40,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const char cmd_misc[CMD_SIZE] = {
0x55, 0x53, 0x42, 0x43, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x80, 0x01, 0x10, 0xfd,
0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const char data_block_header[DATA_BLOCK_HEADER_SIZE] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xfb, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x04, 0x15, 0x00, 0x00, 0xfc, 0x00, 0x00,
0x01, 0x00, 0x00, 0xdb
};
static const char data_last_block_header[DATA_BLOCK_HEADER_SIZE] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xfb, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2a, 0x00, 0x20, 0x00, 0xc0, 0x0f, 0x00, 0x00,
0x01, 0x00, 0x00, 0xd7
};
static const char data_block_footer[DATA_BLOCK_FOOTER_SIZE] = {
0xfb, 0x14, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x00, 0x00, 0x4f
};
static inline struct usb_device *gm12u320_to_usb_device(struct gm12u320_device *gm12u320)
{
return interface_to_usbdev(to_usb_interface(gm12u320->dev.dev));
}
static int gm12u320_usb_alloc(struct gm12u320_device *gm12u320)
{
int i, block_size;
const char *hdr;
gm12u320->cmd_buf = drmm_kmalloc(&gm12u320->dev, CMD_SIZE, GFP_KERNEL);
if (!gm12u320->cmd_buf)
return -ENOMEM;
for (i = 0; i < GM12U320_BLOCK_COUNT; i++) {
if (i == GM12U320_BLOCK_COUNT - 1) {
Annotation
- Immediate include surface: `linux/module.h`, `linux/pm.h`, `linux/usb.h`, `drm/clients/drm_client_setup.h`, `drm/drm_atomic_helper.h`, `drm/drm_atomic_state_helper.h`, `drm/drm_connector.h`, `drm/drm_damage_helper.h`.
- Detected declarations: `struct gm12u320_device`, `function gm12u320_usb_alloc`, `function gm12u320_misc_request`, `function gm12u320_32bpp_to_24bpp_packed`, `function gm12u320_copy_fb_to_blocks`, `function gm12u320_fb_update_work`, `function gm12u320_fb_mark_dirty`, `function gm12u320_stop_fb_update`, `function gm12u320_set_ecomode`, `function gm12u320_conn_get_modes`.
- 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.