drivers/gpu/drm/panel/panel-lincolntech-lcd197.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-lincolntech-lcd197.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-lincolntech-lcd197.c
Extension
.c
Size
8419 bytes
Lines
262
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 lincoln_lcd197_panel {
	struct drm_panel panel;
	struct mipi_dsi_device *dsi;
	struct regulator *supply;
	struct gpio_desc *enable_gpio;
	struct gpio_desc *reset_gpio;
};

static inline
struct lincoln_lcd197_panel *to_lincoln_lcd197_panel(struct drm_panel *panel)
{
	return container_of(panel, struct lincoln_lcd197_panel, panel);
}

static int lincoln_lcd197_panel_prepare(struct drm_panel *panel)
{
	struct lincoln_lcd197_panel *lcd = to_lincoln_lcd197_panel(panel);
	struct mipi_dsi_multi_context ctx = { .dsi = lcd->dsi };
	int err;

	gpiod_set_value_cansleep(lcd->enable_gpio, 0);
	err = regulator_enable(lcd->supply);
	if (err < 0)
		return err;

	gpiod_set_value_cansleep(lcd->enable_gpio, 1);
	usleep_range(1000, 2000);
	gpiod_set_value_cansleep(lcd->reset_gpio, 1);
	usleep_range(5000, 6000);
	gpiod_set_value_cansleep(lcd->reset_gpio, 0);
	msleep(50);

	mipi_dsi_dcs_write_seq_multi(&ctx, 0xb9, 0xff, 0x83, 0x99);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xd2, 0x55);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0x02, 0x04, 0x70, 0x90, 0x01,
			       0x32, 0x33, 0x11, 0x11, 0x4d, 0x57, 0x56, 0x73,
			       0x02, 0x02);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xb2, 0x00, 0x80, 0x80, 0xae, 0x0a,
			       0x0e, 0x75, 0x11, 0x00, 0x00, 0x00);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xb4, 0x00, 0xff, 0x04, 0xa4, 0x02,
			       0xa0, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02, 0x00,
			       0x24, 0x02, 0x04, 0x0a, 0x21, 0x03, 0x00, 0x00,
			       0x08, 0xa6, 0x88, 0x04, 0xa4, 0x02, 0xa0, 0x00,
			       0x00, 0x10, 0x00, 0x00, 0x02, 0x00, 0x24, 0x02,
			       0x04, 0x0a, 0x00, 0x00, 0x08, 0xa6, 0x00, 0x08,
			       0x11);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x00,
			       0x00, 0x18, 0x18, 0x32, 0x10, 0x09, 0x00, 0x09,
			       0x32, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			       0x00, 0x00, 0x11, 0x00, 0x02, 0x02, 0x03, 0x00,
			       0x00, 0x00, 0x0a, 0x40);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xd5, 0x18, 0x18, 0x18, 0x18, 0x21,
			       0x20, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 0x18,
			       0x18, 0x18, 0x18, 0x03, 0x02, 0x01, 0x00, 0x2f,
			       0x2f, 0x30, 0x30, 0x31, 0x31, 0x18, 0x18, 0x18,
			       0x18, 0x18, 0x18);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xd6, 0x18, 0x18, 0x18, 0x18, 0x20,
			       0x21, 0x19, 0x19, 0x18, 0x18, 0x19, 0x19, 0x18,
			       0x18, 0x18, 0x18, 0x00, 0x01, 0x02, 0x03, 0x2f,
			       0x2f, 0x30, 0x30, 0x31, 0x31, 0x18, 0x18, 0x18,
			       0x18, 0x18, 0x18);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xbd, 0x01);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xd8, 0x0a, 0xbe, 0xfa, 0xa0, 0x0a,
			       0xbe, 0xfa, 0xa0);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xd8, 0x0f, 0xff, 0xff, 0xe0, 0x0f,
			       0xff, 0xff, 0xe0);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xbd, 0x02);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xd8, 0x0f, 0xff, 0xff, 0xe0, 0x0f,
			       0xff, 0xff, 0xe0);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xe0, 0x01, 0x11, 0x1c, 0x17, 0x39,
			       0x43, 0x54, 0x51, 0x5a, 0x64, 0x6c, 0x74, 0x7a,
			       0x83, 0x8d, 0x92, 0x99, 0xa4, 0xa9, 0xb4, 0xaa,
			       0xba, 0xbe, 0x63, 0x5e, 0x69, 0x73, 0x01, 0x11,
			       0x1c, 0x17, 0x39, 0x43, 0x54, 0x51, 0x5a, 0x64,
			       0x6c, 0x74, 0x7a, 0x83, 0x8d, 0x92, 0x99, 0xa4,
			       0xa7, 0xb2, 0xa9, 0xba, 0xbe, 0x63, 0x5e, 0x69,
			       0x73);
	mipi_dsi_usleep_range(&ctx, 200, 300);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x92, 0x92);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xcc, 0x00);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xbf, 0x40, 0x41, 0x50, 0x49);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xc6, 0xff, 0xf9);
	mipi_dsi_dcs_write_seq_multi(&ctx, 0xc0, 0x25, 0x5a);
	mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x02);
	mipi_dsi_dcs_exit_sleep_mode_multi(&ctx);
	mipi_dsi_msleep(&ctx, 120);

	if (ctx.accum_err) {
		gpiod_set_value_cansleep(lcd->enable_gpio, 0);
		gpiod_set_value_cansleep(lcd->reset_gpio, 1);

Annotation

Implementation Notes