drivers/gpu/drm/tiny/hx8357d.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/tiny/hx8357d.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/tiny/hx8357d.c- Extension
.c- Size
- 9762 bytes
- Lines
- 404
- 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/backlight.hlinux/delay.hlinux/gpio/consumer.hlinux/module.hlinux/property.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_modeset_helper.hdrm/drm_print.hvideo/mipi_display.h
Detected Declarations
struct hx8357d_devicefunction hx8357d_crtc_helper_atomic_enablefunction hx8357d_probefunction hx8357d_removefunction hx8357d_shutdown
Annotated Snippet
struct hx8357d_device {
struct mipi_dbi_dev dbidev;
struct drm_plane plane;
struct drm_crtc crtc;
struct drm_encoder encoder;
struct drm_connector connector;
};
static struct hx8357d_device *to_hx8357d_device(struct drm_device *dev)
{
return container_of(drm_to_mipi_dbi_dev(dev), struct hx8357d_device, dbidev);
}
static const u32 hx8357d_plane_formats[] = {
DRM_MIPI_DBI_PLANE_FORMATS,
};
static const u64 hx8357d_plane_format_modifiers[] = {
DRM_MIPI_DBI_PLANE_FORMAT_MODIFIERS,
};
static const struct drm_plane_helper_funcs hx8357d_plane_helper_funcs = {
DRM_MIPI_DBI_PLANE_HELPER_FUNCS,
};
static const struct drm_plane_funcs hx8357d_plane_funcs = {
DRM_MIPI_DBI_PLANE_FUNCS,
.destroy = drm_plane_cleanup,
};
static void hx8357d_crtc_helper_atomic_enable(struct drm_crtc *crtc,
struct drm_atomic_commit *state)
{
struct drm_device *drm = crtc->dev;
struct hx8357d_device *hx8357d = to_hx8357d_device(drm);
struct mipi_dbi_dev *dbidev = &hx8357d->dbidev;
struct mipi_dbi *dbi = &dbidev->dbi;
u8 addr_mode;
int ret, idx;
if (!drm_dev_enter(drm, &idx))
return;
DRM_DEBUG_KMS("\n");
ret = mipi_dbi_poweron_conditional_reset(dbidev);
if (ret < 0)
goto out_exit;
if (ret == 1)
goto out_enable;
/* setextc */
mipi_dbi_command(dbi, HX8357D_SETEXTC, 0xFF, 0x83, 0x57);
msleep(150);
/* setRGB which also enables SDO */
mipi_dbi_command(dbi, HX8357D_SETRGB, 0x00, 0x00, 0x06, 0x06);
/* -1.52V */
mipi_dbi_command(dbi, HX8357D_SETCOM, 0x25);
/* Normal mode 70Hz, Idle mode 55 Hz */
mipi_dbi_command(dbi, HX8357D_SETOSC, 0x68);
/* Set Panel - BGR, Gate direction swapped */
mipi_dbi_command(dbi, HX8357D_SETPANEL, 0x05);
mipi_dbi_command(dbi, HX8357D_SETPOWER,
0x00, /* Not deep standby */
0x15, /* BT */
0x1C, /* VSPR */
0x1C, /* VSNR */
0x83, /* AP */
0xAA); /* FS */
mipi_dbi_command(dbi, HX8357D_SETSTBA,
0x50, /* OPON normal */
0x50, /* OPON idle */
0x01, /* STBA */
0x3C, /* STBA */
0x1E, /* STBA */
0x08); /* GEN */
mipi_dbi_command(dbi, HX8357D_SETCYC,
0x02, /* NW 0x02 */
0x40, /* RTN */
0x00, /* DIV */
0x2A, /* DUM */
0x2A, /* DUM */
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/property.h`, `linux/spi/spi.h`, `drm/clients/drm_client_setup.h`, `drm/drm_atomic_helper.h`.
- Detected declarations: `struct hx8357d_device`, `function hx8357d_crtc_helper_atomic_enable`, `function hx8357d_probe`, `function hx8357d_remove`, `function hx8357d_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.