Lines Matching +full:c +full:- +full:45

1 // SPDX-License-Identifier: GPL-2.0
3 * Mantix MLAF057WE51 5.7" MIPI-DSI panel driver
5 * Copyright (C) Purism SPC 2020
11 #include <linux/media-bus-format.h>
22 #define DRV_NAME "panel-mantix-mlaf057we51"
50 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in mantix_init_sequence()
51 struct device *dev = ctx->dev; in mantix_init_sequence()
77 struct device *dev = ctx->dev; in mantix_enable()
83 dev_err(ctx->dev, "Panel init sequence failed: %d\n", ret); in mantix_enable()
111 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in mantix_disable()
116 dev_err(ctx->dev, "Failed to turn off the display: %d\n", ret); in mantix_disable()
120 dev_err(ctx->dev, "Failed to enter sleep mode: %d\n", ret); in mantix_disable()
130 gpiod_set_value_cansleep(ctx->tp_rstn_gpio, 1); in mantix_unprepare()
132 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in mantix_unprepare()
134 regulator_disable(ctx->avee); in mantix_unprepare()
135 regulator_disable(ctx->avdd); in mantix_unprepare()
138 regulator_disable(ctx->vddi); in mantix_unprepare()
151 dev_dbg(ctx->dev, "Resetting the panel\n"); in mantix_prepare()
152 ret = regulator_enable(ctx->vddi); in mantix_prepare()
154 dev_err(ctx->dev, "Failed to enable vddi supply: %d\n", ret); in mantix_prepare()
161 ret = regulator_enable(ctx->avdd); in mantix_prepare()
163 dev_err(ctx->dev, "Failed to enable avdd supply: %d\n", ret); in mantix_prepare()
169 ret = regulator_enable(ctx->avee); in mantix_prepare()
171 dev_err(ctx->dev, "Failed to enable avee supply: %d\n", ret); in mantix_prepare()
177 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in mantix_prepare()
178 gpiod_set_value_cansleep(ctx->tp_rstn_gpio, 0); in mantix_prepare()
188 .hsync_start = 720 + 45,
189 .hsync_end = 720 + 45 + 14,
190 .htotal = 720 + 45 + 14 + 25,
203 .hsync_start = 720 + 45,
204 .hsync_end = 720 + 45 + 14,
205 .htotal = 720 + 45 + 14 + 25,
226 mode = drm_mode_duplicate(connector->dev, ctx->default_mode); in mantix_get_modes()
228 dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n", in mantix_get_modes()
229 ctx->default_mode->hdisplay, ctx->default_mode->vdisplay, in mantix_get_modes()
230 drm_mode_vrefresh(ctx->default_mode)); in mantix_get_modes()
231 return -ENOMEM; in mantix_get_modes()
236 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in mantix_get_modes()
237 connector->display_info.width_mm = mode->width_mm; in mantix_get_modes()
238 connector->display_info.height_mm = mode->height_mm; in mantix_get_modes()
241 drm_display_info_set_bus_formats(&connector->display_info, in mantix_get_modes()
258 struct device *dev = &dsi->dev; in mantix_probe()
264 return -ENOMEM; in mantix_probe()
265 ctx->default_mode = of_device_get_match_data(dev); in mantix_probe()
267 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in mantix_probe()
268 if (IS_ERR(ctx->reset_gpio)) { in mantix_probe()
270 return PTR_ERR(ctx->reset_gpio); in mantix_probe()
273 ctx->tp_rstn_gpio = devm_gpiod_get(dev, "mantix,tp-rstn", GPIOD_OUT_HIGH); in mantix_probe()
274 if (IS_ERR(ctx->tp_rstn_gpio)) { in mantix_probe()
275 dev_err(dev, "cannot get tp-rstn gpio\n"); in mantix_probe()
276 return PTR_ERR(ctx->tp_rstn_gpio); in mantix_probe()
280 ctx->dev = dev; in mantix_probe()
282 dsi->lanes = 4; in mantix_probe()
283 dsi->format = MIPI_DSI_FMT_RGB888; in mantix_probe()
284 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | in mantix_probe()
287 ctx->avdd = devm_regulator_get(dev, "avdd"); in mantix_probe()
288 if (IS_ERR(ctx->avdd)) in mantix_probe()
289 return dev_err_probe(dev, PTR_ERR(ctx->avdd), "Failed to request avdd regulator\n"); in mantix_probe()
291 ctx->avee = devm_regulator_get(dev, "avee"); in mantix_probe()
292 if (IS_ERR(ctx->avee)) in mantix_probe()
293 return dev_err_probe(dev, PTR_ERR(ctx->avee), "Failed to request avee regulator\n"); in mantix_probe()
295 ctx->vddi = devm_regulator_get(dev, "vddi"); in mantix_probe()
296 if (IS_ERR(ctx->vddi)) in mantix_probe()
297 return dev_err_probe(dev, PTR_ERR(ctx->vddi), "Failed to request vddi regulator\n"); in mantix_probe()
299 drm_panel_init(&ctx->panel, dev, &mantix_drm_funcs, in mantix_probe()
302 ret = drm_panel_of_backlight(&ctx->panel); in mantix_probe()
306 drm_panel_add(&ctx->panel); in mantix_probe()
311 drm_panel_remove(&ctx->panel); in mantix_probe()
315 dev_info(dev, "%ux%u@%u %ubpp dsi %udl - ready\n", in mantix_probe()
316 ctx->default_mode->hdisplay, ctx->default_mode->vdisplay, in mantix_probe()
317 drm_mode_vrefresh(ctx->default_mode), in mantix_probe()
318 mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes); in mantix_probe()
327 drm_panel_unprepare(&ctx->panel); in mantix_shutdown()
328 drm_panel_disable(&ctx->panel); in mantix_shutdown()
338 drm_panel_remove(&ctx->panel); in mantix_remove()
342 { .compatible = "mantix,mlaf057we51-x", .data = &default_mode_mantix },
360 MODULE_DESCRIPTION("DRM driver for Mantix MLAF057WE51-X MIPI DSI panel");