drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
Extension
.c
Size
17917 bytes
Lines
501
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ili9806e_dsi_panel_desc {
	const struct drm_display_mode *display_mode;
	unsigned long mode_flags;
	enum mipi_dsi_pixel_format format;
	unsigned int lanes;
	void (*init_sequence)(struct mipi_dsi_multi_context *ctx);
};

struct ili9806e_dsi_panel {
	struct mipi_dsi_device *dsi;
	const struct ili9806e_dsi_panel_desc *desc;
	enum drm_panel_orientation orientation;
};

static int ili9806e_dsi_on(struct ili9806e_dsi_panel *ili9806e)
{
	struct mipi_dsi_multi_context ctx = { .dsi = ili9806e->dsi };

	if (ili9806e->desc->init_sequence)
		ili9806e->desc->init_sequence(&ctx);

	mipi_dsi_dcs_exit_sleep_mode_multi(&ctx);
	mipi_dsi_msleep(&ctx, 120);
	mipi_dsi_dcs_set_display_on_multi(&ctx);

	return ctx.accum_err;
}

static int ili9806e_dsi_off(struct ili9806e_dsi_panel *panel)
{
	struct mipi_dsi_multi_context ctx = { .dsi = panel->dsi };

	mipi_dsi_dcs_set_display_off_multi(&ctx);
	mipi_dsi_dcs_enter_sleep_mode_multi(&ctx);
	mipi_dsi_msleep(&ctx, 120);

	return ctx.accum_err;
}

static int ili9806e_dsi_prepare(struct drm_panel *panel)
{
	struct ili9806e_dsi_panel *ctx = ili9806e_get_transport(panel);
	struct device *dev = &ctx->dsi->dev;
	int ret;

	ret = ili9806e_power_on(dev);
	if (ret < 0)
		return ret;

	ret = ili9806e_dsi_on(ctx);
	if (ret < 0) {
		ili9806e_power_off(dev);
		return ret;
	}

	return 0;
}

static int ili9806e_dsi_unprepare(struct drm_panel *panel)
{
	struct ili9806e_dsi_panel *ctx = ili9806e_get_transport(panel);
	struct device *dev = &ctx->dsi->dev;
	int ret;

	ili9806e_dsi_off(ctx);

	ret = ili9806e_power_off(dev);
	if (ret < 0)
		dev_err(dev, "power off failed: %d\n", ret);

	return ret;
}

static int ili9806e_dsi_get_modes(struct drm_panel *panel,
			      struct drm_connector *connector)
{
	struct ili9806e_dsi_panel *ctx = ili9806e_get_transport(panel);
	const struct drm_display_mode *mode = ctx->desc->display_mode;

	return drm_connector_helper_get_modes_fixed(connector, mode);
}

static enum drm_panel_orientation ili9806e_dsi_get_orientation(struct drm_panel *panel)
{
	struct ili9806e_dsi_panel *ctx = ili9806e_get_transport(panel);

	return ctx->orientation;
}

static const struct drm_panel_funcs ili9806e_dsi_funcs = {

Annotation

Implementation Notes