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

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

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
Extension
.c
Size
25789 bytes
Lines
784
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 s6e3ha2_panel_desc {
	const struct drm_display_mode *mode;
	enum s6e3ha2_type type;
};

struct s6e3ha2 {
	struct device *dev;
	struct drm_panel panel;
	struct backlight_device *bl_dev;

	struct regulator_bulk_data supplies[2];
	struct gpio_desc *reset_gpio;
	struct gpio_desc *enable_gpio;

	const struct s6e3ha2_panel_desc *desc;
};

static int s6e3ha2_dcs_write(struct s6e3ha2 *ctx, const void *data, size_t len)
{
	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);

	return mipi_dsi_dcs_write_buffer(dsi, data, len);
}

#define s6e3ha2_dcs_write_seq_static(ctx, seq...) do {	\
	static const u8 d[] = { seq };			\
	int ret;					\
	ret = s6e3ha2_dcs_write(ctx, d, ARRAY_SIZE(d));	\
	if (ret < 0)					\
		return ret;				\
} while (0)

#define s6e3ha2_call_write_func(ret, func) do {	\
	ret = (func);				\
	if (ret < 0)				\
		return ret;			\
} while (0)

static int s6e3ha2_test_key_on_f0(struct s6e3ha2 *ctx)
{
	s6e3ha2_dcs_write_seq_static(ctx, 0xf0, 0x5a, 0x5a);
	return 0;
}

static int s6e3ha2_test_key_off_f0(struct s6e3ha2 *ctx)
{
	s6e3ha2_dcs_write_seq_static(ctx, 0xf0, 0xa5, 0xa5);
	return 0;
}

static int s6e3ha2_test_key_on_fc(struct s6e3ha2 *ctx)
{
	s6e3ha2_dcs_write_seq_static(ctx, 0xfc, 0x5a, 0x5a);
	return 0;
}

static int s6e3ha2_test_key_off_fc(struct s6e3ha2 *ctx)
{
	s6e3ha2_dcs_write_seq_static(ctx, 0xfc, 0xa5, 0xa5);
	return 0;
}

static int s6e3ha2_single_dsi_set(struct s6e3ha2 *ctx)
{
	s6e3ha2_dcs_write_seq_static(ctx, 0xf2, 0x67);
	s6e3ha2_dcs_write_seq_static(ctx, 0xf9, 0x09);
	return 0;
}

static int s6e3ha2_freq_calibration(struct s6e3ha2 *ctx)
{
	s6e3ha2_dcs_write_seq_static(ctx, 0xfd, 0x1c);
	if (ctx->desc->type == HF2_TYPE)
		s6e3ha2_dcs_write_seq_static(ctx, 0xf2, 0x67, 0x40, 0xc5);
	s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20, 0x39);
	s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0xa0);
	s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20);

	if (ctx->desc->type == HA2_TYPE)
		s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x12, 0x62,
						  0x40, 0x80, 0xc0, 0x28, 0x28,
						  0x28, 0x28, 0x39, 0xc5);
	else
		s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x14, 0x6d,
						  0x40, 0x80, 0xc0, 0x28, 0x28,
						  0x28, 0x28, 0x39, 0xc5);

	return 0;
}

Annotation

Implementation Notes