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

drm/panel: boe-th101mb31ig002: Support for starry-er88577 MIPI-DSI panel

The init_code of the starry-er88577 panel is very similar to the
panel-boe-th101mb31ig002-28a.c driver, so we make it compatible with
the panel-boe-th101mb31ig002-28a.c driver

Signed-off-by: Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20240709134754.28013-6-lvzhaoxiong@huaqin.corp-partner.google.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240709134754.28013-6-lvzhaoxiong@huaqin.corp-partner.google.com

authored by

Zhaoxiong Lv and committed by
Neil Armstrong
e4bd1db1 3808a15e

+123
+123
drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
··· 25 25 enum mipi_dsi_pixel_format format; 26 26 int (*init)(struct boe_th101mb31ig002 *ctx); 27 27 unsigned int lanes; 28 + bool lp11_before_reset; 29 + unsigned int vcioo_to_lp11_delay_ms; 30 + unsigned int lp11_to_reset_delay_ms; 31 + unsigned int backlight_off_to_display_off_delay_ms; 32 + unsigned int enter_sleep_to_reset_down_delay_ms; 33 + unsigned int power_off_delay_ms; 28 34 }; 29 35 30 36 struct boe_th101mb31ig002 { ··· 114 108 return dsi_ctx.accum_err; 115 109 } 116 110 111 + static int starry_er88577_init_cmd(struct boe_th101mb31ig002 *ctx) 112 + { 113 + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; 114 + 115 + msleep(70); 116 + 117 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xe0, 0xab, 0xba); 118 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xe1, 0xba, 0xab); 119 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb1, 0x10, 0x01, 0x47, 0xff); 120 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb2, 0x0c, 0x14, 0x04, 0x50, 0x50, 0x14); 121 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb3, 0x56, 0x53, 0x00); 122 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb4, 0x33, 0x30, 0x04); 123 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb6, 0xb0, 0x00, 0x00, 0x10, 0x00, 0x10, 124 + 0x00); 125 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb8, 0x05, 0x12, 0x29, 0x49, 0x40); 126 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb9, 0x7c, 0x61, 0x4f, 0x42, 0x3e, 0x2d, 127 + 0x31, 0x1a, 0x33, 0x33, 0x33, 0x52, 0x40, 128 + 0x47, 0x38, 0x34, 0x26, 0x0e, 0x06, 0x7c, 129 + 0x61, 0x4f, 0x42, 0x3e, 0x2d, 0x31, 0x1a, 130 + 0x33, 0x33, 0x33, 0x52, 0x40, 0x47, 0x38, 131 + 0x34, 0x26, 0x0e, 0x06); 132 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc0, 0xcc, 0x76, 0x12, 0x34, 0x44, 0x44, 133 + 0x44, 0x44, 0x98, 0x04, 0x98, 0x04, 0x0f, 134 + 0x00, 0x00, 0xc1); 135 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc1, 0x54, 0x94, 0x02, 0x85, 0x9f, 0x00, 136 + 0x6f, 0x00, 0x54, 0x00); 137 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc2, 0x17, 0x09, 0x08, 0x89, 0x08, 0x11, 138 + 0x22, 0x20, 0x44, 0xff, 0x18, 0x00); 139 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc3, 0x87, 0x47, 0x05, 0x05, 0x1c, 0x1c, 140 + 0x1d, 0x1d, 0x02, 0x1e, 0x1e, 0x1f, 0x1f, 141 + 0x0f, 0x0f, 0x0d, 0x0d, 0x13, 0x13, 0x11, 142 + 0x11, 0x24); 143 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc4, 0x06, 0x06, 0x04, 0x04, 0x1c, 0x1c, 144 + 0x1d, 0x1d, 0x02, 0x1e, 0x1e, 0x1f, 0x1f, 145 + 0x0e, 0x0e, 0x0c, 0x0c, 0x12, 0x12, 0x10, 146 + 0x10, 0x24); 147 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc8, 0x21, 0x00, 0x31, 0x42, 0x34, 0x16); 148 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xca, 0xcb, 0x43); 149 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xcd, 0x0e, 0x4b, 0x4b, 0x20, 0x19, 0x6b, 150 + 0x06, 0xb3); 151 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xd1, 0x40, 0x0d, 0xff, 0x0f); 152 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xd2, 0xe3, 0x2b, 0x38, 0x08); 153 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xd3, 0x00, 0x00, 0x00, 0x00, 154 + 0x00, 0x33, 0x20, 0x3a, 0xd5, 0x86, 0xf3); 155 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xd4, 0x00, 0x01, 0x00, 0x0e, 0x04, 0x44, 156 + 0x08, 0x10, 0x00, 0x00, 0x00); 157 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xe6, 0x80, 0x09, 0xff, 0xff, 0xff, 0xff, 158 + 0xff, 0xff); 159 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0x12, 0x03, 0x20, 0x00, 0xff); 160 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf3, 0x00); 161 + 162 + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); 163 + 164 + mipi_dsi_msleep(&dsi_ctx, 120); 165 + 166 + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); 167 + 168 + mipi_dsi_msleep(&dsi_ctx, 20); 169 + 170 + return dsi_ctx.accum_err; 171 + } 172 + 117 173 static int boe_th101mb31ig002_disable(struct drm_panel *panel) 118 174 { 119 175 struct boe_th101mb31ig002 *ctx = container_of(panel, ··· 183 115 panel); 184 116 struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; 185 117 118 + if (ctx->desc->backlight_off_to_display_off_delay_ms) 119 + mipi_dsi_msleep(&dsi_ctx, ctx->desc->backlight_off_to_display_off_delay_ms); 120 + 186 121 mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); 187 122 188 123 mipi_dsi_msleep(&dsi_ctx, 120); 189 124 190 125 mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); 126 + 127 + if (ctx->desc->enter_sleep_to_reset_down_delay_ms) 128 + mipi_dsi_msleep(&dsi_ctx, ctx->desc->enter_sleep_to_reset_down_delay_ms); 191 129 192 130 return dsi_ctx.accum_err; 193 131 } ··· 207 133 gpiod_set_value_cansleep(ctx->reset, 1); 208 134 gpiod_set_value_cansleep(ctx->enable, 0); 209 135 regulator_disable(ctx->power); 136 + 137 + if (ctx->desc->power_off_delay_ms) 138 + msleep(ctx->desc->power_off_delay_ms); 210 139 211 140 return 0; 212 141 } ··· 227 150 dev_err(dev, "Failed to enable power supply: %d\n", ret); 228 151 return ret; 229 152 } 153 + 154 + if (ctx->desc->vcioo_to_lp11_delay_ms) 155 + msleep(ctx->desc->vcioo_to_lp11_delay_ms); 156 + 157 + if (ctx->desc->lp11_before_reset) { 158 + ret = mipi_dsi_dcs_nop(ctx->dsi); 159 + if (ret) 160 + return ret; 161 + } 162 + 163 + if (ctx->desc->lp11_to_reset_delay_ms) 164 + msleep(ctx->desc->lp11_to_reset_delay_ms); 230 165 231 166 gpiod_set_value_cansleep(ctx->enable, 1); 232 167 msleep(50); ··· 274 185 MIPI_DSI_MODE_NO_EOT_PACKET | 275 186 MIPI_DSI_MODE_LPM, 276 187 .init = boe_th101mb31ig002_enable, 188 + }; 189 + 190 + static const struct drm_display_mode starry_er88577_default_mode = { 191 + .clock = (800 + 25 + 25 + 25) * (1280 + 20 + 4 + 12) * 60 / 1000, 192 + .hdisplay = 800, 193 + .hsync_start = 800 + 25, 194 + .hsync_end = 800 + 25 + 25, 195 + .htotal = 800 + 25 + 25 + 25, 196 + .vdisplay = 1280, 197 + .vsync_start = 1280 + 20, 198 + .vsync_end = 1280 + 20 + 4, 199 + .vtotal = 1280 + 20 + 4 + 12, 200 + .width_mm = 135, 201 + .height_mm = 216, 202 + .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, 203 + }; 204 + 205 + static const struct panel_desc starry_er88577_desc = { 206 + .modes = &starry_er88577_default_mode, 207 + .lanes = 4, 208 + .format = MIPI_DSI_FMT_RGB888, 209 + .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | 210 + MIPI_DSI_MODE_LPM, 211 + .init = starry_er88577_init_cmd, 212 + .lp11_before_reset = true, 213 + .vcioo_to_lp11_delay_ms = 5, 214 + .lp11_to_reset_delay_ms = 50, 215 + .backlight_off_to_display_off_delay_ms = 100, 216 + .enter_sleep_to_reset_down_delay_ms = 100, 217 + .power_off_delay_ms = 1000, 277 218 }; 278 219 279 220 static int boe_th101mb31ig002_get_modes(struct drm_panel *panel, ··· 431 312 { 432 313 .compatible = "boe,th101mb31ig002-28a", 433 314 .data = &boe_th101mb31ig002_desc 315 + }, 316 + { 317 + .compatible = "starry,er88577", 318 + .data = &starry_er88577_desc 434 319 }, 435 320 { /* sentinel */ } 436 321 };