drivers/gpu/drm/panel/panel-lg-lg4573.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-lg-lg4573.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panel/panel-lg-lg4573.c- Extension
.c- Size
- 6544 bytes
- Lines
- 295
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/gpio/consumer.hlinux/module.hlinux/regulator/consumer.hlinux/spi/spi.hvideo/mipi_display.hvideo/of_videomode.hvideo/videomode.hdrm/drm_device.hdrm/drm_modes.hdrm/drm_panel.h
Detected Declarations
struct lg4573function lg4573_spi_write_u16function lg4573_spi_write_u16_arrayfunction lg4573_spi_write_dcsfunction lg4573_display_onfunction lg4573_display_offfunction lg4573_display_mode_settingsfunction lg4573_power_settingsfunction lg4573_gamma_settingsfunction lg4573_initfunction lg4573_power_onfunction lg4573_disablefunction lg4573_enablefunction lg4573_get_modesfunction lg4573_probefunction lg4573_remove
Annotated Snippet
struct lg4573 {
struct drm_panel panel;
struct spi_device *spi;
struct videomode vm;
};
static inline struct lg4573 *panel_to_lg4573(struct drm_panel *panel)
{
return container_of(panel, struct lg4573, panel);
}
static int lg4573_spi_write_u16(struct lg4573 *ctx, u16 data)
{
struct spi_transfer xfer = {
.len = 2,
};
__be16 temp = cpu_to_be16(data);
struct spi_message msg;
dev_dbg(ctx->panel.dev, "writing data: %x\n", data);
xfer.tx_buf = &temp;
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
return spi_sync(ctx->spi, &msg);
}
static int lg4573_spi_write_u16_array(struct lg4573 *ctx, const u16 *buffer,
unsigned int count)
{
unsigned int i;
int ret;
for (i = 0; i < count; i++) {
ret = lg4573_spi_write_u16(ctx, buffer[i]);
if (ret)
return ret;
}
return 0;
}
static int lg4573_spi_write_dcs(struct lg4573 *ctx, u8 dcs)
{
return lg4573_spi_write_u16(ctx, (0x70 << 8 | dcs));
}
static int lg4573_display_on(struct lg4573 *ctx)
{
int ret;
ret = lg4573_spi_write_dcs(ctx, MIPI_DCS_EXIT_SLEEP_MODE);
if (ret)
return ret;
msleep(5);
return lg4573_spi_write_dcs(ctx, MIPI_DCS_SET_DISPLAY_ON);
}
static int lg4573_display_off(struct lg4573 *ctx)
{
int ret;
ret = lg4573_spi_write_dcs(ctx, MIPI_DCS_SET_DISPLAY_OFF);
if (ret)
return ret;
msleep(120);
return lg4573_spi_write_dcs(ctx, MIPI_DCS_ENTER_SLEEP_MODE);
}
static int lg4573_display_mode_settings(struct lg4573 *ctx)
{
static const u16 display_mode_settings[] = {
0x703A, 0x7270, 0x70B1, 0x7208,
0x723B, 0x720F, 0x70B2, 0x7200,
0x72C8, 0x70B3, 0x7200, 0x70B4,
0x7200, 0x70B5, 0x7242, 0x7210,
0x7210, 0x7200, 0x7220, 0x70B6,
0x720B, 0x720F, 0x723C, 0x7213,
0x7213, 0x72E8, 0x70B7, 0x7246,
0x7206, 0x720C, 0x7200, 0x7200,
};
dev_dbg(ctx->panel.dev, "transfer display mode settings\n");
return lg4573_spi_write_u16_array(ctx, display_mode_settings,
ARRAY_SIZE(display_mode_settings));
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/regulator/consumer.h`, `linux/spi/spi.h`, `video/mipi_display.h`, `video/of_videomode.h`, `video/videomode.h`.
- Detected declarations: `struct lg4573`, `function lg4573_spi_write_u16`, `function lg4573_spi_write_u16_array`, `function lg4573_spi_write_dcs`, `function lg4573_display_on`, `function lg4573_display_off`, `function lg4573_display_mode_settings`, `function lg4573_power_settings`, `function lg4573_gamma_settings`, `function lg4573_init`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.