drivers/gpu/drm/tiny/panel-mipi-dbi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/tiny/panel-mipi-dbi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/tiny/panel-mipi-dbi.c- Extension
.c- Size
- 15952 bytes
- Lines
- 566
- 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/backlight.hlinux/delay.hlinux/firmware.hlinux/gpio/consumer.hlinux/module.hlinux/of.hlinux/property.hlinux/regulator/consumer.hlinux/spi/spi.hdrm/clients/drm_client_setup.hdrm/drm_atomic_helper.hdrm/drm_drv.hdrm/drm_fbdev_dma.hdrm/drm_gem_atomic_helper.hdrm/drm_gem_dma_helper.hdrm/drm_managed.hdrm/drm_mipi_dbi.hdrm/drm_modes.hdrm/drm_modeset_helper.hdrm/drm_print.hvideo/mipi_display.h
Detected Declarations
struct panel_mipi_dbi_formatstruct panel_mipi_dbi_configstruct panel_mipi_dbi_commandsstruct panel_mipi_dbi_devicefunction panel_mipi_dbi_get_formatfunction panel_mipi_dbi_check_commandsfunction panel_mipi_dbi_commands_executefunction panel_mipi_dbi_crtc_helper_atomic_enablefunction panel_mipi_dbi_get_modefunction panel_mipi_dbi_spi_probefunction panel_mipi_dbi_spi_removefunction panel_mipi_dbi_spi_shutdownfunction panel_mipi_dbi_pm_suspendfunction panel_mipi_dbi_pm_resume
Annotated Snippet
struct panel_mipi_dbi_format {
const char *name;
u32 fourcc;
unsigned int bpp;
};
static const struct panel_mipi_dbi_format panel_mipi_dbi_formats[] = {
{ "r5g6b5", DRM_FORMAT_RGB565, 16 },
{ "b6x2g6x2r6x2", DRM_FORMAT_RGB888, 24 },
};
static int panel_mipi_dbi_get_format(struct device *dev, u32 *formats, unsigned int *bpp)
{
const char *format_name;
unsigned int i;
int ret;
formats[1] = DRM_FORMAT_XRGB8888;
ret = device_property_read_string(dev, "format", &format_name);
if (ret) {
/* Old Device Trees don't have this property */
formats[0] = DRM_FORMAT_RGB565;
*bpp = 16;
return 0;
}
for (i = 0; i < ARRAY_SIZE(panel_mipi_dbi_formats); i++) {
const struct panel_mipi_dbi_format *format = &panel_mipi_dbi_formats[i];
if (strcmp(format_name, format->name))
continue;
formats[0] = format->fourcc;
*bpp = format->bpp;
return 0;
}
dev_err(dev, "Pixel format is not supported: '%s'\n", format_name);
return -EINVAL;
}
static const u8 panel_mipi_dbi_magic[15] = { 'M', 'I', 'P', 'I', ' ', 'D', 'B', 'I',
0, 0, 0, 0, 0, 0, 0 };
/*
* The display controller configuration is stored in a firmware file.
* The Device Tree 'compatible' property value with a '.bin' suffix is passed
* to request_firmware() to fetch this file.
*/
struct panel_mipi_dbi_config {
/* Magic string: panel_mipi_dbi_magic */
u8 magic[15];
/* Config file format version */
u8 file_format_version;
/*
* MIPI commands to execute when the display pipeline is enabled.
* This is used to configure the display controller.
*
* The commands are stored in a byte array with the format:
* command, num_parameters, [ parameter, ...], command, ...
*
* Some commands require a pause before the next command can be received.
* Inserting a delay in the command sequence is done by using the NOP command with one
* parameter: delay in miliseconds (the No Operation command is part of the MIPI Display
* Command Set where it has no parameters).
*
* Example:
* command 0x11
* sleep 120ms
* command 0xb1 parameters 0x01, 0x2c, 0x2d
* command 0x29
*
* Byte sequence:
* 0x11 0x00
* 0x00 0x01 0x78
* 0xb1 0x03 0x01 0x2c 0x2d
* 0x29 0x00
*/
u8 commands[];
};
struct panel_mipi_dbi_commands {
const u8 *buf;
size_t len;
};
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/delay.h`, `linux/firmware.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/of.h`, `linux/property.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct panel_mipi_dbi_format`, `struct panel_mipi_dbi_config`, `struct panel_mipi_dbi_commands`, `struct panel_mipi_dbi_device`, `function panel_mipi_dbi_get_format`, `function panel_mipi_dbi_check_commands`, `function panel_mipi_dbi_commands_execute`, `function panel_mipi_dbi_crtc_helper_atomic_enable`, `function panel_mipi_dbi_get_mode`, `function panel_mipi_dbi_spi_probe`.
- 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.