Add support for Tianma TL060FVXS16-00 video mode panel based on Novatek NT36672A, used in Xiaomi Mi A2 smartphone (xiaomi-jasmine). It shares some code with already supported panel in this driver for xiaomi-lavender, so we can reuse the same panel deinit function.
Signed-off-by: Alexey Minnekhanov <[email protected]> --- drivers/gpu/drm/panel/panel-novatek-nt36672a.c | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c index e6971ba6ef464..1bfa808365874 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c @@ -445,6 +445,29 @@ static void lavender_tulip_deinit_cmds(struct mipi_dsi_multi_context *dsi_ctx) mipi_dsi_msleep(dsi_ctx, 120); } +static void tianma_jasmine_init_cmds(struct mipi_dsi_multi_context *dsi_ctx) +{ + dsi_ctx->dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xff, 0x20); + mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(dsi_ctx, MIPI_DCS_SET_PARTIAL_ROWS, 0x10); + mipi_dsi_dcs_write_seq_multi(dsi_ctx, MIPI_DCS_SET_PARTIAL_COLUMNS, 0x50); + mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x32, 0x2f); + mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xff, 0x10); + + mipi_dsi_dcs_exit_sleep_mode_multi(dsi_ctx); + mipi_dsi_msleep(dsi_ctx, 70); + + mipi_dsi_dcs_set_display_brightness_multi(dsi_ctx, 0x00ff); + mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x68, 0x03, 0x04); + mipi_dsi_dcs_write_seq_multi(dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x2c); + mipi_dsi_dcs_write_seq_multi(dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00); + + mipi_dsi_dcs_set_display_on_multi(dsi_ctx); + usleep_range(5000, 6000); +} + static const struct drm_display_mode tianma_fhd_video_panel_default_mode = { .clock = 161331, @@ -556,6 +579,39 @@ static const struct nt36672a_panel_desc tianmaplus_e7t_tulip_panel_desc = { .send_deinit_cmds = lavender_tulip_deinit_cmds, }; +static const struct drm_display_mode tianma_jasmine_panel_default_mode = { + .clock = (1080 + 96 + 4 + 56) * (2160 + 4 + 2 + 33) * 60 / 1000, + + .hdisplay = 1080, + .hsync_start = 1080 + 96, + .hsync_end = 1080 + 96 + 4, + .htotal = 1080 + 96 + 4 + 56, + + .vdisplay = 2160, + .vsync_start = 2160 + 4, + .vsync_end = 2160 + 4 + 2, + .vtotal = 2160 + 4 + 2 + 33, + + .width_mm = 68, + .height_mm = 136, + .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, +}; + +static const struct nt36672a_panel_desc tianma_jasmine_panel_desc = { + .display_mode = &tianma_jasmine_panel_default_mode, + + .width_mm = 68, + .height_mm = 136, + + .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | + MIPI_DSI_CLOCK_NON_CONTINUOUS, + .format = MIPI_DSI_FMT_RGB888, + .lanes = 4, + .send_init_cmds = tianma_jasmine_init_cmds, + /* jasmine panel uses the same deinit sequence as lavender/tulip */ + .send_deinit_cmds = lavender_tulip_deinit_cmds, +}; + static int nt36672a_panel_add(struct nt36672a_panel *pinfo) { struct device *dev = &pinfo->link->dev; @@ -634,6 +690,7 @@ static void nt36672a_panel_remove(struct mipi_dsi_device *dsi) static const struct of_device_id panel_nt36672a_match[] = { { .compatible = "shenchao,fhdplus-video", .data = &shenchao_lavender_panel_desc }, { .compatible = "tianma,fhd-video", .data = &tianma_fhd_video_panel_desc }, + { .compatible = "tianma,tl060fvxs16-00", .data = &tianma_jasmine_panel_desc }, { .compatible = "tianma,tl063fvmca01-00", .data = &tianma_lavender_panel_desc }, { .compatible = "tianma,tl063fvmc43-02", .data = &tianmaplus_e7t_tulip_panel_desc }, { }, -- 2.55.0
