Skip to content

Instantly share code, notes, and snippets.

@captain-amygdala
Created October 31, 2024 06:46
Show Gist options
  • Save captain-amygdala/5860495786feabcc4bcc2cc0570ed3d3 to your computer and use it in GitHub Desktop.
Save captain-amygdala/5860495786feabcc4bcc2cc0570ed3d3 to your computer and use it in GitHub Desktop.
static void ali24_init_sequence(struct st7701 *st7701)
{
st7701_switch_cmd_bkx(st7701, true, 3);
ST7701_DSI(st7701,0xEF,0x08);
st7701_switch_cmd_bkx(st7701, true, 0);
ST7701_DSI(st7701,0xC0,0x4F,0x00);
ST7701_DSI(st7701,0xC1,0x10,0x0C);
ST7701_DSI(st7701,0xC2,0x01,0x14);
ST7701_DSI(st7701,0xCC,0x10);
ST7701_DSI(st7701,0xB0,
0x00,0x0B,0x13,0x0D,
0x10,0x07,0x02,0x08,
0x07,0x1F,0x04,0x11,
0x0F,0x28,0x2F,0x1F);
ST7701_DSI(st7701,0xB1,
0x00,0x0C,0x13,0x0C,
0x10,0x05,0x02,0x08,
0x08,0x1E,0x05,0x13,
0x11,0x27,0x30,0x1F);
st7701_switch_cmd_bkx(st7701, true, 1);
ST7701_DSI(st7701,0xB0,0x4D);//VOP
ST7701_DSI(st7701,0xB1,0x4D);//VCOM
ST7701_DSI(st7701,0xB2,0x87);//VGH
ST7701_DSI(st7701,0xB3,0x80);
ST7701_DSI(st7701,0xB5,0x45);//VGL
ST7701_DSI(st7701,0xB7,0x85);
ST7701_DSI(st7701,0xB8,0x20);
ST7701_DSI(st7701,0xC0,0x09);
ST7701_DSI(st7701,0xC1,0x78);
ST7701_DSI(st7701,0xC2,0x78);
ST7701_DSI(st7701,0xD0,0x88);
msleep(100);
ST7701_DSI(st7701,0xE0,
0x00,0x00,0x02);
ST7701_DSI(st7701,0xE1,
0x04,0xB0,0x06,0xB0,
0x05,0xB0,0x07,0xB0,
0x00,0x44,0x44);
ST7701_DSI(st7701,0xE2,
0x20,0x20,0x44,0x44,
0x96,0xA0,0x00,0x00,
0x96,0xA0,0x00,0x00);
ST7701_DSI(st7701,0xE3,
0x00,0x00,0x22,0x22);
ST7701_DSI(st7701,0xE4,0x44,0x44);
ST7701_DSI(st7701,0xE5,
0x0C,0x90,0xB0,0xA0,
0x0E,0x92,0xB0,0xA0,
0x08,0x8C,0xB0,0xA0,
0x0A,0x8E,0xB0,0xA0);
ST7701_DSI(st7701,0xE6,
0x00,0x00,0x22,0x22);
ST7701_DSI(st7701,0xE7,0x44,0x44);
ST7701_DSI(st7701,0xE8,
0x0D,0x91,0xB0,0xA0,
0x0F,0x93,0xB0,0xA0,
0x09,0x8D,0xB0,0xA0,
0x0B,0x8F,0xB0,0xA0);
ST7701_DSI(st7701,0xE9,0x36,0x00);
ST7701_DSI(st7701,0xEB,
0x00,0x00,0xE4,0xE4,
0x44,0x88,0x40);
ST7701_DSI(st7701,0xED,
0xC1,0xA2,0xBF,0x0F,
0x67,0x45,0xFF,0xFF,
0xFF,0xFF,0x54,0x76,
0xF0,0xFB,0x2A,0x1C);
ST7701_DSI(st7701,0xEF,
0x10,0x0D,0x04,0x08,
0x3F,0x1F);
st7701_switch_cmd_bkx(st7701, true, 3);
ST7701_DSI(st7701,0xE8,0x00,0x0E);
st7701_switch_cmd_bkx(st7701, false, 0);
ST7701_DSI(st7701,0x11);
msleep(120);
st7701_switch_cmd_bkx(st7701, true, 3);
ST7701_DSI(st7701,0xE8,0x00,0x0C);
msleep(10);
ST7701_DSI(st7701,0xE8,0x00,0x00);
st7701_switch_cmd_bkx(st7701, false, 0);
ST7701_DSI(st7701,0x29);
msleep(20);
}
static const struct drm_display_mode ali24_mode = {
.clock = 22325,
.hdisplay = 480,
.hsync_start = 480 + 40,
.hsync_end = 480 + 40 + 4,
.htotal = 480 + 40 + 4 + 20,
.vdisplay = 640,
.vsync_start = 640 + 2,
.vsync_end = 640 + 2 + 40,
.vtotal = 640 + 2 + 40 + 16,
.width_mm = 40,
.height_mm = 55,
.type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
};
static const struct st7701_panel_desc ali24_desc = {
.mode = &ali24_mode,
.lanes = 2,
.format = MIPI_DSI_FMT_RGB888,
.panel_sleep_delay = 120,
.init_sequence = ali24_init_sequence,
.conn_type = DRM_MODE_CONNECTOR_DSI,
.interface = ST7701_CTRL_DSI,
.gip_sequence = NULL,
};
static const struct of_device_id st7701_dsi_of_match[] = {
{ .compatible = "densitron,dmt028vghmcmi-1a", .data = &dmt028vghmcmi_1a_desc },
{ .compatible = "elida,kd50t048a", .data = &kd50t048a_desc },
{ .compatible = "techstar,ts8550b", .data = &ts8550b_desc },
{ .compatible = "microtips,mtd0286adp04mf", .data = &mtd0286adp04mf_desc },
{ .compatible = "ali,ali24", .data = &ali24_desc },
{ }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment