drivers/gpu/drm/tiny/ili9163.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/tiny/ili9163.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/tiny/ili9163.c- Extension
.c- Size
- 8513 bytes
- Lines
- 333
- 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_mipi_dbi.hdrm/drm_modeset_helper.hdrm/drm_print.hvideo/mipi_display.h
Detected Declarations
struct ili9163_devicefunction ili9163_crtc_helper_atomic_enablefunction ili9163_probefunction ili9163_removefunction ili9163_shutdown
Annotated Snippet
struct ili9163_device {
struct mipi_dbi_dev dbidev;
struct drm_plane plane;
struct drm_crtc crtc;
struct drm_encoder encoder;
struct drm_connector connector;
};
static struct ili9163_device *to_ili9163_device(struct drm_device *dev)
{
return container_of(drm_to_mipi_dbi_dev(dev), struct ili9163_device, dbidev);
}
static const u32 ili9163_plane_formats[] = {
DRM_MIPI_DBI_PLANE_FORMATS,
};
static const u64 ili9163_plane_format_modifiers[] = {
DRM_MIPI_DBI_PLANE_FORMAT_MODIFIERS,
};
static const struct drm_plane_helper_funcs ili9163_plane_helper_funcs = {
DRM_MIPI_DBI_PLANE_HELPER_FUNCS,
};
static const struct drm_plane_funcs ili9163_plane_funcs = {
DRM_MIPI_DBI_PLANE_FUNCS,
.destroy = drm_plane_cleanup,
};
static void ili9163_crtc_helper_atomic_enable(struct drm_crtc *crtc,
struct drm_atomic_commit *state)
{
struct drm_device *drm = crtc->dev;
struct ili9163_device *ili9163 = to_ili9163_device(drm);
struct mipi_dbi_dev *dbidev = &ili9163->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;
/* Gamma */
mipi_dbi_command(dbi, MIPI_DCS_SET_GAMMA_CURVE, 0x04);
mipi_dbi_command(dbi, ILI9163_EN3GAM, 0x00);
/* Frame Rate */
mipi_dbi_command(dbi, ILI9163_FRMCTR1, 0x0a, 0x14);
/* Power Control */
mipi_dbi_command(dbi, ILI9163_PWCTRL1, 0x0a, 0x00);
mipi_dbi_command(dbi, ILI9163_PWCTRL2, 0x02);
/* VCOM */
mipi_dbi_command(dbi, ILI9163_VMCTRL1, 0x2f, 0x3e);
mipi_dbi_command(dbi, ILI9163_VMCTRL2, 0x40);
/* Memory Access Control */
mipi_dbi_command(dbi, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT);
mipi_dbi_command(dbi, MIPI_DCS_EXIT_SLEEP_MODE);
msleep(100);
mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_ON);
msleep(100);
out_enable:
switch (dbidev->rotation) {
default:
addr_mode = ILI9163_MADCTL_MX | ILI9163_MADCTL_MY;
break;
case 90:
addr_mode = ILI9163_MADCTL_MX | ILI9163_MADCTL_MV;
break;
case 180:
addr_mode = 0;
break;
case 270:
addr_mode = ILI9163_MADCTL_MY | ILI9163_MADCTL_MV;
break;
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 ili9163_device`, `function ili9163_crtc_helper_atomic_enable`, `function ili9163_probe`, `function ili9163_remove`, `function ili9163_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.