Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/panel: st7703: Add Powkiddy RGB30 Panel Support

The Powkiddy RGB30 4 inch panel is a 4 inch 720x720 DSI panel used in
the Powkiddy RGB30 handheld gaming device. Add support for it.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20231013183918.225666-4-macroalpha82@gmail.com

authored by

Chris Morgan and committed by
Heiko Stuebner
636a989e daee0320

+89
+89
drivers/gpu/drm/panel/panel-sitronix-st7703.c
··· 433 433 .init_sequence = rg353v2_init_sequence, 434 434 }; 435 435 436 + static int rgb30panel_init_sequence(struct st7703 *ctx) 437 + { 438 + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); 439 + 440 + /* Init sequence extracted from Powkiddy RGB30 BSP kernel. */ 441 + 442 + /* 443 + * For some reason this specific panel must be taken out of sleep 444 + * before the full init sequence, or else it will not display. 445 + */ 446 + mipi_dsi_dcs_exit_sleep_mode(dsi); 447 + msleep(250); 448 + 449 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETEXTC, 0xf1, 0x12, 0x83); 450 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETMIPI, 0x33, 0x81, 0x05, 0xf9, 451 + 0x0e, 0x0e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 452 + 0x00, 0x00, 0x44, 0x25, 0x00, 0x90, 0x0a, 0x00, 453 + 0x00, 0x01, 0x4f, 0x01, 0x00, 0x00, 0x37); 454 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER_EXT, 0x25, 0x22, 0xf0, 455 + 0x63); 456 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00); 457 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETRGBIF, 0x10, 0x10, 0x28, 458 + 0x28, 0x03, 0xff, 0x00, 0x00, 0x00, 0x00); 459 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETSCR, 0x73, 0x73, 0x50, 0x50, 460 + 0x00, 0x00, 0x12, 0x70, 0x00); 461 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVDC, 0x46); 462 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPANEL, 0x0b); 463 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETCYC, 0x80); 464 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETDISP, 0x3c, 0x12, 0x30); 465 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETEQ, 0x07, 0x07, 0x0b, 0x0b, 466 + 0x03, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 467 + 0xc0, 0x10); 468 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER, 0x36, 0x00, 0x32, 469 + 0x32, 0x77, 0xf1, 0xcc, 0xcc, 0x77, 0x77, 0x33, 470 + 0x33); 471 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP, 0x0a, 0x0a); 472 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM, 0x88, 0x88); 473 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP1, 0xc8, 0x10, 0x0a, 0x10, 474 + 0x0f, 0xa1, 0x80, 0x12, 0x31, 0x23, 0x47, 0x86, 475 + 0xa1, 0x80, 0x47, 0x08, 0x00, 0x00, 0x0d, 0x00, 476 + 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 477 + 0x48, 0x02, 0x8b, 0xaf, 0x46, 0x02, 0x88, 0x88, 478 + 0x88, 0x88, 0x88, 0x48, 0x13, 0x8b, 0xaf, 0x57, 479 + 0x13, 0x88, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 480 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 481 + 0x00, 0x00, 0x00); 482 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP2, 0x96, 0x12, 0x01, 0x01, 483 + 0x01, 0x78, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 484 + 0x4f, 0x31, 0x8b, 0xa8, 0x31, 0x75, 0x88, 0x88, 485 + 0x88, 0x88, 0x88, 0x4f, 0x20, 0x8b, 0xa8, 0x20, 486 + 0x64, 0x88, 0x88, 0x88, 0x88, 0x88, 0x23, 0x00, 487 + 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 488 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 489 + 0x00, 0x00, 0x40, 0xa1, 0x80, 0x00, 0x00, 0x00, 490 + 0x00); 491 + mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGAMMA, 0x00, 0x0a, 0x0f, 492 + 0x29, 0x3b, 0x3f, 0x42, 0x39, 0x06, 0x0d, 0x10, 493 + 0x13, 0x15, 0x14, 0x15, 0x10, 0x17, 0x00, 0x0a, 494 + 0x0f, 0x29, 0x3b, 0x3f, 0x42, 0x39, 0x06, 0x0d, 495 + 0x10, 0x13, 0x15, 0x14, 0x15, 0x10, 0x17); 496 + 497 + return 0; 498 + } 499 + 500 + static const struct drm_display_mode rgb30panel_mode = { 501 + .hdisplay = 720, 502 + .hsync_start = 720 + 45, 503 + .hsync_end = 720 + 45 + 4, 504 + .htotal = 720 + 45 + 4 + 45, 505 + .vdisplay = 720, 506 + .vsync_start = 720 + 15, 507 + .vsync_end = 720 + 15 + 3, 508 + .vtotal = 720 + 15 + 3 + 11, 509 + .clock = 36570, 510 + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, 511 + .width_mm = 76, 512 + .height_mm = 76, 513 + }; 514 + 515 + static const struct st7703_panel_desc rgb30panel_desc = { 516 + .mode = &rgb30panel_mode, 517 + .lanes = 4, 518 + .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 519 + MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_LPM, 520 + .format = MIPI_DSI_FMT_RGB888, 521 + .init_sequence = rgb30panel_init_sequence, 522 + }; 523 + 436 524 static int st7703_enable(struct drm_panel *panel) 437 525 { 438 526 struct st7703 *ctx = panel_to_st7703(panel); ··· 784 696 785 697 static const struct of_device_id st7703_of_match[] = { 786 698 { .compatible = "anbernic,rg353v-panel-v2", .data = &rg353v2_desc }, 699 + { .compatible = "powkiddy,rgb30-panel", .data = &rgb30panel_desc }, 787 700 { .compatible = "rocktech,jh057n00900", .data = &jh057n00900_panel_desc }, 788 701 { .compatible = "xingbangda,xbd599", .data = &xbd599_desc }, 789 702 { /* sentinel */ }