Lines Matching +full:enforce +full:- +full:video +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0+
3 * MIPI-DSI Sony ACX424AKP panel driver. This is a 480x864
4 * AMOLED panel with a command-only DSI interface.
8 * Based on code and know-how from Marcus Lorentzon
9 * Copyright (C) ST-Ericsson SA 2010
18 #include <video/mipi_display.h>
65 * command mode using the maximum HS frequency.
96 struct mipi_dsi_device *dsi = to_mipi_dsi_device(acx->dev); in acx424akp_set_brightness()
98 int duty_ns = bl->props.brightness; in acx424akp_set_brightness()
110 dev_err(acx->dev, "failed to disable display backlight (%d)\n", ret); in acx424akp_set_brightness()
117 pwm_ratio = max(((duty_ns * 256) / period_ns) - 1, 1); in acx424akp_set_brightness()
123 dev_dbg(acx->dev, "calculated duty cycle %02x\n", pwm_ratio); in acx424akp_set_brightness()
127 dev_err(acx->dev, "failed to set display PWM ratio (%d)\n", ret); in acx424akp_set_brightness()
143 dev_err(acx->dev, "failed to unlock CMD 2 (%d)\n", ret); in acx424akp_set_brightness()
149 dev_err(acx->dev, "failed to enter page 1 (%d)\n", ret); in acx424akp_set_brightness()
155 dev_err(acx->dev, "failed to disable MTP reload (%d)\n", ret); in acx424akp_set_brightness()
160 dev_err(acx->dev, "failed to set PWM divisor (%d)\n", ret); in acx424akp_set_brightness()
166 dev_err(acx->dev, "failed to lock CMD 2 (%d)\n", ret); in acx424akp_set_brightness()
175 dev_err(acx->dev, "failed to enable display backlight (%d)\n", ret); in acx424akp_set_brightness()
194 struct mipi_dsi_device *dsi = to_mipi_dsi_device(acx->dev); in acx424akp_read_id()
201 dev_err(acx->dev, "could not vendor ID byte\n"); in acx424akp_read_id()
206 dev_err(acx->dev, "could not read device version byte\n"); in acx424akp_read_id()
211 dev_err(acx->dev, "could not read panel ID byte\n"); in acx424akp_read_id()
216 dev_err(acx->dev, "device vendor ID is zero\n"); in acx424akp_read_id()
217 return -ENODEV; in acx424akp_read_id()
225 dev_info(acx->dev, "MTP vendor: %02x, version: %02x, panel: %02x\n", in acx424akp_read_id()
229 dev_info(acx->dev, "unknown vendor: %02x, version: %02x, panel: %02x\n", in acx424akp_read_id()
241 ret = regulator_enable(acx->supply); in acx424akp_power_on()
243 dev_err(acx->dev, "failed to enable supply (%d)\n", ret); in acx424akp_power_on()
248 gpiod_set_value_cansleep(acx->reset_gpio, 1); in acx424akp_power_on()
250 /* De-assert RESET */ in acx424akp_power_on()
251 gpiod_set_value_cansleep(acx->reset_gpio, 0); in acx424akp_power_on()
260 gpiod_set_value_cansleep(acx->reset_gpio, 1); in acx424akp_power_off()
263 regulator_disable(acx->supply); in acx424akp_power_off()
269 struct mipi_dsi_device *dsi = to_mipi_dsi_device(acx->dev); in acx424akp_prepare()
279 dev_err(acx->dev, "failed to read panel ID (%d)\n", ret); in acx424akp_prepare()
283 /* Enabe tearing mode: send TE (tearing effect) at VBLANK */ in acx424akp_prepare()
287 dev_err(acx->dev, "failed to enable vblank TE (%d)\n", ret); in acx424akp_prepare()
304 dev_err(acx->dev, "failed to set MDDI (%d)\n", ret); in acx424akp_prepare()
308 /* Exit sleep mode */ in acx424akp_prepare()
311 dev_err(acx->dev, "failed to exit sleep mode (%d)\n", ret); in acx424akp_prepare()
318 dev_err(acx->dev, "failed to turn display on (%d)\n", ret); in acx424akp_prepare()
321 if (acx->video_mode) { in acx424akp_prepare()
322 /* In video mode turn peripheral on */ in acx424akp_prepare()
325 dev_err(acx->dev, "failed to turn on peripheral\n"); in acx424akp_prepare()
340 struct mipi_dsi_device *dsi = to_mipi_dsi_device(acx->dev); in acx424akp_unprepare()
345 dev_err(acx->dev, "failed to turn display off (%d)\n", ret); in acx424akp_unprepare()
349 /* Enter sleep mode */ in acx424akp_unprepare()
352 dev_err(acx->dev, "failed to enter sleep mode (%d)\n", ret); in acx424akp_unprepare()
367 struct drm_display_mode *mode; in acx424akp_get_modes() local
369 if (acx->video_mode) in acx424akp_get_modes()
370 mode = drm_mode_duplicate(connector->dev, in acx424akp_get_modes()
373 mode = drm_mode_duplicate(connector->dev, in acx424akp_get_modes()
375 if (!mode) { in acx424akp_get_modes()
376 dev_err(panel->dev, "bad mode or failed to add mode\n"); in acx424akp_get_modes()
377 return -EINVAL; in acx424akp_get_modes()
379 drm_mode_set_name(mode); in acx424akp_get_modes()
380 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in acx424akp_get_modes()
382 connector->display_info.width_mm = mode->width_mm; in acx424akp_get_modes()
383 connector->display_info.height_mm = mode->height_mm; in acx424akp_get_modes()
385 drm_mode_probed_add(connector, mode); in acx424akp_get_modes()
398 struct device *dev = &dsi->dev; in acx424akp_probe()
404 return -ENOMEM; in acx424akp_probe()
405 acx->video_mode = of_property_read_bool(dev->of_node, in acx424akp_probe()
406 "enforce-video-mode"); in acx424akp_probe()
409 acx->dev = dev; in acx424akp_probe()
411 dsi->lanes = 2; in acx424akp_probe()
412 dsi->format = MIPI_DSI_FMT_RGB888; in acx424akp_probe()
414 * FIXME: these come from the ST-Ericsson vendor driver for the in acx424akp_probe()
416 * platform, if you have the datasheet, please cross-check the in acx424akp_probe()
419 dsi->lp_rate = 19200000; in acx424akp_probe()
420 dsi->hs_rate = 420160000; in acx424akp_probe()
422 if (acx->video_mode) in acx424akp_probe()
423 /* Burst mode using event for sync */ in acx424akp_probe()
424 dsi->mode_flags = in acx424akp_probe()
428 dsi->mode_flags = in acx424akp_probe()
431 acx->supply = devm_regulator_get(dev, "vddi"); in acx424akp_probe()
432 if (IS_ERR(acx->supply)) in acx424akp_probe()
433 return PTR_ERR(acx->supply); in acx424akp_probe()
436 acx->reset_gpio = devm_gpiod_get_optional(dev, "reset", in acx424akp_probe()
438 if (IS_ERR(acx->reset_gpio)) in acx424akp_probe()
439 return dev_err_probe(dev, PTR_ERR(acx->reset_gpio), in acx424akp_probe()
442 drm_panel_init(&acx->panel, dev, &acx424akp_drm_funcs, in acx424akp_probe()
445 acx->panel.backlight = devm_backlight_device_register(dev, "acx424akp", dev, acx, in acx424akp_probe()
447 if (IS_ERR(acx->panel.backlight)) in acx424akp_probe()
448 return dev_err_probe(dev, PTR_ERR(acx->panel.backlight), in acx424akp_probe()
451 drm_panel_add(&acx->panel); in acx424akp_probe()
455 drm_panel_remove(&acx->panel); in acx424akp_probe()
467 drm_panel_remove(&acx->panel); in acx424akp_remove()
482 .name = "panel-sony-acx424akp",
489 MODULE_DESCRIPTION("MIPI-DSI Sony acx424akp Panel Driver");