Lines Matching +full:panel +full:- +full:specific

1 // SPDX-License-Identifier: GPL-2.0+
104 (((typeof(_mask))(_val) << (__builtin_ffsll(_mask) - 1)) & (_mask))
121 /* TFT matrix driver configuration, panel specific. */
143 struct drm_panel panel; member
152 static inline struct st7701 *panel_to_st7701(struct drm_panel *panel) in panel_to_st7701() argument
154 return container_of(panel, struct st7701, panel); in panel_to_st7701()
160 return mipi_dsi_dcs_write_buffer(st7701->dsi, seq, len); in st7701_dsi_write()
171 const struct st7701_panel_desc *desc = st7701->desc; in st7701_vgls_map()
176 { -7060, 0x0 }, { -7470, 0x1 }, in st7701_vgls_map()
177 { -7910, 0x2 }, { -8140, 0x3 }, in st7701_vgls_map()
178 { -8650, 0x4 }, { -8920, 0x5 }, in st7701_vgls_map()
179 { -9210, 0x6 }, { -9510, 0x7 }, in st7701_vgls_map()
180 { -9830, 0x8 }, { -10170, 0x9 }, in st7701_vgls_map()
181 { -10530, 0xa }, { -10910, 0xb }, in st7701_vgls_map()
182 { -11310, 0xc }, { -11730, 0xd }, in st7701_vgls_map()
183 { -12200, 0xe }, { -12690, 0xf } in st7701_vgls_map()
188 if (desc->vgl_mv == map[i].vgl) in st7701_vgls_map()
196 const struct st7701_panel_desc *desc = st7701->desc; in st7701_init_sequence()
197 const struct drm_display_mode *mode = desc->mode; in st7701_init_sequence()
198 const u8 linecount8 = mode->vdisplay / 8; in st7701_init_sequence()
199 const u8 linecountrem2 = (mode->vdisplay % 8) / 2; in st7701_init_sequence()
208 msleep(st7701->sleep_delay); in st7701_init_sequence()
213 mipi_dsi_dcs_write(st7701->dsi, DSI_CMD2_BK0_PVGAMCTRL, in st7701_init_sequence()
214 desc->pv_gamma, ARRAY_SIZE(desc->pv_gamma)); in st7701_init_sequence()
215 mipi_dsi_dcs_write(st7701->dsi, DSI_CMD2_BK0_NVGAMCTRL, in st7701_init_sequence()
216 desc->nv_gamma, ARRAY_SIZE(desc->nv_gamma)); in st7701_init_sequence()
221 * LDE_EN: enable sub-8-line granularity line count in st7701_init_sequence()
229 FIELD_PREP(DSI_CMD2_BK0_LNESET_LINE_MASK, linecount8 - 1) | in st7701_init_sequence()
234 mode->vtotal - mode->vsync_end), in st7701_init_sequence()
236 mode->vsync_start - mode->vdisplay)); in st7701_init_sequence()
245 FIELD_PREP(DSI_CMD2_BK0_INVSEL_NLINV_MASK, desc->nlinv), in st7701_init_sequence()
247 DIV_ROUND_UP(mode->htotal, 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()
407 static int st7701_prepare(struct drm_panel *panel) in st7701_prepare() argument
409 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_prepare()
412 gpiod_set_value(st7701->reset, 0); in st7701_prepare()
414 ret = regulator_bulk_enable(ARRAY_SIZE(st7701->supplies), in st7701_prepare()
415 st7701->supplies); in st7701_prepare()
420 gpiod_set_value(st7701->reset, 1); in st7701_prepare()
425 if (st7701->desc->gip_sequence) in st7701_prepare()
426 st7701->desc->gip_sequence(st7701); in st7701_prepare()
435 static int st7701_enable(struct drm_panel *panel) in st7701_enable() argument
437 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_enable()
444 static int st7701_disable(struct drm_panel *panel) in st7701_disable() argument
446 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_disable()
453 static int st7701_unprepare(struct drm_panel *panel) in st7701_unprepare() argument
455 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_unprepare()
459 msleep(st7701->sleep_delay); in st7701_unprepare()
461 gpiod_set_value(st7701->reset, 0); in st7701_unprepare()
472 msleep(st7701->sleep_delay); in st7701_unprepare()
474 regulator_bulk_disable(ARRAY_SIZE(st7701->supplies), st7701->supplies); in st7701_unprepare()
479 static int st7701_get_modes(struct drm_panel *panel, in st7701_get_modes() argument
482 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_get_modes()
483 const struct drm_display_mode *desc_mode = st7701->desc->mode; in st7701_get_modes()
486 mode = drm_mode_duplicate(connector->dev, desc_mode); in st7701_get_modes()
488 dev_err(&st7701->dsi->dev, "failed to add mode %ux%u@%u\n", in st7701_get_modes()
489 desc_mode->hdisplay, desc_mode->vdisplay, in st7701_get_modes()
491 return -ENOMEM; in st7701_get_modes()
497 connector->display_info.width_mm = desc_mode->width_mm; in st7701_get_modes()
498 connector->display_info.height_mm = desc_mode->height_mm; in st7701_get_modes()
534 .panel_sleep_delay = 80, /* panel need extra 80ms for sleep out cmd */
598 .vgl_mv = -9510,
600 .avcl_mv = -4400,
635 .panel_sleep_delay = 5, /* panel need extra 5ms for sleep out cmd */
699 .vgl_mv = -10170,
701 .avcl_mv = -4400,
717 st7701 = devm_kzalloc(&dsi->dev, sizeof(*st7701), GFP_KERNEL); in st7701_dsi_probe()
719 return -ENOMEM; in st7701_dsi_probe()
721 desc = of_device_get_match_data(&dsi->dev); in st7701_dsi_probe()
722 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | in st7701_dsi_probe()
724 dsi->format = desc->format; in st7701_dsi_probe()
725 dsi->lanes = desc->lanes; in st7701_dsi_probe()
727 st7701->supplies[0].supply = "VCC"; in st7701_dsi_probe()
728 st7701->supplies[1].supply = "IOVCC"; in st7701_dsi_probe()
730 ret = devm_regulator_bulk_get(&dsi->dev, ARRAY_SIZE(st7701->supplies), in st7701_dsi_probe()
731 st7701->supplies); in st7701_dsi_probe()
735 st7701->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW); in st7701_dsi_probe()
736 if (IS_ERR(st7701->reset)) { in st7701_dsi_probe()
737 dev_err(&dsi->dev, "Couldn't get our reset GPIO\n"); in st7701_dsi_probe()
738 return PTR_ERR(st7701->reset); in st7701_dsi_probe()
741 drm_panel_init(&st7701->panel, &dsi->dev, &st7701_funcs, in st7701_dsi_probe()
749 * add panel specific delay for those cases. As now this panel specific in st7701_dsi_probe()
750 * delay information is referenced from those panel BSP driver, example in st7701_dsi_probe()
753 st7701->sleep_delay = 120 + desc->panel_sleep_delay; in st7701_dsi_probe()
755 ret = drm_panel_of_backlight(&st7701->panel); in st7701_dsi_probe()
759 drm_panel_add(&st7701->panel); in st7701_dsi_probe()
762 st7701->dsi = dsi; in st7701_dsi_probe()
763 st7701->desc = desc; in st7701_dsi_probe()
773 drm_panel_remove(&st7701->panel); in st7701_dsi_remove()
777 { .compatible = "densitron,dmt028vghmcmi-1a", .data = &dmt028vghmcmi_1a_desc },
794 MODULE_DESCRIPTION("Sitronix ST7701 LCD Panel Driver");