drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
Extension
.c
Size
6730 bytes
Lines
257
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 s6e3fa7_panel {
	struct drm_panel panel;
	struct mipi_dsi_device *dsi;
	struct gpio_desc *reset_gpio;
};

static inline struct s6e3fa7_panel *to_s6e3fa7_panel(struct drm_panel *panel)
{
	return container_of(panel, struct s6e3fa7_panel, panel);
}

static void s6e3fa7_panel_reset(struct s6e3fa7_panel *ctx)
{
	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
	usleep_range(1000, 2000);
	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
	usleep_range(10000, 11000);
}

static int s6e3fa7_panel_on(struct mipi_dsi_device *dsi)
{
	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };

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

	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0x5a, 0x5a);
	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf4,
				     0xbb, 0x23, 0x19, 0x3a, 0x9f, 0x0f, 0x09, 0xc0,
				     0x00, 0xb4, 0x37, 0x70, 0x79, 0x69);
	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5);
	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x20);

	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);

	return dsi_ctx.accum_err;
}

static int s6e3fa7_panel_prepare(struct drm_panel *panel)
{
	struct s6e3fa7_panel *ctx = to_s6e3fa7_panel(panel);
	int ret;

	s6e3fa7_panel_reset(ctx);

	ret = s6e3fa7_panel_on(ctx->dsi);
	if (ret < 0)
		gpiod_set_value_cansleep(ctx->reset_gpio, 1);

	return ret;
}

static int s6e3fa7_panel_unprepare(struct drm_panel *panel)
{
	struct s6e3fa7_panel *ctx = to_s6e3fa7_panel(panel);

	gpiod_set_value_cansleep(ctx->reset_gpio, 1);

	return 0;
}

static int s6e3fa7_panel_disable(struct drm_panel *panel)
{
	struct s6e3fa7_panel *ctx = to_s6e3fa7_panel(panel);
	struct mipi_dsi_device *dsi = ctx->dsi;
	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);
	mipi_dsi_msleep(&dsi_ctx, 120);

	return dsi_ctx.accum_err;
}

static const struct drm_display_mode s6e3fa7_panel_mode = {
	.clock = (1080 + 32 + 32 + 78) * (2220 + 32 + 4 + 78) * 60 / 1000,
	.hdisplay = 1080,
	.hsync_start = 1080 + 32,
	.hsync_end = 1080 + 32 + 32,
	.htotal = 1080 + 32 + 32 + 78,
	.vdisplay = 2220,
	.vsync_start = 2220 + 32,
	.vsync_end = 2220 + 32 + 4,
	.vtotal = 2220 + 32 + 4 + 78,
	.width_mm = 62,
	.height_mm = 127,
};

static int s6e3fa7_panel_get_modes(struct drm_panel *panel,

Annotation

Implementation Notes