Lines Matching +full:panel +full:- +full:specific
1 // SPDX-License-Identifier: GPL-2.0+
92 (((typeof(_mask))(_val) << (__builtin_ffsll(_mask) - 1)) & (_mask))
109 /* TFT matrix driver configuration, panel specific. */
131 struct drm_panel panel; member
141 static inline struct st7701 *panel_to_st7701(struct drm_panel *panel) in panel_to_st7701() argument
143 return container_of(panel, struct st7701, panel); in panel_to_st7701()
149 return mipi_dsi_dcs_write_buffer(st7701->dsi, seq, len); in st7701_dsi_write()
160 const struct st7701_panel_desc *desc = st7701->desc; in st7701_vgls_map()
165 { -7060, 0x0 }, { -7470, 0x1 }, in st7701_vgls_map()
166 { -7910, 0x2 }, { -8140, 0x3 }, in st7701_vgls_map()
167 { -8650, 0x4 }, { -8920, 0x5 }, in st7701_vgls_map()
168 { -9210, 0x6 }, { -9510, 0x7 }, in st7701_vgls_map()
169 { -9830, 0x8 }, { -10170, 0x9 }, in st7701_vgls_map()
170 { -10530, 0xa }, { -10910, 0xb }, in st7701_vgls_map()
171 { -11310, 0xc }, { -11730, 0xd }, in st7701_vgls_map()
172 { -12200, 0xe }, { -12690, 0xf } in st7701_vgls_map()
177 if (desc->vgl_mv == map[i].vgl) in st7701_vgls_map()
197 const struct st7701_panel_desc *desc = st7701->desc; in st7701_init_sequence()
198 const struct drm_display_mode *mode = desc->mode; in st7701_init_sequence()
199 const u8 linecount8 = mode->vdisplay / 8; in st7701_init_sequence()
200 const u8 linecountrem2 = (mode->vdisplay % 8) / 2; in st7701_init_sequence()
209 msleep(st7701->sleep_delay); in st7701_init_sequence()
214 mipi_dsi_dcs_write(st7701->dsi, DSI_CMD2_BK0_PVGAMCTRL, in st7701_init_sequence()
215 desc->pv_gamma, ARRAY_SIZE(desc->pv_gamma)); in st7701_init_sequence()
216 mipi_dsi_dcs_write(st7701->dsi, DSI_CMD2_BK0_NVGAMCTRL, in st7701_init_sequence()
217 desc->nv_gamma, ARRAY_SIZE(desc->nv_gamma)); in st7701_init_sequence()
222 * LDE_EN: enable sub-8-line granularity line count in st7701_init_sequence()
230 FIELD_PREP(DSI_CMD2_BK0_LNESET_LINE_MASK, linecount8 - 1) | in st7701_init_sequence()
235 mode->vtotal - mode->vsync_end), in st7701_init_sequence()
237 mode->vsync_start - mode->vdisplay)); in st7701_init_sequence()
246 FIELD_PREP(DSI_CMD2_BK0_INVSEL_NLINV_MASK, desc->nlinv), in st7701_init_sequence()
248 (clamp((u32)mode->htotal, 512U, 1008U) - 512) / 16)); in st7701_init_sequence()
256 DIV_ROUND_CLOSEST(desc->vop_uv - 3537500, 12500))); in st7701_init_sequence()
261 DIV_ROUND_CLOSEST(desc->vcom_uv - 100000, 12500))); in st7701_init_sequence()
266 DIV_ROUND_CLOSEST(clamp(desc->vgh_mv, in st7701_init_sequence()
268 (u16)17000) - 11500, in st7701_init_sequence()
273 /* Vgl is non-linear */ in st7701_init_sequence()
280 desc->gamma_op_bias) | in st7701_init_sequence()
282 desc->input_op_bias) | in st7701_init_sequence()
284 desc->output_op_bias)); in st7701_init_sequence()
286 /* Avdd = 6.2V + (AVDD[1:0] * 0.2V) , Avcl = -4.4V - (AVCL[1:0] * 0.2V) */ in st7701_init_sequence()
289 DIV_ROUND_CLOSEST(desc->avdd_mv - 6200, 200)) | in st7701_init_sequence()
291 DIV_ROUND_CLOSEST(-4400 - desc->avcl_mv, 200))); in st7701_init_sequence()
297 DIV_ROUND_CLOSEST(desc->t2d_ns, 200))); in st7701_init_sequence()
303 DIV_ROUND_CLOSEST(desc->t3d_ns - 4000, 800))); in st7701_init_sequence()
307 (desc->eot_en ? DSI_CMD2_BK1_MIPISET1_EOT_EN : 0)); in st7701_init_sequence()
314 * specific command sequence, so grab the same from vendor BSP driver. in ts8550b_gip_sequence()
405 * specific command sequence, so grab the same from vendor BSP driver. in kd50t048a_gip_sequence()
426 static int st7701_prepare(struct drm_panel *panel) in st7701_prepare() argument
428 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_prepare()
431 gpiod_set_value(st7701->reset, 0); in st7701_prepare()
433 ret = regulator_bulk_enable(ARRAY_SIZE(st7701->supplies), in st7701_prepare()
434 st7701->supplies); in st7701_prepare()
439 gpiod_set_value(st7701->reset, 1); in st7701_prepare()
444 if (st7701->desc->gip_sequence) in st7701_prepare()
445 st7701->desc->gip_sequence(st7701); in st7701_prepare()
453 static int st7701_enable(struct drm_panel *panel) in st7701_enable() argument
455 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_enable()
462 static int st7701_disable(struct drm_panel *panel) in st7701_disable() argument
464 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_disable()
471 static int st7701_unprepare(struct drm_panel *panel) in st7701_unprepare() argument
473 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_unprepare()
477 msleep(st7701->sleep_delay); in st7701_unprepare()
479 gpiod_set_value(st7701->reset, 0); in st7701_unprepare()
490 msleep(st7701->sleep_delay); in st7701_unprepare()
492 regulator_bulk_disable(ARRAY_SIZE(st7701->supplies), st7701->supplies); in st7701_unprepare()
497 static int st7701_get_modes(struct drm_panel *panel, in st7701_get_modes() argument
500 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_get_modes()
501 const struct drm_display_mode *desc_mode = st7701->desc->mode; in st7701_get_modes()
504 mode = drm_mode_duplicate(connector->dev, desc_mode); in st7701_get_modes()
506 dev_err(&st7701->dsi->dev, "failed to add mode %ux%u@%u\n", in st7701_get_modes()
507 desc_mode->hdisplay, desc_mode->vdisplay, in st7701_get_modes()
509 return -ENOMEM; in st7701_get_modes()
515 connector->display_info.width_mm = desc_mode->width_mm; in st7701_get_modes()
516 connector->display_info.height_mm = desc_mode->height_mm; in st7701_get_modes()
522 drm_connector_set_panel_orientation(connector, st7701->orientation); in st7701_get_modes()
527 static enum drm_panel_orientation st7701_get_orientation(struct drm_panel *panel) in st7701_get_orientation() argument
529 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_get_orientation()
531 return st7701->orientation; in st7701_get_orientation()
566 .panel_sleep_delay = 80, /* panel need extra 80ms for sleep out cmd */
630 .vgl_mv = -9510,
632 .avcl_mv = -4400,
667 .panel_sleep_delay = 5, /* panel need extra 5ms for sleep out cmd */
731 .vgl_mv = -10170,
733 .avcl_mv = -4400,
830 .vgl_mv = -9510,
832 .avcl_mv = -4400,
848 st7701 = devm_kzalloc(&dsi->dev, sizeof(*st7701), GFP_KERNEL); in st7701_dsi_probe()
850 return -ENOMEM; in st7701_dsi_probe()
852 desc = of_device_get_match_data(&dsi->dev); in st7701_dsi_probe()
853 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | in st7701_dsi_probe()
855 dsi->format = desc->format; in st7701_dsi_probe()
856 dsi->lanes = desc->lanes; in st7701_dsi_probe()
858 st7701->supplies[0].supply = "VCC"; in st7701_dsi_probe()
859 st7701->supplies[1].supply = "IOVCC"; in st7701_dsi_probe()
861 ret = devm_regulator_bulk_get(&dsi->dev, ARRAY_SIZE(st7701->supplies), in st7701_dsi_probe()
862 st7701->supplies); in st7701_dsi_probe()
866 st7701->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW); in st7701_dsi_probe()
867 if (IS_ERR(st7701->reset)) { in st7701_dsi_probe()
868 dev_err(&dsi->dev, "Couldn't get our reset GPIO\n"); in st7701_dsi_probe()
869 return PTR_ERR(st7701->reset); in st7701_dsi_probe()
872 ret = of_drm_get_panel_orientation(dsi->dev.of_node, &st7701->orientation); in st7701_dsi_probe()
874 return dev_err_probe(&dsi->dev, ret, "Failed to get orientation\n"); in st7701_dsi_probe()
876 drm_panel_init(&st7701->panel, &dsi->dev, &st7701_funcs, in st7701_dsi_probe()
884 * add panel specific delay for those cases. As now this panel specific in st7701_dsi_probe()
885 * delay information is referenced from those panel BSP driver, example in st7701_dsi_probe()
888 st7701->sleep_delay = 120 + desc->panel_sleep_delay; in st7701_dsi_probe()
890 ret = drm_panel_of_backlight(&st7701->panel); in st7701_dsi_probe()
894 drm_panel_add(&st7701->panel); in st7701_dsi_probe()
897 st7701->dsi = dsi; in st7701_dsi_probe()
898 st7701->desc = desc; in st7701_dsi_probe()
907 drm_panel_remove(&st7701->panel); in st7701_dsi_probe()
916 drm_panel_remove(&st7701->panel); in st7701_dsi_remove()
920 { .compatible = "densitron,dmt028vghmcmi-1a", .data = &dmt028vghmcmi_1a_desc },
938 MODULE_DESCRIPTION("Sitronix ST7701 LCD Panel Driver");