drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
Extension
.c
Size
8570 bytes
Lines
326
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 mantix {
	struct device *dev;
	struct drm_panel panel;

	struct gpio_desc *reset_gpio;
	struct gpio_desc *tp_rstn_gpio;

	struct regulator *avdd;
	struct regulator *avee;
	struct regulator *vddi;

	const struct drm_display_mode *default_mode;
};

static inline struct mantix *panel_to_mantix(struct drm_panel *panel)
{
	return container_of(panel, struct mantix, panel);
}

static void mantix_init_sequence(struct mipi_dsi_multi_context *dsi_ctx)
{
	/*
	 * Init sequence was supplied by the panel vendor.
	 */
	mipi_dsi_generic_write_seq_multi(dsi_ctx, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5a);

	mipi_dsi_generic_write_seq_multi(dsi_ctx, MANTIX_CMD_INT_CANCEL, 0x03);

	mipi_dsi_generic_write_seq_multi(dsi_ctx, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5a, 0x03);
	mipi_dsi_generic_write_seq_multi(dsi_ctx, 0x80, 0xa9, 0x00); /* VCOM */

	mipi_dsi_generic_write_seq_multi(dsi_ctx, MANTIX_CMD_SPI_FINISH, 0xa5);
	mipi_dsi_generic_write_seq_multi(dsi_ctx, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x00, 0x2f);
}

static int mantix_enable(struct drm_panel *panel)
{
	struct mantix *ctx = panel_to_mantix(panel);
	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };

	mantix_init_sequence(&dsi_ctx);
	if (!dsi_ctx.accum_err)
		dev_dbg(ctx->dev, "Panel init sequence done\n");

	/* remainder to 120ms (7.3.1 Note 4) */
	mipi_dsi_msleep(&dsi_ctx, 70);

	mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
	mipi_dsi_msleep(&dsi_ctx, 120);

	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
	mipi_dsi_usleep_range(&dsi_ctx, 10000, 12000);

	return dsi_ctx.accum_err;
}

static int mantix_disable(struct drm_panel *panel)
{
	struct mantix *ctx = panel_to_mantix(panel);
	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };

	mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
	mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);

	/* T10 */
	mipi_dsi_msleep(&dsi_ctx, 150);

	return dsi_ctx.accum_err;
}

static int mantix_unprepare(struct drm_panel *panel)
{
	struct mantix *ctx = panel_to_mantix(panel);

	regulator_disable(ctx->avee);
	regulator_disable(ctx->avdd);
	/* T11 */
	usleep_range(5000, 6000);
	regulator_disable(ctx->vddi);

	gpiod_set_value_cansleep(ctx->tp_rstn_gpio, 1);
	usleep_range(5000, 6000);
	gpiod_set_value_cansleep(ctx->reset_gpio, 1);

	/* T14 */
	msleep(50);

	return 0;

Annotation

Implementation Notes