Lines Matching +full:dsi +full:- +full:based
1 // SPDX-License-Identifier: GPL-2.0
3 * Xinpeng xpp055c272 5.5" MIPI-DSI panel driver
6 * based on
8 * Rockteck jh057n00900 5.5" MIPI-DSI panel driver
21 #include <linux/media-bus-format.h>
26 /* Manufacturer specific Commands send via DSI */
64 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in xpp055c272_init_sequence() local
65 struct device *dev = ctx->dev; in xpp055c272_init_sequence()
71 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETEXTC, 0xf1, 0x12, 0x83); in xpp055c272_init_sequence()
72 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETMIPI, in xpp055c272_init_sequence()
77 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETPOWER_EXT, 0x25); in xpp055c272_init_sequence()
78 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETPCR, 0x02, 0x11, 0x00); in xpp055c272_init_sequence()
79 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETRGBIF, in xpp055c272_init_sequence()
82 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETSCR, in xpp055c272_init_sequence()
85 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETVDC, 0x46); in xpp055c272_init_sequence()
86 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETPANEL, 0x0b); in xpp055c272_init_sequence()
87 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETCYC, 0x80); in xpp055c272_init_sequence()
88 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETDISP, 0xc8, 0x12, 0x30); in xpp055c272_init_sequence()
89 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETEQ, in xpp055c272_init_sequence()
92 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETPOWER, in xpp055c272_init_sequence()
95 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETECO, 0x00, 0x00, 0xff, in xpp055c272_init_sequence()
97 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETBGP, 0x09, 0x09); in xpp055c272_init_sequence()
100 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETVCOM, 0x87, 0x95); in xpp055c272_init_sequence()
101 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETGIP1, in xpp055c272_init_sequence()
110 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETGIP2, in xpp055c272_init_sequence()
119 mipi_dsi_dcs_write_seq(dsi, XPP055C272_CMD_SETGAMMA, in xpp055c272_init_sequence()
135 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in xpp055c272_unprepare() local
138 ret = mipi_dsi_dcs_set_display_off(dsi); in xpp055c272_unprepare()
140 dev_err(ctx->dev, "failed to set display off: %d\n", ret); in xpp055c272_unprepare()
142 mipi_dsi_dcs_enter_sleep_mode(dsi); in xpp055c272_unprepare()
144 dev_err(ctx->dev, "failed to enter sleep mode: %d\n", ret); in xpp055c272_unprepare()
148 regulator_disable(ctx->iovcc); in xpp055c272_unprepare()
149 regulator_disable(ctx->vci); in xpp055c272_unprepare()
157 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in xpp055c272_prepare() local
160 dev_dbg(ctx->dev, "Resetting the panel\n"); in xpp055c272_prepare()
161 ret = regulator_enable(ctx->vci); in xpp055c272_prepare()
163 dev_err(ctx->dev, "Failed to enable vci supply: %d\n", ret); in xpp055c272_prepare()
166 ret = regulator_enable(ctx->iovcc); in xpp055c272_prepare()
168 dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); in xpp055c272_prepare()
172 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in xpp055c272_prepare()
175 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in xpp055c272_prepare()
182 dev_err(ctx->dev, "Panel init sequence failed: %d\n", ret); in xpp055c272_prepare()
186 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); in xpp055c272_prepare()
188 dev_err(ctx->dev, "Failed to exit sleep mode: %d\n", ret); in xpp055c272_prepare()
195 ret = mipi_dsi_dcs_set_display_on(dsi); in xpp055c272_prepare()
197 dev_err(ctx->dev, "Failed to set display on: %d\n", ret); in xpp055c272_prepare()
206 regulator_disable(ctx->iovcc); in xpp055c272_prepare()
208 regulator_disable(ctx->vci); in xpp055c272_prepare()
232 mode = drm_mode_duplicate(connector->dev, &default_mode); in xpp055c272_get_modes()
234 dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n", in xpp055c272_get_modes()
237 return -ENOMEM; in xpp055c272_get_modes()
242 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in xpp055c272_get_modes()
243 connector->display_info.width_mm = mode->width_mm; in xpp055c272_get_modes()
244 connector->display_info.height_mm = mode->height_mm; in xpp055c272_get_modes()
256 static int xpp055c272_probe(struct mipi_dsi_device *dsi) in xpp055c272_probe() argument
258 struct device *dev = &dsi->dev; in xpp055c272_probe()
264 return -ENOMEM; in xpp055c272_probe()
266 ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in xpp055c272_probe()
267 if (IS_ERR(ctx->reset_gpio)) in xpp055c272_probe()
268 return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), in xpp055c272_probe()
271 ctx->vci = devm_regulator_get(dev, "vci"); in xpp055c272_probe()
272 if (IS_ERR(ctx->vci)) in xpp055c272_probe()
273 return dev_err_probe(dev, PTR_ERR(ctx->vci), in xpp055c272_probe()
276 ctx->iovcc = devm_regulator_get(dev, "iovcc"); in xpp055c272_probe()
277 if (IS_ERR(ctx->iovcc)) in xpp055c272_probe()
278 return dev_err_probe(dev, PTR_ERR(ctx->iovcc), in xpp055c272_probe()
281 mipi_dsi_set_drvdata(dsi, ctx); in xpp055c272_probe()
283 ctx->dev = dev; in xpp055c272_probe()
285 dsi->lanes = 4; in xpp055c272_probe()
286 dsi->format = MIPI_DSI_FMT_RGB888; in xpp055c272_probe()
287 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | in xpp055c272_probe()
290 drm_panel_init(&ctx->panel, &dsi->dev, &xpp055c272_funcs, in xpp055c272_probe()
293 ret = drm_panel_of_backlight(&ctx->panel); in xpp055c272_probe()
297 drm_panel_add(&ctx->panel); in xpp055c272_probe()
299 ret = mipi_dsi_attach(dsi); in xpp055c272_probe()
302 drm_panel_remove(&ctx->panel); in xpp055c272_probe()
309 static void xpp055c272_remove(struct mipi_dsi_device *dsi) in xpp055c272_remove() argument
311 struct xpp055c272 *ctx = mipi_dsi_get_drvdata(dsi); in xpp055c272_remove()
314 ret = mipi_dsi_detach(dsi); in xpp055c272_remove()
316 dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); in xpp055c272_remove()
318 drm_panel_remove(&ctx->panel); in xpp055c272_remove()
329 .name = "panel-xinpeng-xpp055c272",
337 MODULE_AUTHOR("Heiko Stuebner <heiko.stuebner@theobroma-systems.com>");
338 MODULE_DESCRIPTION("DRM driver for Xinpeng xpp055c272 MIPI DSI panel");