Lines Matching +full:panel +full:- +full:specific
1 // SPDX-License-Identifier: GPL-2.0+
94 (((typeof(_mask))(_val) << (__builtin_ffsll(_mask) - 1)) & (_mask))
111 /* TFT matrix driver configuration, panel specific. */
133 struct drm_panel panel; member
147 static inline struct st7701 *panel_to_st7701(struct drm_panel *panel) in panel_to_st7701() argument
149 return container_of(panel, struct st7701, panel); in panel_to_st7701()
155 return mipi_dsi_dcs_write(st7701->dsi, cmd, seq, len); in st7701_dsi_write()
161 return mipi_dbi_command_stackbuf(&st7701->dbi, cmd, seq, len); in st7701_dbi_write()
167 st7701->write_command(st7701, cmd, d, ARRAY_SIZE(d)); \
172 const struct st7701_panel_desc *desc = st7701->desc; in st7701_vgls_map()
177 { -7060, 0x0 }, { -7470, 0x1 }, in st7701_vgls_map()
178 { -7910, 0x2 }, { -8140, 0x3 }, in st7701_vgls_map()
179 { -8650, 0x4 }, { -8920, 0x5 }, in st7701_vgls_map()
180 { -9210, 0x6 }, { -9510, 0x7 }, in st7701_vgls_map()
181 { -9830, 0x8 }, { -10170, 0x9 }, in st7701_vgls_map()
182 { -10530, 0xa }, { -10910, 0xb }, in st7701_vgls_map()
183 { -11310, 0xc }, { -11730, 0xd }, in st7701_vgls_map()
184 { -12200, 0xe }, { -12690, 0xf } in st7701_vgls_map()
189 if (desc->vgl_mv == map[i].vgl) in st7701_vgls_map()
209 const struct st7701_panel_desc *desc = st7701->desc; in st7701_init_sequence()
210 const struct drm_display_mode *mode = desc->mode; in st7701_init_sequence()
211 const u8 linecount8 = mode->vdisplay / 8; in st7701_init_sequence()
212 const u8 linecountrem2 = (mode->vdisplay % 8) / 2; in st7701_init_sequence()
221 msleep(st7701->sleep_delay); in st7701_init_sequence()
226 st7701->write_command(st7701, ST7701_CMD2_BK0_PVGAMCTRL, desc->pv_gamma, in st7701_init_sequence()
227 ARRAY_SIZE(desc->pv_gamma)); in st7701_init_sequence()
228 st7701->write_command(st7701, ST7701_CMD2_BK0_NVGAMCTRL, desc->nv_gamma, in st7701_init_sequence()
229 ARRAY_SIZE(desc->nv_gamma)); in st7701_init_sequence()
234 * LDE_EN: enable sub-8-line granularity line count in st7701_init_sequence()
242 FIELD_PREP(ST7701_CMD2_BK0_LNESET_LINE_MASK, linecount8 - 1) | in st7701_init_sequence()
247 mode->vtotal - mode->vsync_end), in st7701_init_sequence()
249 mode->vsync_start - mode->vdisplay)); in st7701_init_sequence()
258 FIELD_PREP(ST7701_CMD2_BK0_INVSEL_NLINV_MASK, desc->nlinv), in st7701_init_sequence()
260 (clamp((u32)mode->htotal, 512U, 1008U) - 512) / 16)); in st7701_init_sequence()
268 DIV_ROUND_CLOSEST(desc->vop_uv - 3537500, 12500))); in st7701_init_sequence()
273 DIV_ROUND_CLOSEST(desc->vcom_uv - 100000, 12500))); in st7701_init_sequence()
278 DIV_ROUND_CLOSEST(clamp(desc->vgh_mv, in st7701_init_sequence()
280 (u16)17000) - 11500, in st7701_init_sequence()
285 /* Vgl is non-linear */ in st7701_init_sequence()
292 desc->gamma_op_bias) | in st7701_init_sequence()
294 desc->input_op_bias) | in st7701_init_sequence()
296 desc->output_op_bias)); in st7701_init_sequence()
298 /* Avdd = 6.2V + (AVDD[1:0] * 0.2V) , Avcl = -4.4V - (AVCL[1:0] * 0.2V) */ in st7701_init_sequence()
301 DIV_ROUND_CLOSEST(desc->avdd_mv - 6200, 200)) | in st7701_init_sequence()
303 DIV_ROUND_CLOSEST(-4400 - desc->avcl_mv, 200))); in st7701_init_sequence()
309 DIV_ROUND_CLOSEST(desc->t2d_ns, 200))); in st7701_init_sequence()
315 DIV_ROUND_CLOSEST(desc->t3d_ns - 4000, 800))); in st7701_init_sequence()
319 (desc->eot_en ? ST7701_CMD2_BK1_MIPISET1_EOT_EN : 0)); in st7701_init_sequence()
326 * specific command sequence, so grab the same from vendor BSP driver. in ts8550b_gip_sequence()
417 * specific command sequence, so grab the same from vendor BSP driver. in kd50t048a_gip_sequence()
523 static int st7701_prepare(struct drm_panel *panel) in st7701_prepare() argument
525 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_prepare()
528 gpiod_set_value(st7701->reset, 0); in st7701_prepare()
530 ret = regulator_bulk_enable(ARRAY_SIZE(st7701->supplies), in st7701_prepare()
531 st7701->supplies); in st7701_prepare()
536 gpiod_set_value(st7701->reset, 1); in st7701_prepare()
541 if (st7701->desc->gip_sequence) in st7701_prepare()
542 st7701->desc->gip_sequence(st7701); in st7701_prepare()
550 static int st7701_enable(struct drm_panel *panel) in st7701_enable() argument
552 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_enable()
559 static int st7701_disable(struct drm_panel *panel) in st7701_disable() argument
561 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_disable()
568 static int st7701_unprepare(struct drm_panel *panel) in st7701_unprepare() argument
570 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_unprepare()
574 msleep(st7701->sleep_delay); in st7701_unprepare()
576 gpiod_set_value(st7701->reset, 0); in st7701_unprepare()
587 msleep(st7701->sleep_delay); in st7701_unprepare()
589 regulator_bulk_disable(ARRAY_SIZE(st7701->supplies), st7701->supplies); in st7701_unprepare()
594 static int st7701_get_modes(struct drm_panel *panel, in st7701_get_modes() argument
597 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_get_modes()
598 const struct drm_display_mode *desc_mode = st7701->desc->mode; in st7701_get_modes()
601 mode = drm_mode_duplicate(connector->dev, desc_mode); in st7701_get_modes()
603 dev_err(panel->dev, "failed to add mode %ux%u@%u\n", in st7701_get_modes()
604 desc_mode->hdisplay, desc_mode->vdisplay, in st7701_get_modes()
606 return -ENOMEM; in st7701_get_modes()
612 connector->display_info.width_mm = desc_mode->width_mm; in st7701_get_modes()
613 connector->display_info.height_mm = desc_mode->height_mm; in st7701_get_modes()
619 drm_connector_set_panel_orientation(connector, st7701->orientation); in st7701_get_modes()
624 static enum drm_panel_orientation st7701_get_orientation(struct drm_panel *panel) in st7701_get_orientation() argument
626 struct st7701 *st7701 = panel_to_st7701(panel); in st7701_get_orientation()
628 return st7701->orientation; in st7701_get_orientation()
663 .panel_sleep_delay = 80, /* panel need extra 80ms for sleep out cmd */
727 .vgl_mv = -9510,
729 .avcl_mv = -4400,
764 .panel_sleep_delay = 5, /* panel need extra 5ms for sleep out cmd */
828 .vgl_mv = -10170,
830 .avcl_mv = -4400,
927 .vgl_mv = -9510,
929 .avcl_mv = -4400,
1026 .vgl_mv = -9510,
1028 .avcl_mv = -4400,
1126 .vgl_mv = -11730,
1128 .avcl_mv = -4400,
1142 drm_panel_remove(&st7701->panel); in st7701_cleanup()
1143 drm_panel_disable(&st7701->panel); in st7701_cleanup()
1144 drm_panel_unprepare(&st7701->panel); in st7701_cleanup()
1155 return -ENOMEM; in st7701_probe()
1159 return -ENODEV; in st7701_probe()
1161 st7701->supplies[0].supply = "VCC"; in st7701_probe()
1162 st7701->supplies[1].supply = "IOVCC"; in st7701_probe()
1164 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(st7701->supplies), in st7701_probe()
1165 st7701->supplies); in st7701_probe()
1169 st7701->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in st7701_probe()
1170 if (IS_ERR(st7701->reset)) { in st7701_probe()
1172 return PTR_ERR(st7701->reset); in st7701_probe()
1175 ret = of_drm_get_panel_orientation(dev->of_node, &st7701->orientation); in st7701_probe()
1179 drm_panel_init(&st7701->panel, dev, &st7701_funcs, connector_type); in st7701_probe()
1186 * add panel specific delay for those cases. As now this panel specific in st7701_probe()
1187 * delay information is referenced from those panel BSP driver, example in st7701_probe()
1190 st7701->sleep_delay = 120 + desc->panel_sleep_delay; in st7701_probe()
1192 ret = drm_panel_of_backlight(&st7701->panel); in st7701_probe()
1196 drm_panel_add(&st7701->panel); in st7701_probe()
1199 st7701->desc = desc; in st7701_probe()
1209 err = st7701_probe(&dsi->dev, DRM_MODE_CONNECTOR_DSI); in st7701_dsi_probe()
1213 st7701 = dev_get_drvdata(&dsi->dev); in st7701_dsi_probe()
1214 st7701->dsi = dsi; in st7701_dsi_probe()
1215 st7701->write_command = st7701_dsi_write; in st7701_dsi_probe()
1217 if (!st7701->desc->lanes) in st7701_dsi_probe()
1218 return dev_err_probe(&dsi->dev, -EINVAL, "This panel is not for MIPI DSI\n"); in st7701_dsi_probe()
1220 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | in st7701_dsi_probe()
1222 dsi->format = st7701->desc->format; in st7701_dsi_probe()
1223 dsi->lanes = st7701->desc->lanes; in st7701_dsi_probe()
1227 return dev_err_probe(&dsi->dev, err, "Failed to init MIPI DSI\n"); in st7701_dsi_probe()
1238 err = st7701_probe(&spi->dev, DRM_MODE_CONNECTOR_DPI); in st7701_spi_probe()
1242 st7701 = dev_get_drvdata(&spi->dev); in st7701_spi_probe()
1243 st7701->write_command = st7701_dbi_write; in st7701_spi_probe()
1245 dc = devm_gpiod_get_optional(&spi->dev, "dc", GPIOD_OUT_LOW); in st7701_spi_probe()
1247 return dev_err_probe(&spi->dev, PTR_ERR(dc), "Failed to get GPIO for D/CX\n"); in st7701_spi_probe()
1249 err = mipi_dbi_spi_init(spi, &st7701->dbi, dc); in st7701_spi_probe()
1251 return dev_err_probe(&spi->dev, err, "Failed to init MIPI DBI\n"); in st7701_spi_probe()
1252 st7701->dbi.read_commands = NULL; in st7701_spi_probe()
1263 { .compatible = "anbernic,rg-arc-panel", .data = &rg_arc_desc },
1264 { .compatible = "densitron,dmt028vghmcmi-1a", .data = &dmt028vghmcmi_1a_desc },
1272 { .compatible = "anbernic,rg28xx-panel", .data = &rg28xx_desc },
1278 { "rg28xx-panel" },
1336 MODULE_DESCRIPTION("Sitronix ST7701 LCD Panel Driver");