• Home
  • Raw
  • Download

Lines Matching +full:panel +full:- +full:dsi

1 // SPDX-License-Identifier: GPL-2.0
3 * Mantix MLAF057WE51 5.7" MIPI-DSI panel driver
20 #define DRV_NAME "panel-mantix-mlaf057we51"
22 /* Manufacturer specific Commands send via DSI */
29 struct drm_panel panel; member
39 static inline struct mantix *panel_to_mantix(struct drm_panel *panel) in panel_to_mantix() argument
41 return container_of(panel, struct mantix, panel); in panel_to_mantix()
44 #define dsi_generic_write_seq(dsi, seq...) do { \ argument
47 ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \
54 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in mantix_init_sequence() local
55 struct device *dev = ctx->dev; in mantix_init_sequence()
58 * Init sequence was supplied by the panel vendor. in mantix_init_sequence()
60 dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5A); in mantix_init_sequence()
62 dsi_generic_write_seq(dsi, MANTIX_CMD_INT_CANCEL, 0x03); in mantix_init_sequence()
63 dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5A, 0x03); in mantix_init_sequence()
64 dsi_generic_write_seq(dsi, 0x80, 0xA9, 0x00); in mantix_init_sequence()
66 dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x5A, 0x09); in mantix_init_sequence()
67 dsi_generic_write_seq(dsi, 0x80, 0x64, 0x00, 0x64, 0x00, 0x00); in mantix_init_sequence()
70 dsi_generic_write_seq(dsi, MANTIX_CMD_SPI_FINISH, 0xA5); in mantix_init_sequence()
71 dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x00, 0x2F); in mantix_init_sequence()
74 dev_dbg(dev, "Panel init sequence done\n"); in mantix_init_sequence()
78 static int mantix_enable(struct drm_panel *panel) in mantix_enable() argument
80 struct mantix *ctx = panel_to_mantix(panel); in mantix_enable()
81 struct device *dev = ctx->dev; in mantix_enable()
82 struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); in mantix_enable() local
87 dev_err(ctx->dev, "Panel init sequence failed: %d\n", ret); in mantix_enable()
91 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); in mantix_enable()
98 ret = mipi_dsi_dcs_set_display_on(dsi); in mantix_enable()
103 ret = mipi_dsi_turn_on_peripheral(dsi); in mantix_enable()
112 static int mantix_disable(struct drm_panel *panel) in mantix_disable() argument
114 struct mantix *ctx = panel_to_mantix(panel); in mantix_disable()
115 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in mantix_disable() local
118 ret = mipi_dsi_dcs_set_display_off(dsi); in mantix_disable()
120 dev_err(ctx->dev, "Failed to turn off the display: %d\n", ret); in mantix_disable()
122 ret = mipi_dsi_dcs_enter_sleep_mode(dsi); in mantix_disable()
124 dev_err(ctx->dev, "Failed to enter sleep mode: %d\n", ret); in mantix_disable()
130 static int mantix_unprepare(struct drm_panel *panel) in mantix_unprepare() argument
132 struct mantix *ctx = panel_to_mantix(panel); in mantix_unprepare()
134 gpiod_set_value_cansleep(ctx->tp_rstn_gpio, 1); in mantix_unprepare()
136 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in mantix_unprepare()
138 regulator_disable(ctx->avee); in mantix_unprepare()
139 regulator_disable(ctx->avdd); in mantix_unprepare()
142 regulator_disable(ctx->vddi); in mantix_unprepare()
149 static int mantix_prepare(struct drm_panel *panel) in mantix_prepare() argument
151 struct mantix *ctx = panel_to_mantix(panel); in mantix_prepare()
155 dev_dbg(ctx->dev, "Resetting the panel\n"); in mantix_prepare()
156 ret = regulator_enable(ctx->vddi); in mantix_prepare()
158 dev_err(ctx->dev, "Failed to enable vddi supply: %d\n", ret); in mantix_prepare()
165 ret = regulator_enable(ctx->avdd); in mantix_prepare()
167 dev_err(ctx->dev, "Failed to enable avdd supply: %d\n", ret); in mantix_prepare()
173 ret = regulator_enable(ctx->avee); in mantix_prepare()
175 dev_err(ctx->dev, "Failed to enable avee supply: %d\n", ret); in mantix_prepare()
181 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in mantix_prepare()
182 gpiod_set_value_cansleep(ctx->tp_rstn_gpio, 0); in mantix_prepare()
205 static int mantix_get_modes(struct drm_panel *panel, in mantix_get_modes() argument
208 struct mantix *ctx = panel_to_mantix(panel); in mantix_get_modes()
211 mode = drm_mode_duplicate(connector->dev, &default_mode); in mantix_get_modes()
213 dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n", in mantix_get_modes()
216 return -ENOMEM; in mantix_get_modes()
221 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in mantix_get_modes()
222 connector->display_info.width_mm = mode->width_mm; in mantix_get_modes()
223 connector->display_info.height_mm = mode->height_mm; in mantix_get_modes()
237 static int mantix_probe(struct mipi_dsi_device *dsi) in mantix_probe() argument
239 struct device *dev = &dsi->dev; in mantix_probe()
245 return -ENOMEM; in mantix_probe()
247 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in mantix_probe()
248 if (IS_ERR(ctx->reset_gpio)) { in mantix_probe()
250 return PTR_ERR(ctx->reset_gpio); in mantix_probe()
253 ctx->tp_rstn_gpio = devm_gpiod_get(dev, "mantix,tp-rstn", GPIOD_OUT_HIGH); in mantix_probe()
254 if (IS_ERR(ctx->tp_rstn_gpio)) { in mantix_probe()
255 dev_err(dev, "cannot get tp-rstn gpio\n"); in mantix_probe()
256 return PTR_ERR(ctx->tp_rstn_gpio); in mantix_probe()
259 mipi_dsi_set_drvdata(dsi, ctx); in mantix_probe()
260 ctx->dev = dev; in mantix_probe()
262 dsi->lanes = 4; in mantix_probe()
263 dsi->format = MIPI_DSI_FMT_RGB888; in mantix_probe()
264 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | in mantix_probe()
267 ctx->avdd = devm_regulator_get(dev, "avdd"); in mantix_probe()
268 if (IS_ERR(ctx->avdd)) in mantix_probe()
269 return dev_err_probe(dev, PTR_ERR(ctx->avdd), "Failed to request avdd regulator\n"); in mantix_probe()
271 ctx->avee = devm_regulator_get(dev, "avee"); in mantix_probe()
272 if (IS_ERR(ctx->avee)) in mantix_probe()
273 return dev_err_probe(dev, PTR_ERR(ctx->avee), "Failed to request avee regulator\n"); in mantix_probe()
275 ctx->vddi = devm_regulator_get(dev, "vddi"); in mantix_probe()
276 if (IS_ERR(ctx->vddi)) in mantix_probe()
277 return dev_err_probe(dev, PTR_ERR(ctx->vddi), "Failed to request vddi regulator\n"); in mantix_probe()
279 drm_panel_init(&ctx->panel, dev, &mantix_drm_funcs, in mantix_probe()
282 ret = drm_panel_of_backlight(&ctx->panel); in mantix_probe()
286 drm_panel_add(&ctx->panel); in mantix_probe()
288 ret = mipi_dsi_attach(dsi); in mantix_probe()
291 drm_panel_remove(&ctx->panel); in mantix_probe()
295 dev_info(dev, "%ux%u@%u %ubpp dsi %udl - ready\n", in mantix_probe()
298 mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes); in mantix_probe()
303 static void mantix_shutdown(struct mipi_dsi_device *dsi) in mantix_shutdown() argument
305 struct mantix *ctx = mipi_dsi_get_drvdata(dsi); in mantix_shutdown()
307 drm_panel_unprepare(&ctx->panel); in mantix_shutdown()
308 drm_panel_disable(&ctx->panel); in mantix_shutdown()
311 static int mantix_remove(struct mipi_dsi_device *dsi) in mantix_remove() argument
313 struct mantix *ctx = mipi_dsi_get_drvdata(dsi); in mantix_remove()
315 mantix_shutdown(dsi); in mantix_remove()
317 mipi_dsi_detach(dsi); in mantix_remove()
318 drm_panel_remove(&ctx->panel); in mantix_remove()
324 { .compatible = "mantix,mlaf057we51-x" },
341 MODULE_DESCRIPTION("DRM driver for Mantix MLAF057WE51-X MIPI DSI panel");