Skip to content

Commit 5dfa343

Browse files
flamingradianminlexx
authored andcommitted
drm/panel: nt36672a: Add Shenchao panel used in Xiaomi Redmi Note 7
Add support for the Shenchao panel used in the Xiaomi Redmi Note 7 (xiaomi-lavender) smartphone. It is one of the 3 display panels found in xiaomi-lavender. Signed-off-by: Richard Acayan <[email protected]>
1 parent 7756b1d commit 5dfa343

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

drivers/gpu/drm/panel/panel-novatek-nt36672a.c

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,66 @@ static inline struct nt36672a_panel *to_nt36672a_panel(struct drm_panel *panel)
7171
return container_of(panel, struct nt36672a_panel, base);
7272
}
7373

74+
static int shenchao_lavender_init_cmds(struct drm_panel *panel)
75+
{
76+
struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
77+
struct mipi_dsi_multi_context dsi_ctx = { .dsi = pinfo->link };
78+
79+
pinfo->link->mode_flags |= MIPI_DSI_MODE_LPM;
80+
81+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xff, 0x25);
82+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfb, 0x01);
83+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x18, 0x96);
84+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x05, 0x04);
85+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xff, 0x27);
86+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfb, 0x01);
87+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xd9, 0x10);
88+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xff, 0x24);
89+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfb, 0x01);
90+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x82, 0x13);
91+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x84, 0x31);
92+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x88, 0x13);
93+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x8a, 0x31);
94+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x8e, 0xe4);
95+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x8f, 0x01);
96+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x90, 0x80);
97+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x9d, 0xb0);
98+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xff, 0x26);
99+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfb, 0x01);
100+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_READ_PPS_CONTINUE,
101+
0x12);
102+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xaa, 0x10);
103+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xae, 0x8a);
104+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x1c, 0xfa);
105+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xff, 0x10);
106+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb0, 0x01);
107+
mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
108+
mipi_dsi_msleep(&dsi_ctx, 70);
109+
mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0x00b8);
110+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x68, 0x03, 0x04);
111+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY,
112+
0x2c);
113+
mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00);
114+
mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
115+
116+
return dsi_ctx.accum_err;
117+
}
118+
119+
static int shenchao_lavender_off_cmds(struct drm_panel *panel)
120+
{
121+
struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
122+
struct mipi_dsi_multi_context dsi_ctx = { .dsi = pinfo->link };
123+
124+
pinfo->link->mode_flags &= ~MIPI_DSI_MODE_LPM;
125+
126+
mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
127+
mipi_dsi_msleep(&dsi_ctx, 20);
128+
mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
129+
mipi_dsi_msleep(&dsi_ctx, 120);
130+
131+
return dsi_ctx.accum_err;
132+
}
133+
74134
static int tianma_beryllium_init_cmds(struct drm_panel *panel)
75135
{
76136
struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
@@ -903,6 +963,38 @@ static const struct nt36672a_panel_desc tianma_fhd_video_panel_desc = {
903963
.off_cmds = tianma_beryllium_off_cmds,
904964
};
905965

966+
static const struct drm_display_mode shenchao_lavender_panel_default_mode = {
967+
.clock = (1080 + 90 + 2 + 120) * (2340 + 10 + 3 + 8) * 60 / 1000,
968+
969+
.hdisplay = 1080,
970+
.hsync_start = 1080 + 90,
971+
.hsync_end = 1080 + 90 + 2,
972+
.htotal = 1080 + 90 + 2 + 120,
973+
974+
.vdisplay = 2340,
975+
.vsync_start = 2340 + 10,
976+
.vsync_end = 2340 + 10 + 3,
977+
.vtotal = 2340 + 10 + 3 + 8,
978+
979+
.type = DRM_MODE_TYPE_DRIVER,
980+
};
981+
982+
static const struct nt36672a_panel_desc shenchao_lavender_panel_desc = {
983+
.display_mode = &shenchao_lavender_panel_default_mode,
984+
985+
.width_mm = 67,
986+
.height_mm = 145,
987+
988+
.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
989+
MIPI_DSI_CLOCK_NON_CONTINUOUS,
990+
.format = MIPI_DSI_FMT_RGB888,
991+
.lanes = 4,
992+
.reset_gpio_flags = GPIOD_OUT_HIGH,
993+
994+
.init_cmds = shenchao_lavender_init_cmds,
995+
.off_cmds = shenchao_lavender_off_cmds,
996+
};
997+
906998
static const struct drm_display_mode tianma_lavender_panel_default_mode = {
907999
.clock = (1080 + 90 + 2 + 120) * (2340 + 10 + 3 + 8) * 60 / 1000,
9081000

@@ -1116,6 +1208,7 @@ static void nt36672a_panel_remove(struct mipi_dsi_device *dsi)
11161208

11171209
static const struct of_device_id panel_nt36672a_match[] = {
11181210
{ .compatible = "tianma,fhd-video", .data = &tianma_fhd_video_panel_desc },
1211+
{ .compatible = "novatek,nt36672a-shenchao-lavender", .data = &shenchao_lavender_panel_desc },
11191212
{ .compatible = "novatek,nt36672a-tianma-lavender", .data = &tianma_lavender_panel_desc },
11201213
{ .compatible = "novatek,nt36672a-tianma-jasmine", .data = &tianma_jasmine_panel_desc },
11211214
{ .compatible = "novatek,nt36672a-tianma-tulip", .data = &tianmaplus_e7t_tulip_panel_desc },

0 commit comments

Comments
 (0)