drivers/gpu/drm/panel/panel-motorola-mot.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-motorola-mot.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-motorola-mot.c
Extension
.c
Size
6988 bytes
Lines
245
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 mot_panel {
	struct drm_panel panel;
	struct mipi_dsi_device *dsi;

	struct gpio_desc *reset_gpio;

	struct regulator_bulk_data *supplies;
};

static inline struct mot_panel *to_mot_panel(struct drm_panel *panel)
{
	return container_of(panel, struct mot_panel, panel);
}

static void mot_panel_reset(struct mot_panel *priv)
{
	gpiod_set_value_cansleep(priv->reset_gpio, 1);
	usleep_range(50000, 51000);
	gpiod_set_value_cansleep(priv->reset_gpio, 0);
	usleep_range(10000, 11000);
}

static void mot_es2(struct mipi_dsi_multi_context *ctx)
{
	mipi_dsi_generic_write_seq_multi(ctx, 0x55, 0x01);

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

	mipi_dsi_generic_write_seq_multi(ctx, 0xf4, 0x00, 0xbb, 0x46, 0x53, 0x0c, 0x49,
					 0x74, 0x29, 0x12, 0x15, 0x2f, 0x2f, 0x04);
	mipi_dsi_generic_write_seq_multi(ctx, 0xf8, 0x4b, 0x04, 0x10, 0x1a, 0x2c, 0x2c,
					 0x2c, 0x2c, 0x14, 0x12);

	mipi_dsi_generic_write_seq_multi(ctx, 0xb5, 0x03, 0x7f, 0x00, 0x80, 0xc7, 0x00);
	mipi_dsi_generic_write_seq_multi(ctx, 0xb7, 0x66, 0xf6, 0x46, 0x9f, 0x90, 0x99,
					 0xff, 0x80, 0x6d, 0x01);

	/* Gamma R */
	mipi_dsi_generic_write_seq_multi(ctx, 0xf9, 0x04);
	mipi_dsi_generic_write_seq_multi(ctx, 0xfa, 0x00, 0x2f, 0x30, 0x12, 0x0e, 0x0c,
					 0x22, 0x27, 0x31, 0x2e, 0x07, 0x0f);
	mipi_dsi_generic_write_seq_multi(ctx, 0xfb, 0x00, 0x2f, 0x30, 0x12, 0x0e, 0x0c,
					 0x22, 0x27, 0x31, 0x2e, 0x07, 0x0f);

	/* Gamma G */
	mipi_dsi_generic_write_seq_multi(ctx, 0xf9, 0x02);
	mipi_dsi_generic_write_seq_multi(ctx, 0xfa, 0x00, 0x2f, 0x37, 0x15, 0x15, 0x11,
					 0x1f, 0x25, 0x2d, 0x2a, 0x05, 0x0f);
	mipi_dsi_generic_write_seq_multi(ctx, 0xfb, 0x00, 0x2f, 0x37, 0x15, 0x15, 0x11,
					 0x1f, 0x25, 0x2d, 0x2a, 0x05, 0x0f);

	/* Gamma B */
	mipi_dsi_generic_write_seq_multi(ctx, 0xf9, 0x01);
	mipi_dsi_generic_write_seq_multi(ctx, 0xfa, 0x00, 0x2f, 0x3f, 0x16, 0x1f, 0x15,
					 0x1f, 0x25, 0x2d, 0x2b, 0x06, 0x0b);
	mipi_dsi_generic_write_seq_multi(ctx, 0xfb, 0x00, 0x2f, 0x3f, 0x16, 0x1f, 0x15,
					 0x1f, 0x25, 0x2d, 0x2b, 0x06, 0x0b);

	/* Gamma W */
	mipi_dsi_generic_write_seq_multi(ctx, 0xf9, 0x20);
	mipi_dsi_generic_write_seq_multi(ctx, 0xfa, 0x00, 0x2f, 0x34, 0x15, 0x1a, 0x11,
					 0x1f, 0x23, 0x2d, 0x29, 0x02, 0x08);
	mipi_dsi_generic_write_seq_multi(ctx, 0xfb, 0x00, 0x2f, 0x34, 0x15, 0x1a, 0x11,
					 0x1f, 0x23, 0x2d, 0x29, 0x02, 0x08);

	mipi_dsi_generic_write_seq_multi(ctx, 0x53, 0x2c);
	mipi_dsi_generic_write_seq_multi(ctx, 0x35, 0x00);
}

static int mot_panel_prepare(struct drm_panel *panel)
{
	struct mot_panel *priv = to_mot_panel(panel);
	struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };
	struct device *dev = panel->dev;
	int ret;

	ret = regulator_bulk_enable(ARRAY_SIZE(mot_panel_supplies), priv->supplies);
	if (ret < 0) {
		dev_err(dev, "failed to enable power supplies: %d\n", ret);
		return ret;
	}

	mot_panel_reset(priv);

	mipi_dsi_generic_write_seq_multi(&ctx, 0xf0, 0x5a, 0x5a);
	mipi_dsi_generic_write_seq_multi(&ctx, 0xf1, 0x5a, 0x5a);
	mipi_dsi_generic_write_seq_multi(&ctx, 0xd0, 0x8e);

	mot_es2(&ctx);

Annotation

Implementation Notes